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.

 Re: Odd Behavior With gethostbyname Peter_in_27804-Oct-21 21:08 Peter_in_2780 4-Oct-21 21:08
 Re: Odd Behavior With gethostbyname YahiaEQ5-Oct-21 22:12 YahiaEQ 5-Oct-21 22:12
 Re: Odd Behavior With gethostbyname englebart1-Sep-22 16:37 englebart 1-Sep-22 16:37
 Reversing a logical ( OR ) albert_redditt2-Sep-21 12:31 albert_redditt 2-Sep-21 12:31
 Re: Reversing a logical ( OR ) PIEBALDconsult2-Sep-21 13:13 PIEBALDconsult 2-Sep-21 13:13
 Re: Reversing a logical ( OR ) Jon McKee2-Sep-21 14:11 Jon McKee 2-Sep-21 14:11
 Re: Reversing a logical ( OR ) Matias Lopez18-Oct-21 12:11 Matias Lopez 18-Oct-21 12:11
 Re: Reversing a logical ( OR ) Rick York2-Sep-21 15:43 Rick York 2-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?"
 Re: Reversing a logical ( OR ) jschell5-Sep-21 10:24 jschell 5-Sep-21 10:24
 Re: Reversing a logical ( OR ) James Curran24-Sep-21 6:53 James Curran 24-Sep-21 6:53
 Re: Reversing a logical ( OR ) harold aptroot5-Oct-21 22:09 harold aptroot 5-Oct-21 22:09
 Re: Reversing a logical ( OR ) Phil Hodgkins5-Oct-21 23:28 Phil Hodgkins 5-Oct-21 23:28
 Re: Reversing a logical ( OR ) Rob Grainger14-Oct-21 11:06 Rob Grainger 14-Oct-21 11:06
 Re: Reversing a logical ( OR ) Richard Deeming15-Oct-21 0:17 Richard Deeming 15-Oct-21 0:17
 That's one way to do it Kent Sharkey17-Aug-21 11:21 Kent Sharkey 17-Aug-21 11:21
 Re: That's one way to do it Mike Hankey17-Aug-21 11:38 Mike Hankey 17-Aug-21 11:38
 Re: That's one way to do it PIEBALDconsult17-Aug-21 11:50 PIEBALDconsult 17-Aug-21 11:50
 Re: That's one way to do it Jon McKee17-Aug-21 12:18 Jon McKee 17-Aug-21 12:18
 Re: That's one way to do it den2k885-Oct-21 22:17 den2k88 5-Oct-21 22:17
 Re: That's one way to do it Dan Neely29-Nov-21 4:23 Dan Neely 29-Nov-21 4:23
 Re: That's one way to do it Jon McKee17-Aug-21 12:10 Jon McKee 17-Aug-21 12:10
 Re: That's one way to do it PIEBALDconsult17-Aug-21 12:14 PIEBALDconsult 17-Aug-21 12:14
 Re: That's one way to do it Jon McKee17-Aug-21 12:23 Jon McKee 17-Aug-21 12:23
 Re: That's one way to do it jsc4218-Aug-21 23:38 jsc42 18-Aug-21 23:38
 Re: That's one way to do it kalberts17-Aug-21 12:31 kalberts 17-Aug-21 12:31
 Last Visit: 31-Dec-99 19:00     Last Update: 7-Dec-22 11:26 Refresh ᐊ Prev1...11121314151617181920 Next ᐅ