<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>The Code Project Latest postings for Hall Of Shame</title>
    <link>http://www.codeproject.com</link>
    <description>Latest postings for Hall Of Shame from The Code Project</description>
    <language>en-us</language>
    <image>
      <title>The Code Project Latest postings for Hall Of Shame</title>
      <url>http://www.codeproject.com/App_Themes/Std/Img/logo100x30.gif</url>
      <link>http://www.codeproject.com</link>
      <width>100</width>
      <height>30</height>
      <description>The Code Project</description>
    </image>
    <copyright>Copyright  CodeProject, 1999-2012</copyright>
    <webMaster>webmaster@codeproject.com (Webmaster)</webMaster>
    <lastBuildDate>Fri, 10 Feb 2012 08:10:00 GMT</lastBuildDate>
    <ttl>20</ttl>
    <generator>C# Hand-coded goodness</generator>
    <item>
      <title>Do you want string or string?</title>
      <description>OK, by Hall Of Shame standards, this isn't too bad.  Still worth sharing...&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&lt;pre lang="c#"&gt;KeyValuePair&amp;lt;DateTime, string&amp;gt; lastItem;
&lt;span class="code-comment"&gt;//&lt;/span&gt;&lt;span class="code-comment"&gt;Some code...
&lt;/span&gt;&lt;span class="code-keyword"&gt;if&lt;/span&gt; (lastItem.Value != &lt;span class="code-keyword"&gt;null&lt;/span&gt; &amp;amp;&amp;amp; lastItem.Value.ToString().Trim() != &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;"&lt;/span&gt;)
{
&lt;span class="code-comment"&gt;//&lt;/span&gt;&lt;span class="code-comment"&gt;Some more code...&lt;/span&gt;&lt;/pre&gt;
&amp;nbsp;&lt;br /&gt;
Three things jump out at me:&lt;br /&gt;
1. Use of empty string literal instead of &lt;code&gt;String.Empty&lt;/code&gt;&lt;br /&gt;
2. Seperate testing of null and empty string instead of &lt;code&gt;String.IsNullOrEmpty()&lt;/code&gt;&lt;br /&gt;
3. Calling &lt;code&gt;ToString()&lt;/code&gt; on something that is already a string.&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
#1 and #2 isn't too serious, especially if you consider that you also want to trim the string, so you need to check for null before trying to trim anyway.  #3, on the other hand, confuses me.  Why would you want to call &lt;code&gt;ToString()&lt;/code&gt; on a string?</description>
      <link>http://www.codeproject.com/Messages/4153272/Do-you-want-string-or-string.aspx</link>
      <author>TheOtherCPian</author>
      <pubDate>Fri, 10 Feb 2012 08:10:00 GMT</pubDate>
      <subject>Hall Of Shame</subject>
    </item>
    <item>
      <title>Bad filtering</title>
      <description>Hi guys&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
im new here but i tough i would share this example of code i encountered a couple months back&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
in one class&lt;br /&gt;
&lt;pre lang="sql"&gt;
&lt;span class="code-keyword"&gt;Select&lt;/span&gt; field1,field2,field3
&lt;span class="code-keyword"&gt;From&lt;/span&gt; table1
&lt;span class="code-keyword"&gt;Where&lt;/span&gt; type=&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;EDU"&lt;/span&gt;&lt;/pre&gt;
&amp;nbsp;&lt;br /&gt;
the only fucntion using this result set was coded like this&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&lt;pre lang="vb"&gt;&lt;span class="code-keyword"&gt;If&lt;/span&gt;(field1=cond1 &lt;span class="code-keyword"&gt;and&lt;/span&gt; field2=con4 &lt;span class="code-keyword"&gt;and&lt;/span&gt; Active=true)
 &lt;span class="code-keyword"&gt;do&lt;/span&gt; something
&lt;span class="code-keyword"&gt;else&lt;/span&gt; &lt;span class="code-keyword"&gt;If&lt;/span&gt;(field1=cond1 &lt;span class="code-keyword"&gt;and&lt;/span&gt; field2=con2 &lt;span class="code-keyword"&gt;and&lt;/span&gt; Active=true)
&lt;span class="code-keyword"&gt;do&lt;/span&gt; something
&lt;span class="code-keyword"&gt;else&lt;/span&gt; &lt;span class="code-keyword"&gt;If&lt;/span&gt;(field3=cond10 &lt;span class="code-keyword"&gt;and&lt;/span&gt; field2=con2 &lt;span class="code-keyword"&gt;and&lt;/span&gt; Active=true)
&lt;span class="code-keyword"&gt;do&lt;/span&gt; something &lt;span class="code-keyword"&gt;else&lt;/span&gt;
&lt;/pre&gt;
this went on for like 9 time  &lt;img src="/script/Forums/Images/smiley_WTF.gif" align="top" alt="WTF | :WTF:" /&gt;  &lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
now someone added another If lower down in the code but forgot the Active=true hense causing  a bug ! now after searching to make sure that the Selqct wasent used anywhere else(the name was a dead give away but you never know)&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
First off &lt;br /&gt;
&lt;pre lang="SQL"&gt;&lt;span class="code-keyword"&gt;Select&lt;/span&gt; field1,field2,field3
&lt;span class="code-keyword"&gt;From&lt;/span&gt; table1
&lt;span class="code-keyword"&gt;Where&lt;/span&gt; type=&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;EDU"&lt;/span&gt; &lt;span class="code-keyword"&gt;AND&lt;/span&gt; Active=True&lt;/pre&gt; &lt;br /&gt;
PLEASE add this AND ... just reducing the result set will bost this application speed has its database was Huge&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
as for the rest we where not allowed to modify working code but come on 9 inbricked iff with some repeating coditions ....</description>
      <link>http://www.codeproject.com/Messages/4149342/Bad-filtering.aspx</link>
      <author>Jtai</author>
      <pubDate>Mon, 06 Feb 2012 19:12:00 GMT</pubDate>
      <subject>Hall Of Shame</subject>
    </item>
    <item>
      <title>DAO Framework</title>
      <description>&lt;blockquote class="FQ"&gt;
    &lt;div class="FQA"&gt;tecgoblin wrote:&lt;/div&gt;It's surprising how many people try to create their own solutions to problems which already have established and well-behaving solution :S.&lt;/blockquote&gt;
  &lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
In the spirit of this comment I wanted to introduce a new standard - the DAO Framework. Problem: "Some day you may wish to change databases." Solution: "Create a generic database access framework to ease migration."&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
Example:&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
Firstly, define a DBConst file as follows:&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&lt;pre&gt;&lt;span class="code-keyword"&gt;public&lt;/span&gt; &lt;span class="code-keyword"&gt;class&lt;/span&gt; DBConst {
  &lt;span class="code-keyword"&gt;public&lt;/span&gt; &lt;span class="code-keyword"&gt;static&lt;/span&gt; &lt;span class="code-SDKkeyword"&gt;String&lt;/span&gt; SELECT = &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;SELECT"&lt;/span&gt;;
  &lt;span class="code-keyword"&gt;public&lt;/span&gt; &lt;span class="code-keyword"&gt;static&lt;/span&gt; &lt;span class="code-SDKkeyword"&gt;String&lt;/span&gt; WHERE = &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;WHERE"&lt;/span&gt;;
  &lt;span class="code-keyword"&gt;public&lt;/span&gt; &lt;span class="code-keyword"&gt;static&lt;/span&gt; &lt;span class="code-SDKkeyword"&gt;String&lt;/span&gt; AND = &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;AND"&lt;/span&gt;
  etc
}&lt;/pre&gt;
&amp;nbsp;&lt;br /&gt;
Then create an interface: SQLFactory as follows:&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&lt;pre&gt;&lt;span class="code-keyword"&gt;public&lt;/span&gt; &lt;span class="code-keyword"&gt;interface&lt;/span&gt; SQLFactory {
  &lt;span class="code-keyword"&gt;public&lt;/span&gt; &lt;span class="code-SDKkeyword"&gt;String&lt;/span&gt; createSQL(&lt;span class="code-SDKkeyword"&gt;String&lt;/span&gt;[] selectors, &lt;span class="code-SDKkeyword"&gt;String&lt;/span&gt;[] whereClauses);
}&lt;/pre&gt;
&amp;nbsp;&lt;br /&gt;
If I remember correctly, now all you have to do is (Not in the original this was a class, I invented using interfaces - yay me):&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&lt;pre lang="java"&gt;&lt;span class="code-keyword"&gt;public&lt;/span&gt; &lt;span class="code-keyword"&gt;interface&lt;/span&gt; MyTable {
  &lt;span class="code-keyword"&gt;public&lt;/span&gt; &lt;span class="code-keyword"&gt;static&lt;/span&gt; String TABLE_NAME = &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;MyTable"&lt;/span&gt;;
  &lt;span class="code-keyword"&gt;public&lt;/span&gt; &lt;span class="code-keyword"&gt;static&lt;/span&gt; String COL_1 = &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;Col1"&lt;/span&gt;;
  &lt;span class="code-keyword"&gt;public&lt;/span&gt; &lt;span class="code-keyword"&gt;static&lt;/span&gt; String COL_2 = &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;Col2"&lt;/span&gt;;
}
&lt;/pre&gt;
&amp;nbsp;&lt;br /&gt;
Okay, we're nearly ready to write some code:&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&lt;pre&gt;&lt;span class="code-keyword"&gt;public&lt;/span&gt; &lt;span class="code-keyword"&gt;class&lt;/span&gt; MyTableDao {
  &lt;span class="code-keyword"&gt;public&lt;/span&gt; MyObject selectObject(&lt;span class="code-SDKkeyword"&gt;String&lt;/span&gt; selector) {
    &lt;span class="code-comment"&gt;//&lt;/span&gt;&lt;span class="code-comment"&gt; list the columns to select
&lt;/span&gt;    &lt;span class="code-SDKkeyword"&gt;String&lt;/span&gt;[] columns = {MyTable.COL_1, MyTable.COL_2);
    &lt;span class="code-SDKkeyword"&gt;Object&lt;/span&gt;[] types = {DbTypes.DATE, DbTypes.INTEGER};
&amp;nbsp;
    &lt;span class="code-comment"&gt;//&lt;/span&gt;&lt;span class="code-comment"&gt; list the selector(s) for the statement "WHERE COL_1 = ?"
&lt;/span&gt;    &lt;span class="code-SDKkeyword"&gt;String&lt;/span&gt;[] whereClause = {MyTable.COL_1};
    &lt;span class="code-SDKkeyword"&gt;Object&lt;/span&gt;[] whereValues = {selector};
&amp;nbsp;
    MySqlFactory sqlFactory = &lt;span class="code-keyword"&gt;new&lt;/span&gt; MySqlFactory();
    &lt;span class="code-SDKkeyword"&gt;String&lt;/span&gt; sql = sqlFactory.createSql(columns, whereClause);
&amp;nbsp;
    PreparedStatement ps = connect.prepareStatement(sql)
&amp;nbsp;
    &lt;span class="code-comment"&gt;//&lt;/span&gt;&lt;span class="code-comment"&gt; this might have been a generic utility actually. Overridden 
&lt;/span&gt;    &lt;span class="code-comment"&gt;//&lt;/span&gt;&lt;span class="code-comment"&gt; for complex requirements maybe?
&lt;/span&gt;    MySqlInjector.injectValues(ps, &lt;span class="code-keyword"&gt;new&lt;/span&gt; &lt;span class="code-SDKkeyword"&gt;Object&lt;/span&gt;[] {selector});
&amp;nbsp;
    &lt;span class="code-comment"&gt;//&lt;/span&gt;&lt;span class="code-comment"&gt; get the resulting data and create objects from it
&lt;/span&gt;    ResultSet rs = stmt.executeQuery(query);
    MyObject[] objs = MyObjectFactory.getObjects(rs, columns, types);
&amp;nbsp;
}
&lt;/pre&gt;
&amp;nbsp;&lt;br /&gt;
Yeah, I think that was it. I'm writing from memory from 5 years ago so forgive if errors. &lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
Key standards:&lt;br /&gt;
* List the columns to retrieve&lt;br /&gt;
&lt;pre&gt;sb.append(DbConsts.SELECT).append(&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt; "&lt;/span&gt;).append(COL).append(,) ...&lt;/pre&gt;
* List the types of the columns so an object factory can retrieve the right type&lt;br /&gt;
&lt;pre&gt;&lt;span class="code-keyword"&gt;if&lt;/span&gt;(type[&lt;span class="code-digit"&gt;0&lt;/span&gt;]==DbTypes.INTEGER) rs.getInt(); &lt;span class="code-comment"&gt;//&lt;/span&gt;&lt;span class="code-comment"&gt; or whatever&lt;/span&gt;&lt;/pre&gt;
* List the WHERE clauses&lt;br /&gt;
&lt;pre&gt;sb.append(DbConsts.WHERE).append(&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt; "&lt;/span&gt;).append(clauses[&lt;span class="code-digit"&gt;0&lt;/span&gt;]...&lt;/pre&gt;
&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
I forgot about the static object factories until now. I suspect the SQL factories were static rather than implementations of an interface. It was more by program by convention.&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
The rest of the implementation is left as an exercise for the reader.&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
Can we stop all this nonsense with Hibernate now please?</description>
      <link>http://www.codeproject.com/Messages/4144736/DAO-Framework.aspx</link>
      <author>Chanoch Wiggers</author>
      <pubDate>Wed, 01 Feb 2012 13:06:00 GMT</pubDate>
      <subject>Hall Of Shame</subject>
    </item>
    <item>
      <title>Connectivity test</title>
      <description>I came across the following, working on some one else's project:&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
            &lt;pre&gt;
            pingHost pping = &lt;span class="code-keyword"&gt;new&lt;/span&gt; pingHost();
            &lt;span class="code-comment"&gt;//&lt;/span&gt;&lt;span class="code-comment"&gt;if ping is false then connection issues
&lt;/span&gt;            &lt;span class="code-keyword"&gt;if&lt;/span&gt; (!pping.ping(&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;www.google.com"&lt;/span&gt;)) {
                MessageBox.Show(&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;The application is unable to connect to the internet and cannot continue."&lt;/span&gt;)
                &lt;span class="code-keyword"&gt;return&lt;/span&gt;;
            }&lt;/pre&gt;
&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
So, I take it that Google IS the internet.&lt;br /&gt;
What's more, this app runs on a VPN and in some cases on a LAN where the server is in the same building.&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
I wonder how many seemingly unrelated applications, neigh, systems, will EPICALLY FAIL throughout the world the day Google dies or decides to block ICMP requests.  &lt;img src="/script/Forums/Images/smiley_rolleyes.gif" align="top" alt="Roll eyes | :rolleyes:" /&gt;  &lt;br /&gt;
(Maybe that's the event the Mayans predicted for 21 December 2012?)</description>
      <link>http://www.codeproject.com/Messages/4144670/Connectivity-test.aspx</link>
      <author>MatthysDT</author>
      <pubDate>Wed, 01 Feb 2012 12:19:00 GMT</pubDate>
      <subject>Hall Of Shame</subject>
    </item>
    <item>
      <title>The beauty that is the default conversion...</title>
      <description>Ladies and Gentlemen!&lt;br /&gt;
Direct, from the wonders of Q&amp;A (no, names, no embarrassment - although it is most definately deserved):&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&lt;pre lang="c#"&gt;SqlDataAdapter dad = &lt;span class="code-keyword"&gt;new&lt;/span&gt; SqlDataAdapter(&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;Select * from esrdat where esrdat_date between '"&lt;/span&gt; + Convert.ToDateTime(dateTimePicker1.Value) + &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;' and '"&lt;/span&gt; + Convert.ToDateTime(dateTimePicker2.Value) + &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;'"&lt;/span&gt;, con); &lt;/pre&gt;
&amp;nbsp;&lt;br /&gt;
Here, for your delectation we have:&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
1) Take a valid DateTime&lt;br /&gt;
2) Use a default conversion to a string&lt;br /&gt;
3) Convert it back to a DateTime&lt;br /&gt;
4) Then pass that (converted back to a string via another default conversion) to SQL&lt;br /&gt;
But in the local format, rather than anything SQL is expecting, which is ISO format.&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
Twice.&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
And it's in Q&amp;A because SQL doesn't like the date format it eventually gets passed... &lt;img src="/script/Forums/Images/smiley_sigh.gif" align="top" alt="Sigh | :sigh:" /&gt; &lt;br /&gt;
&lt;div class="signature"&gt;&lt;small&gt;Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water&lt;/small&gt;&lt;/div&gt;</description>
      <link>http://www.codeproject.com/Messages/4143632/The-beauty-that-is-the-default-conversion.aspx</link>
      <author>OriginalGriff</author>
      <pubDate>Tue, 31 Jan 2012 11:40:00 GMT</pubDate>
      <subject>Hall Of Shame</subject>
    </item>
    <item>
      <title>Enabling backwards compatibility</title>
      <description>So this is an approach that proved so successful that it was made into a standard. You're writing a shared library and you're concerned to ensure future compatibility across services. Problems include:&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
* How to support non built-in types? (e.g. MyCustomType)&lt;br /&gt;
* How to support float, int, double, etc?&lt;br /&gt;
* How to prevent constantly updating interfaces from complicating builds?&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
Best approach? Well, how about you convert all your arguments into Strings to transfer across the wire and then convert them back. &lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
Every method has the following signature:&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&lt;pre&gt;&lt;span class="code-keyword"&gt;public&lt;/span&gt; &lt;span class="code-SDKkeyword"&gt;String&lt;/span&gt;[] doSomething(&lt;span class="code-SDKkeyword"&gt;String&lt;/span&gt;[] args, &lt;span class="code-SDKkeyword"&gt;String&lt;/span&gt; userId)&lt;/pre&gt;
&amp;nbsp;&lt;br /&gt;
Then you have a static library that allows:&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&lt;pre&gt;TypeUtils.stringify(&lt;span class="code-SDKkeyword"&gt;Object&lt;/span&gt; object); &lt;span class="code-comment"&gt;//&lt;/span&gt;&lt;span class="code-comment"&gt; native types are supported by simply ""+myVar
&lt;/span&gt;&lt;span class="code-SDKkeyword"&gt;Object&lt;/span&gt; obj = TypeUtils.fromString(&lt;span class="code-SDKkeyword"&gt;String&lt;/span&gt; string, &lt;span class="code-SDKkeyword"&gt;String&lt;/span&gt; fromType);&lt;/pre&gt;
&amp;nbsp;&lt;br /&gt;
Easy. (Note you may need to cast the object returned from TypeUtils.fromString(). User id is there to ensure security, obviously. You don't have to use the TypeUtils but you are encouraged to, &lt;i&gt;for convenience.&lt;/i&gt;&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
This way, when you swap args[2] and args[3], or when you introduce a new argument at the end, you don't have to declare a new version of the interface.&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
Simply keep the same version interface jar throughout and require everyone to use the very latest implementation.&lt;br /&gt;
&lt;div class="signature"&gt;This is why I don't program&lt;/div&gt;</description>
      <link>http://www.codeproject.com/Messages/4142458/Enabling-backwards-compatibility.aspx</link>
      <author>Chanoch Wiggers</author>
      <pubDate>Mon, 30 Jan 2012 13:30:00 GMT</pubDate>
      <subject>Hall Of Shame</subject>
    </item>
    <item>
      <title>Strictly Short Circuit</title>
      <description>Names changed to protect the innocent...&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
I'm working with some VB.net projects and I decided to turn on Option Strict. It threw an error for this line:&lt;br /&gt;
&lt;pre lang="vb.net"&gt;&lt;span class="code-keyword"&gt;If&lt;/span&gt; someProp &lt;span class="code-keyword"&gt;Is&lt;/span&gt; &lt;span class="code-keyword"&gt;Nothing&lt;/span&gt; &lt;span class="code-keyword"&gt;OrElse&lt;/span&gt; &lt;span class="code-keyword"&gt;String&lt;/span&gt;.IsNullOrEmpty(someProp.Value &lt;span class="code-keyword"&gt;OrElse&lt;/span&gt; someProp.Value = &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;0"&lt;/span&gt;) &lt;span class="code-keyword"&gt;Then&lt;/span&gt;&lt;/pre&gt;
This is what was intended:&lt;br /&gt;
&lt;pre lang="vb.net"&gt;&lt;span class="code-keyword"&gt;If&lt;/span&gt; someProp &lt;span class="code-keyword"&gt;Is&lt;/span&gt; &lt;span class="code-keyword"&gt;Nothing&lt;/span&gt; &lt;span class="code-keyword"&gt;OrElse&lt;/span&gt; &lt;span class="code-keyword"&gt;String&lt;/span&gt;.IsNullOrEmpty(someProp.Value) &lt;span class="code-keyword"&gt;OrElse&lt;/span&gt; someProp.Value = &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;0"&lt;/span&gt; &lt;span class="code-keyword"&gt;Then&lt;/span&gt;&lt;/pre&gt;
  &lt;img src="/script/Forums/Images/smiley_biggrin.gif" align="top" alt="Big Grin | :-D" /&gt;   for option explicit!  &lt;img src="/script/Forums/Images/smiley_cry.gif" align="top" alt="Cry | :((" /&gt;  for the fact that I have several projects to go and I'm working in the order of best code to worst code.&lt;br /&gt;
&lt;div class="signature"&gt;&lt;a href="http://www.pangloss.com/seidel/Shaker/"&gt;Thou mewling ill-breeding pignut!&lt;/a&gt;&lt;/div&gt;</description>
      <link>http://www.codeproject.com/Messages/4139919/Strictly-Short-Circuit.aspx</link>
      <author>AspDotNetDev</author>
      <pubDate>Fri, 27 Jan 2012 02:02:00 GMT</pubDate>
      <subject>Hall Of Shame</subject>
    </item>
    <item>
      <title>Code should be 5 or anything above 7 long...</title>
      <description>Before people start... The horror is NOT that this is VB code... Now with that out of the way...&lt;br /&gt;
A bit of weird code a colleague found recently...&lt;br /&gt;
&lt;pre lang="vb"&gt;
&lt;span class="code-comment"&gt;'&lt;/span&gt;&lt;span class="code-comment"&gt; This code should always be 5 characters long.
&lt;/span&gt;&lt;span class="code-keyword"&gt;If&lt;/span&gt; code.Length &amp;lt; &lt;span class="code-digit"&gt;5&lt;/span&gt; &lt;span class="code-keyword"&gt;Or&lt;/span&gt; code.Length = &lt;span class="code-digit"&gt;6&lt;/span&gt; &lt;span class="code-keyword"&gt;Or&lt;/span&gt; code.Length = &lt;span class="code-digit"&gt;7&lt;/span&gt; &lt;span class="code-keyword"&gt;Then&lt;/span&gt;
   &lt;span class="code-keyword"&gt;Throw&lt;/span&gt; &lt;span class="code-keyword"&gt;New&lt;/span&gt; Exception(&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;Code should be 5 characters long."&lt;/span&gt;)
&lt;span class="code-keyword"&gt;End&lt;/span&gt; &lt;span class="code-keyword"&gt;If&lt;/span&gt;
&lt;/pre&gt;My guess is that the programmer assumed it would be 5 characters long or less. Then it turned out it could be 6 too so the &lt;code&gt;Or code.length = 6&lt;/code&gt; part was added, then the code was 7 at some occurrence... The users weren't stupid enough to enter an 8 character code so that one hasn't been added (yet) &lt;img src="/script/Forums/Images/smiley_laugh.gif" align="top" alt="Laugh | :laugh:" /&gt;  &lt;br /&gt;
Why not simply check if &lt;code&gt;code.Length &amp;lt;&amp;gt; 5&lt;/code&gt;? &lt;img src="/script/Forums/Images/smiley_rolleyes.gif" align="top" alt="Roll eyes | :rolleyes:" /&gt; &lt;br /&gt;
&lt;div class="signature"&gt;It's an OO world.&lt;br /&gt;
&lt;pre lang="c#"&gt;&lt;span class="code-keyword"&gt;public&lt;/span&gt; &lt;span class="code-keyword"&gt;class&lt;/span&gt; Naerling : Lazy&amp;lt;Person&amp;gt;{
    &lt;span class="code-keyword"&gt;public&lt;/span&gt; &lt;span class="code-keyword"&gt;void&lt;/span&gt; DoWork(){ &lt;span class="code-keyword"&gt;throw&lt;/span&gt; &lt;span class="code-keyword"&gt;new&lt;/span&gt; NotImplementedException(); }
}&lt;/pre&gt;&lt;/div&gt;</description>
      <link>http://www.codeproject.com/Messages/4139062/Code-should-be-5-or-anything-above-7-long.aspx</link>
      <author>Naerling</author>
      <pubDate>Thu, 26 Jan 2012 08:00:00 GMT</pubDate>
      <subject>Hall Of Shame</subject>
    </item>
    <item>
      <title>Logical AND with false...</title>
      <description>Didn't notice this little piece of code and it was making me think some sections worked completely different than they actually do.&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&lt;pre lang="c++"&gt;
&lt;span class="code-comment"&gt;//&lt;/span&gt;&lt;span class="code-comment"&gt;C++
&lt;/span&gt;&lt;span class="code-keyword"&gt;if&lt;/span&gt;(m_Config.m_isContinuous &amp;amp;&amp;amp; &lt;span class="code-keyword"&gt;false&lt;/span&gt;){ &lt;span class="code-comment"&gt;//&lt;/span&gt;&lt;span class="code-comment"&gt;&amp;lt;- should have probably payed closer attention to that...
&lt;/span&gt;   &lt;span class="code-comment"&gt;//&lt;/span&gt;&lt;span class="code-comment"&gt;A whole bunch of code that I thought was getting executed
&lt;/span&gt;}
&lt;span class="code-keyword"&gt;else&lt;/span&gt;{
   &lt;span class="code-comment"&gt;//&lt;/span&gt;&lt;span class="code-comment"&gt;What's actually getting executed
&lt;/span&gt;}&lt;/pre&gt;
&amp;nbsp;&lt;br /&gt;
Guess that was left like that for lack of time to clean up or something... but it shure led me astray...  &lt;img src="/script/Forums/Images/smiley_doh.gif" align="top" alt="D'Oh! | :doh:" /&gt;</description>
      <link>http://www.codeproject.com/Messages/4136601/Logical-AND-with-false.aspx</link>
      <author>Albert Holguin</author>
      <pubDate>Tue, 24 Jan 2012 01:09:00 GMT</pubDate>
      <subject>Hall Of Shame</subject>
    </item>
    <item>
      <title>Classical unitialized C pointer</title>
      <description>While porting an old DOS software to Windows that controls a temperature bath, i came across this code to show error messages:&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&lt;pre lang="c"&gt;
COUNT showerr(COUNT res)
   {
   &lt;span class="code-keyword"&gt;char&lt;/span&gt; *szGp;
   ...
   sprintf(szGp,&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;ibsta:%x iberr:%x ibcnt:%x"&lt;/span&gt;,ibsta,iberr,ibcnt);
   ...
   }
&lt;/pre&gt;
There are 18 lines of code between declaration and first usage. &lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
The date of last modification was in 1997. The oldest sources I found are dated 1996, but I know that the initial sources must be from about 1989 (they should exist somewhere on floppy disks and printed sources may be buried somewhere in the basement storage).&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
The colleagues from the calibration lab told me, that they always wonder why the software often locks after showing an error message.</description>
      <link>http://www.codeproject.com/Messages/4134071/Classical-unitialized-C-pointer.aspx</link>
      <author>Jochen Arndt</author>
      <pubDate>Fri, 20 Jan 2012 11:59:00 GMT</pubDate>
      <subject>Hall Of Shame</subject>
    </item>
    <item>
      <title>Code Optimize</title>
      <description>Today I found this code, from DAL class&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&lt;pre lang="cs"&gt;&lt;span class="code-keyword"&gt;public&lt;/span&gt; &lt;span class="code-SDKkeyword"&gt;Boolean&lt;/span&gt; Execute_NoN_Query(&lt;span class="code-keyword"&gt;string&lt;/span&gt; Sqlstring)
      {
             &lt;span class="code-keyword"&gt;int&lt;/span&gt; ResultFlag = &lt;span class="code-digit"&gt;0&lt;/span&gt;;
              ResultFlag = MSSqlHelper.SqlHelper.ExecuteNonQuery(SqlServerConnection.Cn, CommandType.Text, Sqlstring);
&amp;nbsp;
              &lt;span class="code-keyword"&gt;if&lt;/span&gt;  (ResultFlag != &lt;span class="code-digit"&gt;0&lt;/span&gt;)
                  &lt;span class="code-keyword"&gt;return&lt;/span&gt; &lt;span class="code-keyword"&gt;true&lt;/span&gt;;
              &lt;span class="code-keyword"&gt;else&lt;/span&gt;
                  &lt;span class="code-keyword"&gt;return&lt;/span&gt; &lt;span class="code-keyword"&gt;false&lt;/span&gt;;
      }&lt;/pre&gt;
&amp;nbsp;&lt;br /&gt;
 My Code is .... &lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&lt;pre lang="cs"&gt;&lt;span class="code-keyword"&gt;public&lt;/span&gt; &lt;span class="code-SDKkeyword"&gt;Boolean&lt;/span&gt; Execute_NoN_Query(&lt;span class="code-keyword"&gt;string&lt;/span&gt; Sqlstring)
{
    &lt;span class="code-keyword"&gt;return&lt;/span&gt; (&lt;span class="code-digit"&gt;0&lt;/span&gt; != MSSqlHelper.SqlHelper.ExecuteNonQuery(SqlServerConnection.Cn, CommandType.Text, Sqlstring));
}&lt;/pre&gt;
&lt;div class="signature"&gt;&lt;a href="http://www.codeproject.com/Articles/Rajesh-Anuhya#tips"&gt;my Tip/Tricks&lt;/a&gt;[&lt;a href="http://www.codeproject.com/Articles/Rajesh-Anuhya#tips" target="_blank" title="New Window"&gt;^&lt;/a&gt;] | "Rajesh-Puli" now "Rajesh-Anuhya"&lt;/div&gt;</description>
      <link>http://www.codeproject.com/Messages/4129470/Code-Optimize.aspx</link>
      <author>Rajesh Anuhya</author>
      <pubDate>Mon, 16 Jan 2012 14:06:00 GMT</pubDate>
      <subject>Hall Of Shame</subject>
    </item>
    <item>
      <title>Congratulations, you have overtaxed the .NET garbage collector!</title>
      <description>Trying to translate a winforms app into silverlight, which doesn't have blocking socket operations:&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&lt;pre lang="c#"&gt;
&lt;span class="code-keyword"&gt;private&lt;/span&gt; &lt;span class="code-keyword"&gt;void&lt;/span&gt; ReceiveTelnetDataRepeatedly()
{
	&lt;span class="code-keyword"&gt;while&lt;/span&gt; (connection != &lt;span class="code-keyword"&gt;null&lt;/span&gt; &amp;amp;&amp;amp; connection.isconnected)
	{
		connection.CheckForNewBytes();
		ProcessData(connection.GetIncomingStrings());
	}
}
&lt;/pre&gt;
&amp;nbsp;&lt;br /&gt;
This was executing in a thread, and the "check for new bytes" was allocating an 8K array every time... within 30 seconds, I'd allocated 1.5GB of RAM and caused an OutOfMemoryException... &lt;img src="/script/Forums/Images/smiley_OMG.gif" align="top" alt="OMG | :OMG:" /&gt;</description>
      <link>http://www.codeproject.com/Messages/4128565/Congratulations-you-have-overtaxed-the-NET-garbage.aspx</link>
      <author>ekolis</author>
      <pubDate>Sat, 14 Jan 2012 20:15:00 GMT</pubDate>
      <subject>Hall Of Shame</subject>
    </item>
    <item>
      <title>Why is dates so difficult?</title>
      <description>&lt;pre lang="SQL"&gt;
    &lt;span class="code-keyword"&gt;DECLARE&lt;/span&gt; @Month &lt;span class="code-keyword"&gt;VARCHAR&lt;/span&gt;(&lt;span class="code-digit"&gt;2&lt;/span&gt;), @Year &lt;span class="code-keyword"&gt;VARCHAR&lt;/span&gt;(&lt;span class="code-digit"&gt;4&lt;/span&gt;)
&lt;span class="code-keyword"&gt;IF&lt;/span&gt; (month(GETDATE())) = &lt;span class="code-digit"&gt;1&lt;/span&gt;
&lt;span class="code-keyword"&gt;BEGIN&lt;/span&gt;
	&lt;span class="code-keyword"&gt;Set&lt;/span&gt; @Month = MONTH(DateAdd(month, -1, GETDATE()));
	&lt;span class="code-keyword"&gt;Set&lt;/span&gt; @Year =  YEAR(DateAdd(month, -1, GETDATE()));
&lt;span class="code-keyword"&gt;END&lt;/span&gt;
&lt;span class="code-keyword"&gt;ELSE&lt;/span&gt;
&lt;span class="code-keyword"&gt;BEGIN&lt;/span&gt;
	&lt;span class="code-keyword"&gt;Set&lt;/span&gt; @Month = MONTH(GETDATE()) -1
	&lt;span class="code-keyword"&gt;Set&lt;/span&gt; @Year = YEAR(GETDATE())
&lt;span class="code-keyword"&gt;END&lt;/span&gt;&lt;/pre&gt;
&amp;nbsp;&lt;br /&gt;
I just shook my head... It could have been done as easily as:&lt;br /&gt;
&lt;pre lang="SQL"&gt;&lt;span class="code-keyword"&gt;DECLARE&lt;/span&gt; @Month &lt;span class="code-keyword"&gt;VARCHAR&lt;/span&gt;(&lt;span class="code-digit"&gt;2&lt;/span&gt;), @Year &lt;span class="code-keyword"&gt;VARCHAR&lt;/span&gt;(&lt;span class="code-digit"&gt;4&lt;/span&gt;)
	&lt;span class="code-keyword"&gt;Set&lt;/span&gt; @Month = MONTH(DateAdd(month, -1, GETDATE()));
	&lt;span class="code-keyword"&gt;Set&lt;/span&gt; @Year =  YEAR(DateAdd(month, -1, GETDATE()));
&lt;/pre&gt;</description>
      <link>http://www.codeproject.com/Messages/4127329/Why-is-dates-so-difficult.aspx</link>
      <author>Jan Steyn</author>
      <pubDate>Fri, 13 Jan 2012 10:26:00 GMT</pubDate>
      <subject>Hall Of Shame</subject>
    </item>
    <item>
      <title>What one Should do if Program warns you about one's uninitialized variable?</title>
      <description>My Priors Idea is hide it. &lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
So from the Servers Initialization file Error and Warning is completely disabled during development time.</description>
      <link>http://www.codeproject.com/Messages/4125955/What-one-Should-do-if-Program-warns-you-about-ones.aspx</link>
      <author>johny10151981</author>
      <pubDate>Thu, 12 Jan 2012 08:29:00 GMT</pubDate>
      <subject>Hall Of Shame</subject>
    </item>
    <item>
      <title>Code Repeating</title>
      <description>Take a look at the algorithm&lt;br /&gt;
&lt;pre lang="text"&gt;
function Process()
{
  if(error!="")
  {
   //   Some HTML code over 1000 lines with javascript
  }
  else if(update!="")
  {
   //   Same like above &lt;img src="/script/Forums/Images/smiley_redface.gif" align="top" alt="Blush | :O" /&gt;  with same f-king javascript
  }
  else 
  {
   // Same 1000 of lines with same javascript. 
  }
}
&lt;/pre&gt;
now my job is to make some change, for new requirements. the file is over 4000 lines. And reading over hour I actually failed to figure out how actually it works. Authority got that reason, I am not good enough. I agreed with them.&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
Oh the reason to change the code was "Performance and incomplete verification"</description>
      <link>http://www.codeproject.com/Messages/4125894/Code-Repeating.aspx</link>
      <author>johny10151981</author>
      <pubDate>Thu, 12 Jan 2012 06:17:00 GMT</pubDate>
      <subject>Hall Of Shame</subject>
    </item>
    <item>
      <title>Gem... As time goes by..</title>
      <description>&lt;pre lang="cs"&gt;
    &lt;span class="code-keyword"&gt;private&lt;/span&gt; &lt;span class="code-keyword"&gt;string&lt;/span&gt; GetTime(&lt;span class="code-keyword"&gt;string&lt;/span&gt; strShiftCode, &lt;span class="code-keyword"&gt;string&lt;/span&gt; strTime)
        {
            &lt;span class="code-keyword"&gt;string&lt;/span&gt; strReturn = &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;"&lt;/span&gt;;
&amp;nbsp;
                &lt;span class="code-keyword"&gt;switch&lt;/span&gt; (strTime)
                {
                    &lt;span class="code-keyword"&gt;case&lt;/span&gt; &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;01"&lt;/span&gt;:
                        strReturn = &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;AM"&lt;/span&gt;;
                        &lt;span class="code-keyword"&gt;break&lt;/span&gt;;
                    &lt;span class="code-keyword"&gt;case&lt;/span&gt; &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;02"&lt;/span&gt;:
                        strReturn = &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;AM"&lt;/span&gt;;
                        &lt;span class="code-keyword"&gt;break&lt;/span&gt;;
                    &lt;span class="code-keyword"&gt;case&lt;/span&gt; &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;03"&lt;/span&gt;:
                        strReturn = &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;AM"&lt;/span&gt;;
                        &lt;span class="code-keyword"&gt;break&lt;/span&gt;;
                    &lt;span class="code-keyword"&gt;case&lt;/span&gt; &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;04"&lt;/span&gt;:
                        strReturn = &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;AM"&lt;/span&gt;;
                        &lt;span class="code-keyword"&gt;break&lt;/span&gt;;
                    &lt;span class="code-keyword"&gt;case&lt;/span&gt; &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;05"&lt;/span&gt;:
                        strReturn = &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;AM"&lt;/span&gt;;
                        &lt;span class="code-keyword"&gt;break&lt;/span&gt;;
                    &lt;span class="code-keyword"&gt;case&lt;/span&gt; &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;06"&lt;/span&gt;:
                        strReturn = &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;AM"&lt;/span&gt;;
                        &lt;span class="code-keyword"&gt;break&lt;/span&gt;;
                    &lt;span class="code-keyword"&gt;case&lt;/span&gt; &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;07"&lt;/span&gt;:
                        strReturn = &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;AM"&lt;/span&gt;;
                        &lt;span class="code-keyword"&gt;break&lt;/span&gt;;
                    &lt;span class="code-keyword"&gt;case&lt;/span&gt; &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;08"&lt;/span&gt;:
                        strReturn = &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;AM"&lt;/span&gt;;
                        &lt;span class="code-keyword"&gt;break&lt;/span&gt;;
                    &lt;span class="code-keyword"&gt;case&lt;/span&gt; &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;09"&lt;/span&gt;:
                        strReturn = &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;AM"&lt;/span&gt;;
                        &lt;span class="code-keyword"&gt;break&lt;/span&gt;;
                    &lt;span class="code-keyword"&gt;case&lt;/span&gt; &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;10"&lt;/span&gt;:
                        strReturn = &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;AM"&lt;/span&gt;;
                        &lt;span class="code-keyword"&gt;break&lt;/span&gt;;
                    &lt;span class="code-keyword"&gt;case&lt;/span&gt; &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;11"&lt;/span&gt;:
                        strReturn = &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;AM"&lt;/span&gt;;
                        &lt;span class="code-keyword"&gt;break&lt;/span&gt;;
                    &lt;span class="code-keyword"&gt;case&lt;/span&gt; &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;12"&lt;/span&gt;:
                        strReturn = &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;PM"&lt;/span&gt;;
                        &lt;span class="code-keyword"&gt;break&lt;/span&gt;;
                    &lt;span class="code-keyword"&gt;case&lt;/span&gt; &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;13"&lt;/span&gt;:
                        strReturn = &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;PM"&lt;/span&gt;;
                        &lt;span class="code-keyword"&gt;break&lt;/span&gt;;
                    &lt;span class="code-keyword"&gt;case&lt;/span&gt; &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;14"&lt;/span&gt;:
                        strReturn = &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;PM"&lt;/span&gt;;
                        &lt;span class="code-keyword"&gt;break&lt;/span&gt;;
                    &lt;span class="code-keyword"&gt;case&lt;/span&gt; &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;15"&lt;/span&gt;:
                        strReturn = &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;PM"&lt;/span&gt;;
                        &lt;span class="code-keyword"&gt;break&lt;/span&gt;;
                    &lt;span class="code-keyword"&gt;case&lt;/span&gt; &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;16"&lt;/span&gt;:
                        strReturn = &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;PM"&lt;/span&gt;;
                        &lt;span class="code-keyword"&gt;break&lt;/span&gt;;
                    &lt;span class="code-keyword"&gt;case&lt;/span&gt; &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;17"&lt;/span&gt;:
                        strReturn = &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;PM"&lt;/span&gt;;
                        &lt;span class="code-keyword"&gt;break&lt;/span&gt;;
                    &lt;span class="code-keyword"&gt;case&lt;/span&gt; &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;18"&lt;/span&gt;:
                        strReturn = &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;PM"&lt;/span&gt;;
                        &lt;span class="code-keyword"&gt;break&lt;/span&gt;;
                    &lt;span class="code-keyword"&gt;case&lt;/span&gt; &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;19"&lt;/span&gt;:
                        strReturn = &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;PM"&lt;/span&gt;;
                        &lt;span class="code-keyword"&gt;break&lt;/span&gt;;
                    &lt;span class="code-keyword"&gt;case&lt;/span&gt; &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;20"&lt;/span&gt;:
                        strReturn = &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;PM"&lt;/span&gt;;
                        &lt;span class="code-keyword"&gt;break&lt;/span&gt;;
                    &lt;span class="code-keyword"&gt;case&lt;/span&gt; &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;21"&lt;/span&gt;:
                        strReturn = &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;PM"&lt;/span&gt;;
                        &lt;span class="code-keyword"&gt;break&lt;/span&gt;;
                    &lt;span class="code-keyword"&gt;case&lt;/span&gt; &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;22"&lt;/span&gt;:
                        strReturn = &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;PM"&lt;/span&gt;;
                        &lt;span class="code-keyword"&gt;break&lt;/span&gt;;
                    &lt;span class="code-keyword"&gt;case&lt;/span&gt; &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;23"&lt;/span&gt;:
                        strReturn = &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;PM"&lt;/span&gt;;
                        &lt;span class="code-keyword"&gt;break&lt;/span&gt;;
                    &lt;span class="code-keyword"&gt;case&lt;/span&gt; &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;24"&lt;/span&gt;:
                        strReturn = &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;PM"&lt;/span&gt;;
                        &lt;span class="code-keyword"&gt;break&lt;/span&gt;;
&amp;nbsp;
                }
&amp;nbsp;
            &lt;span class="code-keyword"&gt;return&lt;/span&gt; strReturn;
        }&lt;/pre&gt;
&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
Found this one on one of the project assigned to me today.... It really is about quality control.. &lt;img src="/script/Forums/Images/smiley_smile.gif" align="top" alt="Smile | :)" /&gt; &lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
One variable passed is never been used in function and do I really need a function ?&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
My solution : &lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&lt;pre lang="c#"&gt;
&amp;nbsp;
&lt;span class="code-keyword"&gt;string&lt;/span&gt; strReturn = &lt;span class="code-SDKkeyword"&gt;Int32&lt;/span&gt;.Parse(strTime.Trim())&amp;lt;&lt;span class="code-digit"&gt;12&lt;/span&gt; ? &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;AM"&lt;/span&gt; : &lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;PM"&lt;/span&gt;;
&lt;/pre&gt;
&lt;div class="signature"&gt;Zen and the art of software maintenance : rm -rf * &lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
Math is like love : a simple idea but it can get complicated.&lt;/div&gt;</description>
      <link>http://www.codeproject.com/Messages/4122373/Gem-As-time-goes-by.aspx</link>
      <author>virang_21</author>
      <pubDate>Mon, 09 Jan 2012 09:29:00 GMT</pubDate>
      <subject>Hall Of Shame</subject>
    </item>
    <item>
      <title>Stupid code</title>
      <description>Long back i saw this code chunk which was causing alot of issue once a while, unfortunately that code did not had proper logs/comments/exception catching mechanisms involved. So we did had to spend atleast half a day to find it..&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&lt;pre lang="c#"&gt;
&lt;span class="code-keyword"&gt;class&lt;/span&gt; MyClass
{
   &lt;span class="code-keyword"&gt;static&lt;/span&gt; &lt;span class="code-keyword"&gt;int&lt;/span&gt; value = &lt;span class="code-digit"&gt;10&lt;/span&gt;;
   &lt;span class="code-keyword"&gt;static&lt;/span&gt; &lt;span class="code-keyword"&gt;int&lt;/span&gt; Value { &lt;span class="code-keyword"&gt;get&lt;/span&gt; { &lt;span class="code-keyword"&gt;return&lt;/span&gt; Value; } }
}
&lt;/pre&gt;
&amp;nbsp;&lt;br /&gt;
At first it was a bit difficult to find where stackoverflow exception was occuring and then i was wondering what made the original developer do this stupid way and released with out even testing.&lt;br /&gt;
&lt;div class="signature"&gt;My Blog -&amp;gt; https://adventurouszen.wordpress.com/&lt;/div&gt;</description>
      <link>http://www.codeproject.com/Messages/4120329/Stupid-code.aspx</link>
      <author>zenwalker1985</author>
      <pubDate>Fri, 06 Jan 2012 08:21:00 GMT</pubDate>
      <subject>Hall Of Shame</subject>
    </item>
    <item>
      <title>The developer's golden rule, 100% true</title>
      <description>The only sound rule that applies to all processes, standards, and approaches is the following:&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
"The only rule, is that there are exceptions to all rules"&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
I was talking to my coworkers (all former contractors) about SVN and when to commit, some said "on save", others "end of day" and of course "when I am done". This is interesting to me, that not everything is worth committing, and sometimes things are critical, that every line counts. This is just one of those things, we developers are pragmatic. Our careers are in constant Limbo, between heaven and hell, and the fragility is an ever-present reality. I am sure you have your own examples. &lt;img src="/script/Forums/Images/smiley_dead.gif" align="top" alt="Dead | X|" /&gt; &lt;br /&gt;
&lt;div class="signature"&gt;*--==[::tSc::]==--*&lt;br /&gt;
&lt;a href="http://www.testshoot.com/"&gt;TestShoot.com&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://www.filmsupplies.com/"&gt;Film Supplies&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://teambeachbody.com"&gt;TBB aka P90X (my day job)&lt;/a&gt;&lt;/div&gt;</description>
      <link>http://www.codeproject.com/Messages/4119772/The-developers-golden-rule-100-true.aspx</link>
      <author>TestShoot</author>
      <pubDate>Thu, 05 Jan 2012 17:23:00 GMT</pubDate>
      <subject>Hall Of Shame</subject>
    </item>
    <item>
      <title>How to Train Your Programmer</title>
      <description>I just found the following code&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
	if (Name == "Ticket")&lt;br /&gt;
         {&lt;br /&gt;
            IngGenInvPs post = new IngGenInvPs(taxBO, "Ticket");&lt;br /&gt;
         }&lt;br /&gt;
         else if (Name == "Advertisement")&lt;br /&gt;
         {&lt;br /&gt;
         IngGenInvPs post = new IngGenInvPs(taxBO, "Advertisement");&lt;br /&gt;
         }&lt;br /&gt;
         else if (Name == "Asset")&lt;br /&gt;
         {&lt;br /&gt;
              IngGenInvPs post = new IngGenInvPs(taxBO, "Asset");&lt;br /&gt;
         }&lt;br /&gt;
         else if (Name == "Telecom")&lt;br /&gt;
         {&lt;br /&gt;
              IngGenInvPs post = new IngGenInvPs(taxBO, "Telecom");&lt;br /&gt;
         }&lt;br /&gt;
         else&lt;br /&gt;
         {&lt;br /&gt;
            IngGenInvPs post = new IngGenInvPs(taxBO, "Inventory");&lt;br /&gt;
         }&lt;br /&gt;
&lt;img src="/script/Forums/Images/smiley_cool.gif" align="top" alt="Cool | :cool:" /&gt;</description>
      <link>http://www.codeproject.com/Messages/4117372/How-to-Train-Your-Programmer.aspx</link>
      <author>Rajesh_Francis</author>
      <pubDate>Tue, 03 Jan 2012 09:21:00 GMT</pubDate>
      <subject>Hall Of Shame</subject>
    </item>
    <item>
      <title>Gem code</title>
      <description>Today while reviewing one of the code, i found this chunk &lt;img src="/script/Forums/Images/smiley_smile.gif" align="top" alt="Smile | :)" /&gt; &lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&lt;pre lang="c#"&gt;
&lt;span class="code-keyword"&gt;class&lt;/span&gt; MyClass
{
    &lt;span class="code-keyword"&gt;private&lt;/span&gt; &lt;span class="code-keyword"&gt;int&lt;/span&gt; m_SomeValue;
    
    &lt;span class="code-keyword"&gt;public&lt;/span&gt; &lt;span class="code-keyword"&gt;int&lt;/span&gt; SomeValue
    {
        &lt;span class="code-keyword"&gt;get&lt;/span&gt; { &lt;span class="code-keyword"&gt;return&lt;/span&gt; m_SomeValue;}
    }
    &lt;span class="code-keyword"&gt;public&lt;/span&gt; &lt;span class="code-keyword"&gt;void&lt;/span&gt; SomeMethod()
    {
        &lt;span class="code-keyword"&gt;var&lt;/span&gt; value = GetValue();
        &lt;span class="code-comment"&gt;//&lt;/span&gt;&lt;span class="code-comment"&gt;Some core logic on value
&lt;/span&gt;    }
    
    &lt;span class="code-keyword"&gt;private&lt;/span&gt; &lt;span class="code-keyword"&gt;int&lt;/span&gt; GetValue()
    {
        &lt;span class="code-keyword"&gt;return&lt;/span&gt; SomeValue;
    }
}
&lt;/pre&gt;
At first i started to think is there any catch behind this style. after few mins, i found its lame to write this way and finally it was admitted &lt;img src="/script/Forums/Images/smiley_wink.gif" align="top" alt="Wink | ;)" /&gt;</description>
      <link>http://www.codeproject.com/Messages/4113784/Gem-code.aspx</link>
      <author>zenwalker1985</author>
      <pubDate>Wed, 28 Dec 2011 14:00:00 GMT</pubDate>
      <subject>Hall Of Shame</subject>
    </item>
  </channel>
</rss>
