@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16



Comments:

<0> use Foo::Package qw(funcs that you want to use);
<1> ChillAxen- right, just clarifying, you have restaurants, and you want to allow each restaurant to define unlimited options?
<2> then a list of different types of music played there
<2> and thats just htis 1 table
<2> exactly
<1> all are true/false
<1> ?
<2> yup
<0> ChillAxen: one question
<3> ***ociative array, serialized?
<3> any objections?
<0> the bit order is based on the order of "options" presented
<2> im inputting a array of different TYPES that they either HAVE and DONT HAVE thus bools
<0> if , say, the second option in the list isremoved, what happens?
<1> jed, not easily searchable
<2> Two: im just setting it as "" then



<2> and it wont show to user
<0> the third option is still occupying the third bit. how would you go about reusing the second bit? or would it become dead?
<2> i can always do a m*** change
<2> i forgot the operator to use
<2> cause i didnt do bitwise comparisons in a LONG time
<2> to over-use it
<2> as i add a new one
<0> if you know a bit is set, you can unset it with xor ^
<2> such as i would change what was "" to the new one
<2> and just set all to 0
<2> i thought XOR but didnt know for sure so didnt want to say
<3> xor 0 will always unset a bit
<2> i havnt delt with XOR OR and AND since asm
<4> xor toggles
<2> and that was like 4 years ago
<0> jedzilla: no
<3> er, i'm backwards
<3> kicken is right, xor toggles
<4> & ~$whatever
<0> usually you'd xor the reuslt of &
<4> that unsets
<2> but none the less, ***uming i wanted to set the 2nd byte back to all 0 and XOR did work
<3> anything xor itself is 0
<0> kicken: eh?
<3> that's why you see "xor eax, eax" in ***embler so commonly
<3> because xor is cheaper than moving 0 into eax
<3> usually
<1> how about tables RESTAURANTS (restaurant_id, name, address, ...), OPTIONS (option_id, name), RESTAURANT_OPTIONS (option_id, restaurant_id, value)
<0> !php $bm = 201; $bm = $bm & ~64; echo decbin($bm);
<5> 10001001
<2> olinux: idk... im trying to limit table joins
<0> hrm
<4> Two-Bits using & ~$field will make the bits defined by $field zero
<2> cause if this site im coding it for grows HUGE
<2> with lots of traffic
<2> that would slow the database bad
<3> to always unset a bit, xor it with itself
<3> to always set a bit, or it with 1
<2> i mean, if possible, i would ***ume what im trying to do right now is by far the best way
<1> not properly indexed
<2> when speaking SQL seed
<2> speed
<0> jedzilla: xoring it with itself turns it on if it's off
<0> it doesn't alway unset
<4> jedzilla xor 0 is a noop
<3> something xor itself is always 0
<3> always
<4> xor 1 would only do something for be 1
<0> xor itself, yes
<0> but that's useless
<3> [18:05:01] <3> to always unset a bit, xor it with itself
<0> that's like anything minus itself is always 0
<0> pointless
<3> actually, it's speedy
<3> and if you ever break into ***embler, use it
<3> xoring a register with itself is a lot quicker than moving 0 into it
<0> if by "itself" you mean you have to get the actual value of the bit first, then that's what i said earlier about &ing first
<3> and 0 will always unset
<4> xor is only useful as a toggle
<4> if you want it to be 0, you should use & ~
<3> if you want to argue logistics



<3> and not? that's two logic operations
<4> so would xoring itself.
<0> the only problem i have with using & ~ is if you're using a language that differentiates ints and longs
<4> you'd have to make sure it's not on first.
<3> uh, no you don't
<4> yes you do
<4> or you'd turn it on, not off.
<3> !php $x = 5; $x ^= $x; print $x;
<5> 0
<4> That zero's everything
<3> !php $x = 0; $x ^= 0; print $x;
<4> not one specific bit
<5> 0
<0> !php $bm = 201; $bm = $bm ^ ($bm & 64); echo decbin($bm);
<5> 10001001
<0> that's what jed's saying
<0> use & to GET the bit, and xor it
<0> if it's on, it toggles. if it's off, it's noop
<3> !php $x = 3; print $x ^ 2;
<5> 1
<0> i find it to be safer too
<3> !php $x = 1; print $x ^ 2;
<5> 3
<4> see
<3> anything xor itself is still 0
<4> yes
<0> SO WHAT
<3> and it's something that ***embler still preaches heavily
<4> but we don't want that :)
<0> 1 ^ 2... there is no 2 bit set in 1
<0> so you're not unsetting it
<0> you're setting it
<3> you want a guaranteed unset, use AND 0 or XOR itself
<4> xor is only useful as a toggle, or to zero something in it's entirety
<3> you want a guaranteed set, OR 1
<3> ****s
<0> dammit jed, illustrate your "xor itself" with a bitmask and a bit
<3> i mean in its entirety
<0> we're using MASKS
<3> i know
<3> you think i can't read english or something?
<4> you said 'a bit' before.
<4> which is untrue
<0> we want to SET or UNSET individual bits IN the mask
<3> so i made a silly mistake about digital logic
<0> #@$^@#$^@
<0> digital!?
<3> the realm of which is limited to people who make IC chips and people who stupidly use bitmasks in databases
<3> notice s t u p i d l y
<0> this has nothing to do with databases
<3> yes, digital logic
<4> bitmasks are quite common in C.
<0> it's a sheer matter of how to set or unset bits in a bitmask
<3> there's usually a better way to do it, kicken
<3> i've been programming C longer than you've been alive and i've used maybe 2 bitmasks
<4> nice way to store several on/off options in a small space
<3> i know APIs love them
<3> but that's about it
<0> bitmasks are a wonderful way to handle this sort of thing as long as scalability is maintained from the beginning
<0> very fast, very memory efficient
<2> two-bits so what im trying to do is smarT?
<3> no, what you're trying to do is silly
<0> yes and no
<0> and dont listen to jed
<3> bitmasks in databases are stupid
<3> quite, quite stupid
<4> if ($num & 1){ } else { } is a faster way to do if ($num % 2){ } else { }
<3> and i believe i have been backed up on this from someone else
<0> sounds like an unsubstatiated zealot's rant
<3> and 1? the one bit would indicate odd
<4> I would use a bitmask in a db, but only if I knew it wouldn't be more than 32 bits
<3> you'd have to reverse your logic, they're not interchangable
<3> $num & 1 being true indicates an odd number


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #php
or
Go to some related logs:

#india
grils,sis
#kl
#india
thenostra
muhabbet.az
#php
#allnitecafe
#php
#chat-world



Home  |  disclaimer  |  contact  |  submit quotes