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
  • Preparing for the future...

    help html question
    19
    0 Votes
    19 Posts
    57 Views
    M
    I liked that. Thank you.
  • M5 Stack Fire - can recommend!

    iot c++ asp-net adobe hardware
    1
    0 Votes
    1 Posts
    6 Views
    No one has replied
  • Orion Realtors is a spammer

    com tools question
    1
    0 Votes
    1 Posts
    10 Views
    No one has replied
  • LOL THAT'S A FUNNI JOKE!

    question
    1
    0 Votes
    1 Posts
    5 Views
    No one has replied
  • 0 Votes
    7 Posts
    27 Views
    J
    raddevus wrote: I need to actually insert a System.DbNull.Value into the databse -- that's a true DBNull -- not the String null which the db chokes on. That statement makes no sense. Given a string/text value in a database it can have one of the following values. 1. Null 2. Empty string. Some databases do not allow this 3. Any other non-empty value. That list does not include 'DBNull'. The 'DBNull' value is usually a value that is intended as a stand in for results for the first item in the list above. Perhaps your real problem is that you need to represent the following 1. A value that is not null 2. User did not 'choose' anything. So you need to represent 'no value', but you cannot use 'null'. In the above you then use a magical value. If your database supports it and there NO chance it will be needed then an empty string can be used. But otherwise some nonsensical value is chosen. For example say you need to provide a customer telephone number. So you allow numbers. But for your special value you allow 'xxx-xxx-xxxx'. Naturally you must special case the code. HOWEVER, this is not an idea solution. And you should first examine the requirements that state that 'null' cannot be used in the first place. That the database does not allow it is NOT a argument for that. Because that to is just code and it must meet the needs of the business and not arbitrary developer opinions.
  • PathYetAnotherMakeUniqueName

    question com adobe json architecture
    6
    0 Votes
    6 Posts
    24 Views
    S
    History: This was part of a batch of embarrassing internal junk, that lawyers forced to document as part of the DoJ consent decree in 2001. Basically, various API surface in Windows (mostly helper functions in Shell32.dll) that other products (mostly Office) were calling. It was never intended to see light of day.. obviously, it was the result of some dev who rotated from one org to another, and copy-pasted some helper function code from one product repo to another. I don't recall any of those lawyer-documented functions doing anything meaningful (that couldn't be replicated in user-mode code using existing Win32 APIs). But, try explaining that to DoJ lawyers..
  • BuT cAn ThEY RuN DoOM?

    com question
    14
    0 Votes
    14 Posts
    38 Views
    A
    A couple of years ago we had a TV show where they took a bunch of different pet dogs and whittled them down via various agility and obedience tests etc until they had a dog which they taught to pilot an light aircraft, by using lights to indicate to it what adjustments to make. It didn't just have to fly straight and level, though, they set it a route it had to navigate. They didn't expect it to take off and land, of course. A pilot took it up, then handed the controls over to the dog.
  • 0 Votes
    1 Posts
    3 Views
    No one has replied
  • 0 Votes
    16 Posts
    57 Views
    Z
    Find Online Quran Tutors or teachers that are best to learn with. If you want to learn arabic language i have a clean and almost free arabic language learning sites for you. Some of the bests are: 1. Bismillah Schooling 2. Quran Xperts
  • This is actually cleaned up!

    20
    0 Votes
    20 Posts
    77 Views
    J
    honey the codewitch wrote: I did not write it that way, and I'm not rewriting six files of macros. As I already said in my previous post...Your statement strongly suggested that you were responding to the code sample. To be very clear - that would be the code sample that was posted in this thread and not your code. That code sample does not require "six files of macros".
  • Intergalactic cephalopods

    com
    7
    0 Votes
    7 Posts
    31 Views
    R
    Having bothered to follow the link to the paper, and scan that, I'm unsurprised to note that the paper in way makes the suggestion that Octopuses came from space. Rather, that organic material from space (such as viruses) may have affected the DNA of hosts to result in the mutations that became Octopuses and related species. And the reviews summarised of the papers point out that there is insufficient evidence as yet to support even that claim. Sounds like Science continues to function as intended to me. Science journalism on the other hand... "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.
  • .Net Core 6 jumps the shark

    csharp dotnet javascript asp-net wpf
    41
    0 Votes
    41 Posts
    225 Views
    D
    You're thinking in technical terms. My issues with the previous ways of doing it are more "customer" issues than anything technical. Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak
  • 0 Votes
    1 Posts
    2 Views
    No one has replied
  • What sort of progression is this?

    question
    6
    0 Votes
    6 Posts
    11 Views
    J
    That is what happens when the source control system requires comments but no one actually reviews code.
  • Cuter by the day....

    linux agentic-ai tutorial question
    4
    0 Votes
    4 Posts
    16 Views
    S
    ha... some of the data was related to the currently much talked about vulnerability, I see... Mmm.. I am only at 2/4+ :laugh: A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!
  • I think I just built a better mousetrap

    regex algorithms data-structures
    1
    0 Votes
    1 Posts
    3 Views
    No one has replied
  • 0 Votes
    3 Posts
    13 Views
    honey the codewitchH
    Yeah I just deleted it. I accidently landed here instead of the lounge and I wasn't paying close enough attention apparently. Real programmers use butterflies
  • 0 Votes
    1 Posts
    7 Views
    No one has replied
  • That's one way to do it

    com help
    64
    0 Votes
    64 Posts
    528 Views
    D
    PIEBALDconsult wrote: Only works with base-10 ? You just need to add conversion functions and call them first. function hexToDec(number) { if (number === 1) return 1; else if (number === 2) return 2; //... else if (number === A) return 10; else if (number === B) return 11; //... } 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
    7 Posts
    12 Views
    honey the codewitchH
    The comment block was test code. The error of my ways was an outdated idea of restricting access to tables in SQL coupled with stored procedure based field validation, which is where this came in. There is a code generator that produced this particular matcher. Real programmers use butterflies