> I believe that someone once gave a presentation at one of the CFUGs about
> using bit masks, also know as Right Bit AND, to set up security access
> levels. This wasn't the same as the presentation at the Fig Leaf site
> that's slight more oriented towards hierarchy uses. I've looked
> at all the
> CFUG sites linked to from the Allaire site but I can't find the
> presentation. Does anyone recall where the presentation was made
> and/or how to get the presentation file?
I once did a presentation a long time ago for the Atlanta CFUG on a simple
security model that used bits in this fashion, but it was designed for
CF4.0, and has a few outdated syntax samples in it if you are using
something newer than 4.0. I'm emailing you a copy of it offlist. If anyone
else wants it, please let me know offlist.
Here's a bonus for working with bits... Slap the following code into a CFM
template, run it, and them print the output. I keep a copy of it on my
wall, and it really helps with remembering how the heck bit functions work
and where the positions are/start etc...
-Cameron
--------------------
Cameron Childress
elliptIQ Inc.
p.770.460.7277.232
f.770.460.0963
<!--- create the initial integers. Doing it this way helps you visualize
what your int looks like in binary form --->
<CFSET x = InputBaseN('00000000000000110000000000000001', 2)>
<CFSET y = InputBaseN('00111111111111111111100111111110', 2)>
<!--- position guide --->
10987654321098765432109876543210<BR>
<CFOUTPUT>
<!--- Read the bit values back out one by one to display the int in
binary --->
<CFLOOP INDEX="i" FROM="31" TO="0" STEP="-1">#BitMaskRead(x, i, 1)#</CFLOOP>
= x = (#x#)<BR>
<CFLOOP INDEX="i" FROM="31" TO="0" STEP="-1">#BitMaskRead(y, i, 1)#</CFLOOP>
= y = (#y#)<BR>
<BR>
<!--- Do different bit operations BitAnd(), BitOr, etc, and see what they do
to the values of the integers and bit positions. --->
<CFLOOP INDEX="i" FROM="31" TO="0" STEP="-1">#BitMaskRead(BitAnd(x, y), i,
1)#</CFLOOP> = BitAnd(x, y) = #BitAnd(x, y)#<BR>
<CFLOOP INDEX="i" FROM="31" TO="0" STEP="-1">#BitMaskRead(BitOr(x, y), i,
1)#</CFLOOP> = BitOr(x, y) = #BitOr(x, y)#<BR>
<CFLOOP INDEX="i" FROM="31" TO="0" STEP="-1">#BitMaskRead(BitXOr(x, y), i,
1)#</CFLOOP> = BitXOr(x, y) = #BitXOr(x, y)#<BR>
<CFLOOP INDEX="i" FROM="31" TO="0" STEP="-1">#BitMaskRead(BitNot(x), i,
1)#</CFLOOP> = BitNot(x) = #BitNot(x)#<BR>
<CFLOOP INDEX="i" FROM="31" TO="0" STEP="-1">#BitMaskRead(BitNot(y), i,
1)#</CFLOOP> = BitNot(y) = #BitNot(y)#<BR>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists