Click here to Skip to main content
15,900,815 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: Command line fun in .NET Pin
honey the codewitch27-Jan-24 7:37
mvahoney the codewitch27-Jan-24 7:37 
GeneralMicrosoft example includes obsolete code: Why? Pin
raddevus25-Jan-24 2:15
mvaraddevus25-Jan-24 2:15 
GeneralRe: Microsoft example includes obsolete code: Why? Pin
Bruno van Dooren25-Jan-24 5:28
mvaBruno van Dooren25-Jan-24 5:28 
GeneralRe: Microsoft example includes obsolete code: Why? Pin
raddevus25-Jan-24 8:50
mvaraddevus25-Jan-24 8:50 
GeneralFound an interesting algorithm Pin
honey the codewitch21-Jan-24 5:16
mvahoney the codewitch21-Jan-24 5:16 
GeneralRe: Found an interesting algorithm Pin
Nelek21-Jan-24 6:15
protectorNelek21-Jan-24 6:15 
GeneralRe: Found an interesting algorithm Pin
Greg Utas21-Jan-24 13:32
professionalGreg Utas21-Jan-24 13:32 
GeneralMicrosoft Regex Weirdness Pin
honey the codewitch7-Jan-24 4:17
mvahoney the codewitch7-Jan-24 4:17 
[[:IsLetter:]_][[:IsLetterOrDigit:]_]*|0|-?[1-9][0-9]*(\\.[0-9]+([Ee]-?[1-9][0-9]*)?)?|[ \t\r\n]+
Runs over twice as slow as
[[:IsLetter:]_][[:IsLetterOrDigit:]_]*|0|-?[1-9][0-9]*(\\.[0-9]+([Ee]-?[1-9][0-9]*)?)?|[[:IsWhiteSpace:]]+

IsWhiteSpace is a Unicode charset. The [ \t\r\n] is simply ASCII.

Why is this weird? Because there are a lot more characters in the IsWhiteSpace character set than 4 ([ \t\r\n]) which should make the transitions slower due to having to search several character ranges.

Also 1552ms vs 629ms. That was what I found in my tests.

My regex lib searches and matches the test input in about 4ms regardless of which expression is used.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix

GeneralRe: Microsoft Regex Weirdness Pin
PIEBALDconsult7-Jan-24 5:30
mvePIEBALDconsult7-Jan-24 5:30 
GeneralRe: Microsoft Regex Weirdness Pin
k50547-Jan-24 7:34
mvek50547-Jan-24 7:34 
GeneralRe: Microsoft Regex Weirdness Pin
PIEBALDconsult7-Jan-24 7:59
mvePIEBALDconsult7-Jan-24 7:59 
GeneralRe: Microsoft Regex Weirdness Pin
Brisingr Aerowing7-Jan-24 8:40
professionalBrisingr Aerowing7-Jan-24 8:40 
GeneralRe: Microsoft Regex Weirdness Pin
PIEBALDconsult7-Jan-24 8:58
mvePIEBALDconsult7-Jan-24 8:58 
GeneralRe: Microsoft Regex Weirdness Pin
honey the codewitch7-Jan-24 14:40
mvahoney the codewitch7-Jan-24 14:40 
GeneralRe: Microsoft Regex Weirdness Pin
PIEBALDconsult7-Jan-24 15:34
mvePIEBALDconsult7-Jan-24 15:34 
GeneralRe: Microsoft Regex Weirdness Pin
honey the codewitch7-Jan-24 15:49
mvahoney the codewitch7-Jan-24 15:49 
GeneralRe: Microsoft Regex Weirdness Pin
PIEBALDconsult7-Jan-24 16:35
mvePIEBALDconsult7-Jan-24 16:35 
GeneralRe: Microsoft Regex Weirdness Pin
honey the codewitch7-Jan-24 17:16
mvahoney the codewitch7-Jan-24 17:16 
GeneralRe: Microsoft Regex Weirdness Pin
Peter_in_27807-Jan-24 15:16
professionalPeter_in_27807-Jan-24 15:16 
GeneralRe: Microsoft Regex Weirdness Pin
Richard Deeming9-Jan-24 1:16
mveRichard Deeming9-Jan-24 1:16 
GeneralRe: Microsoft Regex Weirdness Pin
Brisingr Aerowing9-Jan-24 15:27
professionalBrisingr Aerowing9-Jan-24 15:27 
GeneralHow to make thing more complicated for nothing... Pin
Maximilien29-Nov-23 2:58
Maximilien29-Nov-23 2:58 
JokeRe: How to make thing more complicated for nothing... PinPopular
Mircea Neacsu29-Nov-23 3:51
Mircea Neacsu29-Nov-23 3:51 
GeneralRe: How to make thing more complicated for nothing... Pin
Maximilien29-Nov-23 3:53
Maximilien29-Nov-23 3:53 
GeneralRe: How to make thing more complicated for nothing... PinPopular
Mircea Neacsu29-Nov-23 3:55
Mircea Neacsu29-Nov-23 3:55 

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.