|
Why not just use reCAPTCHA[^] - it's free, it's easy to use and people are familiar with it. Plus, it helps digitize books...
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
I second the reCaptcha recommend!
If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun
|
|
|
|
|
1. Have the image files named Captcha00.png ... Captcha09.png
2. Generate a random number from 0 to 9
3. Append that number to the string "Captcha0" then append ".png" to it.
4. output the resulting string to the webpage
5. compare the input text to what was computed in step 2
But as someone else said, this may not be a very secure Captcha.
A better one is to generate a simple equation with an "infinite" number of permutations. Such as a + b * c = where a, b & c are random integers between 2 and 99.
The best one is to implement with open source reCaptcha.
Good luck.
If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun
|
|
|
|
|
Hi,
In windows application how can i validate the ip address in a textbox on key press event.
I have used masked text box but still no solution.
Can anyone give me a solution ?
Thanks in advance.
|
|
|
|
|
|
Your regex is broken (but then so is mine - I'm about to fix it and explain why). You don't want \b before and after. Also, yours would accept 345.567.678.789, which is not a valid IP address!
Peter
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
I agree with you, my regex would accept 999.999.999.999 as well. I will update that.
Thanks....
I quit being afraid when my first venture failed and the sky didn't fall down.
|
|
|
|
|
Use a regular expression, such as
^(2[0-4]\d|25[0-5]|[01]?\d\d?)\.(2[0-4]\d|25[0-5]|[01]?\d\d?)\.(2[0-4]\d|25[0-5]|[01]?\d\d?)\.(2[0-4]\d|25[0-5]|[01]?\d\d?)$ (wrap it in whatever delimiters you need.)
If you can't read this, get a copy of Expresso and paste the expression into the expression window.
[edit]I thought it was broken, but it's not... It's just smarter than I am feeling right now. Need coffee! Forget the edit.[/edit]
Peter
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
Regex is NOT necessary.
Just use IPAddress.Parse(myIPAddress) , and handle the FormatException exception.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
And there we have the correct answer. Regexes are good - when used in appropriate cases. Reinventing the wheel is not the case though.
|
|
|
|
|
Oh John....you wouldn't be using exception handling as program flow control now would you? Naughty boy - go sit in the corner... Perhaps using IPAddress.TryParse() would be less "expensive"?
C# has already designed away most of the tedium of C++.
|
|
|
|
|
The cost in a GUI (per the OP) would be difficult to measure and certainly not significant.
Actually I am not sure what sort of application it would take where this would be expensive. It would require all of the following.
1. IPs arrive as strings.
2. A signficant number are invalid.
3. There are a lot of them.
|
|
|
|
|
I merely mentioned it to avoid being pinged for not doing so. It seems one cannot win.
Besides that, I'm sure intellisense works in his copy of VS, so he may have discovered it on his own.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
Depending on the situation, it may be appropriate (i.e. if the vast majority are valid and an invalid one really is exceptional). For UI validation it frankly doesn't matter but from a perspective of style you are correct.
|
|
|
|
|
TextBlock wrapping of text in Silverlight XAML file.
I have a wierd and annoying problem. I have a textblock that is inside a stackpanel that is Oriented horizontal. It would be nice if I could have the textblock appear in multiple lines nicely wrapped. How could I do that?
|
|
|
|
|
Set the textbox textwrapping to wrap
TextWrapping="Wrap"
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hello,
I use this code to send files to the FTP server :
FtpWebRequest myRequest = (FtpWebRequest)FtpWebRequest.Create(ftp:
myRequest.Credentials = new NetworkCredential(TEST,HEROS);
myRequest.Method = WebRequestMethods.Ftp.UploadFile;
FileStream stream = File.OpenRead(@"c:\test.txt");
byte[] buffer = new byte[stream.Length];
stream.Read(buffer, 0, buffer.Length);
stream.Close();
Stream reqStream = myRequest.GetRequestStream();
reqStream.Write(buffer, 0, buffer.Length);
reqStream.Close();
How i can receive the reponse, the server ftp return an ID of commande, i can see this number in FilZilla, bu i need to retrieve this id on C#, thank you verry mutch.
|
|
|
|
|
Use GetResponse[^].
(Also, learn to search, and use the documentation. I found that just from looking at the FtpWebRequest page on MSDN.)
|
|
|
|
|
how i can read cell value when i move up and down with the arrows key in datagridview
using C# code ?
thanks in advance
|
|
|
|
|
as always with Windows programming, split the problem in smaller pieces you can manage:
1.
what events are available that could suit your needs? use MSDN to browse the DataGridView events. Maybe there is something related to the current cell having changed? or the selection having changed?
2.
if such event doesn't offer a specialized EventArgs holding the required information (such as RowIndex and ColumnIndex), then go look for the Control's properties that may help you out.
3.
and finally, try it to see it works in all relevant scenarios.
|
|
|
|
|
Hello,
i am on a little player project in C# i like to give it away for some friends but without this wmp.dll i would just like to give the *.exe and refer to the already existing dll in system32 folder any idea maybe how to can do that?
it works all fine if i import it over the visual studio references (right mouseclick, add..) but than it have to be next to the *.exe file when i wanna start the prog
please give advise
Regards,
Sep
|
|
|
|
|
|
hm bit confusing its not my dll its COM i just saw its located in system32 folder but when i move my exe out of the project folder it wont start with out this dll, i was just trying to DllImport()... but i cant read the classes then so it wont let me compil..
btw how and where can i put it as GAC?
regards
|
|
|
|
|
I don't know the entire answer, however this much I can tell you:
1.
wmp.dll contains native code, hence it can't go into the GAC. Either it holds COM components (which I don't know much about), or it requires P/Invoke to call individual functions (which I have descibed to some length here[^]). And I do expect it to be COM.
2.
If you use P/Invoke (which also means you don't "Add Reference"), the DLL is located in the good old way, in the exe's folder first, then through the system environment variable "PATH", which typically contains C:\Windows\system32\ and many others. The app will start even when the DLL isn't present, however every reference to it will obviously fail during app execution.
3.
OTOH, if you have a hard reference to a DLL (as with "Add Reference"), then the DLL file (and its dependencies) must be present for the app to load successfully.
4.
I'm pretty sure there are several CP articles that refer to wmp.dll, so you could go and have a look how they handle things.
|
|
|
|
|
This[^] SO post may help.
/ravi
|
|
|
|