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
  • Belt and suspenders

    html com
    3
    0 Votes
    3 Posts
    10 Views
    B
    ... and he forgot the StringEqualityComparison parameter in the Equals function... Oh sanctissimi Wilhelmus, Theodorus, et Fredericus!
  • 0 Votes
    1 Posts
    2 Views
    No one has replied
  • Uhhh...

    question com adobe architecture
    8
    0 Votes
    8 Posts
    20 Views
    G
    Ah, but there's a reason for the ridiculously long name. The name I listed is the longest for a group of enum values which are individual bits in a 32 bit mask. Each bit identifies a message that should be displayed to the operator. The equipment can identify a single message or several to be displayed at once. The messages don't lend themselves to any kind of consistent, concise naming scheme. As we know, the following two problems are fundamentally difficult in computing: Cache invalidation Creating appropriate identifiers Off-by-1 errors The simplest and most logically consistent naming for each bit was therefore the text for that bit, with minor transformations to convert the text into a valid C++ identifier. Space characters and all punctuation became underscores, and Bob's your uncle. Just to add to your excitement over this challenging and seemingly intransigent problem, there is ongoing grumbling from the equipment group over the text I actually display based upon each bit. They expect the exact text in their specification to be displayed. You see, I have this effete and unwanted fondness for grammatical English, which their text... isn't. We won't even mention (yes we will) the fact that our UI is also translated to French, Italian, German, Spanish, Japanese, Chinese Simplified, Korean, Polish, and Russian. Some folks just kind of expect us to speak their language. Software Zen: delete this;
  • C++ & Thinking about SSD & wear level

    c++ com data-structures json tutorial
    10
    0 Votes
    10 Posts
    24 Views
    D
    If you're just concerned about how close your SSD thinks it is to being worn out any diagnostic tool that can pull SMART values can give the wear out value. Did you ever see history portrayed as an old man with a wise brow and pulseless heart, weighing all things in the balance of reason? Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful? --Zachris Topelius
  • 0 Votes
    5 Posts
    25 Views
    D
    If it was my terrible code, the empty `Catch()` block would've been a helpful breakpoint holder while I was debugging the initial implementation. It may also have had code to handle a case that I subsequently made impossible. Did you ever see history portrayed as an old man with a wise brow and pulseless heart, weighing all things in the balance of reason? Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful? --Zachris Topelius
  • ad hoc Programming

    javascript learning csharp com data-structures
    19
    0 Votes
    19 Posts
    48 Views
    J
    Someone who's typing up an example? ;P
  • .Net Framework vs .Net 5 Core

    dotnet csharp asp-net visual-studio announcement
    31
    0 Votes
    31 Posts
    185 Views
    C
    I get it. I was taking a trip down memory lane with some old 3 1/2 inch disks and was thinking 'how did we ever survive??' 640Kb RAM, 20Mb HDD, 4.77MHz. Ah, those were the days... cheers Chris Maunder
  • More clueless Web App designers?

    question announcement
    3
    0 Votes
    3 Posts
    12 Views
    N
    raddevus wrote: This is how technology makes our lives better. I don't think that's a problem with technology. I think that's a problem with idiots using the technology. Not exactly the same. M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpful answers is nice, but saying thanks can be even nicer.
  • Objective-J

    question adobe architecture
    2
    0 Votes
    2 Posts
    18 Views
    R
    This was actually pretty neat back in the wild west days of single page web apps. Standard practice at the time was to assemble 'Web 2.0' apps using a combination of jQuery, duct tape, and hope. So seeing a language + framework combo (Cappuccino and Objective-J) that would let you construct your app's UI using OSX's Interface Builder and then write your application in something other than Ecmascript 3.0 was actually a breath of fresh air, even if it seems a bit crazy now. And I still wonder if they were onto something here. I still like 280Slides better than Google Slides and PowerPoint Online now, more than a decade later. FWIW, SproutCore was another framework that aimed to do kind of the same thing but using plain JS. In some ways, it was a progenitor of things like Angular and I still like some aspects of it more than Angular and React. Heck, I would actually love a modern take on this that lets you build your UI with XCode/Interface builder, then write your code in Swift and compile it all down to WASM. I think there are tools that already let you do something similar using XAML and C# compiled to WASM.
  • And it just gets worse

    business
    9
    0 Votes
    9 Posts
    30 Views
    Sander RosselS
    Mandatory Dilbert[^] :) Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript
  • Random Number Generation

    question com adobe architecture lounge
    5
    0 Votes
    5 Posts
    23 Views
    W
    How did I not know about r/badcode before
  • Both Weird & Wonderful - a W10 Surprise

    com question announcement
    18
    0 Votes
    18 Posts
    70 Views
    R
    I'm not old enough to remember... ;P Will Rogers never met me.
  • Probabilistic Log Levels

    question com adobe architecture
    11
    0 Votes
    11 Posts
    30 Views
    C
    Oh! Stop using logic in the forum! :laugh: I am not wrong. I am just different!
  • Windows 10 'Odd Behavoir'

    question announcement
    8
    0 Votes
    8 Posts
    29 Views
    G
    I'm in the UK! We have our own problems, we don't need Wild Fires! :)
  • 0 Votes
    15 Posts
    43 Views
    raddevusR
    markrlondon wrote: Isn't this sort of thing why TypeScript was invented? Yes it is! I will switch to TS one day too. I'm just so lazy I haven't gotten around to it. :laugh:
  • historia del teletipo

    csharp
    1
    0 Votes
    1 Posts
    6 Views
    No one has replied
  • invert if : visual studio code helper

    csharp visual-studio com data-structures question
    35
    0 Votes
    35 Posts
    170 Views
    Mircea NeacsuM
    I know, but I didn't have NDEBUG defined in that configuration so assert was active. Don't get me wrong, I agree with having Intellisense looking over my shoulder and flagging potential issues but sometimes it gets annoying just like sometimes a coworker can be annoying when you do pair programming. And just as with a coworker, it feels good to bitch from time to time ;P Mircea
  • Google Docs and inline images (CP related)

    tools question html help announcement
    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • Egyptology and computer science

    com help question
    8
    0 Votes
    8 Posts
    27 Views
    L
    Rick York wrote: Yes, that number arising is pure coincidence Well, actually it's not really coincidence that the ratio of the Egyptian cubit is 0.52 of a meter. However there is nothing mysterious or special about it. I am not sure I conveyed what I am talking about in a clear way. Here is an absolute fact: If I gave you only a rope and a rock and asked you to divide the day using only those materials into 24 hours, 1440 minutes and 86400 seconds. When you completed the task your rope would be approximately 1 meter long. The arc of your pendulum would cover ~0.52 of the meter when swinging. That's all, nothing mysterious.
  • Found on TDWTF

    question com adobe architecture
    2
    0 Votes
    2 Posts
    7 Views
    L
    Maybe this should be the proper naming: const bool _alwaysWrong= true It does not solve my Problem, but it answers my question Chemists have exactly one rule: there are only exceptions