|
Assuming your using the System.Windows.Forms.Timer (in the Toolbox), you simply would have had to read the documentation on it (click on the Timer on your form, then hit F1) to find this:
Note:
The Windows Forms Timer component is single-threaded, and is limited to an accuracy of 55 milliseconds. If you require a multithreaded timer with greater accuracy, use the Timer class in the System.Timers namespace.
In practice, your actual accuracy will vary, depending on system load, application load, and hardware capabilities.
|
|
|
|
|
I can't remember which way the Win.Forms Timer class works, but I'm pretty certain it marshalls events back onto the UI thread using Form.Invoke. That means you are limited to the speed of the windows message loop, and definitely the scheduling quanta, which is about 50ms.
There's another Timer class somewhere, but I doubt that will get down to 1ms accurately. Any other thread that takes up the CPU is going to get a whole 50ms to itself, blocking your stuff.
|
|
|
|
|
Hi
Im trying to right some code to list the files on a unix ftp server - code as per below - and, guess what - it works!
Except:
If I try to use it on an anonymous server - it works ok.
If I try to use it against a unix server - on our network which is what its for - then if the URL is ftp://servername - and i use the account fred - and freds default folder is /export/home/fred - then it lists the files in this folder.
If I want to list or download) files from another directory - say /tmp - here is no way to do this without getting "the remote server returned an error: (550) File unavailable"
ie if I make the URL ftp://servername/tmp - then I get the error - as its looking for a subfolder called /tmp in /export/home/fred...
Does anyone know a way round this ?
Thanks if you can help.
George
Private Sub List2(ByVal listUrl As String, ByRef p_dirlist As String)
Dim reader As StreamReader = Nothing
p_dirlist = ""
Try
Dim listRequest As FtpWebRequest = WebRequest.Create(listUrl)
' set the username and password !
listRequest.Credentials = New System.Net.NetworkCredential("username", "password")
' get the whole line - iw owner, size etc
'listRequest.Method = WebRequestMethods.Ftp.ListDirectoryDetails
' show just the file name
listRequest.Method = WebRequestMethods.Ftp.ListDirectory
Dim listResponse As FtpWebResponse = listRequest.GetResponse()
reader = New StreamReader(listResponse.GetResponseStream())
' read the whole lot
Dim strdirlist As String
strdirlist = reader.ReadToEnd()
MsgBox(strdirlist)
' Return the list of files in the directory
p_dirlist = strdirlist
Catch ex As UriFormatException
MsgBox(ex.Message)
Catch ex As WebException
MsgBox(ex.Message)
Finally
If reader IsNot Nothing Then
reader.Close()
End If
End Try
End Sub
|
|
|
|
|
ya..,
am also faced the same problem.
u can easily identified this bug, if u are debug u r code.
listRequest.Method = WebRequestMethods.Ftp.ListDirectoryDetails
If u debug your code the above statement returns the HTML tags instead of list directory. reader.ReadToEnd() this statment returns all the HTML code. Your strdirlist contains HTML code instead of file(s) list.
To slove this problem.
1. go to internet explorer
2. click internet options.
3. select connection tab.
4. click LANsetting button.
5. uncheck all the check boxes.
6. apply the settings, close IE
7. now run the code.
** do similar think if u use another browser.
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
How do I convert the following line of C# code to VB.Net
CheckComboBoxItem box = (CheckComboBoxItem)Items[ e.Index ];
Thank you.
|
|
|
|
|
What have you tried?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Dim box As CheckComboBoxItem = DirectCast(Items(e.Index), CheckComboBoxItem)
http://labs.developerfusion.co.uk/convert/csharp-to-vb.aspx
|
|
|
|
|
technette wrote: http://labs.developerfusion.co.uk/convert/csharp-to-vb.aspx
It probably took you longer to register than it would have to search the forums for technette's answer. This gets asked weekly.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
|
|
|
|
|
Congrats to technette for doing the OP's work for them. The OP sure didn't learn much, other than to rely on the Internet when they can't figure out how to do a simple thing like that conversion
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
yeah, it is obvious from birth that there is a web tool that converts any C# code to VB.NET
|
|
|
|
|
Yeah, it's called a brain
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
|
Thanks. I've always wondered if anyone could find it on my personal site
How much longer until you are done with your MBA?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
He had a brain and thats why he thought of posting in a forum.
|
|
|
|
|
I'll give him credit for that
I guess I could have been nicer and pointed him to SharpDevelop's code converter. Though not perfect, it does pretty well.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Thank you Technette. You are smarter than anyone who did not criticize and helped honestly. Rewards are waiting for you. Thanks again.
|
|
|
|
|
Its becomming a common thing here
|
|
|
|
|
You need to write, in pseudo code (or a computer language you are hapy with), a procedure that takes four parameters as follows:
DictionaryFile - the file name of a text file containing four letter words
StartWord - a four letter word (that you can assume is found in the DictionaryFile file)
EndWord - a four letter word (that you can assume is found in the DictionaryFile file)
ResultFile - the file name of a text file that will contain the result
The result is the shortest list of four letter words, starting with StartWord, and ending with EndWord, with a number of intermediate words that are to be found in the DictionaryFile file where each word differs from the previous word by precisely one letter.
For example, if StartWord = Spin, EndWord = Spot and DictionaryFile file contains
Spin
Spit
Spat
Spot
Span
then ResultFile should contain
Spin
Spit
Spot
Two examples of incorrect results:
Spin, Span, Spat, Spot (invalid as it takes 3 changes rather than 2)
Spin, Spon, Spot (invalid as spon is not a word)
Hint: Your solution should deal with the case where the dictionary file contains {AAAA,ABAA, ABZA, ABZZ, AAZZ} and the start and end word are AAAA and AAZZ respectively.
|
|
|
|
|
If this is a school assignment, then no one at the codeproject will want to help you. If you have solved the problem or are having problems with the problem than you can post it here, but no one will write the entire application for you.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my Blog
|
|
|
|
|
I've left school, so I do not need to do school assignments. But thank you anyway.
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
Steven J Jowett wrote: left school, so I do not need to do school assignments. But thank you anyway.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Geeze, do your own assignment
If you are stumped with a particular piece of code in your assignment, people may give you insight, not the solution to your assignment.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
This exact same crap has been posted before.
|
|
|
|
|
The idea of schools handing out assignments is to either as an excercise to help you learn, or for you to demonstrate what you know.
If we do this for you you will not learn, and it will only show what we know.
If you want help with this, then try and create a solution of your own first. If you get stuck then you can come to us for help. You MUST demonstrate that you have at least tried.
|
|
|
|
|
Colin Angus Mackay wrote: If you get stuck then you can come to us for help
Well, even he stucks somewhere than he should go to his teaher/instructor. A teacher would be anyday more than happy to help his student/
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|