Click here to Skip to main content
15,511,131 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: 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
YahiaEQ5-Oct-21 22:12 
GeneralRe: Odd Behavior With gethostbyname Pin
englebart1-Sep-22 16:37
professionalenglebart1-Sep-22 16:37 
GeneralReversing a logical ( OR ) Pin
albert_redditt2-Sep-21 12:31
albert_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
Matias Lopez18-Oct-21 12:11 
GeneralRe: Reversing a logical ( OR ) Pin
Rick York2-Sep-21 15:43
mveRick York2-Sep-21 15:43 
To stay with binary logic operations, what your formula boils down to is (using C syntax) :
A | B = ( A ^ B ) | ( A & B )
That is not "undoing" the OR operation. That is a sequence of operations which arrive at the same result. To undo A | B = C you need to perform operations on C with B to give a result of A or operations on C with A that give B.

I find it easier to do binary logic with hexadecimal numbers so with the first numbers,
100 = 0x64
5 = 0x05
0x64 | 0x05 = 0x65
To undo the OR what you need is
0x65 ? 0x05 = 0x64
or
0x65 ? 0x64 = 0x05
I don't know what that expression would be and I can see why you were told it is impossible.
"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: Reversing a logical ( OR ) Pin
jschell5-Sep-21 10:24
jschell5-Sep-21 10:24 
GeneralRe: Reversing a logical ( OR ) Pin
James Curran24-Sep-21 6:53
James Curran24-Sep-21 6:53 
GeneralRe: Reversing a logical ( OR ) Pin
harold aptroot5-Oct-21 22:09
harold aptroot5-Oct-21 22:09 
GeneralRe: Reversing a logical ( OR ) Pin
Phil Hodgkins5-Oct-21 23:28
Phil Hodgkins5-Oct-21 23:28 
GeneralRe: Reversing a logical ( OR ) Pin
Rob Grainger14-Oct-21 11:06
Rob 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 Pin
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 
GeneralRe: That's one way to do it Pin
den2k885-Oct-21 22:17
professionalden2k885-Oct-21 22:17 
GeneralRe: That's one way to do it Pin
Dan Neely29-Nov-21 4:23
Dan Neely29-Nov-21 4:23 
GeneralRe: That's one way to do it Pin
Jon McKee17-Aug-21 12:10
professionalJon McKee17-Aug-21 12:10 
GeneralRe: That's one way to do it Pin
PIEBALDconsult17-Aug-21 12:14
professionalPIEBALDconsult17-Aug-21 12:14 
GeneralRe: That's one way to do it Pin
Jon McKee17-Aug-21 12:23
professionalJon McKee17-Aug-21 12:23 
GeneralRe: That's one way to do it Pin
jsc4218-Aug-21 23:38
professionaljsc4218-Aug-21 23:38 
GeneralRe: That's one way to do it Pin
kalberts17-Aug-21 12:31
kalberts17-Aug-21 12:31 

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.