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
  • 0 Votes
    1 Posts
    0 Views
    No one has replied
  • 0 Votes
    1 Posts
    0 Views
    No one has replied
  • Doesn't "should" mean it's not required?

    question
    32
    0 Votes
    32 Posts
    4 Views
    R
    Teal'c says "Indeed"! hatfok King Yiddum's Castle Pegasus Galaxy
  • Recursion schmecursion!

    data-structures
    8
    0 Votes
    8 Posts
    0 Views
    P
    Yes, that cast is very safe. However, originally I was casting to a custom derived TreeNode type, I could probably remove it now.
  • 0 Votes
    1 Posts
    0 Views
    No one has replied
  • The "One"

    question
    14
    0 Votes
    14 Posts
    0 Views
    D
    Thanks for the bedtime brain teaser. ;) David A. Gray Delivering Solutions for the Ages, One Problem at a Time Interpreting the Fundamental Principle of Tabular Reporting
  • Beautiful code...

    13
    0 Votes
    13 Posts
    0 Views
    D
    I had to go back and look. Yes, it's awesome, and about as enlightened as ignoring the return code of a method or function. Catch exception and throw it away. Why even bother with naming it? David A. Gray Delivering Solutions for the Ages, One Problem at a Time Interpreting the Fundamental Principle of Tabular Reporting
  • Nullable<bool> ?

    com cloud collaboration question
    18
    0 Votes
    18 Posts
    0 Views
    D
    Kornfeld Eliyahu Peter wrote: obviously the default for a bool (at the end of the day) will be false, if not stated otherwise...And if stated otherwise, than it should be part of the IMO, this is the most significant statement in this thread. The thing that drew me into this thread was its subject, which made me wonder how a bool could be considered nullable. When I see the word "nullable," I assume that the context is an object, rather than a primitive type such as bool, int, long, uint, ulong, double, etc. David A. Gray Delivering Solutions for the Ages, One Problem at a Time Interpreting the Fundamental Principle of Tabular Reporting
  • Access to SQL

    database question
    14
    0 Votes
    14 Posts
    0 Views
    D
    I've seen the Access wizards generate SQL that looks like that. David A. Gray Delivering Solutions for the Ages, One Problem at a Time Interpreting the Fundamental Principle of Tabular Reporting
  • But it works ...

    database announcement
    6
    0 Votes
    6 Posts
    0 Views
    D
    Reading this thread reminds me of a short story that I read long ago. I can no longer remember whether I was in high school or college; the only reason that has any relevance is that I have forgotten the story, but not its title, "Insert Flap A and Throw It Away." I have learned, and am periodically reminded of its importance, that if a function returns a value, even if it is poop, you would do well to check it. After all, if the author thought it was important enough to return, who am I to brush him off by ignoring it? Plenty of authors have written plenty of functions that return void. In all versions of BASIC, these are called Subs, short for Subroutines. Their author is effectively saying, "I have nothing to report; just trust me." A couple of weeks ago, I ran across a method that returns void that I wish didn't. The method in question, Console.WriteLine() would be much more useful if it returned a character count, along the lines of what you can get from printf(), but probably aren't. Almost every example I see that uses printf() doesn't bother with the return code. This is so prevalent that I hadn't given the matter any consideration until I started working with its buffered cousin, sprintf(). Along the way, I discovered that both have a return value of type int, which returns the number of characters written. While the newer "secure" print functions in the latest Visual C runtime library return minus one to indicate failure, even the old ones can be persuaded to print nothing and return zero. David A. Gray Delivering Solutions for the Ages, One Problem at a Time Interpreting the Fundamental Principle of Tabular Reporting
  • How difficult is it really?

    question
    12
    0 Votes
    12 Posts
    0 Views
    D
    Well, if Lloyd was a Genius he would have an insurance company with a misspelled Alliance. Gosh this is almost CCC material. GCS d--- s-/++ a- C++++ U+++ P- L- E-- W++ N++ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t++ 5? X R++ tv-- b+ DI+++ D++ G e++>+++ h--- ++>+++ y+++*      Weapons extension: ma- k++ F+2 X If you think 'goto' is evil, try writing an Assembly program without JMP. -- TNCaver When I was six, there were no ones and zeroes - only zeroes. And not all of them worked. -- Ravi Bhavnani
  • Yes, I know it's 2016

    csharp data-structures
    6
    0 Votes
    6 Posts
    0 Views
    R
    That was exactly my thought when I looked at getopt, but its somehow become the established standard for command-line processing on Unix-like systems. But then, that's elegant compared to the dog's do-do that is autoconf and the m4 macro-processor. Shudders. "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.
  • Blackcore Edge Testosterone Booster

    com tutorial
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Stopwatch To pause App ????

    help question
    7
    0 Votes
    7 Posts
    1 Views
    N
    Intent and reality intersect far too rarely. "There are three kinds of lies: lies, damned lies and statistics." - Benjamin Disraeli
  • Dysfunctional programming?

    database sql-server sysadmin question
    11
    0 Votes
    11 Posts
    0 Views
    N
    this deserves a trophy ===================================================== The grass is always greener on the other side of the fence
  • Concrete Mixer Development Prospects

    performance html com lounge
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Caught in the trap again

    graphics testing beta-testing json help
    9
    0 Votes
    9 Posts
    0 Views
    M
    Bernhard Hiller wrote: Bad Things (TM) I think Winnie the Pooh already trademarked that. :) Marc Imperative to Functional Programming Succinctly Contributors Wanted for Higher Order Programming Project! Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny
  • Virtual Girlfriends are coming; what do you think?

    com question discussion
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • 0 Votes
    3 Posts
    0 Views
    P
    To me the Game of Life is wonderful.... Try playing it after drinking lots of vodka and you will see it.
  • Your spam folder is empty - would you like some more?

    adobe question
    3
    0 Votes
    3 Posts
    0 Views
    B
    enhzflep wrote: Your Spam folder is empty Spam folder: an internet artist folding spiced ham. You cannot get enough of his great works.