|
hi,
it may simple logical error. if it is possible show me the code.
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
Hi,
In my application I have to call an external application (System.Diagnostics.Process.Start("C:\\NeckingRa\\Fortran\\necking_contour.exe"), (command window) , which creates one FILE that I need for my calculation, and thats why I need to pause my app untill external app is done (terminated).. Please, can somebody help me?? How can I do it?? Thanks
|
|
|
|
|
|
cant find .EnableRaisingEvents
|
|
|
|
|
It's a property of the Process class. You get an instance of Process from System.Diagnostics.Process.Start() ...
mav
|
|
|
|
|
Firs thankYou for help..
But I am not wery god in it..
I have to make a little application and call extern .exe file, wait untill its done and go on.. this extern .exe file creates a file i need in my calculation..
i have a button, and when I click on it:
private void button3_Click(object sender, System.EventArgs e)
{
System.Diagnostics.Process.Start"C:\\NeckingRa\\Fortran\\necking_contour.exe");
********* Hier I have to wait until this .exe app creates output.dat***************
********* how would U do it? Can U please write it for me, (I am beginer ********
System.IO.File.Exists("C:\\NeckingRa\\Temp\\output.dat");
System.IO.File.Copy("C:\\NeckingRa\\Temp\\output.dat",DSave.FileName,true);
}
|
|
|
|
|
using System.IO;
using System.Diagnostics;
private void button3_Click(object sender, System.EventArgs e)
{
Process p = Process.Start("C:\\NeckingRa\\Fortran\\necking_contour.exe");
p.EnableRaisingEvents = true;
p.Exited += new EventHandler(ProcessExited);
}
private void ProcessExited(object sender, EventArgs e)
{
if (System.IO.File.Exists("C:\\NeckingRa\\Temp\\output.dat"))
System.IO.File.Copy("C:\\NeckingRa\\Temp\\output.dat",DSave.FileName,true);
} The bill is in the mail
mav
|
|
|
|
|
Thank U, it works now.. Great, I am very very thankful for Your Help..
There are still a lot of Great an Cool people outthere in the World..
Once again Thanx
|
|
|
|
|
i want draw something the save to image, but i found that if use "BitBlt" function,if the window is overlaped by another window,"Bitblt" will copy the screen rectangle but not the window what i want.
i kown i can redraw "something" in "Bitmap" and use "Bitmap.Save()" to save to image, but i realy not want to redraw "Something" in "Bitmap",beacause redraw "Something" will waste time.
what can i do?
|
|
|
|
|
i want draw string follow a polyline, how to do in C#? e.g : i want draw a road and its name
|
|
|
|
|
This can be done, but will be tricky. I think the best would be to calculate the angle vector, and then use Graphics.TransformTranslate before writing each character. Perhaps there is something in the GraphicsPath class that mite be better?
top secret Download xacc-ide 0.0.3 now! See some screenshots
|
|
|
|
|
Hi,
I want to sort a classes by different paramters, but no idea how to do this.
I delcared one class to store card infos, they are (string)name, (int) width and (int)height. I put them into one ArrayList, now I wnat to sort them by name or width or height. but how can I do this?
Could anyone give me some ideas or example code?
thanks for help.
|
|
|
|
|
|
|
Any idea how to disable some items in C# ComboBox?
|
|
|
|
|
hi,
Item Means List Content.
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
Absolutely yes, I've found similar article but was done in VC++ 6.0 and I don't know how to convert it to C#..
|
|
|
|
|
hi,
Change your DrawMode property of combobox to OwnerDrawVariable. And then try to override the DrawItem event of your combobox.
Note : "DrawItemState enumeration" use this keyword to find help from MSDN.
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
I'm learning how to access MySQL through C# using ODBC. Unfortunately, whenever I try to run two MySql commands my program crashes!
Here's the code...
OdbcCommand nameTableShow = new OdbcCommand("select find_in_set('"+ this.LoginBox.Text.Trim() +"', usr_name) from user", MyConnection);
OdbcCommand passTableShow = new OdbcCommand("select usr_passwd from user where usr_name='" + this.LoginBox.Text.Trim()+ "'", MyConnection);
OdbcDataReader nameTableReader = nameTableShow.ExecuteReader();
OdbcDataReader passTableReader = passTableShow.ExecuteReader();
If I run one, I have no problem. If I run both... crash city...
The purpose of the two commands is for two parts of a login process. The first command checks if a certain user name exists in the MySql user table. The second actually looks up the password for that particual username. I can do one, and I can do the other. But when I try to do both no go.
Any clue as to what I'm doing wrong?
|
|
|
|
|
From MSDN: "While the OdbcDataReader is in use, the associated OdbcConnection is busy serving the OdbcDataReader, and no other operations can be performed on the OdbcConnection other than closing it. This is the case until the Close method of the OdbcDataReader is called."
You are trying to reuse the connection before closing the first OdbcDataReader . Finish with the first reader before executing the second one or give the second one its own connection.
On a side note, concatenating strings to come up with your sql command is asking for trouble. You'll save yourself headaches down the road if you switch to paramterized queries. If your DB doesn't support named parameters, you'll have to add them in the exact order they appear in the command. For example:
OdbcCommand nameTableShow = new OdbcCommand("select find_in_set(?, usr_name) from user", MyConnection);
nameTableShow.Parameters.Add("login", this.LoginBox.Text.Trim());
Charlie
if(!curlies){ return; }
|
|
|
|
|
Cool. Thanks. My noobness in using ODBC obviously shows. I guess I should do something like nameTableShow.Close() before I run the next reader execution. Also thanks for the Parameters advice. I didn't know you could do that. I'll give that a shot too.
|
|
|
|
|
hi all,
Here's what i'm trying to do:
1.Encrypted User password will be entered into database during Registeration.
2.next time user tries to login i decrpt the value from the data base and allow the user to logon if the decrypted value is same as the User entered password.
My Problem is, no matter what i do i always get different decrpted values for any string.
ie if a user logs on say with a password "letmein" (which is already lying in the database in its encrypted format) when i try to decrypt it back i'm not getting the same value "letmein".
what do i do???
Plz help.
here's my Cryptography Class File.....(could some one tell me whats wrong with my code)
public class Cryptography
{
public static RSACryptoServiceProvider rsa;
public static void AssignParameter()
{
const int PROVIDER_RSA_FULL = 1;
const string CONTAINER_NAME = "MyOnlyContainer";
CspParameters cspParams;
cspParams = new CspParameters(PROVIDER_RSA_FULL);
cspParams.KeyContainerName = CONTAINER_NAME;
cspParams.Flags = CspProviderFlags.UseMachineKeyStore;
cspParams.ProviderName = "Microsoft Strong Cryptographic Provider";
rsa = new RSACryptoServiceProvider(cspParams);
}
public static string EncryptData(string data2Encrypt)
{
AssignParameter();
StreamReader reader = new StreamReader("PublicOnlyKey.xml");
string publicOnlyKeyXML = reader.ReadToEnd();
rsa.FromXmlString(publicOnlyKeyXML);
reader.Close();
//read plaintext, encrypt it to ciphertext
byte[] plainbytes = System.Text.Encoding.UTF8.GetBytes(data2Encrypt);
byte[] cipherbytes = rsa.Encrypt(plainbytes,false);
return Convert.ToBase64String(cipherbytes);
}
public static string DecryptData(string data2Decrypt)
{
AssignParameter();
byte[] getpassword = Convert.FromBase64String(data2Decrypt);
//public and private RSA parameters for encrypt
StreamReader reader = new StreamReader("PublicPrivateKey.xml");
string publicPrivateKeyXML = reader.ReadToEnd();
rsa.FromXmlString(publicPrivateKeyXML);
reader.Close();
//read ciphertext, decrypt it to plaintext
byte[] plain = rsa.Decrypt(getpassword,false);
return Convert.ToBase64String(plain);
}
public static void AssignPublicPrivateKeys()
{
AssignParameter();
//provide public and private RSA params
StreamWriter writer = new StreamWriter("PublicPrivateKey.xml");
string publicPrivateKeyXML = rsa.ToXmlString(true);
writer.Write(publicPrivateKeyXML);
writer.Close();
//provide public only RSA params
writer = new StreamWriter("PublicOnlyKey.xml");
string publicOnlyKeyXML = rsa.ToXmlString(false);
writer.Write(publicOnlyKeyXML);
writer.Close();
}
}
please Help
|
|
|
|
|
Take a look at my article, Using XML Digital Signatures for Application Licensing[^] and pay attention to the note in the middle of the page. The content of the article may not be so important to you (hope you enjoy it all the same), but the note there is from a valuable lesson I learned: a key container (depending on the implementation) stores different types of keys in different locations. Since you're using the Strong Name CSP, you need to specify the key index 1, not accepting the default of 0 which is for key exchange and will be unique on each machine and may, in fact, generate different plain texts from the cipher text. Also make sure you're using the same IV.
On another note, consider a different way of handling credentials that is more widely implemented. Hash the passwords in the database using a mathematically-proven hash algorithm to generate a digest of the password like MD5 or SHA1 (which are both provided in the framework). You then hash the password the user enters using the same algorithm and compare the hashes.
This way, the user's password is not send over the wire as plain text (still a good idea to use SSL or some other encrypted communication channel to protect the username, and digests are still victim to brute-force attacks) and anyone with access to the database and the private key can't decrypt the data (if they can get to one, they can probably get to the other).
This is also much faster. One-way hash algorithms are fairly quick compared to decryption.
Again, this is a more widely used implementation because it's faster and it's practically impossible to recover the users' passwords (even for administrators, which helps with security immensely).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Hello, I'm normally a C++ .NET programmer but I'm building a DirectX game in C# .NET. I'm having a problem understanding how to pass a variable (directX device) to my Base class when declaring a Derived class. Example:
<br />
class Base<br />
{<br />
public Base( Device device )<br />
{}<br />
..process device physics..<br />
}<br />
<br />
class Derived:Base<br />
{<br />
public Derived()<br />
{}<br />
..variables for whatever object this is..<br />
}<br />
How would I declare an object of Derived class and pass my device object to the base class?
Thanks for the help.
Cyric74@hotmail.com
|
|
|
|
|
Try this
class Base
{
public Base( )
{
}
public Base( Device device )
{
int i =11;
}
}
class Derived:Base
{
public Derived( Device device ):base(device)
{
int i =10;
}
}
class Device
{
}
Device device = new Device();
Derived der = new Derived(device);
Or Change the BASE constructor to a Method.
Sanjay Sansanwal
www.sansanwal.com
|
|
|
|