Tweets
Wednesday, November 02, 2005
Another Wacky way to Authenticate Users
Instead of a password, analyze how they type. This is about as cool, and as scary as the programs that can figure out your passwords by listening to the clicks on the board...
Tuesday, November 01, 2005
More ruby fun
Interleaving arrays together to form a super array. Kind of in reverse of what I need, but the yield comments made me thing about the idea that I could do something like
Which *seems* to work, albeit throwing complaints all the way. And it does the a,b;b,c;c,d sort of thing with a list...
class Array
def couple()
(length-1).times { |n| yield(at(n), at(n+1)) }
end
end
Which *seems* to work, albeit throwing complaints all the way. And it does the a,b;b,c;c,d sort of thing with a list...
Working in Ruby
So I'm working in ruby and I'd like to get the following from one list:
so either [a,b], [c,d],[e,f] as a list (which I l hate how the above destroys colors inside the loop
or
a,b ; b,c ; c,d ; d,e ; e,f as a list.
I did use the following for the second part:
Any hints,tips suggestions would be appreciated.
lines = %w{a b c d e f}
irb(main):211:0> colors = lines.clone
=> ["a", "b", "c", "d", "e", "f"]
irb(main):212:0> (1..colors.length/2).map {|z| [ colors.shift ] + [ colors.shift ] }
=> [["a", "b"], ["c", "d"], ["e", "f"]]
so either [a,b], [c,d],[e,f] as a list (which I l hate how the above destroys colors inside the loop
or
a,b ; b,c ; c,d ; d,e ; e,f as a list.
I did use the following for the second part:
colors[0..-2].zip(colors[1..-1])
Any hints,tips suggestions would be appreciated.
Subscribe to:
Posts (Atom)