Nice catch!
-
Hint: use <pre> when formatting code - much more readable The .NET Framework does supply some operations to find out whether an operation is possible, rather than throw an exception in case of failure. In the case of the above code, you should use
int.TryParse
instead ofConvert.ToInt32
(.NET 2.0 - in .NET 1.x you have to useDouble.TryParse
then cast toint
), which will return abool
to indicate whether it could convert it. Lookups in aHashtable
will also throw an exception if the key isn't found. To avoid this, test for the presence of a key usingContainsKey
. Exceptions are slow. Avoid them where not necessary.Stability. What an interesting concept. -- Chris Maunder
-
Hint: use <pre> when formatting code - much more readable The .NET Framework does supply some operations to find out whether an operation is possible, rather than throw an exception in case of failure. In the case of the above code, you should use
int.TryParse
instead ofConvert.ToInt32
(.NET 2.0 - in .NET 1.x you have to useDouble.TryParse
then cast toint
), which will return abool
to indicate whether it could convert it. Lookups in aHashtable
will also throw an exception if the key isn't found. To avoid this, test for the presence of a key usingContainsKey
. Exceptions are slow. Avoid them where not necessary.Stability. What an interesting concept. -- Chris Maunder
Mike Dimmick wrote:
Exceptions are slow.
http://www.codeproject.com/dotnet/ExceptionPerformance.asp[^]
Mike Dimmick wrote:
Avoid them where not necessary.
Well, yeah, but don't go out of your way to do so.
--| "Every tool is a hammer." |--
-
It is in Dutch. I have no problem reading it, and I don't even speak the language (2 minutes at Babelfish will do it). Get a Dutch programmer to translate it for you. Or does program code always have to be in English?:sigh:
arc_10spd wrote:
Or does program code always have to be in English?
If you ever want to start a lobby for making a law that states that all code should be in English, I'll make the buttons :cool:
-
arc_10spd wrote:
Or does program code always have to be in English?
If you ever want to start a lobby for making a law that states that all code should be in English, I'll make the buttons :cool:
There are about currently about 4,000 unique languages remaining in the world. English will overrun most of them within the next 100 years at the cost of an extraordinary and fascinating diversity in human culture and history stretching back for over 10,000 years (at least that is what some historical linguists claim they can reconstruct). I for one would find it a tragedy if Dutch were to go as well ("not so much a language as an organised method for clearing one's throat"). However, ErikDD, if you MUST have it in English, here is a guess: .... try { int startNumber = Convert.ToInt32(dataGrid1[dataGrid1.CurrentRowIndex, 0]); Hashtable ht = Logic.ObtainTeamIDAtStartnumber(editID); teamID = (int) ht[Startnumber]; if (!Logic.IsTimeControlIntroduced(teamID) return; } catch { return; } ... ;P
-
There are about currently about 4,000 unique languages remaining in the world. English will overrun most of them within the next 100 years at the cost of an extraordinary and fascinating diversity in human culture and history stretching back for over 10,000 years (at least that is what some historical linguists claim they can reconstruct). I for one would find it a tragedy if Dutch were to go as well ("not so much a language as an organised method for clearing one's throat"). However, ErikDD, if you MUST have it in English, here is a guess: .... try { int startNumber = Convert.ToInt32(dataGrid1[dataGrid1.CurrentRowIndex, 0]); Hashtable ht = Logic.ObtainTeamIDAtStartnumber(editID); teamID = (int) ht[Startnumber]; if (!Logic.IsTimeControlIntroduced(teamID) return; } catch { return; } ... ;P
-
There are about currently about 4,000 unique languages remaining in the world. English will overrun most of them within the next 100 years at the cost of an extraordinary and fascinating diversity in human culture and history stretching back for over 10,000 years (at least that is what some historical linguists claim they can reconstruct). I for one would find it a tragedy if Dutch were to go as well ("not so much a language as an organised method for clearing one's throat"). However, ErikDD, if you MUST have it in English, here is a guess: .... try { int startNumber = Convert.ToInt32(dataGrid1[dataGrid1.CurrentRowIndex, 0]); Hashtable ht = Logic.ObtainTeamIDAtStartnumber(editID); teamID = (int) ht[Startnumber]; if (!Logic.IsTimeControlIntroduced(teamID) return; } catch { return; } ... ;P
*grins* I happen to be one of the relatively few people who actually speak Dutch (aka a Dutchman) but I do appreciate the effort :) As for Dutch disappearing, I wouldn't miss it, but I don't enjoy the prospect. It's just that I also believe in code mobility and reusability.
-
*grins* I happen to be one of the relatively few people who actually speak Dutch (aka a Dutchman) but I do appreciate the effort :) As for Dutch disappearing, I wouldn't miss it, but I don't enjoy the prospect. It's just that I also believe in code mobility and reusability.
That would put a new spin on our local culture here outside Phoenix too; we just had our annual "Lost Dutchman Days" festival.
--| "Every tool is a hammer." |--
-
Aha! so ignore any exception, just return. That is indeed the way to do it. Silly me, what was i thinking?:-O
Regards, Marco
Really, what were you thinking. Will the end user report any mysterious issues before you manage to get a new and better job? Besides, 'some day' we're going to integrate an error capture and/or logging methodology into this business critical high visibility application which re-engineers our business case to leverage best-practice synergies to pro actively actualize our bottom line but at this point we really don't know what features are required and we're REALLY in a hurry to get something done so for now, we'll just put the blocks in place and fill them in later. Every application I support in this place is filled with this crap. Every programmer who spews this crap out rapidly is a hero (and soon off to bigger and better jobs)
-
*grins* I happen to be one of the relatively few people who actually speak Dutch (aka a Dutchman) but I do appreciate the effort :) As for Dutch disappearing, I wouldn't miss it, but I don't enjoy the prospect. It's just that I also believe in code mobility and reusability.
ErikDD wrote:
*grins* I happen to be one of the relatively few people who actually speak Dutch (aka a Dutchman) but I do appreciate the effort
ErikDD, A hidden Dutchman! Very drole. And very hard to tell from your English, of course. I have always thought the Dutch speak the best English in Europe. BTW, how was my Dutch translation of the code? I speak English, French, German and two Australian Aboriginal languages, but alas no Dutch, which, if I could find the time I would try to learn. I also have only a Dutch to German phrase book (relic of a vacation in Amsterdam when I lived in Germany 20 years ago), so it was a bit tricky trying to put together a proper translation, and you don't get any nuances from Babelfish. Thanks for the sly humour! You definitely made me laugh. :laugh: Anthony
-
ErikDD wrote:
*grins* I happen to be one of the relatively few people who actually speak Dutch (aka a Dutchman) but I do appreciate the effort
ErikDD, A hidden Dutchman! Very drole. And very hard to tell from your English, of course. I have always thought the Dutch speak the best English in Europe. BTW, how was my Dutch translation of the code? I speak English, French, German and two Australian Aboriginal languages, but alas no Dutch, which, if I could find the time I would try to learn. I also have only a Dutch to German phrase book (relic of a vacation in Amsterdam when I lived in Germany 20 years ago), so it was a bit tricky trying to put together a proper translation, and you don't get any nuances from Babelfish. Thanks for the sly humour! You definitely made me laugh. :laugh: Anthony
arc_10spd wrote:
I have always thought the Dutch speak the best English in Europe
What better than the British? Yeah, you may have a point - have you heard some of our dialects! :-D
-
ErikDD wrote:
*grins* I happen to be one of the relatively few people who actually speak Dutch (aka a Dutchman) but I do appreciate the effort
ErikDD, A hidden Dutchman! Very drole. And very hard to tell from your English, of course. I have always thought the Dutch speak the best English in Europe. BTW, how was my Dutch translation of the code? I speak English, French, German and two Australian Aboriginal languages, but alas no Dutch, which, if I could find the time I would try to learn. I also have only a Dutch to German phrase book (relic of a vacation in Amsterdam when I lived in Germany 20 years ago), so it was a bit tricky trying to put together a proper translation, and you don't get any nuances from Babelfish. Thanks for the sly humour! You definitely made me laugh. :laugh: Anthony
I wouldn't have guessed from your translation that you weren't a Dutch speaker, it was right on the mark :) As for the homour..I have my good days ;P Erik
-
Really, what were you thinking. Will the end user report any mysterious issues before you manage to get a new and better job? Besides, 'some day' we're going to integrate an error capture and/or logging methodology into this business critical high visibility application which re-engineers our business case to leverage best-practice synergies to pro actively actualize our bottom line but at this point we really don't know what features are required and we're REALLY in a hurry to get something done so for now, we'll just put the blocks in place and fill them in later. Every application I support in this place is filled with this crap. Every programmer who spews this crap out rapidly is a hero (and soon off to bigger and better jobs)
JohnnySacks wrote:
Besides, 'some day' we're going to integrate an error capture and/or logging methodology into this business critical high visibility application which re-engineers our business case to leverage best-practice synergies to pro actively actualize our bottom line but at this point we really don't know what features are required and we're REALLY in a hurry to get something done so for now, we'll just put the blocks in place and fill them in later.
This sounds so scarily like my manager..no wonder we've decided not to listen to him anymore ;P