<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://msmvps.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>/bill's House O Insomnia&lt;img src="http://www.williamgryan.com/images/originalcuckoo.jpg" alt="Bill Ryan" /&gt; : WTF</title><link>http://msmvps.com/blogs/williamryan/archive/tags/WTF/default.aspx</link><description>Tags: WTF</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>Programmatic Malpractice</title><link>http://msmvps.com/blogs/williamryan/archive/2007/01/31/programmatic-malpractice.aspx</link><pubDate>Thu, 01 Feb 2007 03:23:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:532889</guid><dc:creator>William</dc:creator><slash:comments>26</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/williamryan/rsscomments.aspx?PostID=532889</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/williamryan/commentapi.aspx?PostID=532889</wfw:comment><comments>http://msmvps.com/blogs/williamryan/archive/2007/01/31/programmatic-malpractice.aspx#comments</comments><description>&lt;p&gt;In the category of &amp;quot;I couldn&amp;#39;t make something like this up even if I tried&amp;quot; comes the following code.&amp;nbsp; Rather than try to dissect what it is that&amp;#39;s wrong with it, it&amp;#39;s a lot easier to find what&amp;#39;s right with it.&amp;nbsp; If the person that wrote this cashes their paycheck, they should be charged with theft.&amp;nbsp; We have all been in a hurry and written code that we aren&amp;#39;t proud of. We all are guilty of oversights.&amp;nbsp; But this was done by a self proclaimed guru and expert, and when you read the comments that were attached to it, it&amp;#39;s clear that this was done intentionally.&amp;nbsp; So I&amp;#39;m opening the floor to pointing out what&amp;#39;s wrong with it, or for my really advanced readers, what&amp;#39;s right with it (God knows a lot can go wrong calling the AddNew method of a DataTable and wrapping such a dangerous operation in catch block catching System.Exception is absolutely critical):&amp;nbsp; Read the code first, then read the comments associated with it.&amp;nbsp; P.S. I&amp;#39;m warning you up front that I&amp;#39;m not responsible if you start barfing, become overwhelmed by the ugliness of it and gouge your eyes out as solace or if your brains succumbs to spontaneous combustion.&amp;nbsp; Yep, a &amp;#39;professional consultant&amp;#39; wrote this work of art.&amp;nbsp; As a consultant, I guess I should find comfort in stuff like this b/c as long as there are people like this committing malpractice, I mean working, then I&amp;#39;ll always have a job. On the other hand, this sort of stuff is so bad and so inexcusably terrible , that my heart goes out to this person&amp;#39;s victim, urr, I mean client.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static decimal EvalNumber(string strExpr, ref bool&lt;br /&gt;calcSuccessful, ref string NegativeDelim)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;calcSuccessful=false;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;NegativeDelim = &amp;quot;-&amp;quot;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DataTable dt = new DataTable();&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;try&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dt.Columns.Add(&amp;quot;Expr&amp;quot;, typeof(Decimal), strExpr);&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;catch&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// tough decision they entered a error&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// colud be as simple as text/words&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// could be division by zero&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return (0);&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;try&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DataRow dr; dr = dt.NewRow();&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dt.Rows.Add(dr);&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;catch&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return (0);&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;decimal TempReturn=0;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;try&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;TempReturn=Convert.ToDecimal(dt.Rows[0][&amp;quot;Expr&amp;quot;]);&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;calcSuccessful=true;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;catch&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;calcSuccessful=false;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// expressions like (9) will resolve as positive 9 which is wrong&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// expressions like (9+2*12)*20 will obviously be a real formula&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (calcSuccessful == true &amp;amp;&amp;amp; strExpr.IndexOf(&amp;quot;(&amp;quot;) == 0)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;string tempStr = strExpr;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tempStr = tempStr.Replace(&amp;quot;(&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tempStr = tempStr.Replace(&amp;quot;)&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// parentheses are stripped&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;decimal tempNum = 0;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;try&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tempNum = Convert.ToDecimal(tempStr);&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// (9) == 9 so we must turn it to -9&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (tempNum == TempReturn)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;TempReturn = TempReturn * -1;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;NegativeDelim = &amp;quot;(&amp;quot;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;catch&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// nothing to do, all is well&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;} // end if parentheses issues&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return (TempReturn);&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;} // end EvalNumber&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp; private void ITDataGridView_CellParsing(object s,&lt;br /&gt;DataGridViewCellParsingEventArgs e)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;string tempMsg = &amp;quot;ITDataGridViewFund_CellParsing&amp;quot;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Logger.DGVStatusGrid(tempMsg, s, e, this);&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (CellTypeCalc(e.RowIndex, e.ColumnIndex, this) == false)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return;&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// we are in a row that allows formulas&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;bool evalSucceeded = false;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;string negativeDelim = &amp;quot;&amp;quot;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;decimal decMoney = 0;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;string CellValue =&lt;br /&gt;this.Rows[e.RowIndex].Cells[e.ColumnIndex].EditedFormattedValue.ToString();&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;decMoney = Utils.EvalNumber(CellValue, ref evalSucceeded,&lt;br /&gt;ref negativeDelim);&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (evalSucceeded)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// set format based on ( or -&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (negativeDelim == &amp;quot;(&amp;quot;)&lt;br /&gt;&lt;br /&gt;this.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.Format =&lt;br /&gt;&amp;quot;#,##0;(#,##0)&amp;quot;; ;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (negativeDelim == &amp;quot;-&amp;quot;)&lt;br /&gt;&lt;br /&gt;this.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.Format =&lt;br /&gt;&amp;quot;#,##0;-#,##0&amp;quot;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; } // end ITDataGridView_CellParsing&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;-----------------------------&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Quote from the Guru that wrote this&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;I tried every event to set .Value to the result of that formula. I&lt;br /&gt;tried dozens of desperate acts including just trying to SendKeys the&lt;br /&gt;Calc result to the cell (even that hack is impossible to get to work).&lt;br /&gt;Despite printing dozens of articles from Google and reading and&lt;br /&gt;empirically experimenting, days of frustrating no answer were my fate.&lt;br /&gt;But its ok, they had not resolved this in months and were going to say&lt;br /&gt;&amp;quot;no&amp;quot; to that user requirement before they handed it to me. They had&lt;br /&gt;made a pretty good app, otherwise that is a 1:1 knockoff functionality&lt;br /&gt;wise of another .net app written in 1 C# file with the Infragistics&lt;br /&gt;grid and spaghetti code everywhere, extraneous code, ad-hoc SQL, etc.&lt;br /&gt;whereas they wrote a fresh code base in 2 dozen sanely organized files&lt;br /&gt;and using Sprocs instead. They just needed a few bugs and enhancements&lt;br /&gt;fixed, and the code refactored in places for the new code and they&lt;br /&gt;were quite burn out on taming the DataGridView with very little,&lt;br /&gt;incomplete and confusing and contradictory docs whereas I am not burnt&lt;br /&gt;out.&lt;br /&gt;&lt;br /&gt;The two things that maybe could help but the docs/Google searches were&lt;br /&gt;as clear as mud i.e.&lt;br /&gt;e.FormattingApplied=true&lt;br /&gt;e.ParsingApplied=true&lt;br /&gt;seemed to not work well. They are normally false but if set to True&lt;br /&gt;they tended to create recursive DGV events in an infinite loop and&lt;br /&gt;overflow the stack. Ouch!&lt;br /&gt;&lt;br /&gt;Finally the answer turns out to be to use&lt;br /&gt;_CellParsing&lt;br /&gt;&lt;br /&gt;and VERY IMPORTANT use these 2 lines:&lt;br /&gt;&lt;br /&gt;e.Value = newValue;&lt;br /&gt;e.ParsingApplied = true;&lt;br /&gt;&lt;br /&gt;and never do:&lt;br /&gt;this.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = newValue;&lt;br /&gt;e.ParsingApplied = true;&lt;br /&gt;&lt;br /&gt;even though its basically the same thing because DataError will fire&lt;br /&gt;and recursion will occur etc.&lt;br /&gt;&lt;br /&gt;The users had 2 needs that sound simple but are quite tricky...&lt;br /&gt;&lt;br /&gt;1) a cell that understands a formula&lt;br /&gt;2) that cell if you enter -33 it should format as -33&lt;br /&gt;&amp;nbsp; &amp;nbsp;if you enter (33) it should format as (33)&lt;br /&gt;&amp;nbsp; &amp;nbsp;(ouch harder than it sounds)&lt;br /&gt;&lt;br /&gt;and the Eval function I use i.e. is crude and convoluted because of&lt;br /&gt;requirement 2 and the fact that when it works as designed (33)&lt;br /&gt;resolves to +33 if one does not compensate since it considers&lt;br /&gt;parentheses to be an algebraic operator i.e. to make (2+3)*9 &amp;nbsp;resolve&lt;br /&gt;without the multiplication occurring first via the order of operation&lt;br /&gt;rules. I probably will redo the EvalNumber function soon to ve cleaner&lt;br /&gt;and maybe with generics to support more numeric types than decimal&lt;br /&gt;(int, double, etc.) but this app only needs decimal.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;UPDATE: You&amp;#39;ve heard the adage &amp;#39;the customer is always right&amp;#39; haven&amp;#39;t you?&amp;nbsp; Well, I guess the&amp;nbsp;developer that wrote this has his own version &amp;quot;If the customer doesn&amp;#39;t complain, then the code doesn&amp;#39;t suck&amp;quot;&amp;nbsp; Hysterically, since the customer was ok with the end result, it&amp;#39;s not bad code.&amp;nbsp; I guess you couldn&amp;#39;t&amp;nbsp;write code that met the customer&amp;#39;s needs&amp;nbsp;that wasn&amp;#39;t so lame?&amp;nbsp; The fact is, that a lot of&amp;nbsp;code problems don&amp;#39;t&amp;nbsp;show themselves at first.&amp;nbsp; It&amp;#39;s only after stuff doesn&amp;#39;t scale or port well,&amp;nbsp;that&amp;nbsp;people realize it&amp;#39;s crap.&amp;nbsp;Trust me dude, you could have written better code that they would have been ok with and rationalize it&amp;nbsp;however you like,&amp;nbsp;people&amp;nbsp;bragging about being gurus shouldn&amp;#39;t start writing stuff like this.&lt;/strong&gt;&amp;nbsp; &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=532889" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/williamryan/archive/tags/Coding+Techniques/default.aspx">Coding Techniques</category><category domain="http://msmvps.com/blogs/williamryan/archive/tags/WTF/default.aspx">WTF</category></item></channel></rss>