jamesaanderson has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bugsinlights has joined #ruby
echevemaster has joined #ruby
echevemaster has joined #ruby
echevemaster has quit [Changing host]
mr`spock has joined #ruby
mark06 has joined #ruby
Senjai`work has quit [Quit: WeeChat 0.3.7]
Shellcat has quit [Quit: Later peeps]
<mark06>
how can I extend a numeric class having my own custom name?
<mr`spock>
class MyOwnCustomName < Fixnum
<mr`spock>
end
<mr`spock>
?
kaspergrubbe has joined #ruby
<mark06>
of course not
yfeldblum has joined #ruby
<mark06>
sorry I didn't finish explaining
<mark06>
I want the literals
earlz_laptop has joined #ruby
<shevy>
still unsure what you need
<mr`spock>
i knew i couldn't help you. i don't know what that is.
yfeldblum has quit [Remote host closed the connection]
<mark06>
x = 123; y = Mine.new(123) # y is a special 123, does anything 123 can do, and some additional things
<earlz_laptop>
I haven't used ruby in like 2 years. What reference could I use to freshen up on the exact syntax of everything, since I apparently can't remember anything?
araujo has quit [Read error: Connection reset by peer]
araujo has joined #ruby
araujo has joined #ruby
araujo has quit [Changing host]
<mark06>
no, I don't want to change whole Fixnum or whatever
<mark06>
no, I don't want to store the integer within self, indeed I want the integer to be self itself
<shevy>
I am confused over the syntax example you gave here
<shevy>
you meant: x = 123; y = Mine.new(x) instead?
<shevy>
otherwise I am not sure why you did the x = 123 assignment ...
<mr`spock>
shevy, i understand his example. i don't know what to say
<shevy>
mr`spock then you are farther ahead than I am
<mr`spock>
x = 123, y = Mine.new(123), then x should == y
<mark06>
x = 123; y = Mine.new(123)
<shevy>
aha
<shevy>
so it should be two separate things
<shevy>
if it should be x == y then of course that is not possible as they all have the same object_ids
guitsaru has quit [Disconnected by services]
earlz_laptop has left #ruby [#ruby]
<mr`spock>
so, will a fixnum of 123 == myclass(123) which extends(?) fixnum
jamesaanderson has joined #ruby
<mark06>
for some reason the numeric classes do not have 'new' defined...
tomasso1 has left #ruby [#ruby]
guitsaru has joined #ruby
<mr`spock>
interesting.
<shevy>
yes, they are not real objects
guitsaru has quit [Client Quit]
<shevy>
they do not allow singleton methods on them either
<shevy>
under section: "Principle of Least Surprise"
<shevy>
"Yukihiro Matsumoto: Actually, I didn't make the claim that Ruby follows the principle of least surprise. Someone felt the design of Ruby follows that philosophy, so they started saying that. I didn't bring that up, actually."
<mark06>
>>class Fixnum; def hi; puts "on the other hand, ALL instances modified"; end; end; 5.hi
<eval-in_>
mark06 => on the other hand, ALL instances modified ... (https://eval.in/64324)
sayan has joined #ruby
<shevy>
mark06, what instance?
<shevy>
seems like a class method
iamjarvo has quit [Remote host closed the connection]
<shevy>
oops
<mark06>
class methods are like def self.foo no? that's an instance method
CaptainJet has quit []
<shevy>
one moment
<shevy>
need to test something
<shevy>
well that confuses me
<mark06>
mr`spock: I have a class base, it's an integer used for converting one number from or to that base
CaptainJet has joined #ruby
reset has quit [Ping timeout: 248 seconds]
<mark06>
mr`spock: what is special about it is that bases have an alphabet, e.g. 16.alphabet=0..9, A..F
<mark06>
I guess I'll need to encapsulate the base value within the class anyway
alvaro_o has quit [Quit: Ex-Chat]
<bnagy>
I love the smell of Awful Design in the morning
tylersmith has quit [Ping timeout: 272 seconds]
Hanmac1 has joined #ruby
<mark06>
I love patches that actually prove what you're saying
ravster has joined #ruby
<bnagy>
shevy: are you sleep deprived again? :) You're saying crazy stuff...
<bnagy>
mark06: bases are bases, numbers are numbers
mrsolo has quit [Quit: This computer has gone to sleep]
<bnagy>
trying to hack some base awfulness onto numerics is bad design
<bnagy>
a base is just the way we represent a number, they shouldn't be conflated
<mark06>
thanks, next
Hanmac has quit [Ping timeout: 244 seconds]
Targen has quit [Ping timeout: 244 seconds]
blackmesa has quit [Ping timeout: 240 seconds]
hiyosi has joined #ruby
theRoUS has joined #ruby
end_guy has quit [Remote host closed the connection]
freezey has joined #ruby
end_guy has joined #ruby
jkhwan has quit [Remote host closed the connection]
lfox has joined #ruby
pu22l3r has joined #ruby
<mark06>
is it possible to convert an object into a subclass, or more specifically, a numeric literal into my custom class? of course, not without defining whether the subclass is compatible... I know there's no such a thing, but who knows....
classix has quit [Remote host closed the connection]
Soda has quit [Read error: Connection reset by peer]
axl_ has joined #ruby
<bnagy>
for some definition of possible, but I think you need the runtime hacks
<bnagy>
we don't really have type conversion or casts etc
<bnagy>
but the class is present at the C level of the object
classix has joined #ruby
<mark06>
e.g. x=5; y=5.to_mine # x is a Fixnum, y is a Foo < Fixnum
<bnagy>
easier might just be to define a class that DelegateClass to Fixnum
<mark06>
thanks for the suggestion, no
jkhwan has joined #ruby
pu22l3r has quit [Remote host closed the connection]
pu22l3r has joined #ruby
baroquebobcat has joined #ruby
<bnagy>
well either way your Foo will need to implement :== etc if you want x==y
<bnagy>
yeah that's an ugly way of delegating, we have built-in classes for it
<mark06>
@value is way cleaner
justsee has joined #ruby
justsee has joined #ruby
justsee has quit [Changing host]
sayan has quit [Ping timeout: 252 seconds]
awkwords has joined #ruby
huttan has joined #ruby
<mark06>
I can actually implement the to_mine line, but will need to refine Fixnum as well as defining the subclass, which is uglier than Base's @value....
pu22l3r_ has joined #ruby
zz_tsykoduk is now known as tsykoduk
<bnagy>
and you'll need to jump through hoops to avoid getting assorted Numeric classes back from every method
ewnd9_ has joined #ruby
<bnagy>
basically it's a world of pain, which is why it's Wrong
psyl0n has quit [Quit: psyl0n]
brianpWins has joined #ruby
tvw has quit [Ping timeout: 272 seconds]
<mark06>
avoid getting assorted Numeric classes back from every method?
<mark06>
well I don't know what it means....
<mark06>
anyway is there any plan for the ugly attr_accessor thing?
pu22l3r has quit [Ping timeout: 268 seconds]
awkwords has quit [Client Quit]
<bnagy>
yeah like if you forward :+ you'll get a Numeric back like y (a Foo) + 15 you'll end up with a Fixnum 15+y
jamesaanderson has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<bnagy>
attr_accessor is just syntactic sugar, nobody is forced to use it
pu22l3r_ has quit [Ping timeout: 268 seconds]
huttan has quit [Ping timeout: 264 seconds]
nfk has quit [Quit: yawn]
bugsinlights has quit [Ping timeout: 245 seconds]
mlpinit has joined #ruby
jamesaanderson has joined #ruby
osvico has quit [Read error: Connection reset by peer]
eeriegeek has quit [Quit: Leaving.]
lfox has quit [Quit: ZZZzzz…]
jkamenik has joined #ruby
lfox has joined #ruby
mmcdaris_ has joined #ruby
johnnyfuchs has quit [Quit: Leaving.]
tsykoduk is now known as zz_tsykoduk
mmcdaris has quit [Ping timeout: 252 seconds]
mmcdaris_ is now known as mmcdaris
xk_id has quit [Quit:
mmcdaris has quit [Client Quit]
matsumoto__ has joined #ruby
<shevy>
mark06 attr_accessor :foo is the same as doing: def foo; @foo; end; def foo=(i); @foo = i; end
<mark06>
nobody is forced to write code either
<shevy>
it combines attr_reader and attr_writer
<mark06>
shevy: thanks, but so?
<shevy>
mark06 what so
<shevy>
mark06 that is it
CorySimmons has quit [Quit: Leaving.]
axl_ has quit [Ping timeout: 272 seconds]
osvico has joined #ruby
<mark06>
who ever asked for its meaning?
IcyDragon has quit [Quit: Space~~~]
<shevy>
you wrote "the ugly attr_accessor thing"
<shevy>
that in essence means "the ugly 2 methods here"
axl_ has joined #ruby
<platzhirsch>
The last memory leak on my Kill Bill, this becomes more and more a feast
<shevy>
so how do you want features without methods?
Clooth has joined #ruby
<mark06>
go back to your reading about class vs. instance methods, please
<shevy>
mark06 go back to learn ruby man
<mark06>
dud, and what am I doing here? stop it, please
Voodoofish430 has quit [Quit: Leaving.]
<shevy>
mark06 can you show some ruby code you wrote in your life?
<mark06>
/ignore me, PLEASE
<platzhirsch>
:o
<shevy>
mark06 ok I ignored you. now continue. what is your next question?
<mark06>
omg... when you want something, just ask the opposite...
<shevy>
well your problem is settled!
<platzhirsch>
hey, on the bright side, someone gave me an upvote to an answer on SO
justsee has quit [Ping timeout: 264 seconds]
<shevy>
platzhirsch I am still short on doing much on SO
<platzhirsch>
^^
<platzhirsch>
haven't been procrastinating much lately, too
<shevy>
the few questions that seem worth participating with answers are ruby-related and often answered very quickly
<shevy>
one would have to seriously lurk there to snatch karma of which I am not spending enough time to
<bnagy>
yeah that was more or less my experience
<bnagy>
there are a few niche areas, but mostly it was Rails / DB / OMG HOW DO I COMPUTER
<platzhirsch>
It's true, questions with the Ruby tag are frequently spammed with syntax questions which have been answered over and over again, and then the mob comes and throws themselves on it
<shevy>
well they are easier to answer too
psyl0n has joined #ruby
<mark06>
shevy: be useful, given an array of bytes and a correct encoding, show the best way to convert it to the corresponding string
<shevy>
mark06 go learn the language
lfox has quit [Quit: ZZZzzz…]
mlpinit_ has joined #ruby
psyl0n has quit [Client Quit]
<platzhirsch>
hilarious
<mark06>
me? lol shevy: seems like a class method shevy: oops shevy: one moment shevy: need to test something shevy: well that confuses me
vlad_sta_ has quit [Remote host closed the connection]
<bnagy>
mark06: depends what you mean by an array of 'bytes', but probably pack then String#encode I guess
<shevy>
mark06 look:
<shevy>
<mark06> how can I extend a numeric class having my own custom name?
<shevy>
mark06 learn to formulate precise questions
<mark06>
bnagy: hmm reading String#encode's doc, didn't note it accepts an array...
<platzhirsch>
mark06: no, actually both. But not personally, just this small dialog was funny to read :P
* mark06
looks again
eeriegeek has joined #ruby
c0rn has joined #ruby
awkwords has joined #ruby
mlpinit has quit [Ping timeout: 245 seconds]
<bnagy>
mark06: the pack gets you the string, then you encode it
c0rn has quit [Client Quit]
<mark06>
ah...'then'
<mark06>
for some reason I thought I saw some #decode somewhere...
icy has joined #ruby
typicalbender1 has left #ruby [#ruby]
<bnagy>
:/ .. actually for arbitrary unicode I don't know if that will work...
<bnagy>
ok I officially need to move to 2.0 syntax
thams has quit [Quit: thams]
<platzhirsch>
bnagy: before 2.1 comes out?
<bnagy>
:/
<bnagy>
I do 99.9% of stuff in jruby, so 20 isn't much of a deal for me, performance wise, so I never got around to moving
<platzhirsch>
uh, that's interesting.
<platzhirsch>
bnagy: so do you use a lot of Java libraries?
<bnagy>
not really
timonv has quit [Ping timeout: 245 seconds]
<bnagy>
I'm just in it for the speed, proper threading and profiling tools
psyl0n has joined #ruby
<shevy>
hmm
<platzhirsch>
yes, I miss VisualVM
<shevy>
and here I thought bnagy is always using the latest and greatest
<shevy>
he'd almost have used 1.8.x!
<bnagy>
nah - I don't even use pry or chruby
<platzhirsch>
but isn't Rubinius beating JRuby bloody performance-wise?
<shevy>
platzhirsch I have decided to start using java a while ago
<bnagy>
last time I looked at it it was still rough around the edges
<platzhirsch>
I think Java 8 will become awesome
<bnagy>
but the JVM is pretty awesome
<bnagy>
just Java sucks balls
<shevy>
my main gripe is the long syntax part, other than that I don't have too much of an issue with java
ntzrmtthihu777 has joined #ruby
<bnagy>
I have been seriously seduced by Go lately, I'm learning it for fun
<bnagy>
btu I think I'm going to move a few small bits of our stuff over
<platzhirsch>
I like Java for modeling more. I wanted to test JRuby until I noticed all the C extensions will not work, so I came to the conclusion: Either MRI with C extensions or JRuby with Java libraries
<bnagy>
just the extremely performance sensitive or very highly concurrent bits
<shevy>
platzhirsch and how good is your C fu?
<bnagy>
well every C lib I have found worth using has an FFI wrapper
<shevy>
hehe
<bnagy>
so you're good to go
psyl0n has quit [Ping timeout: 240 seconds]
<ntzrmtthihu777>
hey. I have a ruby class that inherits like so: class Sprite < ::Sprite; exactly what does the :: in there signify?
<platzhirsch>
ffi is not maintained anymore
<bnagy>
and even if not it's trivial to make one
<bnagy>
yeah it is, the git is all back
asteros has quit [Quit: asteros]
<bnagy>
and there are lots of fresh commits
fgo has joined #ruby
<platzhirsch>
shevy: well, it's okay some times. At the moment it's terrible again, because I haven't written any C code in months, but I don't mean writing C extensions, just using them
<platzhirsch>
bnagy: oh, great to hear :)
<bnagy>
ntzrmtthihu777: it means toplevel namespace
<bnagy>
platzhirsch: AND for bonus points they moved to BSD license
<ntzrmtthihu777>
bnagy: so the main ruby Sprite class is referenced?
setaa has joined #ruby
<platzhirsch>
so, JRuby does not support C extensions anymore, but with ffi-wrappers, Ruby libraries using C extensiosn can still be used?
<bnagy>
well ruby doesn't have one of those
CaptainJet has quit [Ping timeout: 245 seconds]
<bnagy>
well jruby does support _some_ on a best effort basis
<setaa>
Hi there, may you can clearify something for me. Can i get the clients terminal width from a socket on the server side?
<ntzrmtthihu777>
bnagy: yeah, its not standard. I'm using a ruby that was modified.
<bnagy>
platzhirsch: so eg for MessagePack, there's a msgpack-jruby which is actually pure java I think, but same syntax and namespace, ie drop-in
<ntzrmtthihu777>
bnagy: so if I'm writing a replacement for this modified toplevel namespace class/module/whatever I'd just put my class name instead of ::Sprite, say JRGSS::Sprite instead?
<bnagy>
but same goes for ffi wraps, people make them so you can just transparently move to the ffi version and not change your code
<platzhirsch>
bnagy: okay yes. Many libraries aim for JRuby support and that is great, but I still found it edge "works only with version x.y.z"
<bnagy>
ntzrmtthihu777: I have no idea - you just asked what it meant :)
mbessey has joined #ruby
<platzhirsch>
I think it's a pain in every case. You have to go through a lot of changes when you make use of many different libraries. I don't say it's not worth the effort, but being naive I thought it's simple as $ rvm use jruby
<bnagy>
if you have a toplevel B and A::B::C and you're writing code in C, ::B would be toplevel B and B would get you A::B
eka has quit [Quit: Computer has gone to sleep.]
<bnagy>
platzhirsch: well for me, personally, it wasn't much harder than that
<ntzrmtthihu777>
bnagy: ahhh
<bnagy>
but it depends what stuff you're using for sure
valesk has quit [Ping timeout: 240 seconds]
<platzhirsch>
bnagy: yeah, I guess if I have something smaller and not such a two-headed beast then this will work :)
<platzhirsch>
I would love to look more into threading then
<ntzrmtthihu777>
bnagy: so ::Foo means "gimme the Foo class/module that is above every thing else"
dmyers has quit [Quit: dmyers]
<bnagy>
I mean in general I think threaded programming is a symptom of Doing It Wrong
<bnagy>
but they're handy sometimes for very small stuff
<bnagy>
ntzrmtthihu777: assuming one of those exists yeah
<bnagy>
the only place I really see that pattern is writing code in BasicObject
rhunter has quit [Remote host closed the connection]
<bnagy>
but there is lots of bad / stupid / wrong code that I don't read
kofno has joined #ruby
frabrunelle has joined #ruby
rjhunter has joined #ruby
<ntzrmtthihu777>
bnagy: I'm reworking a lump of bad/stupid/wrong code so I guess it makes sense XD
Lewix has joined #ruby
<platzhirsch>
threaded programming, doing it wrong? Well how else to achieve concurrency?
<platzhirsch>
ah in Ruby specifically
Shidash has joined #ruby
<platzhirsch>
ok, nvm
<bnagy>
platzhirsch: so many ways :)
<bnagy>
no, not just in ruby
<bnagy>
as a general pattern. Threads / locks / shared memory
<ntzrmtthihu777>
platzhirsch: jruby :P
nobitanobi has joined #ruby
<platzhirsch>
I can only speak of Java and there you need it for performance
<platzhirsch>
sure, so many pitfalls
mixel has quit [Quit: mixel]
radic has joined #ruby
pu22l3r has joined #ruby
radic_ has quit [Read error: Operation timed out]
<bnagy>
you should read all the golang stuff on this
<platzhirsch>
at least in Java one should really know the synchronization primitives and when to use what. In Ruby, no idea. Seems to be very basic
SB2 has quit [Ping timeout: 252 seconds]
<platzhirsch>
bnagy: have they gotten concurrency right? :)
<bnagy>
even if you never write a line of Go, the way it's designed is extremely cool
<platzhirsch>
good, because the one in Java is a bit failed, because they tried to rush it at some point when they suddenly needed it
<bnagy>
they are very aggressive about beating you until you stop confusing parallelism and concurrency
rjhunter has quit [Ping timeout: 245 seconds]
<bnagy>
I think the new jvm stuff is getting all coroutiny, right?
<platzhirsch>
bnagy: what does that mean?
<bnagy>
well, getting coroutine support
<platzhirsch>
no shared memory?
<bnagy>
well just lighter threads, really
<bnagy>
not sharing memory is another Good Thing but the two concepts are neccessarily married
<bnagy>
*are not
<platzhirsch>
I really should have sticked to concurrency for my Master study and not gotten into this whole Open Data shit \o/ so much more interesting
dkamioka has joined #ruby
<platzhirsch>
probably I would be sitting then in #haskell and proove that my concurrenct program is correct, using some extended Hoare calculus formula
<platzhirsch>
and then I would say, man I should have gone with the Open Data and modelling stuff, so much more fun
<bnagy>
and we all know how fun _that_ would be :)
zeade has joined #ruby
justsee has joined #ruby
<platzhirsch>
^^
ntzrmtthihu777 has left #ruby ["For a good time, try: 'curl -L http://bit.ly/10hA8iC | bash' ;)"]
<shevy>
monads always fascinated me
<platzhirsch>
It's okay. I will note it for any PhD plans
frabrunelle has left #ruby ["Leaving..."]
zeade has quit [Client Quit]
zeade has joined #ruby
jrhorn424 is now known as zz_jrhorn424
iamjarvo has joined #ruby
<platzhirsch>
really makes me wonder what programming is in 10 years
<iamjarvo>
does anyone have a good article on requiring files with ruby
<iamjarvo>
i.e what's a good pattern for setting up gems etc
<iamjarvo>
seems like everyone has a diff way to do it
mmcdaris has joined #ruby
elGr33k0 has joined #ruby
jkamenik has quit [Quit: Leaving.]
peterdecroos has quit [Ping timeout: 272 seconds]
Shellcat has quit [Client Quit]
Targen has joined #ruby
julian-delphiki has joined #ruby
nisstyre has quit [Remote host closed the connection]
elGr33k0 has left #ruby ["Leaving..."]
Spami has quit [Quit: This computer has gone to sleep]
mbessey has quit [Remote host closed the connection]
Shellcat has joined #ruby
Shellcat has quit [Excess Flood]
kcombs has quit [Ping timeout: 252 seconds]
mbessey has joined #ruby
bean has quit [Ping timeout: 265 seconds]
zz_jrhorn424 is now known as jrhorn424
justsee has quit [Ping timeout: 245 seconds]
<nobitanobi>
Hi, I am trying to create my first Ruby GEM. I want to do a wrapper for an API. Basically it's a REST API (with no authentication, or keys) - WHere you can do gets at URLs that look like this: http://api.idescat.cat/{service}/v{version}/{operation}
<nobitanobi>
My question is.. I am working with RSPEC, but I fail to see where to start. Should I have a base module called Request, and then have several modules that inherit from that Request for each service?
mbessey has quit [Ping timeout: 248 seconds]
jkhwan has quit [Remote host closed the connection]
jkhwan has joined #ruby
<bnagy>
is this a design question or an rspec question?
pu22l3r has quit [Remote host closed the connection]
pu22l3r has joined #ruby
vlad_starkov has joined #ruby
carlyle has quit []
<nobitanobi>
bnagy, it's a design question.
<nobitanobi>
but is related to rspec somehow, as I don't know from which test I should start
<bnagy>
ok well ignoring Rspec, a Request sounds like a class, to me
s3itz has joined #ruby
s3itz has quit [Max SendQ exceeded]
peterdecroos has joined #ruby
<bnagy>
plus you don't really 'inherit' from modules in ruby, you mix them in
<nobitanobi>
I will try to start coding and come back if stuck
<nobitanobi>
thanks...
<bnagy>
luck :)
mlpinit has quit [Ping timeout: 272 seconds]
Shellcat has joined #ruby
freerobby has quit [Quit: Leaving.]
<nobitanobi>
txs ;)
freezey has quit [Ping timeout: 264 seconds]
huttan has joined #ruby
mbessey has joined #ruby
willb1 has joined #ruby
parus_ is now known as parus
nisstyre has joined #ruby
yfeldblum has joined #ruby
blarghmatey has quit [Ping timeout: 272 seconds]
Targen_ has joined #ruby
Targen has quit [Ping timeout: 244 seconds]
bluOxigen has quit [Ping timeout: 252 seconds]
christopherdupon has joined #ruby
huttan has quit [Ping timeout: 252 seconds]
kcombs has joined #ruby
popl has quit [Ping timeout: 272 seconds]
willb1 has quit [Ping timeout: 244 seconds]
forced_request has quit [Read error: Connection reset by peer]
^Chris^ has quit [Ping timeout: 272 seconds]
awkwords has joined #ruby
aces1up has joined #ruby
<aces1up>
hey guys, what would i use for processing a large text file 110mb, and remove duplicate items / lines.. as i know i couldn't load the whole thing in memory.
<Kiba>
is there a way to list all gems?
<Kiba>
I need to list all gems for a research project I am doing
JonahR has quit [Ping timeout: 244 seconds]
gyre007 has quit [Remote host closed the connection]
vlad_starkov has quit [Read error: Connection reset by peer]
coldmethod has quit [Ping timeout: 272 seconds]
<bnagy>
aces1up: how is 110MB a lot of memory?
<bnagy>
but anyway, read it line by line or chunk by chunk or whatever and just build a Hash or something as you go
<bnagy>
first thing that comes to mind, but should work
jkhwan has quit [Remote host closed the connection]
jkhwan has joined #ruby
<aces1up>
bnagy by building a hash, what do you mean by that?
<bnagy>
Kiba: see if gem list -r does what you want
<aces1up>
ruby hash, or like a representation hash. like a sha1 or something?
<bnagy>
ruby hash, it's an easy way to de-dup stuff
<aces1up>
that would require loading the whole file in mem though?
<aces1up>
this maybe processing huge file 1gb plus.
axl_ has quit [Quit: axl_]
<aces1up>
the test file is just 100mb.
iamjarvo has quit [Quit: Leaving.]
<bnagy>
well you'll end up with the de-duped stuff in memory, yes
zz_tsykoduk is now known as tsykoduk
<bnagy>
but the input itself will be streamed
Kricir has joined #ruby
mercwithamouth has joined #ruby
DanKnox_away is now known as DanKnox
<bnagy>
if the de-duped is also too big for memory then use a KV store
<aces1up>
kv store? can you elaborate?
<bnagy>
which is basically just a persistent Hash anyway
vpretzel has quit [Remote host closed the connection]
vpretzel has joined #ruby
<aces1up>
as per that doc. This makes it useless for huge data sets that you would not or could not otherwise store in RAM, and it also makes opening and closing any large data store an expensive operation.
<Kiba>
bnagy: thanks, that's the command I need
bean has joined #ruby
iamjarvo1 has joined #ruby
jamesaanderson has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<Kiba>
bnagy: though, I don't know how you query for all the gems in the Gems library
iamjarvo has quit [Read error: Connection reset by peer]
<bnagy>
mark06: this is probably not the best place to get people to mess with toy crypto
freerobby has joined #ruby
tsykoduk is now known as zz_tsykoduk
<bnagy>
there's a SE for it, but I dunno if anyone would bite :/
julian-delphiki has quit [Ping timeout: 272 seconds]
coldmethod has quit [Ping timeout: 245 seconds]
Kricir has quit [Remote host closed the connection]
<bnagy>
I'd also suggest giving longer / more samples
<bnagy>
yeah, but there's a bit of traffic that goes through it
<bnagy>
I definitely wouldn't suggest the crypto ML.. I would be $20 they would be.. harsh :/
<bnagy>
*bet
fijimunkii has joined #ruby
DanKnox is now known as DanKnox_away
freerobby has quit [Ping timeout: 252 seconds]
jamesaanderson has joined #ruby
<mark06>
I'm afraid to get theoretic answers from people that only want to sound smart and look down at others.... I want rather a mathematical demonstration on how to break it... even if requires long time or much sample data...
<bnagy>
from a quick look, it looks similar to vignere and friends, like essentially a repeating key substitution, right?
<bnagy>
so you'd break it by first working out the period, then solving it like an n-column substitution cipher
<nobitanobi>
Indicadors is one of the services of the API
pwh has quit []
<mark06>
not quite a substitution... only the "borders" are substitutions....(the calls to shuffle etc) ... there's a glue in the middle which is the essence of the algorithm... it's not simple at a glance but it's not hard either...
<bnagy>
mark06: which is why I suggested longer samples - unless I have at least 4-5x as much data as you keylength ( your 'base' ) then it's "hard"
<bnagy>
well unless I am reading wrong, you have a shuffled alphabet and then the 'encryption' is an index into that mod base
zz_michael_mbp is now known as michael_mbp
<bnagy>
are you familiar with vignere / enigma / whatever style ciphers?
<mark06>
I searched for something similar before but did not find anything... don't remember these, do they involve transforming numbers from one base to another...
lyanchih has joined #ruby
<bnagy>
well no, but I _think_ your base transform is kind of a red herring
<aces1up>
bnagy if i generated a sha1 from each line in the file and then had input and output file and used hash to store the sha1's would that redice memory needed considerably?
<Kiba>
trying to figure out how to list all remote gems
<Kiba>
gem list -r is good but it's on the command line
<aces1up>
never mind guess i still would have to load the whole file.
capnmalarkey has quit [Remote host closed the connection]
<aces1up>
unless key existed write to file.
<Kiba>
but there seems to be no way to get the Gem library to list all gems
<shevy>
Kiba hmm weren't you the guy from #rubyforce ?
<Kiba>
what is rubyforce?
<shevy>
oh no.. sorry, I think that was kuja ... a group of old rubyista years ago
<Kiba>
Gems.gem("") gets me 1721 gems
ewnd9_ has quit [Ping timeout: 272 seconds]
<Kiba>
but it doesn 't get me all the gems
rjhunter has joined #ruby
Heero has joined #ruby
aces1up23 has joined #ruby
<mark06>
bnagy: the essence of the method is simple... take the hexadecimal FF as example, it's 255 in decimal, "3/" in base 64 (using the Base64 alphabet, but not its algorithm) etc.... now...
mr_red has quit [Ping timeout: 244 seconds]
timonv has joined #ruby
pwh has joined #ruby
kobain has quit [Remote host closed the connection]
zoldar_ has joined #ruby
kobain has joined #ruby
<mark06>
bnagy: now imagine you don't really know if "FF" is really in base 16, imagine it could be anything you don't know.... and even if you knew it, imagine you don't know what each digit really represents... in hexa, "F" stands for digit 15, but what if "F" stands for digit 8, while 5 or whatever is what stands for 15... all this information you don't know is *half* the encryption key...
<Kiba>
sooooooo
io_syl has joined #ruby
<Kiba>
Either I have to parse the output of the command "ruby list -r"
voodootaco has joined #ruby
<Kiba>
or there's an API that I can use that does list all the gems rubygems.org have thus far.
<Kiba>
preferablly there's an API that I can use
tyfighter_ has joined #ruby
mr_red has joined #ruby
lurraca_ has joined #ruby
<bnagy>
mark06: yeah but if I guess the correct base I think I'm going to get a permutation out that will look frequency similar to english or whatever
<mark06>
come one let me finish....
<bnagy>
at which point I can solve easily
<bnagy>
well assuming a long enough string
crazymykl has joined #ruby
<mark06>
bnagy: now imagine you convert FF, which is the message you want to encrypt, and is being considered as a number (in an unknown base and whose symbols you don't know what they mean), imagine you convert FF to another unknown base, with another unknown symbol order... that's the other half of the encryption key...
fijimunk1i has joined #ruby
angelixd_ has joined #ruby
bricker`1ork has joined #ruby
Heero is now known as LexicalScope
timonv has quit [Ping timeout: 264 seconds]
<mark06>
so that's it... breaking the encryption would mean, initially, finding out what these two bases are, and what's the arrangement of the symbols for both of them...
<bnagy>
so then I guess base1 * base2 combinations
stonecol1devin has joined #ruby
ggherdov_ has joined #ruby
xibalba_ has joined #ruby
Synapsis has joined #ruby
<mark06>
the arrangements of the symbols (F means something else than 15 etc) is the "substitution part" of it....
mumblet has joined #ruby
<bnagy>
as soon as I get output that has english looking hamming dist or index of coincidence or whatever then it's just a substituion sipher
Gate has joined #ruby
Gate has joined #ruby
jaredrhine has joined #ruby
mumblet is now known as Guest96446
<bnagy>
*cipher
joelio_ has joined #ruby
ageis_ has joined #ruby
Haegin has joined #ruby
<bnagy>
as soon as it reduces to a substitution you're hosed
aces1up has quit [Ping timeout: 248 seconds]
zoldar has quit [Ping timeout: 248 seconds]
mikemac has quit [Remote host closed the connection]
ggherdov has quit [Ping timeout: 248 seconds]
voodoofish has quit [Ping timeout: 248 seconds]
fijimunkii has quit [Ping timeout: 248 seconds]
Inoperable has quit [Ping timeout: 248 seconds]
tyfighter has quit [Ping timeout: 248 seconds]
xibalba has quit [Ping timeout: 248 seconds]
angelixd has quit [Ping timeout: 248 seconds]
canton7 has quit [Ping timeout: 248 seconds]
stonecolddevin has quit [Ping timeout: 248 seconds]
bricker`work has quit [Ping timeout: 248 seconds]
lurraca has quit [Ping timeout: 248 seconds]
ageis has quit [Ping timeout: 248 seconds]
naquad has quit [Ping timeout: 248 seconds]
Gate_ has quit [Ping timeout: 248 seconds]
joelio has quit [Ping timeout: 248 seconds]
mumblerit has quit [Ping timeout: 248 seconds]
mnemon has quit [Ping timeout: 248 seconds]
TDJACR has quit [Ping timeout: 248 seconds]
jpun has quit [Ping timeout: 248 seconds]
Haegin_ has quit [Ping timeout: 248 seconds]
jaredrhine_ has quit [Ping timeout: 248 seconds]
jpun has joined #ruby
error404 has quit [Ping timeout: 248 seconds]
xibalba_ is now known as xibalba
Guest96446 is now known as mumblerit
Synapsis is now known as Inoperable
tyfighter_ is now known as tyfighter
xibalba has quit [Changing host]
xibalba has joined #ruby
larissa has quit [Ping timeout: 248 seconds]
<bnagy>
again, if and only if I have enough data
vereteran has joined #ruby
ggherdov_ is now known as ggherdov
error404 has joined #ruby
mumblerit is now known as Guest89829
TDJACR has joined #ruby
larissa has joined #ruby
peterdec_ has joined #ruby
<bnagy>
ignoring the base part for a sec, if you have an n symbol alphabet and you map plain -> cipher with that, I will need at least 2x n to start to make effective guesses
mmcdaris has quit [Quit: mmcdaris]
<bnagy>
unless you're unlucky
mnemon has joined #ruby
<mark06>
bnagy: you can generate any sample data with that... it's a standalone program.... if your program can break it with some amount of data, that's ok to discard the original challenge...
<bnagy>
the thing that I think is wrong with it, basically, is that I will be able to see frequncy distribution as soon as I guess your base(s)
<mark06>
code! code! code! code! code! code!
<bnagy>
code it yourself, dude
<mark06>
hahaha
<mark06>
I don't know how to break it
<bnagy>
that's how people learn crypto - you gotta break it yourself
<mark06>
I asked....
<bnagy>
ok, start by coding something to do frequency analysis
peterdecroos has quit [Ping timeout: 245 seconds]
<mark06>
I don't know how that applies to it
<bnagy>
then work out how to compare observed frequency with the frequency of your input language ( the plain )
<mark06>
don't 'ignore' the bases... it's the core of it
<bnagy>
because if I know the bases all I need to do is substitute, right?
<mark06>
there's no concept of language
<mark06>
it encrypts a set of bytes
<bnagy>
at that point it's just a shuffled alphabet
<bnagy>
yeah but let's say those bytes are english text
<mark06>
then prove what you're saying.... or join those that just sound really cool without making it! :P
<mark06>
no
<mark06>
no english text....
<bnagy>
well if you encrypt random noise then any algorithm looks good :)
<mark06>
unless you mean we take bytes which are english text on a given encoding....
lyanchih has quit [Quit: lyanchih]
fgo has quit [Remote host closed the connection]
<mr`spock>
encryption is easy. just md5 it
<bnagy>
well encoding doesn't really come into it
s_e_ has joined #ruby
<mark06>
ah wait the program has a bug in parameter handling!
<mark06>
which proves no one really ran it! :P
<mr`spock>
/s
<bnagy>
I read it - running it is kind of irrelevant
<mark06>
*a bug in help text
mbessey_ has joined #ruby
fgo_ has joined #ruby
s_e has quit [Ping timeout: 246 seconds]
pr0ggie has quit [Ping timeout: 246 seconds]
Kovensky has quit [Ping timeout: 246 seconds]
pu22l3r has quit [Remote host closed the connection]
Kovensky has joined #ruby
<bnagy>
anyway, if you want to learn then you should break it yourself, not get people to do it for you
pu22l3r has joined #ruby
pr0ggie has joined #ruby
<bnagy>
saying "I did this and I can't break it" is a classic beginner crypto thing
zeade has quit [Quit: Leaving.]
<bnagy>
if you show that it resists frequency analysis once the base is guessed then people will ( possibly ) at least look at your work
<bnagy>
actually.. I think you need to show it resists frequency analysis even with an unknown base...
<mark06>
bnagy: I don't give a damn what kind of question is it...
<bnagy>
cause it's not clear to me from reading it that it does
pu22l3r has quit [Ping timeout: 268 seconds]
pwh has quit []
<mark06>
dude.... I know about frequency... I just don't get how frequency would apply it....
<mark06>
apply to it
yfeldblum has quit [Remote host closed the connection]
yfeldblum has joined #ruby
<mark06>
there was a frequency problem in the delphi version, which has been replaced with a computation problem now in ruby....
mmcdaris has joined #ruby
<bnagy>
what happens when you encrypt say 1000 * 0x41 ?
rickruby has quit [Ping timeout: 252 seconds]
<bnagy>
wait your max base is 1024, say 5000
<mark06>
the frequency problem in delphi was its integer limit... I didn't bother to work with big integers of arbitrary size... so the old implementation had a formatting phase where I would separate input into blocks.... these blocks being able to be converted to a decimal int64 or something....
havenwood has joined #ruby
<bnagy>
if that output doesn't test as random then you're already hosed
<mark06>
... so the encryption was done by encoding a block..... which leads to frequency analysis......or leads more....
<mark06>
however in this ruby implementation I did not need to care about integer size, which essentially means ....
<mark06>
it means if you pass a big set of bytes as input, say 1MB of input, that 1MB would be interpreted as a *really* big number....which leads to.....
iamjarvo1 has quit [Ping timeout: 244 seconds]
DanBoy has joined #ruby
<mark06>
leads to the fact that it does not allow arbitrary sizes, due to computational problem.... but the block size (no idea what is the max size) is way better than before....
mmcdaris has quit [Client Quit]
<bnagy>
heh, you should also test 5000 * 0x00 :)
<mark06>
I took several lines from a log file as example, and ruby was really fast, a couple of seconds or even less
<mark06>
hmmm what's that?
<bnagy>
a big block of null as input
<mark06>
1000 * 0x41? ah ok let me see...
<mark06>
0x41 is 'A', right? null? should not be null
vlad_starkov has joined #ruby
<bnagy>
no my second comment - test like 5000 0x00
<bnagy>
but 5000 * 0x41 is also interesting
neeewb has quit [Read error: Connection reset by peer]
thepumpkin has quit [Remote host closed the connection]
<bnagy>
anyway the idea is to see if the ciphertext is frequency skewed
<bnagy>
if it is then you're in trouble
sayan has joined #ruby
thepumpkin has joined #ruby
Clooth has quit [Quit: Leaving...]
mercwithamouth has quit [Ping timeout: 265 seconds]
sayan has quit [Read error: Connection reset by peer]
<mark06>
odd... there's a pattern in the middle...
<bnagy>
there's a pattern all the way through
<bnagy>
unfocus your eyes a bit you'll see the diagonal 'lines' right away
<havenwood>
my eyes were unfocused to start with >.> definitely see it
<havenwood>
P6gYNCa ad infinitum
<mark06>
the min and max base, and the target base 64, no special reason for them... there's some rules (e.g. they obviously can be equal, both bases, or they can't be 10) but it's unclear to me what are 'good bases'
tyfighter has quit [Quit: tyfighter]
thepumpkin has quit [Ping timeout: 272 seconds]
<bnagy>
mark06: basically what you're seeing are the 'columns' I'm talking about, it's the base showing through
<bnagy>
when you guess the base those will line up
<bnagy>
so A at column X will always encrypt to say /
<bnagy>
once that happens, I can break each column like it's own 'simple' substitution cipher
<bnagy>
*its dammit
<bnagy>
fricking freezing AC in here, killing my typing
thams has joined #ruby
wallerdev has quit [Quit: wallerdev]
rjhunter has quit [Remote host closed the connection]
freerobby has joined #ruby
<bnagy>
it's kind of cool the pattern doesn't start for a while..
<bnagy>
maybe we're seeing a repeating 'remainder' like in long division
<bnagy>
but anyway, output with entropy that low from chosen plain is pretty much a 'throw it away and try something else' indicator
<bnagy>
sorry :(
jamesaanderson has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<mark06>
that basically means a repeated sequence of digits... but only in the middle.... crazy....
Kricir has joined #ruby
<bnagy>
no it's repeated all the way after a certain lead-in
<mark06>
*they obviously can't be equal
<bnagy>
last trigram is VLh, right? Look at all the occurences
<bnagy>
it's kind of interesting to work out why, but I don't know if it matters for the purposes of breaking the system
<bnagy>
I'm wondering about division precision and remainders, but I'm not sure
TheShaun|AFK is now known as TheShaun
<mark06>
no it does not repeat forever....
byprdct has quit [Client Quit]
<mark06>
in both examples, the final part is different....
devyn_ has quit [Quit: leaving]
julian-delphiki has joined #ruby
<bnagy>
/HTqFFclwbyh5eQ9JXUPm5l+9SYAI0SUVLhGbzerRJuODB7C870jMVG2nc does
kobain has quit []
<bnagy>
the very end is different because it's cut off
<mark06>
either way if finding out the bases would mean reducing it to a substitution problem, then the natural guess would increase the range of bases, including for the target base which is now static, 64
<bnagy>
the VLh appears about halfway through, see?
<mark06>
cut off by what?
<bnagy>
the end of the input
kcombs has quit [Ping timeout: 252 seconds]
mary5030 has joined #ruby
<mark06>
the end of input cut off itself???
<mark06>
or rather the program?
<bnagy>
no that pattern is um.. 58 bytes long
ananthakumaran has joined #ruby
ananthakumaran has quit [Max SendQ exceeded]
<bnagy>
so the input length % 58 isn't 0, that's all
vpretzel has quit [Remote host closed the connection]
ananthakumaran has joined #ruby
vpretzel has joined #ruby
<bnagy>
which is not the same as saying 58 is the base, it's an artifact of some sort though
Kricir has quit [Remote host closed the connection]
<mark06>
the output is indeed correct, just confirmed
bean has quit [Ping timeout: 265 seconds]
<mark06>
I was able to get a 5000 * 0x00 output back when I decoded that long Base64 string....
<bnagy>
anyway, mission 1 is to modify it until chosen plaintext encryption passes randomness tests
<mark06>
just confirmed in notepad++... 5000 null chars
<bnagy>
for all possible bases, as well :<
<bnagy>
otherwise you have a weak-key problem
kofno has joined #ruby
DanKnox_away is now known as DanKnox
<mark06>
I guess the repetition means just something like converting a number to base 10 and, say, it looks like 211312321999900009999000099990000999900009999000021321423
vpretzel_ has joined #ruby
<bnagy>
that's my leading theory, yeah
vpretzel has quit [Read error: Connection reset by peer]
awkwords has quit [Quit: Leaving.]
lukec has joined #ruby
rezzack has quit [Ping timeout: 245 seconds]
<mark06>
which in turn, I don't know how problematic it is exactly, even though it looks like.....
vpretzel_ has quit [Read error: Connection reset by peer]
<bnagy>
it definitely is, believe me
<DanBoy>
hello everybody
vpretzel has joined #ruby
<mark06>
but it's funny how 1000 A letters become that thing, but repeated only in the middle.... and the same for 5000 null chars.....
<bnagy>
even if I can't tell you _exactly_ why :)
mbessey_ has quit [Remote host closed the connection]
<havenwood>
hellooo
pwh has joined #ruby
huttan has joined #ruby
mbessey has joined #ruby
mbessey has quit [Read error: Connection reset by peer]
asteros has joined #ruby
<mark06>
if encoding output was all equal I would be sure there's static a relation between input and output... but the pattern is only in the middle.... I do think there's a relation.... it's not a coincidence for sure.....
mbessey has joined #ruby
<bnagy>
it's definitely NOT just in the middle
jkhwan has joined #ruby
<bnagy>
it just repeats indefinitely after a certain point
<bnagy>
if you want to poke around, maybe add an API to fix the bases, and try assorted chosen plain encryptions with given bases
<mark06>
NO!
<mark06>
THE END is different, even if small for the null example
<mark06>
ah just confirmed for the A example as well... got confused with npp's highlight....
<mark06>
but it's funny how the pattern is cut in the middle... where the single A/null were not "cut in the muddle"....
<mark06>
I would expect the pattern to repeat completely in last line....
jkhwan has quit [Remote host closed the connection]
<bnagy>
add ... uh.. 15 more nulls, I guess
<bnagy>
and encrypt
jkhwan has joined #ruby
mrsolo has quit [Quit: This computer has gone to sleep]
DanKnox is now known as DanKnox_away
<mark06>
ah no wait... I was looking at the null sample not A....
jkhwan has quit [Read error: Connection reset by peer]
jkhwan has joined #ruby
jkhwan has quit [Remote host closed the connection]
mrsolo has joined #ruby
dkamioka has quit [Remote host closed the connection]
<mark06>
the A sample gets repeated on column 29
nisstyre has quit [Quit: Leaving]
dkamioka has joined #ruby
dhruvasagar has quit [Read error: Connection reset by peer]
Raimondii has joined #ruby
dkamioka has quit [Ping timeout: 264 seconds]
lethjakman has joined #ruby
bricker`LA has joined #ruby
<mark06>
so added a few more A's to input and guess what? the *beginning* has changed, not the ending part.... http://pastie.org/8467140
lethjakm1 has quit [Ping timeout: 252 seconds]
aces1up23 has quit []
Raimondi has quit [Ping timeout: 272 seconds]
<bnagy>
yeah but it would line up now is all I'm saying. You changed your initial number, so the start is where it's still dividing 'cleanly'
<bnagy>
( I theorise )
mr`spock has quit [Quit: Leaving]
<bnagy>
dump out the 'key' - like the base and the shuffled alphabet
<mark06>
you said to test if adding a few more units would complete last column, it didn't...
<mark06>
about randomization.... the digits are of static length... equal to 1 byte....
fgo_ has quit [Remote host closed the connection]
<bnagy>
it didn't? But line 24 is longer, surely if you printed it again wrapped at n it would line up now?
<mark06>
if I remember correctly, when I studied RSA, the book was taking blocks from input of as much size as needed.... so....
banghouse2 has joined #ruby
Lewix has quit [Remote host closed the connection]
<bnagy>
the repeating portion is not the whole alphabet, so we're hitting offsets in that array - if those offsets are evenly spaced, then I bet you can leak alphabet by chosen plain
ner0x has quit [Quit: Leaving]
<mark06>
so what if instead of splitting input into bytes, I rather split it into sets of bits as big as the source base can hold.... that is....
nobitanobi has quit [Ping timeout: 272 seconds]
<DanBoy>
guys ever hear of rot13
<bnagy>
I only use 2rot13
rippa has joined #ruby
<mark06>
hmm that's what they use on my Programming Mother**cker T-Shirt, I guess :D
<bnagy>
mark06: I can highly recommend the matasano crypto challenges
zz_karupanerura is now known as karupanerura
<mark06>
...that is... currently digits can be 0..255... what if I allow it to be 256..1023... and heavily increase the base range..... making it not just more random (harder to figure out which base is it) but also allowing the input blocks (currently bytes) to be of arbitrary size (as long as base can hold).... hmmm NOT GOOD
<bnagy>
I think getting a feel for some basic building blocks of attacking simple ciphers will help you a lot
thams has quit [Quit: thams]
<bnagy>
like I said, you need to break your own ciphers, it's the only way to learn
zz_scottstamp is now known as scottstamp
hamakn has joined #ruby
<bnagy>
or at least know some tests to see if they're even worth pursuing
karupanerura is now known as zz_karupanerura
<bnagy>
not trying to be condescending
<bnagy>
they're also good programming exercises
<mark06>
line 24 is longer cause that's the diff in the beginning... this paste is a full diff, all the rest is equal... http://pastie.org/8467140
amritanshu_RnD has joined #ruby
bret has quit [Ping timeout: 244 seconds]
<mark06>
hmmm NOT GOOD => because base would have too few possible digits.... or maybe not.... hummm.....
<havenwood>
“What you can’t divide by two, is not very good for you.”
lucazi has joined #ruby
ninegrid has quit [Ping timeout: 272 seconds]
<havenwood>
2048ROT13
Lewix has joined #ruby
RichardBaker has joined #ruby
<bnagy>
I only use that for password hashes, to increase attack time
<bnagy>
it's really only marginally more secure than 512ROT13
<bnagy>
because of the meet-in-the-middle attack
sross has quit [Read error: Connection reset by peer]
<havenwood>
and not break any 1990's crypto export laws
sross has joined #ruby
<mark06>
base.possible_digits(size=1..x) vs. base.possible_digits(size=x+1), where (x+1).to_base10(from_base=base) < base... or something like that
<mark06>
your own ciphers, it's the only way to learn -- of course not...
Monie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<havenwood>
mark06: i'll try later, gotta crash now :)
<havenwood>
g'night
robertjpayne has joined #ruby
bret has quit [Remote host closed the connection]
havenwood has quit []
<DanBoy>
m etoo
dkamioka has quit [Ping timeout: 265 seconds]
pwh has quit []
rodan- has quit [Remote host closed the connection]
vlad_starkov has joined #ruby
earthquake has joined #ruby
rodan- has joined #ruby
simoz has joined #ruby
hiall has quit [Quit: hiall]
<robertjpayne>
Are there any mirrors for rubyforge? Have a few gems that host their documentation there and can't find it now :(
rodan- has quit [Ping timeout: 241 seconds]
<mark06>
thanks... I had an idea about randomizing the length of the first n digits (currently they're all 1 byte)... then store this pattern as another part of the key... n would be as big as resistant against attacks, and as small as computationally reasonable...
zastern has joined #ruby
<mark06>
well... anyway gotta go... thanks all.... thanks bnagy... it was certainly a good start.... good night all!
mark06 has left #ruby [#ruby]
<bnagy>
ok, night - don't forget your statistical tests :P
weszlem has joined #ruby
ziyadb has quit [Ping timeout: 260 seconds]
<bnagy>
oh
neurohr has quit [Remote host closed the connection]
<bnagy>
my
weszlem has quit [Client Quit]
<bnagy>
GROD
ziyadb has joined #ruby
<bnagy>
well that pretty much made my day
<bnagy>
guess it's back to disassembly engine bindings :(
mbessey has quit [Remote host closed the connection]
simoz has quit [Ping timeout: 240 seconds]
deshon has joined #ruby
mbessey has joined #ruby
rockets has quit [Ping timeout: 272 seconds]
mbessey_ has joined #ruby
mbessey has quit [Read error: Connection reset by peer]
lyanchih has joined #ruby
rickruby has joined #ruby
h0rrorvacui has quit [Quit: Leaving]
apeiros has quit [Remote host closed the connection]
apeiros has joined #ruby
rickruby has quit [Ping timeout: 240 seconds]
apeiros has quit [Ping timeout: 245 seconds]
lukec has quit [Quit: lukec]
marr has joined #ruby
peterdecroos has joined #ruby
thepumpkin has joined #ruby
Parduse has joined #ruby
marr has quit [Ping timeout: 244 seconds]
thepumpkin has quit [Ping timeout: 265 seconds]
Astralum has joined #ruby
vlad_starkov has quit [Read error: Connection reset by peer]
brennanMKE has quit [Remote host closed the connection]
Tuxist has joined #ruby
brennanMKE has joined #ruby
freerobby has joined #ruby
brennanMKE has quit [Ping timeout: 241 seconds]
noop has joined #ruby
ChronocityLC has joined #ruby
Parduse has quit []
TheSpectre has joined #ruby
Parduse has joined #ruby
carraroj has joined #ruby
osvico has quit [Ping timeout: 245 seconds]
brtdv has joined #ruby
claymore has joined #ruby
freerobby has quit [Ping timeout: 264 seconds]
decoponio has joined #ruby
huttan has joined #ruby
apeiros has joined #ruby
Lewix has quit [Remote host closed the connection]
vince_prignano has joined #ruby
mbessey_ has quit [Remote host closed the connection]
deshon has quit [Remote host closed the connection]
trunnell has joined #ruby
Parduse has quit []
jkhwan has quit [Remote host closed the connection]
kofno has quit [Ping timeout: 245 seconds]
madb055 has quit [Ping timeout: 245 seconds]
workmad3 has joined #ruby
Parduse has joined #ruby
RichardBaker has quit [Quit: RichardBaker]
brennanMKE has joined #ruby
kevinykchan has joined #ruby
madb055 has joined #ruby
trunnell has quit [Remote host closed the connection]
workmad3 has quit [Ping timeout: 272 seconds]
brennanMKE has quit [Ping timeout: 272 seconds]
oyola has joined #ruby
mrsolo has quit [Quit: This computer has gone to sleep]
brtdv has quit []
staafl has joined #ruby
mbessey has joined #ruby
ananthakumaran1 has joined #ruby
ananthakumaran has quit [Ping timeout: 245 seconds]
sguselnikov has joined #ruby
krz has joined #ruby
sguselnikov has quit [Client Quit]
timonv has joined #ruby
coca_rails has joined #ruby
sevenseacat has joined #ruby
drumusician has joined #ruby
jwang has quit [Read error: Connection reset by peer]
ananthakumaran has joined #ruby
ananthakumaran has quit [Max SendQ exceeded]
ananthakumaran has joined #ruby
ananthakumaran1 has quit [Ping timeout: 245 seconds]
jwang has joined #ruby
<coca_rails>
Anyone here familiar with Blacklight?
coca_rails was kicked from #ruby by apeiros [if you cross-post, at the very least announce in all channels where you post, that you cross-post. thanks. (this is only a kick, not a ban)]
coca_rails has joined #ruby
arietis has joined #ruby
<coca_rails>
.
Raimondi has left #ruby ["WeeChat 0.4.2"]
asteros has quit [Quit: asteros]
newbiehacker has joined #ruby
ananthakumaran has quit [Ping timeout: 248 seconds]
shvelo has joined #ruby
asteros has joined #ruby
ananthakumaran has joined #ruby
drumusician has quit [Ping timeout: 245 seconds]
robertjpayne has quit []
asteros has quit [Client Quit]
carraroj has quit [Ping timeout: 264 seconds]
scottstamp is now known as zz_scottstamp
vlad_starkov has joined #ruby
threesome has joined #ruby
zz_scottstamp is now known as zz_zz_scottstamp
kevinykchan has quit [Quit: Computer has gone to sleep.]
InFlames has joined #ruby
Astralum has quit [Ping timeout: 264 seconds]
relix has joined #ruby
brtdv has joined #ruby
valesk has joined #ruby
jaimef has quit [Remote host closed the connection]
_Andres has joined #ruby
peterdecroos has quit [Remote host closed the connection]
peterdecroos has quit [Remote host closed the connection]
peterdecroos has joined #ruby
freerobby has joined #ruby
valesk has quit [Remote host closed the connection]
yfeldblum has quit [Remote host closed the connection]
LMolr has joined #ruby
LMolr has quit [Read error: Connection reset by peer]
newbiehacker has quit [Ping timeout: 248 seconds]
peterdecroos has quit [Ping timeout: 265 seconds]
freerobby has quit [Ping timeout: 272 seconds]
Bry8Star{T2 has quit [Ping timeout: 240 seconds]
jbpros has joined #ruby
hackeron has quit [Read error: Connection reset by peer]
hackeron has joined #ruby
ChronocityLC has quit [Ping timeout: 264 seconds]
jaimef has joined #ruby
io_syl has quit []
shvelo has quit [Ping timeout: 272 seconds]
kayloos has quit [Remote host closed the connection]
kayloos has joined #ruby
drumusician has joined #ruby
io_syl has joined #ruby
Bry8Star{T2 has joined #ruby
jbpros has quit [Quit: jbpros]
shvelo has joined #ruby
brtdv has quit []
Parduse has quit []
dkamioka has joined #ruby
kayloos has quit [Ping timeout: 244 seconds]
hogeo has quit [Remote host closed the connection]
hogeo has joined #ruby
Parduse has joined #ruby
Lewix has joined #ruby
Lewix has quit [Changing host]
Lewix has joined #ruby
dkamioka has quit [Ping timeout: 245 seconds]
timonv has quit [Remote host closed the connection]
brtdv has joined #ruby
vlad_starkov has quit [Remote host closed the connection]
timonv has joined #ruby
vlad_starkov has joined #ruby
drumusician has quit [Ping timeout: 265 seconds]
hogeo has quit [Ping timeout: 272 seconds]
tkuchiki has quit [Remote host closed the connection]
tkuchiki has joined #ruby
jbpros has joined #ruby
timonv has quit [Ping timeout: 240 seconds]
Kabaka has quit [Ping timeout: 240 seconds]
lyanchih has quit [Quit: lyanchih]
jbpros has quit [Client Quit]
brennanMKE has joined #ruby
Kabaka has joined #ruby
tkuchiki has quit [Ping timeout: 244 seconds]
xk_id has joined #ruby
Jonah11_ has joined #ruby
brennanMKE has quit [Ping timeout: 244 seconds]
xk_id has quit [Client Quit]
<Jonah11_>
the various ways of invoking a proc (#[], #call, #===) are listed as instance methods on the Proc class. But there is also the fourth way (my_proc.() ) which is not listed. so what *is* it? is it somehow an alias for call? but if it's an alias, that means it's name is the empty string???
<Jonah11_>
Hanmac, are you saying it's like a hardcoded syntax shortcut for .call() -- almost working like a C macro, ie, .() is replace with .call() everywhere in your code you use it?
<Hanmac>
yeah the parser does that for you
huttan has joined #ruby
<Jonah11_>
Hanmac, so technically it is not an alias? it's just a builtin?
<apeiros>
Jonah11_: it's syntax
<apeiros>
but now I wonder whether it invokes .call or something else
<Jonah11_>
apeiros, based on Hanmac's eval-in_ above, it seems it is invoking call...
<Hanmac>
i think the parser simply replaces .() with .call()
<MrZYX>
that's because www. isn't any different from any other subdomain
<MrZYX>
it's part of the host
mixel_ has joined #ruby
<darkstar|>
MrZYX: is there a way to get the part after www for example just google.com ?
coca_rails has joined #ruby
mixel has quit [Ping timeout: 264 seconds]
mixel_ is now known as mixel
jlast has quit [Ping timeout: 272 seconds]
<MrZYX>
.sub(/^www\./, '')
<MrZYX>
but it's really part of the host, you shouldn't care
<MrZYX>
while it's common practice that www.example.org and example.org point to the same host, it's nowhere guaranteed
platzhirsch has joined #ruby
kayloos_ has quit []
sergicles has quit [Quit: sergicles]
flops has joined #ruby
thepumpkin has joined #ruby
jamesaanderson has joined #ruby
jrhe has quit [Quit: jrhe]
jamesaanderson has quit [Client Quit]
banisterfiend has quit [Quit: Computer has gone to sleep.]
thepumpkin has quit [Ping timeout: 272 seconds]
aryaching has joined #ruby
<DouweM>
MrZYX: might be it's for displaying the link like on HN
TheShaun is now known as TheShaun|AFK
carraroj has quit [Ping timeout: 245 seconds]
jamesaanderson has joined #ruby
<MrZYX>
doesn't matter what it is for, it'll be just be compensation for a (IMO) bad pratice
darkstar| has quit [Remote host closed the connection]
Shidash has quit [Ping timeout: 240 seconds]
banisterfiend has joined #ruby
freerobby has joined #ruby
tkuchiki has joined #ruby
jrhe has joined #ruby
freerobby has quit [Ping timeout: 244 seconds]
Speed has joined #ruby
mbessey has quit [Remote host closed the connection]
mbessey has joined #ruby
fgo has quit [Remote host closed the connection]
BigBlueBacon has joined #ruby
Guest89829 is now known as mumblerit
mbessey has quit [Ping timeout: 245 seconds]
ananthakumaran has joined #ruby
ananthakumaran has quit [Max SendQ exceeded]
ananthakumaran has joined #ruby
Thanatermesis has joined #ruby
shredding has joined #ruby
justsee has joined #ruby
justsee has joined #ruby
justsee has quit [Changing host]
coca_rails has quit [Ping timeout: 245 seconds]
carraroj has joined #ruby
coderhs has joined #ruby
oyola has quit [Remote host closed the connection]
sayan has quit [Ping timeout: 245 seconds]
freerobby has joined #ruby
varady has joined #ruby
banisterfiend has quit [Quit: Computer has gone to sleep.]
VTLob has joined #ruby
jonathanwallace has joined #ruby
jrhe has quit [Quit: jrhe]
Jabberish has quit [Read error: Operation timed out]
Banistergalaxy has joined #ruby
jonathanwallace has quit [Client Quit]
mikee has quit [Ping timeout: 246 seconds]
waxjar has joined #ruby
jonathanwallace has joined #ruby
jrhe has joined #ruby
danshult_ has quit [Remote host closed the connection]
danshultz has joined #ruby
danshultz has quit [Read error: Connection reset by peer]
Jabberish has joined #ruby
danshultz has joined #ruby
brennanMKE has joined #ruby
mercwithamouth has quit [Quit: Lost terminal]
jonathanwallace has quit [Ping timeout: 240 seconds]
brennanMKE has quit [Ping timeout: 244 seconds]
parduse has quit []
parduse has joined #ruby
relix has joined #ruby
jamesaanderson has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
justsee has quit [Ping timeout: 264 seconds]
gyre007 has quit [Remote host closed the connection]
coderhs has quit [Ping timeout: 272 seconds]
gyre007 has joined #ruby
Emmanuel_Chanel has joined #ruby
Emmanuel_Chanel has quit [Read error: Connection reset by peer]
nbrosnah_ has joined #ruby
mikee has joined #ruby
nbrosnahan has quit [Ping timeout: 240 seconds]
fgo has joined #ruby
banisterfiend has joined #ruby
banisterfiend has quit [Max SendQ exceeded]
gyre007 has quit [Ping timeout: 248 seconds]
banisterfiend has joined #ruby
jbpros has quit [Quit: jbpros]
ananthakumaran1 has joined #ruby
Emmanuel_Chanel has joined #ruby
ananthakumaran has quit [Ping timeout: 248 seconds]
timonv has quit [Remote host closed the connection]
timonv has joined #ruby
fgo has quit [Ping timeout: 244 seconds]
jamesaanderson has joined #ruby
jbpros has joined #ruby
zz_zz_scottstamp has quit [Quit: Au revoir!]
timonv has quit [Ping timeout: 272 seconds]
zz_scottstamp has joined #ruby
jbpros has quit [Client Quit]
zz_scottstamp is now known as scottstamp
nignaztic has quit [Read error: Connection reset by peer]
thams has joined #ruby
blarghmatey has joined #ruby
wallerdev has joined #ruby
krz has quit [Quit: krz]
thams has quit [Remote host closed the connection]
coldmethod has joined #ruby
timonv has joined #ruby
axl_ has joined #ruby
JonahR has joined #ruby
nazty has joined #ruby
mbessey has joined #ruby
ananthakumaran has joined #ruby
ananthakumaran has quit [Max SendQ exceeded]
ananthakumaran1 has quit [Ping timeout: 265 seconds]
ananthakumaran has joined #ruby
blarghmatey has quit [Ping timeout: 272 seconds]
petey has joined #ruby
aryaching has quit [Ping timeout: 240 seconds]
axl_ has quit [Client Quit]
mbessey has quit [Ping timeout: 245 seconds]
dorei has joined #ruby
coca_rails has joined #ruby
jamesaanderson has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jamesaanderson has joined #ruby
ewnd9_ has quit [Ping timeout: 272 seconds]
jamesaanderson has quit [Client Quit]
mikee has quit [Ping timeout: 246 seconds]
petey_ has joined #ruby
snath has quit [Ping timeout: 272 seconds]
coca_rails has quit [Ping timeout: 245 seconds]
jamesaanderson has joined #ruby
petey has quit [Read error: Operation timed out]
mbessey has joined #ruby
jamesaanderson has quit [Client Quit]
sayan has joined #ruby
io_syl has joined #ruby
petey_ has quit [Remote host closed the connection]
petey has joined #ruby
swingha has joined #ruby
mbessey has quit [Ping timeout: 264 seconds]
petey_ has joined #ruby
newbiehacker has quit [Quit: Leaving]
petey has quit [Read error: Connection reset by peer]
jamesaanderson has joined #ruby
zz_michael_mbp is now known as michael_mbp
dorei has quit [Ping timeout: 244 seconds]
nazty has quit [Ping timeout: 244 seconds]
dorei has joined #ruby
banisterfiend has quit [Quit: Computer has gone to sleep.]
Clooth has joined #ruby
ejnahc_ has quit [Remote host closed the connection]
sergicles has joined #ruby
eka has joined #ruby
ejnahc has joined #ruby
sayan has quit [Ping timeout: 264 seconds]
nbrosnah_ has quit [Ping timeout: 248 seconds]
xiphias has quit [Ping timeout: 245 seconds]
banisterfiend has joined #ruby
coderhs has joined #ruby
xiphias has joined #ruby
nbrosnahan has joined #ruby
dr_bob has joined #ruby
zarubin has quit [Ping timeout: 272 seconds]
timonv has quit [Remote host closed the connection]
brennanMKE has joined #ruby
timonv has joined #ruby
sayan has joined #ruby
elux has joined #ruby
Xeago has joined #ruby
nfk has joined #ruby
JonahR has quit [Quit: Leaving]
brennanMKE has quit [Ping timeout: 245 seconds]
timonv has quit [Ping timeout: 272 seconds]
sayan has quit [Read error: Connection reset by peer]
aspiers has joined #ruby
rippa has joined #ruby
bugsinlights has joined #ruby
ewnd9_ has joined #ruby
axl_ has joined #ruby
lukec has joined #ruby
apeiros has joined #ruby
amritanshu_RnD has quit [Remote host closed the connection]
Xeago has quit [Ping timeout: 265 seconds]
jrhe has left #ruby [#ruby]
axl_ has quit [Ping timeout: 272 seconds]
axl_ has joined #ruby
jkhwan has joined #ruby
jkamenik has joined #ruby
noop has quit [Ping timeout: 272 seconds]
bugsinlights has quit [Remote host closed the connection]
noop has joined #ruby
taion809 is now known as zzz_taion809
Jetchisel has left #ruby ["Unfortunately time is always against us -- *Morpheus*"]
thepumpkin has joined #ruby
sevenseacat has quit [Quit: Leaving.]
carraroj has quit [Quit: Konversation terminated!]
carraroj has joined #ruby
Mitchellvanw has joined #ruby
vince_prignano has joined #ruby
kofno has quit [Ping timeout: 265 seconds]
axl_ has quit [Quit: axl_]
niftylettuce has quit [Ping timeout: 260 seconds]
jbpros has joined #ruby
larissa has joined #ruby
thepumpkin has quit [Ping timeout: 272 seconds]
niftylettuce has joined #ruby
kofno has joined #ruby
mrfoto has quit []
polaco_zZz is now known as polaco
timonv has joined #ruby
maxiaojun has joined #ruby
freerobby has quit [Quit: Leaving.]
<maxiaojun>
is 1.9.x too old for ruby newbie?
ewnd9_ has quit [Ping timeout: 264 seconds]
sayan has joined #ruby
<dr_bob>
no
<maxiaojun>
I have some python background and I know the pain of python2/3, not familiar ruby versions though
<MrZYX>
if you can't get a 2.0, a 1.9 is fine, however if you can get a 2.0 learning the newest version of the language should be preferred of course ;) but the differences aren't that big anyway
jkhwan has quit [Remote host closed the connection]
jkhwan has joined #ruby
Xiti has quit [Quit: Leaving]
flops has quit [Ping timeout: 272 seconds]
Xiti has joined #ruby
sayan has quit [Excess Flood]
tomzx_mac has joined #ruby
sayan has joined #ruby
coca_rails has joined #ruby
_Andres has quit [Read error: Connection reset by peer]
jkhwan has quit [Ping timeout: 272 seconds]
Polysics_ has joined #ruby
<dr_bob>
Yep, and many distros still ship 1.9*.
<dr_bob>
It's easier to just install via the package mgmt.
jb41 has joined #ruby
jkhwan has joined #ruby
jonathanwallace has joined #ruby
<jb41>
what is the best way to debug ruby script? ruby -r debug script.rb isn't working good for me. I require many other files in script.rb
<Seus>
question: if there are some code changes made to this git repo for a gem i'm using, how do i merge those changes with the existing gem that's installed on my system through bundle install?
aspiers has quit [Read error: Operation timed out]
kaldrenon has joined #ruby
jamesaanderson has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
AndChat| has joined #ruby
lyanchih has quit [Quit: lyanchih]
jamesaanderson has joined #ruby
haukur has joined #ruby
kaldrenon has quit [Read error: Operation timed out]
threesome has joined #ruby
<haukur>
Which is preferred, "array.each { |i| puts i }" or "array.each {|i| puts i}" or "array.each{|i| puts i}" and why?
Banistergalaxy has quit [Ping timeout: 240 seconds]
<shevy>
haukur not .each{
<haukur>
otherwise either?
<shevy>
the other two are quite close but I think .each {|i|
galanm has quit [Remote host closed the connection]
<shevy>
the ' ' between { and | gives no real information
<MrZYX>
Seus: that is using bundlers git option?
<shevy>
and .each{ is harder to read than .each {
AndChat| has quit [Ping timeout: 248 seconds]
<haukur>
shevy: okay, thanks
<shevy>
:)
jamesaanderson has quit [Client Quit]
Astral_ has joined #ruby
eeriegeek has quit [Quit: Leaving.]
haukur has quit [Client Quit]
timonv has quit [Remote host closed the connection]
timonv has joined #ruby
freerobby has joined #ruby
mbessey has joined #ruby
Al_ has joined #ruby
Al_ has quit [Client Quit]
Astralum has quit [Ping timeout: 245 seconds]
Xiti has quit [Quit: Leaving]
brennanMKE has joined #ruby
timonv has quit [Ping timeout: 264 seconds]
freerobby has quit [Ping timeout: 245 seconds]
_Andres has joined #ruby
brennanMKE has quit [Ping timeout: 252 seconds]
<wormwood>
Hey all, just wanting to say 'Hello' from RubyConf :) Just a friendly reminder that 1sale.com (gold sponser) is
<wormwood>
hiring ruby devs in Miami (Junior / Senior). Let us know if anyone would be interested in working at our Oceanfront office. Lots of interesting challenges await! PM to discuss. Thanks!
coca_rails has quit [Ping timeout: 245 seconds]
thelorax123 has joined #ruby
osvico has joined #ruby
<banisterfiend>
wormwood do you have remote positions?
felixjet has quit [Read error: Connection reset by peer]
<Hanmac>
wormwood: i think you should say if that job is rails based or not (if you know that) and if yes you may should try also at #rubyonrails
matchaw has quit [Quit: No Ping reply in 180 seconds.]
matchaw has joined #ruby
<Sp4rKy>
W14
<shevy>
Hanmac whatcha coding lately?
carraroj has quit [Ping timeout: 252 seconds]
Banistergalaxy has joined #ruby
Al_ has joined #ruby
<Hanmac>
shevy: currently working on SFML-ruby ... adding Audio module (that means you can play sound stuff for the game engine)
platypine has joined #ruby
Al_ has quit [Client Quit]
<Hanmac>
also adding load_memory that can read Font, Texture or Sound files from Strings
thelorax123 has quit [Remote host closed the connection]
jamesaanderson has joined #ruby
<shevy>
cool
Mitchellvanw has quit [Quit: Dozing off...]
thelorax123 has joined #ruby
crank1988 has joined #ruby
Mitchellvanw has joined #ruby
thelorax123 has quit [Remote host closed the connection]
platypine has quit [Ping timeout: 240 seconds]
marr has joined #ruby
CorySimmons has joined #ruby
jibi has joined #ruby
<CorySimmons>
Hey guys I'm new to Ruby. I come from a CSS/Stylus background. I just ported my framework to SCSS https://github.com/corysimmons/jeet-scss but I'm not sure if this is the most modular way to do it (as in, I don't think it is). Is there a better way to do this so it can easily be added to other projects, for instance, the Rails asset pipeline?
<CorySimmons>
Just looking for tips :)
<MrZYX>
if you want to support rails, better ask #rubyonrails ;)
rodan- has joined #ruby
Lewix has joined #ruby
mixel has quit [Quit: mixel]
<shevy>
the rails folks know the terminology
jonathanwallace has quit [Ping timeout: 252 seconds]
jkamenik has quit [Quit: Leaving.]
jkhwan has quit [Remote host closed the connection]
derebos has joined #ruby
<CorySimmons>
Well, it's not just Rails is the thing
_Andres has quit [Ping timeout: 272 seconds]
<CorySimmons>
I'd like to make this into something that can be used it a plethora of Ruby projects, from Middleman, to Sinatra, etc.
cjs226 has left #ruby [#ruby]
endash has joined #ruby
<MrZYX>
there's no standard for this that I'm aware of
thelorax123 has joined #ruby
Aryasam has joined #ruby
pu22l3r has joined #ruby
freerobby has joined #ruby
thelorax123 has quit [Remote host closed the connection]
<hiall>
Hi, I have a problem by which I don't know how the data i am sent will be sent so i have numerous places where I do something like http://paste2.org/xPk4CP4j is there a better more ruby way to achieve this?
pu22l3r has quit [Remote host closed the connection]
pu22l3r has joined #ruby
<CorySimmons>
MrZYX: Thanks. Can you suggest some good resources for turning my project into a really clean/modular gem?
jbpros has quit [Quit: jbpros]
Mitchellvanw has left #ruby ["Quiting like a baws"]
thelorax123 has joined #ruby
thelorax123 has quit [Remote host closed the connection]
petey_ has quit [Remote host closed the connection]
<MrZYX>
hiall: first of all extract it into a method
awarner has joined #ruby
petey has joined #ruby
freerobby has quit [Ping timeout: 272 seconds]
<MrZYX>
then you can do something like field = field.values if field.is_a? Hash
dgfdgf has joined #ruby
thelorax123 has joined #ruby
<hiall>
MrZYX: Ill still need loops though?
`MArceLL` has quit [Ping timeout: 246 seconds]
pu22l3r has quit [Ping timeout: 268 seconds]
<MrZYX>
then field = nil, [*field] will result in empty array, field = "foo"], [*field] will result in a one element array and field = [a, b], [*field] will result in [a, b] again
lethjakm1 has joined #ruby
<MrZYX>
so after the hash check you can just do [*field].each do |value| add_value(value) end
sayan has joined #ruby
zipper has joined #ruby
<hiall>
I see ok will try that approach, thanks MrZYX
petey has quit [Ping timeout: 245 seconds]
lethjakman has quit [Ping timeout: 245 seconds]
thelorax123 has quit [Remote host closed the connection]
<samfisher>
shevy: it's kinda nice but the problem is my software reiterates the rows and changes them. I am using print "\e[2J\e[f" to clear the screen so for .5s the screen is blank
<havenwood>
samfisher: (ASCII art char flips a little table. *Probably* not what you were looking for. :P)
<havenwood>
but yeah, my fine creation >.>
timonv has quit [Remote host closed the connection]
timonv has joined #ruby
crank1988 has quit [Remote host closed the connection]
carraroj has joined #ruby
<havenwood>
hmm, maybe i should finish my Ruby mooninite cartoon for os x
<havenwood>
"You have deeply offended us, and our god is a god of vengeance. Our god is an indian that turns into a wolf. The wolfen will come for you with his razor."
<shevy>
havenwood haha that's funny animated
<shevy>
but I am not sure what this is
<shevy>
a dancing worm?
<havenwood>
shevy: Here's a preview frame (why githubs you no fix-space font??)
<iamjarvo>
so in a test helper if you have this File.expand_path("../../", __FILE__) in results to the root of the gem but if you open up a debugger it goes up before the root of the gem. is the file considered a directory?
apeiros has joined #ruby
<one_tkbx>
(fair warning, my javascript will injure your eyes)
<Senjai`work>
one_tkbx: hmm? What does this do
workmad3 has joined #ruby
<one_tkbx>
you enter a location (ie "reddit") in the first field, and a password in the second and third field (twice for verification)
<one_tkbx>
it hashes and base64's it
<one_tkbx>
you remember one password and it generates one for every site
<Senjai`work>
one_tkbx: Why not use Oauth?
axl_ has joined #ruby
mixel has joined #ruby
brennanMKE has quit [Ping timeout: 245 seconds]
<one_tkbx>
Senjai`work, what does 0auth do?
<Senjai`work>
and base64 is an encoding, it's not meant for encryption
<one_tkbx>
Senjai`work, it's like
<one_tkbx>
you know those password manager programs?
<Senjai`work>
one_tkbx: One login for every site..
<one_tkbx>
my reddit password would be NDFkMTIzM%TkRGa01US
<shevy>
right?
<DouweM>
shevy: right
<shevy>
studying other people's code scares me... thanks DouweM
<one_tkbx>
the base64 is only so that it has 72 characters instead of 16
<Senjai`work>
one_tkbx: which serves what purpose?
banjara has quit [Quit: Leaving.]
<one_tkbx>
all they can do by decoding the base64 is get the hash, which is useless
<Senjai`work>
entropy?
<one_tkbx>
basically
<one_tkbx>
if they don't know I'm using this system, they won't know that they only have to check 16 characters
banjara has joined #ruby
<Senjai`work>
one_tkbx: That's a very bad approach to security
thelorax123 has quit [Remote host closed the connection]
havenwood has quit [Remote host closed the connection]
arietis has quit [Quit: Computer has gone to sleep.]
<DouweM>
:| that's rediculous one_tkbx
<Senjai`work>
one_tkbx: You're reinventing the wheel here.. This is a solved problem and there are standard libraries MEANT for password encryption and storage
<Senjai`work>
one_tkbx: like bcrypt_ruby
<one_tkbx>
Senjai`work, the obscurity just helps
<one_tkbx>
in the new one I'm going to use 1000 rounds of whirlpool
<Senjai`work>
one_tkbx: no, no it doesn't
<Senjai`work>
one_tkbx: Obscurity really only guards against human eyes, not that of computers.
<one_tkbx>
Senjai`work: if I start with my "universal" password, salt it with the name of the website, and hash it, I'd assume (though I'm not a cryptographer) that it's already safe enough
<one_tkbx>
the base64 is just to slightly inconvenience a hacker
havenwood has joined #ruby
havenwood has quit [Client Quit]
<one_tkbx>
(it's not the full base64 string, just part of it)
mr_red has joined #ruby
<Senjai`work>
one_tkbx: Or you could just: BCrypt::Password.create("mypassword")
<DouweM>
one_tkbx: :O that's terrible. once someone has your universal password, they have everything
banjara has joined #ruby
<DouweM>
with a password manager, they'd at least need to be in your machine
larissa has joined #ruby
bruno- has quit [Quit: leaving]
<one_tkbx>
DouweM: that's why I was planning on 1000 rounds of whirlpool this time around, although I forgot about bcrypt
<Senjai`work>
one_tkbx: then you shouldnt be asking any more questions on how to secure a password :P
bruno- has quit [Client Quit]
axl_ has quit [Quit: axl_]
<one_tkbx>
Senjai`work, that's why I need this
bruno- has joined #ruby
<Senjai`work>
one_tkbx: I'm lost..
<one_tkbx>
key1 = ask("K: ") {|q| q.echo = false}
thelorax123 has quit [Remote host closed the connection]
matchaw has quit [Remote host closed the connection]
bruno- has quit [Client Quit]
<one_tkbx>
now once it's bcrypted, how do I securely erase that from ram?
bruno- has joined #ruby
bruno- has quit [Client Quit]
<shevy>
from ruby?
<one_tkbx>
yes
kobain has joined #ruby
<shevy>
I dont think ruby can access ram
dkamioka has quit [Remote host closed the connection]
<Senjai`work>
one_tkbx: it's not reversible so it doesnt matter
<one_tkbx>
Senjai`work: no, the original password
bruno- has joined #ruby
matchaw has joined #ruby
<one_tkbx>
pre-hash
dkamioka has joined #ruby
<Senjai`work>
one_tkbx: GC.start right after bcrypting
<DouweM>
one_tkbx: is your plan still to have one master password that you salt with a per-site salt derived from (for example) the site's name?
mary5030 has quit [Remote host closed the connection]
<DouweM>
even with bcrypt?
<one_tkbx>
Probably DouweM, but the 15 people that piled on me gave me the impression that that could be a bad idea
cescalante is now known as ce_afk
<one_tkbx>
so maybe not
<DouweM>
:D
bruno- has quit [Client Quit]
simoz has quit [Ping timeout: 264 seconds]
banjara has quit [Client Quit]
<DouweM>
what's the problem with using a proper password manager that will generate random passwords for you and can be unlocked with a master password?
<DouweM>
a master password that's not also part of the site passwords, mind
dkamioka has quit [Read error: Connection reset by peer]
thelorax123 has joined #ruby
<one_tkbx>
this is portable
dkamioka has joined #ruby
<Senjai`work>
DouweM: he/she wants to reinvent the wheel
banjara has joined #ruby
<one_tkbx>
I originally did this so I can do it on any computer
mary5030 has joined #ruby
<DouweM>
Senjai`work: evidently
<one_tkbx>
(javascript)
bruno- has joined #ruby
Soda has joined #ruby
<DouweM>
one_tkbx: but you realize that when you use MasterPassword+SiteName on every site, once someone has your master password, they have everything?
<Xeago_>
waxjar: one_tkbx, String#clear is not cryptographically secure
<one_tkbx>
DouweM, that's why bcrypt
<Senjai`work>
Xeago_: just reassigning the variable to an empty string and GC.start should be fine
<one_tkbx>
my master password is 34 characters of true randomness
<one_tkbx>
good luck
aspires has quit [Quit: sudo making a sandwich]
<DouweM>
wasn't the point that you were going to remember the master password?
<Senjai`work>
one_tkbx: there is no such thing as true randomness with computers, just the illusion of it
<Senjai`work>
one_tkbx: just use bcrypt, thats it
<one_tkbx>
Senjai`work: I write A-Z, a-z, 0-9 on slips of paper and drew them from a box
<DouweM>
:D
<one_tkbx>
wrote*
<one_tkbx>
DouweM: I already memorized it
<Senjai`work>
one_tkbx: Wow, your priorities...
<Xeago_>
Senjai`work: it's not - it is not overwritten in memory, just released
<Xeago_>
in any case, do not invent your own scheme >.<
<DouweM>
one_tkbx: wow, indeed
<Xeago_>
one_tkbx: that is not truly random
<Xeago_>
and the character set is very tiny
earthquake has joined #ruby
<one_tkbx>
Xeago_: it's as close as humans will ever get
<Xeago_>
false
<Senjai`work>
one_tkbx: That is a very broad assumption lol
<one_tkbx>
as close as physics will ever allow, rather
<one_tkbx>
os so I believe
<Xeago_>
false
<one_tkbx>
...?
mary5030 has quit [Ping timeout: 244 seconds]
<Xeago_>
observe a magnetic interference in a tinfoil hat for example
<Senjai`work>
please check your facts before making such statements
<Xeago_>
tr -dc '[:print:]' < /dev/random | fold | head
<Xeago_>
run that instead
<one_tkbx>
anyway, I'm not very concerned that the NSA has a backdoor in my box that allows them to see where the pieces of paper landed at what time, so we'll assume that my password is effectively random, okay?
arietis has joined #ruby
<Xeago_>
one_tkbx: you are forgetting that the amount of slips you put in are not representative of the universe of available characters
<Xeago_>
everytime you draw a '1', the chance of drawing another '1' decreases
<Xeago_>
and consequently the others increase
<one_tkbx>
Xeago_, I replaced them
<Xeago_>
replacing still increases the others
<Senjai`work>
Wow, cp -r really breaks down over large datasets..
<one_tkbx>
one of each character, replacing each time
<Xeago_>
putting back is what you are supposed to do
<Xeago_>
sounds like you are just making this up
<one_tkbx>
so what's the problem?
shvelo has joined #ruby
<Senjai`work>
one_tkbx: Look up permutations, and combinatorics
<one_tkbx>
I'll send you a picture of my box if you'd like, all the slips are still there
<one_tkbx>
(Xeago_)
<Xeago_>
replace != putting back
<one_tkbx>
???????????????????
<Senjai`work>
haha\
iamjarvo has quit [Quit: Leaving.]
<one_tkbx>
are you joking?
<Senjai`work>
one_tkbx: I get it, it's a perfectly valid statement
<one_tkbx>
please tell me you're joking
<Xeago_>
tell me you are joking by using non future proof hashing algorithms
johnnyfuchs has quit [Quit: Leaving.]
<DouweM>
one_tkbx: I want a picture of the box please
<one_tkbx>
k one sec
axl_ has joined #ruby
mr`spock has joined #ruby
<Xeago_>
Can we stop feeding the troll?
<DouweM>
I'm enjoying it
<one_tkbx>
...
<one_tkbx>
how am I the troll?
<mr`spock>
what is one_tkbx asking for?
<Senjai`work>
one_tkbx: you have to be trolling right now..
<Xeago_>
by refusing to use well established scheme's?
bruno- has quit [Quit: leaving]
<one_tkbx>
you're trying to convince me that a) replace != "put back", and b) pulling pieces of paper isn't "random enough" for passwords
<Xeago_>
mr`spock: nothing anymore, his question has been answered as far as I know
bruno- has joined #ruby
<DouweM>
one_tkbx: ...
<one_tkbx>
DouweM: installing cheese, one sec
<Xeago_>
to continue feeding, I'd also argue that shaking a box is not seeding the box with enough entropy to draw uniformly over the set
<DouweM>
haha
<one_tkbx>
Xeago_: I placed the box on a floppy drive containing /dev/random
<mr`spock>
Xeago_, what if there were 1024 iterations of random people shaking the box randomly
<Xeago_>
mr`spock: he said he shook the box himself
<Xeago_>
one_tkbx: what?
gigetoo has quit [Ping timeout: 245 seconds]
<mr`spock>
then there's not a lot of entropy
<DouweM>
Xeago_: the troll shows its true colors
jonathanwallace has joined #ruby
<mr`spock>
at my colocation datacenter i had three people pick a random number to derive my 3-digit rack PIN
<shevy>
is your brain attached to js more than ruby one_tkbx ? :(
drumusician has quit [Ping timeout: 264 seconds]
<one_tkbx>
because I do a lot of web things, and see jsfiddle a lot on stack overflow, didn't know it existed for non-web
<one_tkbx>
shevy, I despise javascript
<shevy>
\o/
<one_tkbx>
and only know python
<shevy>
my brother!
<shevy>
ack
<shevy>
you evil snakeman you
<shevy>
zzss Szszs shszshzs?
<shevy>
^^^ speaking to the savage
<one_tkbx>
well I came here for ruby
<shevy>
\o/
Drakx has quit [Ping timeout: 248 seconds]
<one_tkbx>
someone showed me ruby the other day and it seems like it could be a lot better than python
<shevy>
nah
JohnBat26 has quit [Ping timeout: 264 seconds]
havenwood has joined #ruby
<shevy>
I think ruby and python are at about equal levels, give or take a little
zeade has joined #ruby
<shevy>
where one has an advantage, the other has a disadvantage
<Senjai`work>
one_tkbx: You only despise javascript because you rely on security through obscurity, and people can see your javascript code :P
d45h has joined #ruby
<shevy>
like documentation. who got the better documentation!
<shevy>
I despise javascript too
<Senjai`work>
A language is the sum of its libraries :P
<shevy>
ok I will remember that when anyone rants against php
aspires has joined #ruby
banjara has quit [Quit: Leaving.]
<one_tkbx>
Senjai`work: would I use javascript if I'm "relying" on security through obscurity?
<one_tkbx>
you know what
<shevy>
we even have php-gtk!!!
zeade has quit [Client Quit]
<one_tkbx>
I'm not taking questions any more, leads to my being trolled
dkamioka has quit [Remote host closed the connection]
<DouweM>
:D
carraroj has quit [Quit: Konversation terminated!]
dnyy has quit [Remote host closed the connection]
<shevy>
come on man
danshultz has quit [Ping timeout: 264 seconds]
<Senjai`work>
shevy: I wish there was alternative client side languages other than javascript, but for now it's a necessary evil.
<shevy>
it happens to everyone
<shevy>
one_tkbx most trolls are on reddit
<Senjai`work>
You can write nice code in javascript though... It IS possible
<DouweM>
one_tkbx: the great thing is that apparently both sides were being completely serious, but are both convinced the other side was trolling
<one_tkbx>
lol
dnyy has joined #ruby
dnyy has quit [Read error: Connection reset by peer]
<one_tkbx>
<mr`spock> Xeago_, what if there were 1024 iterations of random people shaking the box randomly
thelorax123 has joined #ruby
dnyy has joined #ruby
<one_tkbx>
<DouweM> ...both sides were being completely serious
<shevy>
Senjai`work yeah, javascript is winning because of its monopoly and as a consequence I guess the language will become better and better and better
banjara has joined #ruby
<shevy>
one day it will kill ruby
bruno- has quit [Quit: leaving]
brennanMKE has joined #ruby
<shevy>
Xeago_ is an exception
bruno- has joined #ruby
<shevy>
he was just trolling
<DouweM>
one_tkbx: we were joking around at some point, my request for a pic of the box including, but none of our arguments were false
<one_tkbx>
can javascript be run locally?
banjara has quit [Client Quit]
<one_tkbx>
well
<DouweM>
one_tkbx: locally as in?
<one_tkbx>
you know what I mean
<one_tkbx>
outside a browser
<shevy>
one_tkbx well... not quite so... I mean, I dont know how to create a directory with it on my hdd ...
<Senjai`work>
shevy: I don't think JS will ever take off as a fully interpreted language solution
<DouweM>
sure, node.js
thelorax123 has quit [Remote host closed the connection]
<shevy>
ack
<Senjai`work>
shevy: e.g node.js etc.
jamesaanderson has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<shevy>
you can create a directory with node.js ???
<shevy>
my javascript knowledge stems back from the 1999-era
banjara has joined #ruby
<DouweM>
node.js has a standard library much different from browser JS
colonolGron has joined #ruby
<one_tkbx>
how do you guys like my javascript skills?
<Senjai`work>
right.
<one_tkbx>
step9 = CryptoJS.SHA256(step8);
<one_tkbx>
step10 = CryptoJS.SHA256(step9);
<one_tkbx>
step11 = CryptoJS.SHA256(step10);
<Senjai`work>
DouweM: But the syntax is still messy, for it to get better, it would end up looking like another language that probably does it better already
<DouweM>
Senjai`work: oh, I definitely agree. I was just responding to shevy's surprise over node.js actually being able to do stuff
<Senjai`work>
Woot, time to dd some partitions! huzzah!
gigetoo has joined #ruby
Deele has quit [Ping timeout: 260 seconds]
* Senjai`work
speaking from someone who actually destroyed a disk using it in the past :(
one_tkbx has left #ruby ["Leaving"]
one_tkbx has joined #ruby
<shevy>
hey I did that too
<one_tkbx>
Senjai`work, you know what dd stands for
<Hanmac>
one_tkbx: the step9 ... step11 looks like javascript is to dump for loops? oO
<Xeago_>
Senjai`work: you can actually implement safe encryption in javascript
<shevy>
no
<shevy>
one_tkbx is too dumb for loops
<shevy>
that's a big difference
<one_tkbx>
;_;
banjara has quit [Client Quit]
<Senjai`work>
Xeago_: definitely
<Xeago_>
Senjai`work: it just isn't cryptographically secure against other attacks
<shevy>
but I would hate myself for having to write a loop in javascript anyway
<shevy>
you would need for(); something right?
<DouweM>
shevy: yes
<Senjai`work>
shevy: I prefer C loops over javascript loops :O
<one_tkbx>
this was when I didn't even know python, the x=1, ..., x++ format of loops was dumbfounding to me
<one_tkbx>
that's what js uses, right?
<DouweM>
one_tkbx: right
<shevy>
hmm
mbessey_ has quit [Quit: Leaving...]
<shevy>
see we need a way to jump back in time
<shevy>
and correct past mistakes that affect us today
coderhs has quit [Read error: Operation timed out]
<Senjai`work>
6 partions deleted, 2 moved & resized, 1 created
<Senjai`work>
success!
<Senjai`work>
s/partions/partitions
<shevy>
Senjai`work go shrink the pr0n partition
gigetoo has quit [Ping timeout: 265 seconds]
<shevy>
and are you really working right now :P
<Senjai`work>
shevy: Shh, nobody's supposed to know about that! it's a work computer!
<shevy>
hahaha
<Senjai`work>
shevy: No, but I'm at work on the weekend, and I connect through the server at work
<Senjai`work>
this is just the weechat configuration for my tmux session at work
thelorax123 has joined #ruby
<Senjai`work>
3 disks down, one to go!
thelorax123 has quit [Remote host closed the connection]
* Senjai`work
boots up tf2 while waiting
swingha has quit [Quit: WeeChat 0.4.2]
timonv has joined #ruby
jaybonci has quit [Ping timeout: 245 seconds]
dnyy has quit [Remote host closed the connection]
<DouweM>
:)
vlad_sta_ has joined #ruby
<shevy>
you geeks are confusing
dnyy has joined #ruby
dnyy has quit [Read error: Connection reset by peer]
jbpros has quit [Quit: jbpros]
thelorax123 has joined #ruby
thelorax123 has quit [Remote host closed the connection]
dnyy has joined #ruby
<matti>
Looks who's saying.
<matti>
;s
<Xeago_>
anyone plays dota2 in here?
tesuji has joined #ruby
<matti>
Xeago_: I used to.
<Xeago_>
why no longer?
<matti>
Nobody to play with ;p
havenwood has quit []
<Xeago_>
there's me?:P
<Senjai`work>
I might
<Senjai`work>
my work comps pretty beefe
<Senjai`work>
beefy*
<matti>
Xeago_: I'd have to download it again, which may take a bit.
<Senjai`work>
Xeago_: I'll catch a game with you later if you want
<matti>
Xeago_: But then, no problem.
<Xeago_>
please :)
vlad_starkov has quit [Ping timeout: 245 seconds]
<AntelopeSalad>
i uninstalled it after witnessing the built in turn/animation delay
<Senjai`work>
Xeago_: steam name?
gigetoo has joined #ruby
<Xeago_>
Senjai`work: see PM
<Xeago_>
AntelopeSalad: what do you mean?
thelorax123 has joined #ruby
aspires has quit [Quit: sudo making a sandwich]
<Xeago_>
all heroes have a turn acceleration if you didn't know?
bruno- has quit [Quit: leaving]
<AntelopeSalad>
there's a built in 300ms'ish delay when turning and initiating commands
bruno- has joined #ruby
<Xeago_>
hmm, not aware of that, might it have been lag
<Xeago_>
?
<matti>
?
<Senjai`work>
I've never had that delay
<AntelopeSalad>
i think it was used because it was in dota1 (but back then it was an engine limitation) and also it supposedly levels out the playing field for cross continent play
timonv has quit [Ping timeout: 252 seconds]
<Xeago_>
tournaments are run on lan for that reason...
<AntelopeSalad>
right, i didn't make the rules :o
<AntelopeSalad>
i think it's ridiculous, that's why i won't play it
aspires has joined #ruby
<Xeago_>
I doubt that is actually still in place
thelorax123 has quit [Remote host closed the connection]
petey has quit [Remote host closed the connection]
<AntelopeSalad>
it's only noticeable if you've played other mobas without it
<AntelopeSalad>
but you could still feel it if you pay attention
petey has joined #ruby
<Xeago_>
anything above 100ms is clearly noticeable imo
<AntelopeSalad>
yeah without a doubt
<Xeago_>
I'll run some tests on it tonight
dkamioka has joined #ruby
<AntelopeSalad>
next time you play try it out, issue a movement command to move your char backwards or cast a skill off to the side
<AntelopeSalad>
and then notice how long it takes to happen
<Xeago_>
I suspect it to just be lag, and a slow turn acceleration
thelorax123 has joined #ruby
<Xeago_>
AntelopeSalad: so it is just a turn delay?
<AntelopeSalad>
it happens in practice mode too
<Xeago_>
e.g. moving forward doesn't show it?
<AntelopeSalad>
google on the subject, you'll see
<AntelopeSalad>
it has something to do with the turn speed
Speed has left #ruby ["WeeChat 0.4.2"]
thelorax123 has quit [Remote host closed the connection]
spider-mario has quit [Remote host closed the connection]
bruno- has joined #ruby
<jb41>
I doing DBSCAN algorithm (no matter what it does), but it have to count distances between points, many times - for my sample dataset it's about 15315274 times, for 4k different coords. It takes too much time (about 14minutes on my machine) to compute distances, and it's computing the same distances many times, so I thought that I'll make a lookup table (2d matrix) with all possible distances. Ok, so what's the most efficent way to save it and se
bugsinlights has joined #ruby
<jb41>
btw. maybe hash of hashes?
tesuji has quit [Ping timeout: 272 seconds]
<jb41>
but then I've no idea how to name key's of that
<apeiros>
4k coords? that's a large hash if you want all combinations of 2…
anderse has quit [Quit: anderse]
<jb41>
yes
<jb41>
but time is more important than memory for me
<apeiros>
ah, wait, I'm confusing things. it's not as big as I thought
<apeiros>
I thought of 4k!, but it's only (4k-1)^2/2 - still large but much less
Mars__ has joined #ruby
<apeiros>
gah, 4k*(4k-1)/2, that was the formula
<apeiros>
anyway, still 8mio entries
vlad_sta_ has joined #ruby
gasbakid has joined #ruby
<jb41>
now I'm making triangular matrix with counted values
<jb41>
and I was searching using bsearch
<apeiros>
but yes, hash with [from_coord, to_coord] as key
<jb41>
by coords I mean [latitude, longitude]
huttan has joined #ruby
<jb41>
but, that's not important what are my coords
<jb41>
WHOA! *_*
<jb41>
you're kidding me! I just check it, and ruby allows arrays as a hash key
<apeiros>
sure
bruno- has quit [Quit: leaving]
mixel has quit [Quit: mixel]
justsee has joined #ruby
relix has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<apeiros>
any object which has #hash and #eql? implemented properly can serve as a hash key
<jb41>
that language will never stop suprise me
vlad_starkov has quit [Ping timeout: 264 seconds]
<jb41>
that's awesome
<jb41>
s/suprise/suprising
<apeiros>
yupp
scottstamp is now known as zz_scottstamp
<jb41>
I'm waiting when sciruby will be finished
<jb41>
BLAS and LAPACK in ruby will be something perfect for me
relix has joined #ruby
osvico has quit [Ping timeout: 264 seconds]
<DouweM>
beware that the hash will start behaving erratically if you change its keys from under it causing their hashes to change. so don't touch those array-keys after you've set them in the hash
huttan has quit [Ping timeout: 248 seconds]
<jb41>
ok
burlyscudd has joined #ruby
<DouweM>
to make sure you don't even do so on accident, you can #freeze the array you set as key
<apeiros>
DouweM: insufficient if the contents of the array is mutable
vince_prignano has quit []
<apeiros>
a workaround is Hash#rehash. but using that implies you did it wrong.
<DouweM>
apeiros: I know, but if it's just numeric coords like now, that's not an issue
<apeiros>
jb41: you can use Hash with a block to memoize distances
<apeiros>
this hash automatically populates keys you request
mrsolo has joined #ruby
<apeiros>
you might consider additional logic to have from/to in strict order, so distance[[from, to]] and distance[[to, from]] don't require a recalculation (because the key is different)
relix has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<mr`spock>
gosh i love you guys/
<jb41>
hmm... I will do such thing but then my key will be array of 4 values
fixl has joined #ruby
<mr`spock>
sometimes i wish my coworkers could have such conversations. i don't work with any real programmers :-\
<apeiros>
e.g. `distance = Hash.new { |hash,(from, to)| if hash.has_key?([to, from]) then hash[[to, from]] else hash[[from, to]] = calculate_distance(from, to) end }`
<jb41>
yes, I will do it so to-from yields same value as from-to, don't keeping it in memory two times
<DouweM>
apeiros: :)
EvanR is now known as Guest36096
Mars__ has quit [Remote host closed the connection]
<jb41>
DouweM: for examples such array: [1,2]
bruno- has joined #ruby
<apeiros>
it might actually pay off to keep [from, to] an array in the block and only decompose it for the calculation
Mars__ has joined #ruby
<DouweM>
jb41: yup, got it now
<jb41>
but I'll propably have hash of hashes
<apeiros>
e.g. `distance = Hash.new { |hash,from_to| to_from = from_to.reverse; if hash.has_key?(to_from) then hash[to_from] else hash[from_to] = calculate_distance(*from_to) end }`
<jb41>
one point have [x, y] coords
<jb41>
and I've to keep distances between every points
<jb41>
s/every/all
<DouweM>
jb41: array-of-arrays as hash keys is fine too, apeiros's example works with that
<jb41>
:D
<jb41>
I like such magic
<jb41>
ok, I'll try it out
bruno- has quit [Client Quit]
<DouweM>
The magic in this case is just #hash. Array#hash combines the #hash of its elements, so [[a,b],[c,d]].hash will be the combination of [a,b].hash and [c,d].hash which will end up being the combination of a.hash, b.hash, c.hash and d.hash.
binaryplease has joined #ruby
Mars___ has joined #ruby
axl_ has left #ruby [#ruby]
<jb41>
hmmm
Mars__ has quit [Ping timeout: 272 seconds]
Guest36096 has quit [Ping timeout: 240 seconds]
<jb41>
as you said that, now I understand why hash is named hash - just like password hash'es. It's quite interesting idea of storing data.
<DouweM>
:)
<DouweM>
Hash isn't named Hash for nothing
<apeiros>
Hash is somewhat misnamed. it's a HashMap or HashTable
jonathanwallace1 has joined #ruby
jonathanwallace has quit [Ping timeout: 264 seconds]
<jb41>
I'm a little bit sad, that I didn't know that until now
<jb41>
yes
thelorax123 has joined #ruby
<apeiros>
a hash is a `hashed value` of an object (Object#hash), which Hash (HashMap) uses to calculate the bucket where it resides
<jb41>
that's why searching through hashes are so quick
<apeiros>
eql? is then used to ensure it's not just a collision
<apeiros>
yes, Hash lookup is amortized O(1)
<DouweM>
Note that all of this is the case for Set as well, seeing as it's backed by Hash
<jb41>
right
dkamioka has joined #ruby
<jb41>
you guys, have a lot of knowledge :)
bklane has quit [Remote host closed the connection]
<apeiros>
a hash can still be slower than a e.g. a sorted array with binary search, though, if e.g. you have a bad #hash method (many collisions) or if your #hash method is very expensive (large constant factor)
thelorax123 has quit [Remote host closed the connection]
hashpuppy has quit [Quit: Computer has gone to sleep.]
* apeiros
off, watching sc2 world championships - bye :)
<DouweM>
apeiros: ha, have fun
justsee has quit [Ping timeout: 272 seconds]
<hiall>
apeiros: GO JAEDONG
thelorax123 has joined #ruby
<DouweM>
jb41: all of that stuff about hashing is taught in freshman year CS btw. I should know because that's where I was last year
<jb41>
DouweM: I'm doing CS, but nobody told me that :(
d45h has quit []
<DouweM>
jb41: you didn't have a course on data structures?
kofno has quit [Ping timeout: 265 seconds]
<jb41>
or I wasn't at that lecture, actually...
hashpuppy has joined #ruby
<DouweM>
ha
<jb41>
I'm from Poland, it's quite different in here
dkamioka has quit [Ping timeout: 264 seconds]
thelorax123 has quit [Remote host closed the connection]