Click here to Skip to main content
15,122,559 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: Code to determine whether the passed in string is a C style comment block - in T-SQL Pin
Brisingr Aerowing9-Nov-21 13:53
professionalBrisingr Aerowing9-Nov-21 13:53 
GeneralRe: Code to determine whether the passed in string is a C style comment block - in T-SQL Pin
James Curran26-Nov-21 7:21
MemberJames Curran26-Nov-21 7:21 
GeneralRe: Code to determine whether the passed in string is a C style comment block - in T-SQL Pin
honey the codewitch26-Nov-21 8:38
mvahoney the codewitch26-Nov-21 8:38 
GeneralCursed Project: WasmWinforms Pin
Brisingr Aerowing8-Nov-21 15:44
professionalBrisingr Aerowing8-Nov-21 15:44 
GeneralRe: Cursed Project: WasmWinforms Pin
Gary R. Wheeler22-Nov-21 14:53
MemberGary R. Wheeler22-Nov-21 14:53 
GeneralRe: Cursed Project: WasmWinforms Pin
den2k8822-Nov-21 22:46
professionalden2k8822-Nov-21 22:46 
GeneralRe: Cursed Project: WasmWinforms Pin
Eddy Vluggen23-Nov-21 14:52
professionalEddy Vluggen23-Nov-21 14:52 
GeneralOdd Behavior With gethostbyname Pin
Rick York4-Oct-21 20:57
mveRick York4-Oct-21 20:57 
As the title states, recently I have seen very strange behavior using gethostbyname on Windows 10. We are implementing an interface using CIP to talk to a PLC. CIP is a protocol used to talk to industrial I/O devices and PLCs over Ethernet. It has it's own share of weirdness too and is what started all of this. We are talking to Allen Bradley PLCs and it's a real PITA. We configure these "assembly instances" in the PLC and one of their parameters is the IP address of the target computer. To implement the interface we are using a library we bought because the protocol is rather complex. It has this quirk whereby the IP address you configure for your computer will not work directly. To be more precise, it won't work if it is the primary IP address of a NIC. It has to be the secondary address which is configured using the "Advanced Options" of the control panel page for networking. Here is where the really strange part comes in. When I first configure the secondary address for a NIC it won't work. I have to add the address, accept all options, and close the dialogs, then re-open them, delete the address, and close them again. Then I have to re-open the option dialogs and re-enter that address and accept the changes. Only after doing all of that will it work correctly and I have seen this on four different machines. Where gethostbyname comes in is it is called to enumerate the addresses and find a match to the one you ask for. Unless the procedure I described is followed it will not see the secondary address so the interface initialization fails. You can open the dialogs and verify it is there but the function just will not see it unless it is deleted and then added back in.

I don't recall seeing such weirdness before but, of course, this is Windows 10. Yee haw.
"They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"

GeneralRe: Odd Behavior With gethostbyname Pin
Peter_in_27804-Oct-21 21:08
professionalPeter_in_27804-Oct-21 21:08 
GeneralRe: Odd Behavior With gethostbyname Pin
YahiaEQ5-Oct-21 22:12
MemberYahiaEQ5-Oct-21 22:12 
GeneralReversing a logical ( OR ) Pin
albert_redditt2-Sep-21 12:31
Memberalbert_redditt2-Sep-21 12:31 
GeneralRe: Reversing a logical ( OR ) Pin
PIEBALDconsult2-Sep-21 13:13
professionalPIEBALDconsult2-Sep-21 13:13 
GeneralRe: Reversing a logical ( OR ) Pin
Jon McKee2-Sep-21 14:11
professionalJon McKee2-Sep-21 14:11 
GeneralRe: Reversing a logical ( OR ) Pin
Matias Lopez18-Oct-21 12:11
MemberMatias Lopez18-Oct-21 12:11 
GeneralRe: Reversing a logical ( OR ) PinPopular
Rick York2-Sep-21 15:43
mveRick York2-Sep-21 15:43 
GeneralRe: Reversing a logical ( OR ) Pin
jschell5-Sep-21 10:24
Memberjschell5-Sep-21 10:24 
GeneralRe: Reversing a logical ( OR ) Pin
James Curran24-Sep-21 6:53
MemberJames Curran24-Sep-21 6:53 
GeneralRe: Reversing a logical ( OR ) Pin
harold aptroot5-Oct-21 22:09
Memberharold aptroot5-Oct-21 22:09 
GeneralRe: Reversing a logical ( OR ) Pin
Phil Hodgkins5-Oct-21 23:28
MemberPhil Hodgkins5-Oct-21 23:28 
GeneralRe: Reversing a logical ( OR ) Pin
Rob Grainger14-Oct-21 11:06
MemberRob Grainger14-Oct-21 11:06 
GeneralRe: Reversing a logical ( OR ) Pin
Richard Deeming15-Oct-21 0:17
mveRichard Deeming15-Oct-21 0:17 
GeneralThat's one way to do it Pin
Kent Sharkey17-Aug-21 11:21
staffKent Sharkey17-Aug-21 11:21 
GeneralRe: That's one way to do it PinPopular
Mike Hankey17-Aug-21 11:38
professionalMike Hankey17-Aug-21 11:38 
JokeRe: That's one way to do it Pin
PIEBALDconsult17-Aug-21 11:50
professionalPIEBALDconsult17-Aug-21 11:50 
GeneralRe: That's one way to do it Pin
Jon McKee17-Aug-21 12:18
professionalJon McKee17-Aug-21 12:18 

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.