|
MD5 in itself can't be 'decrypted'.
MD5 is a hash. It is commonly used to store passwords in the following manner:
Step 1) The user signs up and enters his/her password, where it is MD5ed and stored locally.
Step 2) The user logs on with a password, which is MD5ed and compared with the local hash.
I'm sure you can find an article on MD5 on google or here on codeproject.
|
|
|
|
|
MD5 hashing is one way, so you can't 'decrypt' it as such. You'd usually use it to store passwords in a file or database so they're not readable by anyone with access to the database. When someone comes to log-in, you hash the password again and compare the hashed passwords to see if they're entered the correct one.
.NET has a built in function for this:
string hashedPassword = FormsAuthentication.HashPasswordForStoringInConfigFile("Password to Hash", "MD5");
http://msdn2.microsoft.com/en-us/library/system.web.security.formsauthentication.hashpasswordforstoringinconfigfile.aspx[^]
Regards,
Rob Philpott.
|
|
|
|
|
My App keeps on throwing a System.OutOfMemoryException on the e.Graphics.DrawCurve(...) line. Any Ideas?
private void Charges_Paint(object sender, PaintEventArgs e)
{
if (activeParticles < 1)
return;
Pen myPen = new Pen(Color.FromArgb(128, 0, 0, 0), 2.0f);
for(int i = 0; i < activeParticles; i++)
{
if (myParticles[i].Charge)
myPen.Color = Color.FromArgb(128, 255, 0, 0);
else
myPen.Color = Color.FromArgb(128, 0, 0, 255);
e.Graphics.DrawCurve(myPen, myParticles[i].GetCurve());
}
}
|
|
|
|
|
Hello,
I think you have to dispose the pen. Otherwise the GC doesn't clean it.
mypen.Dispose();
Hope that helps,
All the best
Martin
|
|
|
|
|
Hey Martin,
Thanks for your input. I had indeed forgotten to Dispose of the pen, but there is still the same error on the same line.
private void Charges_Paint(object sender, PaintEventArgs e)
{
if (activeParticles < 1)
return;
Pen myPen = new Pen(Color.FromArgb(128, 0, 0, 0), 2.0f);
for(int i = 0; i < activeParticles; i++)
{
if (myParticles[i].Charge)
myPen.Color = Color.FromArgb(128, 255, 0, 0);
else
myPen.Color = Color.FromArgb(128, 0, 0, 255);
e.Graphics.DrawCurve(myPen, myParticles[i].GetCurve());
}
myPen.Dispose();
}
|
|
|
|
|
SharpenedC wrote: myParticles[i].GetCurve()
without knowing what that call does, its impossible to tell you why your app is running out of memory. Likely candidate is an infinate loop within that method call (have you incrememnted all loop control variables - thats a common cause). Of course the other possibility is that you have a huge number of elements in your myParticles array (activeParticles), and it is genuinely running out of available memory to draw all the curves.
|
|
|
|
|
Indeed. Although I might add, the exact error message is "An unhandled exception of type 'System.OutOfMemoryException' occurred in System.Drawing.dll"
public PointF[] GetCurve()
{
PointF[] myPoints = new PointF[4];
myPoints[0] = location.ToPoint();
for(int i = 1; i < 4; i++)
{
myPoints[i] = History[i - 1].ToPoint();
}
return myPoints;
}
EDIT: And the exception is thrown as soon as activeParticles exceeds 1.
|
|
|
|
|
SharpenedC wrote: An unhandled exception of type 'System.OutOfMemoryException' occurred in System.Drawing.dll
Yes, I assumed so, this message often is thrown when an infinite loop is entered into.
Have you tried stepping through the code to see what is happening?
|
|
|
|
|
Hello,
Maybe you have a recursive Call here.
Try to prefent it with a boolean flag:
private void Charges_Paint(.....)
{
if(allreadyinuse==false)
{
allreadyinuse= true;
//Start Youre code
//End Youre code
allreadyinuse= false;
}
}
All the best,
Martin
|
|
|
|
|
I implemented your idea, but now nothing happens :<
private void Charges_Paint(object sender, PaintEventArgs e)
{
if (!isPainting)
{
isPainting = true;
if (activeParticles < 1)
return;
Pen myPen = new Pen(Color.FromArgb(128, 0, 0, 0), 2.0f);
for (int i = 0; i < activeParticles; i++)
{
if (myParticles[i].Charge)
myPen.Color = Color.FromArgb(128, 255, 0, 0);
else
myPen.Color = Color.FromArgb(128, 0, 0, 255);
e.Graphics.DrawCurve(myPen, myParticles[i].GetCurve());
}
myPen.Dispose();
isPainting = false;
}
}
-- modified at 9:37 Thursday 31st August, 2006
|
|
|
|
|
Hello,
Sorry but I don't get your 'if' statement here.
if(!isPainting)
{
isPainting = true
//I think, here should be youre code
}
else
{
}
isPainting = false;
All the best,
MArtin
|
|
|
|
|
SharpenedC wrote: myParticles[i].GetCurve()
That is returning incorrect data. Check the values returned from that call when it crashes, you will likely spot a logic error
|
|
|
|
|
Hi. I am new to the programming bussiness. I have a urgent question.I am still working on .net 2003. When i am on a windows form, and run a select statement from sql to retrieve data, about 5000 records, the app is displaying in the task manager - "Not Responding" and it is opening a new instance of that. When it has retrieved the data, it is then running again and the other instance dissapears. Can smeone please help. This app must write about 50 000 records in to sql in one stage after it has checked in the db for duplications, and cannot display that it is not responding.
Thanks
|
|
|
|
|
Hi
Usually a program runs in a sequential manner (in a single thread) it means that each line of code should be executed and returns before the program flow can proceed.
Sometimes it takes some time for a command to be executed ( like you said,when a SQL statement is executing) and since your program is waiting (busy) during this operation if you want to ask its status using Task Manager,you will get "Not responding"
there are some ways that you can avoid this situation.
You can execute a command Asynchronously ( in another thread.)
This way your command will be executed in another thread (sequence of program flow) and you will be notified when the command execution is ended.
Regards
|
|
|
|
|
Hello,
i'm creating a custom control derived from the textbox class. The user must not be able to set focus on the textbox so i want to do it like this:
bool noFocus = true;<br />
<br />
protected override void OnEnter(EventArgs e)<br />
{<br />
if (noFocus == true)<br />
{<br />
}<br />
}
which code should I write after the comment tags?
Kind regards,
Frederik
|
|
|
|
|
hi
try to make the textbox disable.
Tamimi - Code
|
|
|
|
|
-> if the user cannot focus the textbox, why not set the ReadOnly textbox property to true?
-> you can also set the focus to another control you want in this code snippet, for instance.
good luck
|
|
|
|
|
Hi
As far as I know you can not force a custom control to lose focus but you can notify its container that it can gain the focus (by making it deisable or readonly ) or you can throw an exception when your text box is getting the focus.
for example:
<br />
protected override void OnEnter(EventArgs e)<br />
{<br />
if(noFocus)<br />
throw new MyTextBoxCantGetFocusException();<br />
}<br />
then you can manage the focus in your container
Regards
|
|
|
|
|
I Found the solution:
bool noFocus = true;<br />
<br />
protected override void OnEnter(EventArgs e)<br />
{<br />
if (noFocus == true)<br />
{<br />
int index = Parent.Controls.IndexOf(this);<br />
Parent.Controls[index - 1].Focus();<br />
}<br />
}
|
|
|
|
|
Goerlandt wrote: int index = Parent.Controls.IndexOf(this);
Parent.Controls[index - 1].Focus();
Hello,
Be carefull if index is "0".
All the best,
Martin
|
|
|
|
|
Hi all,
I am creating a form and in which, the user should have an option to insert symbols in the text box. The symbols include Greek symbols, standard mathematical operators and others stuff. How could i make a user interface such that user selects a symbol from the pop-up window, so the selected symbol value should return into the text box.
|
|
|
|
|
Hi everyone
I am trying to export data from datagrid to excel but gives me this erro"Obect reference not set to instance of the object".here is my code.I am using windows C#.
lblMessage.Text = "";
DataTable dtTransactions = dsTransactions.Tables["Transactions"].Copy();
int[] iColumns = {0,1,2,3,5,6};
RKLib.ExportData.Export objExport = new RKLib.ExportData.Export("Win");
objExport.ExportDetails(dtTransactions,iColumns,Export.ExportFormat.Excel,"C:\\TransactionsInfo.Excel");
lblMessage.Text = "Successfully exported to C:\\TransactionsInfo.Excel";
-- modified at 8:28 Thursday 31st August, 2006
|
|
|
|
|
Response.Clear();
Response.Charset = "";
Response.AddHeader("content-isposition", "attachment;filename=FileName.xls");
Response.ContentType = "application/vnd.ms-excel";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
DataGrid dGrid = new DataGrid();
dGrid.DataSource = Classname.functionname();//this is where u write the stored procedure
dGrid.HeaderStyle.Font.Bold = true;
dGrid.DataBind();
dGrid.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
please help me
|
|
|
|
|
Hi all,
This is hard to explain but I need some sort of Algorythm that will calculate a number for me.
Basically, I am "trying" to build a class that will output a Graph for our web stats, within my code I have got the highest amount that will be shown on the graph, and now I need to set the Y Axis values.
So at the moment, I have the values 0,2,0,90,172
because the highest value is 172 i'd like to some how generate a set of numbers like the following:
0,30,60,90,120,150,180
But since these values constantly change, I need some fancy way of calculating them.
Anyone have any idea's?
The reason why I ask, is because the Graph size will be 200hx700w (pixels) and regardless of the
results I want them to fit without any further coding.
Thanks
Gav
|
|
|
|
|
Gavin Roberts wrote: because the highest value is 172 i'd like to some how generate a set of numbers like the following:
0,30,60,90,120,150,180
Round the highest number to be a multiple of 10, and then create a set with n steps with: number / n
Example:
highest value = 154
-> maxnumber = (int)(154 / 10) * 100 + 10
(But this will only work reliable in the range of 10-100 - I can write an algorithm for you that will work on any kind of numbers, up to a million and above, but I have no time right now. I might write it later for you if you need it )
steps: n steps (e.g. 5)
-> step = maxnumber / n
then you can create your steps like this:
0, step, 2*step, 3*step, ... maxnumber
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|