Click here to Skip to main content
14,452,049 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: Bubble Sort, O(N^2) aka Quadratic time Pin
maze328-Jan-20 23:34
professionalmaze328-Jan-20 23:34 
GeneralRe: Bubble Sort, O(N^2) aka Quadratic time Pin
raddevus29-Jan-20 3:14
communityengineerraddevus29-Jan-20 3:14 
GeneralRe: Bubble Sort, O(N^2) aka Quadratic time Pin
RugbyLeague29-Jan-20 22:17
MemberRugbyLeague29-Jan-20 22:17 
GeneralRe: Bubble Sort, O(N^2) aka Quadratic time Pin
englebart29-Jan-20 4:23
professionalenglebart29-Jan-20 4:23 
GeneralRe: Bubble Sort, O(N^2) aka Quadratic time Pin
Jon McKee30-Jan-20 10:16
professionalJon McKee30-Jan-20 10:16 
GeneralRe: Bubble Sort, O(N^2) aka Quadratic time Pin
englebart30-Jan-20 10:28
professionalenglebart30-Jan-20 10:28 
GeneralRe: Bubble Sort, O(N^2) aka Quadratic time Pin
Kirk 103898212-Feb-20 17:37
MemberKirk 103898212-Feb-20 17:37 
GeneralMy very own accidental DoS program Pin
kmoorevs15-Jan-20 11:34
Memberkmoorevs15-Jan-20 11:34 
During the holiday downtime last week I finally took the time to install a Let's Encrypt cert on the company's self-hosted web server. Because I'm impatient and not willing to wait hours for a txt record to propagate, I used the simple challenge test for a single named server. (wildcards require the txt method for verification) The cert was created for the canonical server name meaning that requests with the www prepended failed.

No problem, just add a couple of new url rewrite rules, one to remove the www. and the other to redirect to force https. It worked like a charm...or so I thought.

A week goes by without any reported problems until a customer goes to renew their contract. (desktop app) That's when all hell broke loose. WTF | :WTF: The desktop app sends a request to a registration web app hosted on that server that takes the querystring params and sends back a response indicating if the account is in good standing. This has worked well for many, many years so I was surprised when it started misbehaving. The problem turned out to be the querystring params were doubling. Confused | :confused:

This was happening as a result of the url rewrite even though I had included the option to not append the querystring. D'Oh! | :doh: This was a problem due to the way multiple querystring paramaters with the same name are handled...basically, resource.aspx?sID=2&sID=2 resolves to '2,2'. Try parsing that to an int! (also, another reason to use TryParse vs. Parse)

Now, while that webpage/app was throwing a 500, the client-side app that was calling it became aware that an error had occurred and re-requested the page. It was only supposed to retry a maximum of 10 times before quitting...however, a line of code that made the request was mistakenly left right before the quit condition.... OMG | :OMG: ...so, no matter what the fail counter said, it was going to keep trying...at least until the short variable hit it's limit!

This resulted in an unresponsive app for the client that had to be killed manually as well as a royal mess in the server's WC3 log. D'Oh! | :doh:

Since this webserver is also used by other customers, I had to resort to handling the double parameters in the registration web app until after hours when I could correct the url rewrite rule. (use {URL} instead of {REQUEST_URI} in the redirect) In all, I had around a dozen different apps to fix on the server plus fixing and redeploying the desktop app. Sigh | :sigh:

I was a bit surprised to realize that IIS's auto-ban had not kicked in until I discovered that it was not enabled. I could've sworn I enabled that a while back Confused | :confused: ...maybe that was the old server. (at least 2 years ago)
"Go forth into the source" - Neal Morse

GeneralRe: My very own accidental DoS program Pin
Ron Anders15-Jan-20 16:46
MemberRon Anders15-Jan-20 16:46 
Generalpurchased code from who knows where Pin
rnbergren10-Jan-20 7:47
Memberrnbergren10-Jan-20 7:47 
GeneralRe: purchased code from who knows where Pin
ZurdoDev10-Jan-20 8:06
mveZurdoDev10-Jan-20 8:06 
GeneralRe: purchased code from who knows where Pin
phil.o10-Jan-20 8:29
mvephil.o10-Jan-20 8:29 
GeneralRe: purchased code from who knows where Pin
RickZeeland10-Jan-20 8:30
communityengineerRickZeeland10-Jan-20 8:30 
GeneralRe: purchased code from who knows where Pin
Eddy Vluggen15-Jan-20 13:01
professionalEddy Vluggen15-Jan-20 13:01 
GeneralCross-Platform: dotnet core web api QR Codes Pin
raddevus30-Dec-19 11:00
communityengineerraddevus30-Dec-19 11:00 
PraiseRe: Cross-Platform: dotnet core web api QR Codes Pin
RickZeeland30-Dec-19 11:23
communityengineerRickZeeland30-Dec-19 11:23 
GeneralRe: Cross-Platform: dotnet core web api QR Codes Pin
Brisingr Aerowing10-Jan-20 11:34
professionalBrisingr Aerowing10-Jan-20 11:34 
GeneralRe: Cross-Platform: dotnet core web api QR Codes Pin
raddevus10-Jan-20 12:04
communityengineerraddevus10-Jan-20 12:04 
GeneralHead, meet desk Pin
Richard Deeming20-Dec-19 4:25
communityengineerRichard Deeming20-Dec-19 4:25 
GeneralRe: Head, meet desk Pin
Greg Utas20-Dec-19 5:47
professionalGreg Utas20-Dec-19 5:47 
GeneralRe: Head, meet desk Pin
ZurdoDev20-Dec-19 9:29
mveZurdoDev20-Dec-19 9:29 
GeneralWeird Performance PinPopular
Rick York18-Dec-19 11:11
mveRick York18-Dec-19 11:11 
GeneralRe: Weird Performance Pin
Nelek19-Dec-19 1:27
protectorNelek19-Dec-19 1:27 
GeneralRe: Weird Performance Pin
Rick York19-Dec-19 5:51
mveRick York19-Dec-19 5:51 
GeneralRe: Weird Performance Pin
Nelek19-Dec-19 9:38
protectorNelek19-Dec-19 9:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.