Skip to content

The Weird and The Wonderful

It was the best of code, it was the worst of code. Coding Horrors, Worst Practices, and flashes of brilliance

This category can be followed from the open social web via the handle the-weird-and-the-wonderful@forum.codeproject.com

1.8k Topics 20.7k Posts
  • Another gem from the VB6 code I'm "porting"

    ruby question
    12
    0 Votes
    12 Posts
    0 Views
    M
    Rob Grainger wrote: The real real WTF is that people who produce such garbage are still employed. And quite possibly one of the 23 million surveyed![^] Say it's not true! Marc
  • Pleease don't tell on me...

    com help
    9
    0 Votes
    9 Posts
    2 Views
    N
    haha :D I like how he's told that they won't delete anything and he's like "Ok guys tnx at least delete this thread so she won't think I was doing anything wrong". :laugh:
  • Yes I know it was me who wrote that...

    29
    0 Votes
    29 Posts
    2 Views
    V
    I've been always wondering why people just don't use string comparison functions with the case ignoring ability. Many languages have them. Why use ToLower or ToUpper if you don't really need that lowered string? One my colleague once told me that because of the belovers of ToUpper/ToLower the program he had to improve was doing its job during about 11 hours (the program was in C++)!!! After just replacing the appropriate functions with stricmp and similar ones (which compare ignoring the case) the program got the awesome performance boost: it managed to finish its execution in just one hour or such. Taste the difference! lifecycle of a lifecycle of a lifecycle
  • Yes - It was me

    ruby
    10
    0 Votes
    10 Posts
    0 Views
    C
    Haha - I have the same t-shirt. I earned it late one night trying to debug a release build problem. Had wrapped important code with #ifdef DEBUG.. Charlie Gilley You're going to tell me what I want to know, or I'm going to beat you to death in your own house. "Where liberty dwells, there is my country." B. Franklin, 1783 “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
  • I wonder what the programmer was going to do..

    12
    0 Votes
    12 Posts
    0 Views
    P
    I agree, and the original post was probably more of a question of what the developer intended to do inside the {} in both the if part and the else part; which of course could be anything. If anything it's just dead code the compiler would likely cut out. "I've seen more information on a frickin' sticky note!" - Dave Kreskowiak
  • Password Checking

    4
    0 Votes
    4 Posts
    0 Views
    OriginalGriffO
    Whats the problem? It's completely secure provided you ship a copy of VS and the source to each user so they can set their own... :laugh: Never underestimate the power of stupid things in large numbers --- Serious Sam
  • Error Messages 101

    help csharp visual-studio linux
    13
    0 Votes
    13 Posts
    0 Views
    B
    It was a C# project file that I had modified manually (changed framework version, removed file upgrade-related tags, fixed references) but I had accidentally removed a required end tag on line 15, which caused the error. Getting information off the Internet is like taking a drink from a fire hydrant. - Mitchell Kapor
  • VS Go BOOM!

    visual-studio com
    7
    0 Votes
    7 Posts
    0 Views
    L
    Now we know that VS has it's own way to "take care of business". I heard that it never happens if you have both VS and Eclipse installed. Greetings - Jacek
  • Over-documentation

    performance
    25
    0 Votes
    25 Posts
    2 Views
    L
    No horror here if it was posted to someone who's not into programming. E.g. "==" operator is not obvious and may provoke questions what does it mean. Also, telling about "allocating" memory is more understandable that introducing to how stack and pointers work. Greetings - Jacek
  • Convert.ToInt32

    visual-studio com
    29
    0 Votes
    29 Posts
    1 Views
    L
    Btw. a method Convert.ToSingle(Double) always makes me feel sad. Greetings - Jacek
  • So, a colleague inherited a project to restructure a product..

    help
    13
    0 Votes
    13 Posts
    0 Views
    B
    :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: :doh: Getting information off the Internet is like taking a drink from a fire hydrant. - Mitchell Kapor
  • Days Of Week

    com question
    25
    0 Votes
    25 Posts
    0 Views
    D
    Brilliant answer. One bonus point for you. My plan is to live forever ... so far so good
  • More Stored Procedure Nonsense

    database wpf performance csharp com
    6
    0 Votes
    6 Posts
    0 Views
    S
    That's called error margin :laugh:
  • Stored Procedure Hell

    database
    15
    0 Votes
    15 Posts
    0 Views
    V
    Rob Grainger wrote: now works for Microsoft How about nominating him here? http://www.nextmicrosoftceo.com/[^] Vasudevan Deepak Kumar Personal Homepage You can not step into the same river twice.
  • ... WHY?!

    csharp html asp-net architecture help
    16
    0 Votes
    16 Posts
    0 Views
    B
    Oh dear, I'd better use a different login name for such posts...
  • OWOTW

    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • I just want to be really really sure

    csharp
    14
    0 Votes
    14 Posts
    3 Views
    I
    Somebody knows the "Tell me 3 times and it must be true" rule (see Heinlein's "Number of the Beast")
  • Detect user in group only once

    database data-structures question workspace
    7
    0 Votes
    7 Posts
    0 Views
    M
    SortaCore wrote: testUser = Array.IndexOf(new string[] { "mrock", "kasante" }, Environment.UserName.ToLower()) != -1; If you want to get a little tighter about it: testUser = Array.Exists(new [] { "a", "b" }, t => t=="a"); First of all, you don't need string[] because the compiler can infer the array type. Second, using "Exists" makes it clearer to the reader what you're doing, especially since you're not interested in the index, you just want to know of the value exists. Lastly, the use of the predicate t => t == 'a' means you could do some fancier things if you wanted later on -- it's a more general purpose solution. (Where 'a' would actually be in your case Environment.UserName.ToLower() Marc Day 1: Spider Database Navigator Unit Testing Succinctly
  • Lets poll no matter what time of the day

    5
    0 Votes
    5 Posts
    0 Views
    L
    Maybe this function was designed as Sleep replacement?
  • If in doubt: cast, cast and cast again

    4
    0 Votes
    4 Posts
    0 Views
    Z
    I must be missing something. Doesn't dr["Id"] return an object? There are only 10 types of people in the world, those who understand binary and those who don't.