Re: XOR
ColdFusion comparison statements (CFIF, etc.) support the XOR joiner between clauses. This is used as such: clause1 XOR clause2 This says that either clause1 or clause2 has to be true for the statement to be true. If both are true or both are false, then the entire statement is false. My question is: can anyone think of a real world example where you would need a statement like this? We use XOR in a statement where both a date and a date selection type is required. If one is entered and not the other, then the user is prompted to enter both. If both or neither are entered, then the search proceeds with whatever criteria it has. cfif b_date_entered XOR b_date_sel_entered script language=javascript window.alert('You must enter a date restriction and date(s).'); history.back(); /script cfabort /cfif Tim ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349856 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: XOR
XOR is great for adding things like include / exclude to an argument. Here's a real world example: I have a function that strips out non-numeric data from numeric only form inputs. I use it on a bunch of pages. Some of these pages are basically *all* numeric data. Some pages only have a little bit of numeric data. Instead of stripping them out one by one, I just do a call to my function: stripForm('var1, var2', skip = 1) then in stripForm, you just do a check: foreach form element if arg1 contains elementName XOR skip strip characters So basically, if skip is set to 1, it only strips characters on things not listed in the first argument - that is, it skips the ones in the argument. If Skip is set to 0, it only strips characters on elements in the first argument. There are a lot of variations on this, but XOR's power is primarily in simplifying a two-pronged test into one statement. Maybe for data integrity checks? A record has to be dated in 2005 or 2004, but not both, and not before 2004? Of course then a data range would work just as well... That is an odd one, it doesn't seem like it would be used a whole lot. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, November 03, 2005 2:46 PM To: CF-Talk Subject: XOR ColdFusion comparison statements (CFIF, etc.) support the XOR joiner between clauses. This is used as such: clause1 XOR clause2 This says that either clause1 or clause2 has to be true for the statement to be true. If both are true or both are false, then the entire statement is false. My question is: can anyone think of a real world example where you would need a statement like this? [INFO] -- Access Manager: This transmission may contain information that is privileged, confidential and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. A2 ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:262390 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: XOR
I now I'm real late on this one, but I used to teach people how to do text searching with boolean logic in the pre-web days. When I showed them the XOR command (nearly every computer/query language has one), I told them they would NEVER use it. It's just not a real world operator. Jevo Michael Dinowitz wrote: That is an odd one, it doesn't seem like it would be used a whole lot. I'm doing a complete review of comparisons statements in CF and it's one of the joiners allowed. Even if they're never used, I have to cover them. :) As for the bitwise xor, I'll deal with that later. ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:233024 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: XOR
This is not strictly true. 1 and 2, evaluated as booleans, are both true. However, they are not equal. So, (1 XOR 2) != (1 neq 2) --Ben the nitpicker Doom Claude Schneegans wrote: real world example where you would need a statement like this? Not really, actually, because (a XOR b) is equivalent to (a NEQ b) which is much more intuitive. ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:223185 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: XOR
XOR is more succinct where there are more than 2 terms. -Original Message- From: Claude Schneegans [mailto:[EMAIL PROTECTED] Sent: Thursday, November 03, 2005 6:13 PM To: CF-Talk Subject: Re: XOR XOR coerces it's operands to boolean, while NEQ doesn't. Exact. But what I mean is that if someone has to use an XOR operator, the situation is actually a NEQ issue, he will think of NEQ first, and do what must be done to make sure both operands are boolean. -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:223199 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: XOR
However, they are not equal. So, (1 XOR 2) != (1 neq 2) Exact again, but XOR is rarely used, and even more rarely used on non boolean, actually, 1 XOR 2 just does not make sense if 1 and 2 are not booleans. Normally, one would use boolean1 XOR boolean2, and in THIS situation (only), boolean1 XOR boolean2 is equivalent to boolean1 NEQ boolean2 -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:223302 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: XOR
But again, in CF the implicit coersion is VERY important. If there weren't implicit coersion (or CF was strongly typed, depending on how you want to say it), then there would be no need for an boolean XOR operator, as NEQ would suffice. But that's not the situation we're in with CF, so XOR is needed. cheers, barneyb On 11/4/05, Claude Schneegans [EMAIL PROTECTED] wrote: However, they are not equal. So, (1 XOR 2) != (1 neq 2) Exact again, but XOR is rarely used, and even more rarely used on non boolean, actually, 1 XOR 2 just does not make sense if 1 and 2 are not booleans. Normally, one would use boolean1 XOR boolean2, and in THIS situation (only), boolean1 XOR boolean2 is equivalent to boolean1 NEQ boolean2 -- Barney Boisvert [EMAIL PROTECTED] 360.319.6145 http://www.barneyb.com/ Got Gmail? I have 100 invites. ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:223304 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: XOR
Maybe for data integrity checks? A record has to be dated in 2005 or 2004, but not both, and not before 2004? Of course then a data range would work just as well... That is an odd one, it doesn't seem like it would be used a whole lot. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, November 03, 2005 2:46 PM To: CF-Talk Subject: XOR ColdFusion comparison statements (CFIF, etc.) support the XOR joiner between clauses. This is used as such: clause1 XOR clause2 This says that either clause1 or clause2 has to be true for the statement to be true. If both are true or both are false, then the entire statement is false. My question is: can anyone think of a real world example where you would need a statement like this? [INFO] -- Access Manager: This transmission may contain information that is privileged, confidential and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. A2 ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:223106 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: XOR
The only widespread use I've seen for XOR is in basic encryption algorithms. Never seen it used outside that. -Original Message- From: Michael Dinowitz [mailto:[EMAIL PROTECTED] Sent: Thursday, November 03, 2005 4:46 PM To: CF-Talk Subject: XOR ColdFusion comparison statements (CFIF, etc.) support the XOR joiner between clauses. This is used as such: clause1 XOR clause2 This says that either clause1 or clause2 has to be true for the statement to be true. If both are true or both are false, then the entire statement is false. My question is: can anyone think of a real world example where you would need a statement like this? \ ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:223109 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: XOR
clause1 XOR clause2 I suppose in dating there could only be so much tolerance. I could tolerate a smoker, or blue hair, but not both because that would be too much. cfif isSmoker XOR isBlueHair Winner! /cfif Not practical really. I don't think I've ever actually seen anyone use XOR in my 6+ years of CF coding. I'm sure someone has, but nobody I've worked with. -Justin Scott ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:223112 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: XOR
cfif InvadeAfghan XOR InvadeIraq Elect Kerry cfelseif InvadeAfghan OR InvadeIraq Re-elect Bush cfelse Move to France /cfif -Original Message- From: Michael Dinowitz [mailto:[EMAIL PROTECTED] Sent: Thursday, November 03, 2005 15:46 To: CF-Talk Subject: XOR ColdFusion comparison statements (CFIF, etc.) support the XOR joiner between clauses. This is used as such: clause1 XOR clause2 This says that either clause1 or clause2 has to be true for the statement to be true. If both are true or both are false, then the entire statement is false. My question is: can anyone think of a real world example where you would need a statement like this? ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:223111 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: XOR
cfif lessFilling XOR tastesGreat We've got an argument cfelse Everyone agrees /cfif Remember that true is not just a boolean, it means zero or not zero Remember that you can group these together with NOT, AND, OR, etc. On 11/3/05, Michael Dinowitz [EMAIL PROTECTED] wrote: ColdFusion comparison statements (CFIF, etc.) support the XOR joiner between clauses. This is used as such: clause1 XOR clause2 This says that either clause1 or clause2 has to be true for the statement to be true. If both are true or both are false, then the entire statement is false. My question is: can anyone think of a real world example where you would need a statement like this? ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:223115 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: XOR
That's a binary XOR, not a boolean XOR. I actually just wrote a binaryXOR function last week (it's on my blog: barneyb.com) while I was bum-ba-da-bum ... doing some encryption stuff. Specifically reverse engineering cfusion_encrypt and cfusion_decrypt into CFML UDFs (also available on my blog). cheers, barneyb On 11/3/05, Steve Brownlee [EMAIL PROTECTED] wrote: The only widespread use I've seen for XOR is in basic encryption algorithms. Never seen it used outside that. -Original Message- From: Michael Dinowitz [mailto:[EMAIL PROTECTED] Sent: Thursday, November 03, 2005 4:46 PM To: CF-Talk Subject: XOR ColdFusion comparison statements (CFIF, etc.) support the XOR joiner between clauses. This is used as such: clause1 XOR clause2 This says that either clause1 or clause2 has to be true for the statement to be true. If both are true or both are false, then the entire statement is false. My question is: can anyone think of a real world example where you would need a statement like this? -- Barney Boisvert [EMAIL PROTECTED] 360.319.6145 http://www.barneyb.com/ Got Gmail? I have 100 invites. ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:223114 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: XOR
I used it constantly back in the old days setting bit flags in registers. You can use it for setting parity bit for checksums. You can use it to swap the values of two variables without the need for a third temp variable. On 11/3/05, Justin D. Scott [EMAIL PROTECTED] wrote: clause1 XOR clause2 I suppose in dating there could only be so much tolerance. I could tolerate a smoker, or blue hair, but not both because that would be too much. cfif isSmoker XOR isBlueHair Winner! /cfif Not practical really. I don't think I've ever actually seen anyone use XOR in my 6+ years of CF coding. I'm sure someone has, but nobody I've worked with. -Justin Scott ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:223119 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: XOR
That is an odd one, it doesn't seem like it would be used a whole lot. I'm doing a complete review of comparisons statements in CF and it's one of the joiners allowed. Even if they're never used, I have to cover them. :) As for the bitwise xor, I'll deal with that later. ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:223131 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: XOR
That will be the next question. :) I've never had a need for it, but I've found imp to be useful sometimes. -Original Message- From: Michael Dinowitz [mailto:[EMAIL PROTECTED] Sent: Friday, 4 November 2005 11:00 a.m. To: CF-Talk Subject: XOR ColdFusion comparison statements (CFIF, etc.) support the XOR joiner between clauses. This is used as such: clause1 XOR clause2 This says that either clause1 or clause2 has to be true for the statement to be true. If both are true or both are false, then the entire statement is false. My question is: can anyone think of a real world example where you would need a statement like this? ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:223130 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: XOR
But in this example you couldn't tolerate somebody who had neither blue hair nor smoke. You just killed off your ideal matches ;-) Perhaps: cfif not (isSmoker and isBlueHair) Winner! /cfif I suppose in dating there could only be so much tolerance. I could tolerate a smoker, or blue hair, but not both because that would be too much. cfif isSmoker XOR isBlueHair Winner! /cfif ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:223125 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: XOR
real world example where you would need a statement like this? Not really, actually, because (a XOR b) is equivalent to (a NEQ b) which is much more intuitive. -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:223127 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: XOR
I've never had a need for it, but I've found imp to be useful sometimes. -Original Message- From: Michael Dinowitz [mailto:[EMAIL PROTECTED] Sent: Friday, 4 November 2005 11:00 a.m. To: CF-Talk Subject: XOR ColdFusion comparison statements (CFIF, etc.) support the XOR joiner between clauses. This is used as such: clause1 XOR clause2 This says that either clause1 or clause2 has to be true for the statement to be true. If both are true or both are false, then the entire statement is false. My question is: can anyone think of a real world example where you would need a statement like this? ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:223120 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: XOR
What about no XOR 0? That's a false statement, while no NEQ 0 is true. If CF were a strongly typed language and you could enforce the boolean-ness of the operands, then it'd be true, but that's not the case. XOR coerces it's operands to boolean, while NEQ doesn't. cheers, barneyb On 11/3/05, Claude Schneegans [EMAIL PROTECTED] wrote: real world example where you would need a statement like this? Not really, actually, because (a XOR b) is equivalent to (a NEQ b) which is much more intuitive. -- Barney Boisvert [EMAIL PROTECTED] 360.319.6145 http://www.barneyb.com/ Got Gmail? I have 100 invites. ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:223132 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: XOR
And here I was hoping MOD would be next on the list. I find that to be fairly useful in regular coding for all sorts of things. -Justin -Original Message- From: Michael Dinowitz [mailto:[EMAIL PROTECTED] Sent: Thursday, November 03, 2005 5:32 PM To: CF-Talk Subject: Re: XOR That will be the next question. :) I've never had a need for it, but I've found imp to be useful sometimes. -Original Message- From: Michael Dinowitz [mailto:[EMAIL PROTECTED] Sent: Friday, 4 November 2005 11:00 a.m. To: CF-Talk Subject: XOR ColdFusion comparison statements (CFIF, etc.) support the XOR joiner between clauses. This is used as such: clause1 XOR clause2 This says that either clause1 or clause2 has to be true for the statement to be true. If both are true or both are false, then the entire statement is false. My question is: can anyone think of a real world example where you would need a statement like this? ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:223133 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: XOR
XOR coerces it's operands to boolean, while NEQ doesn't. Exact. But what I mean is that if someone has to use an XOR operator, the situation is actually a NEQ issue, he will think of NEQ first, and do what must be done to make sure both operands are boolean. -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:223134 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: XOR
cfif isSmoker XOR isBlueHair Winner! /cfif cfif not (isSmoker and isBlueHair) Winner! /cfif These two are not logically eqivalent. An Exclusive OR (XOR) follows a logic pattern like this: A | B | A XOR B 0 | 0 | 0 1 | 0 | 1 0 | 1 | 1 1 | 1 | 0 Hatton ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:223135 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: XOR
I already have examples of MOD in use. It's some of the rairer ones that I'd like different examples of and if they happen to be real examples, all the better. Anyone can make up an example such as the smoker/blue hair but showing a code snippet where it's actually in use brings the concept home a lot better. And here I was hoping MOD would be next on the list. I find that to be fairly useful in regular coding for all sorts of things. -Justin ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:223137 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: XOR
One of those all in the coding style situations. After all there are like a million ways to skin a cat. I have always wondered about XOR or the idea behind it because I have wondered on it in other languages and when/if people ever use it. On 11/3/05, Claude Schneegans [EMAIL PROTECTED] wrote: XOR coerces it's operands to boolean, while NEQ doesn't. Exact. But what I mean is that if someone has to use an XOR operator, the situation is actually a NEQ issue, he will think of NEQ first, and do what must be done to make sure both operands are boolean. -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:223155 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54