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
  • My turn on MS Bashing

    csharp php html asp-net visual-studio
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • What a trigger

    database csharp ruby sql-server oracle
    5
    0 Votes
    5 Posts
    0 Views
    C
    Thanks for that explanation, cause at first I thought that selecting a max value from a table to get a new id is a coding horror itself. But your statement explains nearly everything. (I had to use an Oracle-DB only one time and it was a "bittersweet" experience.) Greetings Covean
  • Deliberate Crash

    sales announcement lounge
    9
    0 Votes
    9 Posts
    0 Views
    A
    Actual the code for catching the access violations was pretty good, It logged a snap shot of the callstack to a file, then using witchcraft .map and .code files you could find and fix the problem back at base without having to reproduce the problem.
  • A gem.

    ruby
    15
    0 Votes
    15 Posts
    2 Views
    D
    problem: why "i don't rember exactly the hard coded string".ToString.ToUpper(); ? answer: I just hate writting using caps. Concluzion: I'm sure he/she had his reasons. :) I bug
  • What did he want to lock?

    csharp question
    15
    0 Votes
    15 Posts
    2 Views
    S
    Publicly exposing a lock, or holding the lock across method calls, is insanely poor design. Agreed, but if one wishes to allow people to nicely enumerate collections I'm not sure there's always a good way around it. Personally, I wish that Microsoft's contract had allowed collections to be changed during an enumeration subject to some restrictions (basically, things which exist throughout an enumeration must be returned once; things that exist for part of an enumeration may be returned at most once) but that's not how Microsoft specified it. I am well aware that locking a collection during enumeration is a dangerous recipe for deadlock, but there isn't always a practical alternative.
  • Check input for Alfanumeric...

    database
    7
    0 Votes
    7 Posts
    1 Views
    D
    This looks like it was converted from an old dialect of Basic. The only thing I see as "odd" is the & Chr(8), since the check for < 32 would catch all the common Ctl chars, including Bksp, anyway. But my guess is that it was converted and modified a couple of time to end up with that. The Dim Index As Short = textBox1.GetIndex(eventSender) line looks like something left over from a previous mod or from some debugging effort. It doesn't look like Index is used at all. CQ de W5ALT Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software
  • FML, Edition 6580

    4
    0 Votes
    4 Posts
    0 Views
    J
    Everything that's over 9000 I figure. Jeroen De Dauw Blog ; Wiki
  • A function that does... nothing... :-).

    announcement
    12
    0 Votes
    12 Posts
    0 Views
    C
    MarkBrock wrote: No its used as a handler function in a state machine. The function is really just a bi-product of the design... but still... I thought it was funny . Actually, I frequently used the same technique when I was programming in C - empty functions made good initializers for function tables, and if I wanted to track function calls all I had to do was add a trace of some sort to the empty functions.
  • When you got your numbers, who needs other types

    question com help tutorial
    10
    0 Votes
    10 Posts
    0 Views
    Y
    Jeremy Hutchinson wrote: Did you add the "Code removed" comment, or is this function actually doing nothing at all? I did that only for CP. There is some code in that block. Yusuf May I help you?
  • Size Matters

    com
    21
    0 Votes
    21 Posts
    5 Views
    Y
    Oh that kind of size, I see ;P ;P Yusuf May I help you?
  • One guidelines for C/C++ programmer

    help c++
    37
    0 Votes
    37 Posts
    4 Views
    J
    The problem with if(0 == x) is that we don't naturally read or write that way. It's Yoda-speak[^]: if x is 0 will become if 0, x is. ;P Unnatural actions have a tendency to not stick naturally. Time you enjoy wasting is not wasted time - Bertrand Russel
  • One Too Many

    c++ com tutorial workspace
    2
    0 Votes
    2 Posts
    0 Views
    L
    FTFY :) Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] I only read formatted code with indentation, so please use PRE tags for code snippets. I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
  • Joining stuff, the hard way

    csharp php com question
    3
    0 Votes
    3 Posts
    0 Views
    J
    No, it's the language with the most consistent function behaviour - php. Jeroen De Dauw Blog ; Wiki
  • How to sequence a loop

    tutorial question
    10
    0 Votes
    10 Posts
    4 Views
    L
    Someone who has been using Python for a while? Join the cool kids - Come fold with us[^]
  • someone who does not trust arithmetic

    35
    0 Votes
    35 Posts
    2 Views
    T
    Beautiful, i love it ;P
  • Wrong on so many levels

    performance
    8
    0 Votes
    8 Posts
    0 Views
    E
    Reminds me of my computer science class in high school lol
  • When is a double a string

    learning
    20
    0 Votes
    20 Posts
    0 Views
    S
    In Pascal, one could code: If (A in [1,2,3]) Then .. do something The time and space efficiency of doing that varies considerably by compiler, though. Incidentally, Pascal has variables of type "Set of (whatever)" and includes operations to compute intersection, union, test for inclusion or subset, etc.
  • Selecting all coordinates withing a distance

    database php ruby com
    10
    0 Votes
    10 Posts
    0 Views
    J
    While we're all dragging out our ocean navigation knowledge... David Skelly wrote: a nautical mile is defined as one minute of arc around the Earth's circumference It's worth highlighting that this works at the equator and along meridians, but is not accurate if you are traveling east/west along say 45 degrees north lattitude. Another reason this calculation probably isn't going to be accurate is that the shortest distance between two points is an arc. The further you get from the equator the more curve there is in that arc. Of course if they are just trying to locate stores within 50 miles of your location, their math is probably good enough...
  • Helpful comment

    announcement
    9
    0 Votes
    9 Posts
    3 Views
    C
    maybe he put that comment there so that when he become senile later on his life and stumble across to that code, he will remember everything just glancing on that pretty witty comment :D
  • Excellent usage Of ComapareTo+Equals methods!!

    question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied