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
  • Why try when it's easier to fail?

    python com data-structures json question
    8
    0 Votes
    8 Posts
    16 Views
    S
    var somestr = foo.TryGetValue("bar", out var value) ? value?.ToString() : null; Would that be better?! :o A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!
  • This bug in "Try .NET"...

    csharp help com
    6
    0 Votes
    6 Posts
    15 Views
    S
    And.. you are totally right! :O :laugh: A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!
  • How To Fix Canon Printer 1430?

    help com tutorial question
    1
    0 Votes
    1 Posts
    5 Views
    No one has replied
  • How To Fix Canon Printer 1403 Error?

    help java com tutorial question
    1
    0 Votes
    1 Posts
    2 Views
    No one has replied
  • Pharmaceutical Suppliers in India – Oddway Internatiinal

    com sales
    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • Typos in product code

    python com data-structures learning
    43
    0 Votes
    43 Posts
    180 Views
    S
    It's unacceptable! Any self respecting French person should instantly understand this hybrid German-English word! Instead I wonder, why not Zweibartool? What has Australia to do with it?! :o A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!
  • let, var, val - Swift, Kotlin, JavaScript

    android c++ javascript swift ios
    24
    0 Votes
    24 Posts
    70 Views
    raddevusR
    That really is the best explanation of the proliferation of programming languages.
  • Today's entry for the "kill it with fire" list

    c++
    22
    0 Votes
    22 Posts
    102 Views
    G
    While this code was in fact multithreaded, that had nothing to do with the sloppy way the logic was coded. I've had very few cases where comparing a bool variable to a constant made more sense algorithmically than just using the variable as-is. The second part comparing the variable to the Windows DWORD constant TRUE is just plain stupid. It works, but that's no credit. Software Zen: delete this;
  • 0 Votes
    15 Posts
    50 Views
    K
    Yes, I've been bitten by the numeric e but usually always with very small numbers meaning I must have forgotten a round somewhere. :laugh: Actually, the input fields (in my case) only allow numeric chars plus b/s, and period validated at the keypress event. It's a little extra effort, but it's a good first line of defense against invalid data...of course, the clever ones can still copy/paste so you still have to check again. To be honest, I've never even afaik tried a value with an e in it. I'll have to check it out when I have more time! :) DerekTP123 wrote: you can guarantee that at some point the user will click "yes" Yep, whether they mean to or not...so many users don't even bother to read, they just click 'Yes' to dialogue they see. :sigh: "Go forth into the source" - Neal Morse
  • Kill it with fire #2 - or fml

    graphics help
    19
    0 Votes
    19 Posts
    28 Views
    Richard DeemingR
    Really? Why not: switch (someEnum) { case SomeEnum.SecondCase: // Handle second case break; default: // Handle first case break; } Exactly the same behaviour, with no need to use goto in your code. (Of course, the generated IL will probably still use the equivalent of goto behind the scenes.) "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
  • Concept of "Password Mode"

    algorithms security learning
    6
    0 Votes
    6 Posts
    8 Views
    raddevusR
    Just saw this -- too bad I didn't see it when you first posted. Anyways, the idea you propose sounds like what I've done in my app which allows you to draw a geometric shape and then generates a long (SHA-256 hash-based) password for you. You can read all about it and get the code here at CP: Users Hate Passwords (We're All Users): Never Memorize a Password Again[^] I've written the app as a iphone, Android, WinForm and web app. You can try the web app at the official site (it's all client-side javascript, nothing is saved): C'YaPass : Never type a password again[^]
  • Must-Have NuGet Constants Packages

    asp-net visual-studio com help question
    1
    0 Votes
    1 Posts
    2 Views
    No one has replied
  • XOR is for the weak

    15
    0 Votes
    15 Posts
    27 Views
    M
    It's old school rock! :cool: I remembered how to MessageBox (in Client) some texts on ASP.NET... protected void ShowMessage(string message) { string msg = "alert('" + message + "');"; base.ClientScript.RegisterStartupScript(base.GetType(), "jsShowMessage", msg, true); } Yeah!
  • 0 Votes
    16 Posts
    34 Views
    D
    No, it sounds more like the work of a resourceful engineer. Good on you! :) David A. Gray Delivering Solutions for the Ages, One Problem at a Time Interpreting the Fundamental Principle of Tabular Reporting
  • Well, at least they use SQL Server

    database sql-server sysadmin
    6
    0 Votes
    6 Posts
    13 Views
    M
    http://www.commitstrip.com/en/2017/01/16/nice-try/ :-D
  • Documentation boggle of the day

    hardware
    39
    0 Votes
    39 Posts
    132 Views
    D
    If only we mre humand could give answers before we get the questions! CQ de W5ALT Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software
  • Extending Generics with nested types

    android tutorial
    6
    0 Votes
    6 Posts
    10 Views
    D
    Yeah, but I could be wrong. After all, I'm an engineer who never studied programming in school. CQ de W5ALT Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software
  • Readable code, taken too far (too Swift)?

    learning csharp swift ios com
    35
    0 Votes
    35 Posts
    90 Views
    D
    If you want to see some very readble, but nasty code, you should try Cobol or better yet, SNOBOL. CQ de W5ALT Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software
  • Perl is crazy!

    question perl com adobe json
    26
    0 Votes
    26 Posts
    84 Views
    D
    NMo, I'd say that Perl programmers are crazy. and I've dabbled in nPerl, it's sometimes useful. But PhP suites my needs better. CQ de W5ALT Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software
  • WizzardWrx .NET API Core Available on NuGet

    regex csharp visual-studio c++ html
    18
    0 Votes
    18 Posts
    22 Views
    D
    Yep. Point taken, and I've found a more appropriate forum for it. David A. Gray Delivering Solutions for the Ages, One Problem at a Time Interpreting the Fundamental Principle of Tabular Reporting