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
  • More mining from our deep seam of WTF's

    ruby css database json
    15
    0 Votes
    15 Posts
    0 Views
    R
    Thanks for clarification. I was in false impression that "VB" would be also referring to VB.NET but now I see VB.NET is just another compiler for .Net framework and is far from same thing as VB. Then there is VBA which I often confuse with too. Although VBA is something I have to use sometimes when some Excel-crazy person begs me do something within excel which seems only possible with VBA, then I get to tackle some hundred-sheet workbook with thousands character long cell functions.
  • And I will show you how deep the rabbit hole runs !!!

    csharp announcement
    11
    0 Votes
    11 Posts
    0 Views
    M
    At least it works. I once had to rewrite an entire module because it contained more nesting than the Microsoft C 5.1 compiler could handle. Hooray for greenbar tractor feed paper and multiple colored pens. Oh yeah, that code had Goto's in it. Not only the normal backwards ones, but forward ones too. X|
  • Small Milestone

    question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Developer whose first language is not English

    asp-net com
    6
    0 Votes
    6 Posts
    2 Views
    V
    Initially I didn't get it (because of the asterisks). Such aliases should not surprize anyone. If we step aside from the programming for a moment, one can remember that Japanese car makers are that awesome, that they can name cars "Pajero" (which is not a very good word in Spanish slang) and sell them officially in Spain. With that said, why can't a female developer use genitalia as an alias in that SQL query? lifecycle of a lifecycle of a lifecycle
  • First time worked on Umbraco CMS

    3
    0 Votes
    3 Posts
    0 Views
    A
    As mentioned, this is the wrong forum. However, since this is one of the few times I've seen somebody post about Umbraco here, you may want to check out my article: Umbrazure: Limitless Websites with Umbraco on Azure. Also, I created a thread in case anybody wants to ask me Umbraco questions. Thou mewling ill-breeding pignut!
  • Hello? I guess

    ruby question
    11
    0 Votes
    11 Posts
    1 Views
    J
    I have a 200kg capable anthropomorphic robot in the basement I can lend it to you, don't hesitate to ask for it, of course given the fact you will allow me to use it before some times... Please, put a MadSlapMode in the software in which the robot will start slapping everyone at a fast pace without even making a single question. :thumbsup: [www.tamautomation.com] Robots, CNC and PLC machines for grinding and polishing.
  • 0 Votes
    10 Posts
    0 Views
    L
    Now I see the point of lessons on Assembler... One of the first tasks was to "convert a decimal number to a binary representation and output to the console". If you have to write something in ASM, you desperately look for a smallest an easiest solution possible. Everybody should have such lessons. It teaches how the computer arithmetic works better than a houndred of calculus lectures. Greetings - Jacek
  • No names, no refences - and not mine.

    beta-testing
    26
    0 Votes
    26 Posts
    4 Views
    K
    What else can you do? Well lets seeeeee...... double ptotal = 0; foreach(Control ctrl in this.controls) { if(ctrl is TextBox) ptotal += Double.Parse(ctrl.Text); }
  • Ahh, the joys of Visual Basic

    c++ ruby html com
    13
    0 Votes
    13 Posts
    16 Views
    G
    Indeterminate shows if there are sub-checkboxes belonging to this one, some of them can be checked, some unchecked. So the parent checkbox can't be 'checked' or 'unchecked' but partially-checked. ;-)
  • Why stick to just one database?

    discussion database sales question
    16
    0 Votes
    16 Posts
    3 Views
    J
    Another magnificent specimen for my scrapbook of SQL horrors!! Why create new rows for an event when you can create a whole new database?
  • 0 Votes
    21 Posts
    0 Views
    R
    Yes, I always liked C++'s RAII (Resource Acquisition Is Initialization) approach for exactly this reason. Every scope in C++ acts as an implicit "using" for all names declared within it, and the destructor is implicitly called when the scope exits. This gives deterministic resource management, but does leave more room for developer mistakes than managed languages. While "using" does allow this (to a degree) in C#, to apply it to every resource would sometimes result in a cascade of nested "using" blocks. In C++, its all automatic. Personally, I like to think I don't need my hands held by the compiler all the time. "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.
  • Bug of the day

    help
    37
    0 Votes
    37 Posts
    7 Views
    G
    It's valid syntax, and if you're confident that you'll never ever forget to add or remove braces appropriately, go for it. Software Zen: delete this;
  • How To Use Session Variables

    database tutorial
    14
    0 Votes
    14 Posts
    1 Views
    A
    What you say is what should have been done. The code should check the session variable, if it is null then go to the database and 3rd party API and calculate the value needed, and store it in the session variable for later use. In this way it's basically using the session variable for caching a value that is expensive to calculate and doesn't change often. I posted this because what the person who actually wrote this did was kind of a face-palm moment. They write the value into the session variable and then never read from the session variable again. Every time this value was needed they calculated it, then wrote the calculated value into the session variable only to never retreive it and do anything with it.
  • Catches win matches... they say

    11
    0 Votes
    11 Posts
    2 Views
    J
    One use for such a structure would be to fully log the error without having debuging info in the compiled form. If that is the case, then the outer try/catch would be the unnecessary one, not the internal ones.
  • A Brilliant Replacement of float.toFixed(2)

    javascript ruby question
    8
    0 Votes
    8 Posts
    1 Views
    T
    :laugh: My exact thoughts when I saw that. But no, much as I'd like it, we're salaried here. This fellow doesn't work here any more, and as I've gone back to maintain his code I can see that we should kick ourselves in the arse for not holding code reviews when he was here. I could teach a full semester class on Programming Best Practices and use only his code for examples of what not to do. Not that my code is perfect, but ... If you think 'goto' is evil, try writing an Assembly program without JMP.
  • How not to catch the exception

    ruby announcement
    7
    0 Votes
    7 Posts
    0 Views
    G
    Good "catch" !
  • 0 Votes
    7 Posts
    0 Views
    J
    Enterprisey. It's like the modern version of emulating a 1-M relationship using a delimited string in a text column.
  • HTML 5 Application.

    html question
    10
    0 Votes
    10 Posts
    3 Views
    A
    He was a first timer... little lax was on my part
  • Bug of the Day (2)

    database help
    5
    0 Votes
    5 Posts
    0 Views
    R
    Nice, that had me rollin for a minute! :laugh:
  • Datetimes in java (again)

    java com tools question
    4
    0 Votes
    4 Posts
    0 Views
    R
    Unfortunately, many human systems for dealing with dates are odd, all computers can do is reflect that. "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.