|
I think I wrote it in one of those points in the week where I just couldn't think. Methinks I'll replace it tomorrow.
|
|
|
|
|
Wonderful code!
When I was new to programming I used to do something like this too.
Then I figured out a trick: just add 1.000.000.000 to the number and take the last 4 characters.
Now I just use PadLeft, PadRight or Format
|
|
|
|
|
Just found this gem in the .NET BCL documentation on Process.WaitForExit(Int32):
In the .NET Framework version 3.5 and earlier versions, if milliseconds was -1, the WaitForExit(Int32) overload waited for MaxValue milliseconds (approximately 24 days), not indefinitely.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
I think you will find that 24 days is the maximum number of milliseconds a int32 wil hold.
How do I know this?
Well I wrote a millisecond counter with an int32 and wondered why every 20 or so days the program which was running on someone else's machine crashed.
I never hit the error as I switched my machine off every night and was only away on holiday for less than 20 days when the software was running without a nightly shutdown.
[edit - I missed the first line...]
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
The difference between eternity and 24 days matters actually. Windows 9x did crash after 49.7 days. They used unsigned int back then...
“Today is the first day of the rest of your life.”
|
|
|
|
|
I'm currently working with a GUI built by someone who seems to like using the default names for controls. The language in which this GUI was created allows any control to have a label associated with it. I have just come across a control named copyOfcopyOfcopyOfTextField41282 , with a label of copyOfcopyOfcopyOfTextField4121 .
In this language, it is also common to refer to a control by way of mentioning all its parent controls (which in the GUI builder is often placed in a dropdown with a fixed width to ensure that you cannot see the full control path and name, because that would just make your life too easy). The full path and name of the above control is Group0/Frame/CriteriaBox/VerticalBox2/copyOfcopyOfVerticalBox512/HorizontalBox5/copyOfcopyOfcopyOfTextField41282 .
The control in question isn't even visible to the user, and I have no idea what its purpose is.
Kill me now.
What is this talk of release? I do not release software. My software escapes leaving a bloody trail of designers and quality assurance people in its wake.
|
|
|
|
|
BotCar wrote: I have no idea what its purpose is
It's obvious. It's to make really, really, really sure that you don't lost the contents of TextField41282.
|
|
|
|
|
try deleting them and see if anybody notices 
|
|
|
|
|
Strange behavior in my code, every operation it had to do took 5 seconds..
At the end I found it:
System.Threading.Thread.Sleep(5000);
It was sitting there since the beggining of the project. Commented it, testing, and it worked normally.
Can't remember why I made the system sleep 5 secs, on 10 operations it's ok, but on production we got 2'500 operations, took forever..
The signature is in building process.. Please wait...
|
|
|
|
|
Don't you just love comments.
Be excellent to each other. And... PARTY ON, DUDES!
Abraham Lincoln
|
|
|
|
|
I actually hate them.. But they are usefull, I agree..
The signature is in building process.. Please wait...
|
|
|
|
|
I love them when other do them.
Be excellent to each other. And... PARTY ON, DUDES!
Abraham Lincoln
|
|
|
|
|
Those that explain the bad code, or those to comment out the bad code ?
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
Do not feed the troll ! - Common proverb
|
|
|
|
|
Well, both are better then not.
Be excellent to each other. And... PARTY ON, DUDES!
Abraham Lincoln
|
|
|
|
|
Yeah, that would slow things down. Using a to do list would help to remember to clean up such things. It is like a comment, but looks like //TODO: Remove this after testing. Then you can see the to so list in Visual Studio
Just because the code works, it doesn't mean that it is good code.
modified 24-Sep-13 16:11pm.
|
|
|
|
|
Yep - I do it all the time - so they show up in the VS "Task List".
The only instant messaging I do involves my middle finger.
|
|
|
|
|
Thanks
-Amit Gajjar
|
|
|
|
|
You should have decreased the value.
|
|
|
|
|
To 4'999??? or to 1??
The signature is in building process.. Please wait...
|
|
|
|
|
Maybe by twenty-five to fifty percent; you need to leave some.
|
|
|
|
|
In this case I don't need it at all.. It was there for debugging, because without the sleep, debugging just went too fast.
The signature is in building process.. Please wait...
|
|
|
|
|
No you need to leave some delay in for a development holiday. When Boss Man says the app is too slow, tell him you'll have a look, spend two days faffing, reduce the wait by 20% and tell him you've optimised the code. Simples.
speramus in juniperus
|
|
|
|
|
I guess you are doing the same
Thanks
-Amit Gajjar
|
|
|
|
|
vonb wrote: To 4'999??? or to 1?? Silly, to -1.
(Incidentally, sleeping for 0 cycles has "special behaviour")
|
|
|
|
|
Exactly. You understand the meaning of this valuable coding practise described in
"Real World Software Development - Volume I: Coding Patterns" by W., T., and F.
|
|
|
|