ChanServ changed the topic of #ruby-lang to: Ruby 1.9.3-p125: http://ruby-lang.org | Paste >3 lines of text on http://pastie.org or use a gist
justinseiter has quit [Ping timeout: 246 seconds]
<oddmunds> i'm collecting ngrams
kith_ is now known as kith
<rue> Wouldn’t #each_cons make more sense?
kain has quit [Ping timeout: 256 seconds]
<oddmunds> it would
<oddmunds> thanks a bunch
<oddmunds> this looks like it would solve far more problems than the regexp would
<steveklabnik> oddmunds: just use the list monad!
thisirs has quit [Remote host closed the connection]
<oddmunds> steveklabnik: what do you mean?
<steveklabnik> sorry, i'm semi-trolling.
<steveklabnik> nobody uses monads in ruby
<oddmunds> good
<steveklabnik> you could do that though
lsegal has joined #ruby-lang
headius has quit [Quit: headius]
ledao has quit [Quit: Leaving.]
justinseiter has joined #ruby-lang
<oddmunds> i'm not familiar with it. even though i might guess what it would be.
roadt has joined #ruby-lang
kain has joined #ruby-lang
<steveklabnik> http://en.wikibooks.org/wiki/Haskell/Understanding_monads/List <- unless you know haskell, wont make much sense
<oddmunds> yeah, i glanced over a few other haskell examples
<steveklabnik> The list monad, in some sense, models computations which could return any number of values. Bind pumps values in, and catches all the values output. Such computations are known in computer science as nondeterministic. That is, a list [x,y,z] represents a value which is all of the values x, y, and z at once.
<steveklabnik> is actually a pretty good summary
benanne has quit [Quit: kbai]
rfay has quit [Quit: This computer has gone to sleep]
mpan has quit [Read error: Connection reset by peer]
mpan has joined #ruby-lang
havenn has joined #ruby-lang
<oddmunds> i am way to tired to make any sense of haskell right now
<steveklabnik> :)
rfay has joined #ruby-lang
kain has quit [Read error: Operation timed out]
hgf has quit [Quit: hgf]
S1kx has quit [Ping timeout: 240 seconds]
Sambalero has joined #ruby-lang
<oddmunds> i need to sleep. rue thanks for showing me what i needed rather than what i asked for. steveklabnik, thanks for depleting my mental batteries.
havenn has quit [Remote host closed the connection]
arooni-mobile has joined #ruby-lang
<steveklabnik> :)
<steveklabnik> goodnight!
arooni-mobile has quit [Ping timeout: 246 seconds]
hgf has joined #ruby-lang
Sambalero has quit [Remote host closed the connection]
lsegal has quit [Quit: Quit: Quit: Quit: Stack Overflow.]
kain has joined #ruby-lang
stardiviner has joined #ruby-lang
headius has joined #ruby-lang
headius has quit [Client Quit]
ledao has joined #ruby-lang
jtoy has joined #ruby-lang
hgf has quit [Quit: hgf]
kain has quit [Ping timeout: 252 seconds]
arooni-mobile has joined #ruby-lang
enebo has quit [Quit: enebo]
Madis has quit [Quit: ChatZilla 0.9.89 [Firefox 15.0/20120830123745]]
woollyams has joined #ruby-lang
stardiviner has quit [Quit: my website: http://stardiviner.dyndns-blog.com/]
mistym has joined #ruby-lang
mistym has quit [Changing host]
mistym has joined #ruby-lang
brianpWins has joined #ruby-lang
brianpWins has quit [Client Quit]
woollyams has quit [Quit: Computer has gone to sleep.]
kain has joined #ruby-lang
jtoy has quit [Quit: jtoy]
mpan has quit [Read error: Connection reset by peer]
stardiviner has joined #ruby-lang
kain has quit [Ping timeout: 248 seconds]
havenn has joined #ruby-lang
anannie has quit [Ping timeout: 246 seconds]
mpan has joined #ruby-lang
anannie has joined #ruby-lang
havenn has quit [Ping timeout: 264 seconds]
sepp2k1 has joined #ruby-lang
sepp2k has quit [Ping timeout: 260 seconds]
jtoy has joined #ruby-lang
kain has joined #ruby-lang
jtoy has quit [Client Quit]
roadt has quit [Ping timeout: 246 seconds]
hgf has joined #ruby-lang
Bosox20051 has joined #ruby-lang
kain has quit [Ping timeout: 240 seconds]
sunaku has joined #ruby-lang
charliesome has joined #ruby-lang
gix has quit [Quit: Client exiting]
gix has joined #ruby-lang
gix has quit [Client Quit]
gix has joined #ruby-lang
anannie has quit [Remote host closed the connection]
wyhaines has joined #ruby-lang
kain has joined #ruby-lang
gmci has quit [Quit: Computer has gone to sleep.]
tRAS has joined #ruby-lang
sepp2k1 has quit [Remote host closed the connection]
dominikh has quit [Ping timeout: 260 seconds]
spuk has quit [Quit: Human beings were created by water to transport it uphill.]
kain has quit [Ping timeout: 256 seconds]
corundum has quit [Read error: Connection reset by peer]
corundum has joined #ruby-lang
arooni-mobile has quit [Ping timeout: 246 seconds]
concernedcitizen has joined #ruby-lang
concernedcitizen has quit [Changing host]
concernedcitizen has joined #ruby-lang
concernedcitizen has quit [Read error: Connection reset by peer]
concernedcitizen has joined #ruby-lang
concernedcitizen has quit [Changing host]
concernedcitizen has joined #ruby-lang
rfay has quit [Quit: This computer has gone to sleep]
kain has joined #ruby-lang
gsav has quit [Quit: Lost terminal]
swarley_ has joined #ruby-lang
kain has quit [Ping timeout: 260 seconds]
bnagy_ has left #ruby-lang [#ruby-lang]
roadt has joined #ruby-lang
wyhaines has quit [Remote host closed the connection]
jamjam has quit [Ping timeout: 246 seconds]
mpan has quit [Quit: Leaving]
kain has joined #ruby-lang
deryl-android has joined #ruby-lang
rfay has joined #ruby-lang
spuk has joined #ruby-lang
sunaku has quit [Quit: WeeChat 0.3.9]
jtoy has joined #ruby-lang
sunaku has joined #ruby-lang
jtoy has quit [Client Quit]
deryl-android has quit [Remote host closed the connection]
sunaku has quit [Client Quit]
deryl-android has joined #ruby-lang
deryl-android has quit [Client Quit]
jamjam has joined #ruby-lang
kain has quit [Ping timeout: 264 seconds]
jtoy has joined #ruby-lang
erichmenge has quit [Quit: Linkinus - http://linkinus.com]
dominikh has joined #ruby-lang
jtoy has quit [Quit: jtoy]
kain has joined #ruby-lang
rfay has quit [Quit: This computer has gone to sleep]
tdy has joined #ruby-lang
kain has quit [Ping timeout: 256 seconds]
KA_ has joined #ruby-lang
KA_ has quit [Client Quit]
concernedcitizen has quit [Remote host closed the connection]
imperator has joined #ruby-lang
kain has joined #ruby-lang
tralart has joined #ruby-lang
justinseiter has quit [Ping timeout: 260 seconds]
tralart has left #ruby-lang [#ruby-lang]
swarley_ has quit [Quit: Leaving]
kain has quit [Ping timeout: 246 seconds]
yats has joined #ruby-lang
Bosox20051 has quit [Quit: Leaving]
lordnaz has quit [Quit: WeeChat 0.3.7]
Nisstyre-laptop has quit [Remote host closed the connection]
KA_ has joined #ruby-lang
KA_ has quit [Quit: KA_]
kain has joined #ruby-lang
piyush has joined #ruby-lang
imperator has left #ruby-lang ["Leaving"]
gaveen has joined #ruby-lang
gaveen has joined #ruby-lang
icooba has quit [Quit: Textual IRC Client: www.textualapp.com]
Nisstyre-laptop has joined #ruby-lang
kain has quit [Ping timeout: 264 seconds]
solars has joined #ruby-lang
hgf has quit [Quit: hgf]
yats has quit [Read error: Connection reset by peer]
yats_ has joined #ruby-lang
goshakkk has joined #ruby-lang
kain has joined #ruby-lang
mistym has quit [Remote host closed the connection]
goshakkk has quit [Quit: Computer has gone to sleep.]
kain has quit [Ping timeout: 260 seconds]
lordnaz has joined #ruby-lang
lordnaz has quit [Client Quit]
sush24 has joined #ruby-lang
Nisstyre-laptop has quit [Read error: Connection reset by peer]
nariyal has joined #ruby-lang
piyush has quit [Ping timeout: 260 seconds]
kain has joined #ruby-lang
piyush has joined #ruby-lang
kain has quit [Ping timeout: 246 seconds]
workmad3 has joined #ruby-lang
rippa has joined #ruby-lang
ryanlecompte has joined #ruby-lang
voker57 has joined #ruby-lang
voker57 has quit [Changing host]
voker57 has joined #ruby-lang
__butch__ has joined #ruby-lang
yats__ has joined #ruby-lang
yats_ has quit [Read error: Connection reset by peer]
AlHafoudh has joined #ruby-lang
tRAS has quit [Ping timeout: 256 seconds]
justinmcp has joined #ruby-lang
wallerdev has quit [Quit: wallerdev]
kain has joined #ruby-lang
piyush has quit [Ping timeout: 246 seconds]
tRAS has joined #ruby-lang
kain has quit [Ping timeout: 248 seconds]
justinmcp has quit [Remote host closed the connection]
hakunin has quit [Remote host closed the connection]
hakunin has joined #ruby-lang
nariyal has quit [Ping timeout: 252 seconds]
hakunin has quit [Ping timeout: 260 seconds]
kain has joined #ruby-lang
Criztian has joined #ruby-lang
ryanlecompte has quit [Remote host closed the connection]
ryanlecompte has joined #ruby-lang
goshakkk has joined #ruby-lang
ryanlecompte has quit [Remote host closed the connection]
sush24 has quit [Quit: This computer has gone to sleep]
yats__ has quit [Read error: Connection reset by peer]
yats__ has joined #ruby-lang
OrganicCat has joined #ruby-lang
<OrganicCat> When reading data from a flat file, how can I keep my memory footprint low? Read a chunk, close the file, then rinse and repeat?
workmad3 has quit [Ping timeout: 260 seconds]
undersc0re97 has quit [Quit: i use linux l o l]
woollyams has joined #ruby-lang
nariyal has joined #ruby-lang
justinmcp has joined #ruby-lang
undersc0re97 has joined #ruby-lang
nariyal has left #ruby-lang [#ruby-lang]
sepp2k has joined #ruby-lang
justinmcp has quit [Ping timeout: 246 seconds]
Shine-neko has joined #ruby-lang
yats__ has quit [Read error: Connection reset by peer]
yats__ has joined #ruby-lang
tbuehlmann has joined #ruby-lang
stiang has joined #ruby-lang
goshakkk has quit [Quit: Computer has gone to sleep.]
postmodern has quit [Quit: Leaving]
Madis has joined #ruby-lang
yats__ has quit [Read error: Connection reset by peer]
postmodern has joined #ruby-lang
yats__ has joined #ruby-lang
yats_ has joined #ruby-lang
<ryanf> OrganicCat: you can use foreach or each_line
<ryanf> you don't have to manage the memory manually; it just takes the file line by line
<ryanf> File.foreach(filename) { |line| ... }
yats__ has quit [Ping timeout: 256 seconds]
stiang has quit [Quit: stiang]
yats_ has quit [Read error: Connection reset by peer]
yats__ has joined #ruby-lang
yats__ has quit [Read error: Connection reset by peer]
yats__ has joined #ruby-lang
yats__ has quit [Read error: Connection reset by peer]
yats__ has joined #ruby-lang
goshakkk has joined #ruby-lang
vlad_starkov has joined #ruby-lang
jamo has joined #ruby-lang
jamo has quit [Ping timeout: 260 seconds]
goshakkk has quit [Quit: Computer has gone to sleep.]
toretore has joined #ruby-lang
Madis_ has joined #ruby-lang
benanne has joined #ruby-lang
gruwl has joined #ruby-lang
vlad_starkov has quit [Remote host closed the connection]
Shine-neko has quit [Ping timeout: 245 seconds]
Madis has quit [Ping timeout: 246 seconds]
Madis has joined #ruby-lang
gruwl has left #ruby-lang [#ruby-lang]
Madis_ has quit [Ping timeout: 246 seconds]
ryanf has quit [Quit: leaving]
Madis_ has joined #ruby-lang
sush24 has joined #ruby-lang
goshakkk has joined #ruby-lang
vlad_starkov has joined #ruby-lang
Madis has quit [Ping timeout: 248 seconds]
tRAS has quit [Quit: Mother, did it need to be so high?]
Madis has joined #ruby-lang
justinmcp has joined #ruby-lang
Madis_ has quit [Ping timeout: 246 seconds]
Madis_ has joined #ruby-lang
yats_ has joined #ruby-lang
Madis_ has quit [Client Quit]
yats__ has quit [Ping timeout: 246 seconds]
Madis has quit [Ping timeout: 260 seconds]
Madis has joined #ruby-lang
x0F has quit [Disconnected by services]
x0F_ has joined #ruby-lang
x0F_ is now known as x0F
<OrganicCat> ryanf: thanks
piyush has joined #ruby-lang
__butch__ has quit [Quit: Leaving.]
IPGlider has joined #ruby-lang
IPGlider is now known as Guest4365
Guest4365 has quit [Client Quit]
IPGlider_ has joined #ruby-lang
hackeron has quit [Remote host closed the connection]
yats_ has quit [Read error: Connection reset by peer]
IPGlider_ is now known as IPGlider
stiang has joined #ruby-lang
yats_ has joined #ruby-lang
Shine-neko has joined #ruby-lang
Shine-neko_ has joined #ruby-lang
apeiros_ has joined #ruby-lang
Shine-neko has quit [Ping timeout: 264 seconds]
Shine-neko has joined #ruby-lang
yats_ has quit [Ping timeout: 260 seconds]
Shine-neko_ has quit [Ping timeout: 255 seconds]
jayeola_ has joined #ruby-lang
jayeola has quit [Read error: Operation timed out]
<OrganicCat> Will a file open each_line keep the file open for the duration the block runs? In other words, if I have a large file, will it continuosly read it into memory or close it after each line read?
vesan has quit [Ping timeout: 272 seconds]
jayeola has joined #ruby-lang
jayeola_ has quit [Ping timeout: 260 seconds]
stiang has quit [Quit: stiang]
Shine-neko_ has joined #ruby-lang
Shine-neko has quit [Ping timeout: 245 seconds]
Shine-neko_ is now known as Shine-neko
Shine-neko has quit [Client Quit]
A124 has joined #ruby-lang
goshakkk has quit [Quit: Computer has gone to sleep.]
vesan has joined #ruby-lang
ttilley has joined #ruby-lang
goshakkk has joined #ruby-lang
nazty has quit [Quit: Leaving]
KillerFox has joined #ruby-lang
conorreedy has quit [Read error: Connection reset by peer]
conorreedy has joined #ruby-lang
Boohbah_ has quit [Ping timeout: 255 seconds]
charliesome has quit [Quit: Textual IRC Client: www.textualapp.com]
Boohbah has joined #ruby-lang
solars has quit [Ping timeout: 240 seconds]
Boohbah is now known as Guest86326
jamo has joined #ruby-lang
jamo has quit [Ping timeout: 252 seconds]
woollyams has quit [Quit: Computer has gone to sleep.]
Kogentasama has joined #ruby-lang
jxie has quit [Quit: leaving]
mojacc has joined #ruby-lang
mojacc has quit [Remote host closed the connection]
hackeron has joined #ruby-lang
IPGlider has quit []
nXqd has joined #ruby-lang
raya22 has joined #ruby-lang
Fullmoon has joined #ruby-lang
bastilian has joined #ruby-lang
nXqd has quit [Read error: Connection reset by peer]
nXqd has joined #ruby-lang
yats has joined #ruby-lang
justinmcp has quit [Remote host closed the connection]
Kogentasama has quit [Quit: #freenode]
hgf has joined #ruby-lang
Kogentsama has joined #ruby-lang
<Kogentsama> Hello!
yats_ has joined #ruby-lang
<Kogentsama> I have a newbie problem with threading in ruby, anyone in the mood to help me out?
hackeron_ has joined #ruby-lang
<Kogentsama> This code here http://pastie.org/4927260 causes the following error: /home/user/NetBeansProjects/ImageDuplicateFinder/lib/main.rb:44: undefined method `each' for #<Thread:0x9af1280 dead> (NoMethodError)
yats has quit [Ping timeout: 256 seconds]
hackeron has quit [Ping timeout: 252 seconds]
<Kogentsama> It kinda works on 43 Threads and then the error rises
<Kogentsama> I am using ruby 1.9.3
justinmcp has joined #ruby-lang
gmci has joined #ruby-lang
yats_ has quit [Read error: Connection reset by peer]
yats_ has joined #ruby-lang
<burgestrand> Kogentsama: threads.push Thread.new… not threads = Thread.new
<burgestrand> Kogentsama: line #28
<Kogentsama> oh !
<Kogentsama> i try that :D
<burgestrand> Kogentsama: also, you pass item to Thread.new(item), but do not accept it as block parameter
<burgestrand> Kogentsama: Thread.new(item) { |item| … }
<Kogentsama> Do i have to pass it anyway?
<burgestrand> Kogentsama: probably do not have to pass it at all, but it is good practice to do so
<burgestrand> Kogentsama: also, you have one global mutex for all files, your threads cannot run at the same time because of the mutex
<Kogentsama> Oh okay, thanks for that
<burgestrand> Kogentsama: you want to spend as little time in mutex.synchronize { … } as possible to use your threads to the max :)
<Kogentsama> Ooh yeah i figured that, can i put the mutex around the filecount increment only?
<burgestrand> Kogentsama: yeah, probably a good idea to add it around shahashes.merge(…) too
<burgestrand> For CRuby it does not matter, but JRuby and Rubinius might not be so happy.
<burgestrand> Kogentsama: so maybe just move down the mutex.synchronize two lines, so you do filebuf = … and filesha = … outside it
<Kogentsama> Okay i moved it down, it runs definetly a bit quicker now
<burgestrand> Kogentsama: do you have many items?
<Kogentsama> 1460 images
<burgestrand> hehe, creating 1460 threads will make ruby kind of slow :)
<burgestrand> Threads are nice and fairly cheap, but once you get more than a dussin or two you start seeing slowdowns because ruby spend more time switching between threads than running code inside them
<Kogentsama> So i chunk them into threads of 20 or so?
piyush has quit [Ping timeout: 260 seconds]
<burgestrand> Yeah, something like that, you can experiment with the number
<Kogentsama> so its like 20 chunked .. processing .. next 20 ?
justinmcp has quit [Remote host closed the connection]
<burgestrand> Kogentsama: probably you have your list of files, and your threads will each take one file, process it, and take another one. You wait until the list of files is empty (all processed)
<burgestrand> Kogentsama: so maybe one thread will do all the work if all other threads are very slow
<burgestrand> Kogentsama: http://www.ruby-doc.org/stdlib-1.9.3/libdoc/thread/rdoc/Queue.html <- this is very useful for this kind of work
<Kogentsama> burgestrand: There is no such thing as a configuration on how much threads run concurrently, right?
<burgestrand> Kogentsama: no. What you want is essentially a Threadpool, and ruby does not have one in stdlib.
<burgestrand> Kogentsama: I’ve written one that might be useful: http://burgestrand.se/code/ruby-thread-pool/
samuil has joined #ruby-lang
<Kogentsama> burgestrand: I see. Looks great! Is it adviseable to use this at my early stage? I kinda want to grasp the concept first
<burgestrand> Kogentsama: in that case I urge you to write your own threadpool. It’s a nice exercise, and is not too complicated.
<burgestrand> It’s complicated, but when it comes to threads and stuff, writing a naive and simple threadpool is fairly straight-forward.
<burgestrand> It becomes more complex when you want to restart crashed threads and such.
<Kogentsama> burgestrand: Oh okay i will try that. I think i will play around with that Queue first and then chinking and if i get that concept somehow i will try on the Threadppol :]
<burgestrand> Kogentsama: :)
<Kogentsama> burgestrand: Thanks a lot! That was very helpful :]
<burgestrand> Kogentsama: the threadpool I have written is the simplest thing that could possibly work, it’s not much code if you strip the comments, it might be useful to read through it
<burgestrand> Kogentsama: once you understand how Queue works, you have a good base for understanding threadpool :)
<Kogentsama> burgestrand: Okay! Then i will dive into it now :D
coffeejunk has quit [Quit: WeeChat 0.3.9-dev]
gaveen has quit [Ping timeout: 252 seconds]
coffeejunk has joined #ruby-lang
bastilian has quit [Read error: Connection reset by peer]
coffeejunk has quit [Client Quit]
<OrganicCat> Looping through a list of objects, how can I setup a hashmap that stores and array in ruby? Something like this @user_visits[name] << user_value where 'name' is grabbed from another item generated during that time
<OrganicCat> Getting this error undefined method `[]' for nil:NilClass
gaveen has joined #ruby-lang
wyhaines has joined #ruby-lang
BMF has joined #ruby-lang
enebo has joined #ruby-lang
coffeejunk has joined #ruby-lang
sush24 has quit [Quit: This computer has gone to sleep]
gaveen has quit [Ping timeout: 240 seconds]
<apeiros_> OrganicCat: either you ensure that at least an empty array is present at @users_visits[name] before pushing to it
<apeiros_> or you use @users_visits = Hash.new { |h,k| h[k] = [] }, which does that for you (but will create an empty array when accessing *any* key which has no value set)
tRAS has joined #ruby-lang
<apeiros_> alternatively, use e.g. Enumerable#group_by to do the whole work for you
<ddd> May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch! :) (Good morning, btw)
<OrganicCat> apeiros: thanks much, gives me something to go on
raya22 has quit [Quit: Linkinus - http://linkinus.com]
apeiros_ has quit [Remote host closed the connection]
<OrganicCat> Is there a hashmap key check so I could simply see if that key exists?
lcdhoffman has joined #ruby-lang
<OrganicCat> whoops, yep
<OrganicCat> has_key? :p
ruby-lang085 has joined #ruby-lang
ruby-lang085 has quit [Client Quit]
yats_ has quit [Read error: Connection reset by peer]
chimkan_ has joined #ruby-lang
yats__ has joined #ruby-lang
nertzy has joined #ruby-lang
chimkan_ has left #ruby-lang [#ruby-lang]
lcdhoffman has quit [Quit: lcdhoffman]
Criztian has quit [Remote host closed the connection]
hgf has left #ruby-lang [#ruby-lang]
lcdhoffman has joined #ruby-lang
lcdhoffman has quit [Client Quit]
nertzy has quit [Quit: Leaving]
toertore has joined #ruby-lang
toretore has quit [Ping timeout: 246 seconds]
gaveen has joined #ruby-lang
wyhaines has quit [Remote host closed the connection]
nertzy has joined #ruby-lang
tRAS has quit [Quit: Mother, did it need to be so high?]
yats__ has quit [Ping timeout: 256 seconds]
postmodern has quit [Quit: Leaving]
BMF has quit [Remote host closed the connection]
jperry2_ has joined #ruby-lang
nertzy has quit [Quit: This computer has gone to sleep]
wrist has joined #ruby-lang
ryanlecompte has joined #ruby-lang
goshakkk has quit [Quit: Computer has gone to sleep.]
jperry2_ has quit [Quit: jperry2_]
wrist_ has joined #ruby-lang
wrist has quit [Read error: Connection reset by peer]
Mellett68 has joined #ruby-lang
wrist_ has quit [Read error: Connection reset by peer]
wrist has joined #ruby-lang
tRAS has joined #ruby-lang
wrist has quit [Remote host closed the connection]
coryf has joined #ruby-lang
sush24 has joined #ruby-lang
goshakkk has joined #ruby-lang
jperry2_ has joined #ruby-lang
nm7 has joined #ruby-lang
irleif has joined #ruby-lang
bubonicpestilenc has joined #ruby-lang
bubonicpestilenc has quit [Client Quit]
yats has joined #ruby-lang
Mon_Ouie has quit [Ping timeout: 260 seconds]
roadt has quit [Read error: Connection reset by peer]
jperry2_ has quit [Quit: jperry2_]
ledao1 has joined #ruby-lang
ledao has quit [Ping timeout: 260 seconds]
jxie has joined #ruby-lang
tRAS has quit [Quit: Mother, did it need to be so high?]
kjr has joined #ruby-lang
justinseiter has joined #ruby-lang
ledao1 has quit [Quit: Leaving.]
ledao has joined #ruby-lang
grandy has quit [Remote host closed the connection]
relix has quit [Read error: Connection reset by peer]
wycats has quit [Remote host closed the connection]
amdprophet has quit [Remote host closed the connection]
akahn has quit [Remote host closed the connection]
rikkus has quit [Write error: Connection reset by peer]
anildigital_work has quit [Remote host closed the connection]
mistym has joined #ruby-lang
mistym has quit [Changing host]
mistym has joined #ruby-lang
jperry2_ has joined #ruby-lang
jperry2_ has quit [Client Quit]
grandy has joined #ruby-lang
akahn has joined #ruby-lang
amdprophet has joined #ruby-lang
codewrangler has joined #ruby-lang
jperry2_ has joined #ruby-lang
wallerdev has joined #ruby-lang
relix has joined #ruby-lang
sush24 has quit [Quit: This computer has gone to sleep]
hakunin has joined #ruby-lang
voker57 has quit [Read error: Connection reset by peer]
ruurd has joined #ruby-lang
Criztian has joined #ruby-lang
anildigital_work has joined #ruby-lang
tbuehlmann has quit [Remote host closed the connection]
aharris_ has joined #ruby-lang
aharris_ has quit [Client Quit]
verbad has joined #ruby-lang
ryanlecompte has quit [Remote host closed the connection]
rikkus has joined #ruby-lang
rikkus has quit [Changing host]
rikkus has joined #ruby-lang
verbad has quit [Client Quit]
wycats has joined #ruby-lang
enebo has quit [Quit: enebo]
cantonic_ has joined #ruby-lang
nm7 has quit [Quit: ZNC - http://znc.sourceforge.net]
yats_ has joined #ruby-lang
yats has quit [Read error: Connection reset by peer]
nm7 has joined #ruby-lang
cantonic has quit [Ping timeout: 240 seconds]
cantonic_ is now known as cantonic
yats_ has quit [Read error: Connection reset by peer]
jayeola has quit [Ping timeout: 240 seconds]
jayeola has joined #ruby-lang
nm7 has quit [Quit: ZNC - http://znc.sourceforge.net]
yats_ has joined #ruby-lang
nm7 has joined #ruby-lang
chimkan_ has joined #ruby-lang
sush24 has joined #ruby-lang
workmad3 has joined #ruby-lang
jayeola has quit [Quit: leaving]
irleif has quit [Quit: Computer has gone to sleep.]
Bosox20051 has joined #ruby-lang
gaveen has quit [Remote host closed the connection]
jperry2_ has quit [Quit: jperry2_]
Fullmoon has quit [Quit: Fullmoon]
take_cheeze has joined #ruby-lang
Mellett68 has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
havenn has joined #ruby-lang
Mellett68 has joined #ruby-lang
sush24 has quit [Quit: This computer has gone to sleep]
retro|cz has joined #ruby-lang
Fullmoon has joined #ruby-lang
tRAS has joined #ruby-lang
no_worries has joined #ruby-lang
gaveen has joined #ruby-lang
ruurd has quit [Quit: Leaving...]
workmad3 has quit [Ping timeout: 240 seconds]
yats_ has quit [Read error: Connection reset by peer]
yats_ has joined #ruby-lang
jperry2_ has joined #ruby-lang
irleif has joined #ruby-lang
no_worries has quit [Remote host closed the connection]
anannie has joined #ruby-lang
havenn has quit [Remote host closed the connection]
jperry2_ has quit [Quit: jperry2_]
relix has quit [Quit: Connection closed for inactivity]
S1kx has joined #ruby-lang
S1kx has quit [Changing host]
S1kx has joined #ruby-lang
WrErase has joined #ruby-lang
turbolihis has joined #ruby-lang
ruurd has joined #ruby-lang
Mon_Ouie has joined #ruby-lang
kjr has quit [Quit: kjr]
tdy has quit [Quit: WeeChat 0.3.6-dev]
chimkan__ has joined #ruby-lang
chimkan__ has quit [Remote host closed the connection]
chimkan__ has joined #ruby-lang
nertzy has joined #ruby-lang
chimkan_ has quit [Ping timeout: 246 seconds]
tdy has joined #ruby-lang
ruurd has quit [Quit: Leaving...]
WrErase has quit [Quit: Leaving]
kain has quit [Ping timeout: 246 seconds]
wyhaines has joined #ruby-lang
<OrganicCat> Can anyone guide or tell me how to formulate the answer to this in ruby? http://stackoverflow.com/questions/2991480/most-frequent-3-page-sequence-in-a-weblog
stardiviner has quit [Quit: my website: http://stardiviner.dyndns-blog.com/]
spectra has quit [Ping timeout: 260 seconds]
spectra has joined #ruby-lang
KA_ has joined #ruby-lang
jtoy has joined #ruby-lang
jamjam has quit [Ping timeout: 245 seconds]
yats__ has joined #ruby-lang
BMF has joined #ruby-lang
xuser has joined #ruby-lang
KA_ has quit [Quit: KA_]
jamjam has joined #ruby-lang
yats_ has quit [Ping timeout: 246 seconds]
kain has joined #ruby-lang
anannie has quit [Remote host closed the connection]
tRAS has quit [Quit: Mother, did it need to be so high?]
irleif has quit [Quit: Computer has gone to sleep.]
jamo has joined #ruby-lang
yats__ has quit [Ping timeout: 246 seconds]
mistym has quit [Remote host closed the connection]
Kingy has joined #ruby-lang
jamo has quit [Ping timeout: 255 seconds]
ruurd has joined #ruby-lang
kain has quit [Ping timeout: 260 seconds]
mistym has joined #ruby-lang
mistym has quit [Changing host]
mistym has joined #ruby-lang
unsymbol has joined #ruby-lang
irleif has joined #ruby-lang
Nisstyre-laptop has joined #ruby-lang
piyush has joined #ruby-lang
nertzy2 has joined #ruby-lang
<andrewvos> OrganicCat: Well you could just store a list of three page sequences and count them?
<andrewvos> OrganicCat: Does each sequence start from their first hit, or from anywhere?
nertzy has quit [Ping timeout: 240 seconds]
Kogentsama has quit [Quit: Page closed]
irleif has quit [Quit: Computer has gone to sleep.]
Kingy__ has joined #ruby-lang
irleif has joined #ruby-lang
Kingy has quit [Ping timeout: 245 seconds]
Kingy__ has quit [Client Quit]
BMF has quit [Remote host closed the connection]
nertzy2 has quit [Quit: Leaving]
kain has joined #ruby-lang
nertzy has joined #ruby-lang
nertzy has quit [Client Quit]
nertzy has joined #ruby-lang
ruurd has quit [Quit: Leaving...]
jtoy has quit [Quit: jtoy]
jamjam has quit [Ping timeout: 246 seconds]
sepp2k has quit [Remote host closed the connection]
anannie has joined #ruby-lang
erichmenge has joined #ruby-lang
erichmenge has quit [Client Quit]
unsymbol has left #ruby-lang [#ruby-lang]
<OrganicCat> andrewvos: each sequence can start from anywhere within their list, it's the top 3 most common sequences between users
kain has quit [Ping timeout: 260 seconds]
mistym has quit [Remote host closed the connection]
benanne has quit [Quit: kbai]
goshakkk has quit [Quit: Computer has gone to sleep.]
Mon_Ouie has quit [Ping timeout: 246 seconds]
Mon_Ouie has joined #ruby-lang
workmad3 has joined #ruby-lang
ryanlecompte has joined #ruby-lang
anon_456 has joined #ruby-lang
tRAS has joined #ruby-lang
jamjam has joined #ruby-lang
ruurd has joined #ruby-lang
kain has joined #ruby-lang
vlad_starkov has quit [Remote host closed the connection]
chimkan__ has quit [Quit: chimkan__]
rippa has quit [Ping timeout: 245 seconds]
Firstmate has joined #ruby-lang
<Firstmate> Hi, I was reading the pragmatic programmer book and had a quick question. For class variables
<Firstmate> when setting the value, does it change the value across all instances
<Firstmate> or only within that objects ancestry
<workmad3> Firstmate: it does, and it also changes it across all subclasses
jackhammer2022 has joined #ruby-lang
<workmad3> Firstmate: in all honesty, ruby's class variables are a bit counter-intuitive in behaviour
<Firstmate> So it's kind of like a modifiable static variable (from say java).
apeiros_ has joined #ruby-lang
nlpplz has joined #ruby-lang
<Firstmate> static class variable*
<Firstmate> If so, could you give a realistic usage of something like that?
kjr has joined #ruby-lang
<workmad3> Firstmate: afaik, static class variables in java don't share across the entire inheritance hierarchy in quite as promiscuous manner
<Firstmate> Ah right.
<Firstmate> Forgot about that inheritance part of that.
<apeiros_> heh, "in such a promiscuous manner" - love that
<Firstmate> I meant more in the sense that changing it, changes it across all instances.
<Firstmate> I guess I just really see when we'd want to do that.
<Firstmate> really don't*
<workmad3> Firstmate: yeah, it changes it across all instances of that class... and all instances of subclasses of that class... and (if the class variable was set in an ancestor class) then in all ancestor classes up to that point, and in all subclasses of all those ancestor classes...
<Firstmate> mhm.
<workmad3> Firstmate: it's why class instance variables tend to be used more than actual class variables
<Firstmate> I see, thanks.
apeiros_ has quit [Remote host closed the connection]
<workmad3> apeiros_: can you think of a better description of class variables than 'promiscuous'? :P
countdigi has quit [Quit: leaving]
Nisstyre-laptop has quit [Read error: Connection reset by peer]
justinseiter has quit [Ping timeout: 246 seconds]
<andrewvos> OrganicCat: Write it out in sentences, then convert it to code.
<OrganicCat> andrewvos: It's already in sentences and pseudocode actually, I was asking for someone to help convert it to code
<OrganicCat> As a much easier question, how do I loop through an array of values and use the index so I can pinpoint various values? var[index], var[index+1], var[index+2], etc.
<tdy> i think ary.each_with_index
<Mon_Ouie> And you might actually want something like Enumerable#each_cons
goshakkk has joined #ruby-lang
no_worries has joined #ruby-lang
<OrganicCat> I don't know the size of the array, so is each_cons useful?
<tdy> oh cool, never knew about each_cons
heftig has quit [Quit: leaving]
<workmad3> tdy: each_slice can also be useful ;)
<Mon_Ouie> Sure. It just yields each element along with the (n-1) elements it is followed by.
heftig has joined #ruby-lang
<OrganicCat> Where is a good example of it?
<tdy> workmad3: ah very nice
<workmad3> OrganicCat: [1,2,3,4,5].each_cons(2).to_a => [[1, 2], [2, 3], [3, 4], [4, 5]]
<OrganicCat> Ah, I misread it, it iterates the block for the parameter given
<Mon_Ouie> Finding the difference between succesive array elements: [1, 3, 4, -1].each_cons(2).map { |a, b| a - b }
Sambalero has joined #ruby-lang
ruurd has quit [Quit: Leaving...]
jperry2_ has joined #ruby-lang
<OrganicCat> I wish I knew a bit more about ruby so I could put that together myself, it's all a little greek to me :p
jperry2_ has quit [Client Quit]
Carnage\ has joined #ruby-lang
<bmaland> x
<workmad3> OrganicCat: it just takes practice, that's all
woollyams has joined #ruby-lang
<Mon_Ouie> That's not greek, it's just Ruby
<Mon_Ouie> Finding the difference between succesive array elements: [1, 3, 4, -1].each_cons(2).map { |α, β| Δ = α - β }
<Mon_Ouie> Now it's a bit more Greek :)
<OrganicCat> yeah and doing interview tests :p
KA_ has joined #ruby-lang
woollyams has quit [Client Quit]
lcdhoffman has joined #ruby-lang
KA_ has quit [Client Quit]
jtoy has joined #ruby-lang
hgf has joined #ruby-lang
KA_ has joined #ruby-lang
benanne has joined #ruby-lang
Mon_Ouie has quit [Read error: Connection reset by peer]
tenaciousflea has joined #ruby-lang
Carnage\ has quit []
Mon_Ouie has joined #ruby-lang
rue has quit [Remote host closed the connection]
rue has joined #ruby-lang
rue has quit [Remote host closed the connection]
<OrganicCat> Hey, you should learn Ruby and write a web log parser all in one weekend! #badideas
rue has joined #ruby-lang
arooni-mobile has joined #ruby-lang
Carnage\ has joined #ruby-lang
rue has quit [Remote host closed the connection]
rue has joined #ruby-lang
rue has quit [Remote host closed the connection]
rue has joined #ruby-lang
nertzy has quit [Quit: Leaving]
nertzy has joined #ruby-lang
<OrganicCat> Ok, where'd I mess up in my if defined? I'm still getting an error on the 3rd line saying cannot convert nil to string
<workmad3> OrganicCat: defined? isn't a nil check
s0ber_ has joined #ruby-lang
<workmad3> OrganicCat: defined? is an actual keyword, and it will check to see if local variables, ivars, constants, etc are actually defined, irrespective of contents
KA_ has quit [Quit: KA_]
tRAS has quit [Quit: Mother, did it need to be so high?]
s0ber has quit [Ping timeout: 260 seconds]
s0ber_ is now known as s0ber
<OrganicCat> Yep, I found this worked better
<OrganicCat> unless p1[2].nil?
<workmad3> OrganicCat: you can also do 'if p1[2]'
Nisstyre-laptop has joined #ruby-lang
<workmad3> OrganicCat: which builds on the detail that the only things that evaluate to 'false' in ruby are nil and false
<OrganicCat> Same code, how would I define something like p1[index], p1[index+1], etc. since I'm already working with an each_with_index?
<OrganicCat> Ah, I didn't know that
<tdy> |p1, index|
<tdy> but seems like each_cons would be a good fit for this?
<tdy> user.each_cons(3) {|a,b,c| @key = a+b+c; @web_list[@key] += @web_list.has_key?(@key) 1 : -1 }
<tdy> seems like that's what you're trying to do, but.. i'm in no way a ruby expert
<OrganicCat> I tried playing with each cons, I think it might fit, but it's a little too...advanced for me right now
<tdy> oops 1:0 not 1:-1
<tdy> or wait..
<tdy> you have =1
<tdy> well.. something along those lines
<OrganicCat> Given that I have a list a,b,c,d,e,f,g I want to find sets "abc", "bcd", "cde", etc.
<tdy> yep.. user.each_cons(3) {|a,b,c| .......... }
<tdy> well.. the lettering might be confusing
<OrganicCat> It is, that's why I opted for each_with_index :)
<Mon_Ouie> first, second, third
<Mon_Ouie> fst, snd, thd
<tdy> user.each_cons(3) {|first,second,third|..... }
goshakkk has quit [Quit: Computer has gone to sleep.]
vesan_ has joined #ruby-lang
TTilus has quit [Ping timeout: 246 seconds]
vesan has quit [Ping timeout: 272 seconds]
goshakkk has joined #ruby-lang
hgf has left #ruby-lang [#ruby-lang]
TTilus has joined #ruby-lang
gaveen has quit [Remote host closed the connection]
lzhz_ has quit [Ping timeout: 264 seconds]
tenaciousflea has quit [Quit: tenaciousflea]
justinmcp has joined #ruby-lang
Fullmoon has quit [Quit: Fullmoon]
A124 has quit [Quit: Leaving.]
Carnage\ has quit []
arooni-mobile has quit [Ping timeout: 246 seconds]
ryanlecompte has quit [Remote host closed the connection]
lzhz has joined #ruby-lang
irleif has quit [Quit: Computer has gone to sleep.]
brianpWins has joined #ruby-lang
irleif has joined #ruby-lang
postmodern has joined #ruby-lang
apeiros_ has joined #ruby-lang
OrganicCat has quit [Ping timeout: 248 seconds]
apeiros_ has quit [Ping timeout: 245 seconds]
jtoy has quit [Quit: jtoy]
My_Hearing has joined #ruby-lang
justinmcp has quit [Remote host closed the connection]
nXqd has quit [Ping timeout: 252 seconds]
arooni-mobile has joined #ruby-lang
Mon_Ouie has quit [Ping timeout: 246 seconds]
<rue> Two uses of #each_cons in <24 h!
lcdhoffman has quit [Quit: lcdhoffman]
irleif has quit [Quit: Computer has gone to sleep.]
thone_ has joined #ruby-lang
thone has quit [Ping timeout: 240 seconds]
piyush has quit [Ping timeout: 246 seconds]
_Mon_Ouie_ has joined #ruby-lang
ddd is now known as deryldoucette
deryldoucette is now known as ddd
benanne has quit [Quit: kbai]
no_worries has quit [Remote host closed the connection]
My_Hearing has quit [Ping timeout: 246 seconds]
goshakkk has quit [Quit: Computer has gone to sleep.]
WillMarshall has joined #ruby-lang
burgestrand has quit [Read error: Connection reset by peer]
burgestrand has joined #ruby-lang
lcdhoffman has joined #ruby-lang
justinmcp has joined #ruby-lang
<Firstmate> I'm trying to remove comments from a line (prefixed by two forward slashes, //)
<Firstmate> Trying to remove them by doing,
<Firstmate> line.sub("\/\/.*","")
<Firstmate> But the pattern breaks when adding the .*, can anyone tell me why?
<Firstmate> breaks = no longer matches
<canton7> shouldn't...
woollyams has joined #ruby-lang
<tdy> line.sub(/\/\/(.*)/,'\1')
<tdy> as far as i can tell, that's what you're trying to do
<Firstmate> Yeah, I just did that and it worked.
<Firstmate> I forgot to not put quotes
<Firstmate> Well, I'm removing the comments
<tdy> oh the whole thing?
<Firstmate> So I should be keeping "" as the substitute string.
<tdy> ok
<Firstmate> i.e. //blah
<Firstmate> or
<Firstmate> <some code> //some comment
<tdy> ah
<Firstmate> Thank you though
<Firstmate> A quick question, you don't need to declare class instance variables right?
<Firstmate> By just using the @variable_name syntax, it knows right?
jamjam has quit [Ping timeout: 240 seconds]
vesan_ has quit [Ping timeout: 260 seconds]
<rue> Correct
<rue> Firstmate: "\/\/.*" is a String, not a Regexp
thillux has joined #ruby-lang
mistym has joined #ruby-lang
mistym has quit [Changing host]
mistym has joined #ruby-lang
undersc0re97 has quit [Read error: Operation timed out]
undersc0re97 has joined #ruby-lang
undersc0re97 has quit [Changing host]
undersc0re97 has joined #ruby-lang
arooni-mobile has quit [Ping timeout: 246 seconds]
workmad3 has quit [Ping timeout: 246 seconds]
<Firstmate> rue: I thought it would convert it to a Regexp.
<Firstmate> I didn't read the docs as closely, in particular when it said: given a string, it'll interpret it literally.
Mellett68 has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
ryanlecompte has joined #ruby-lang
thillux has quit [Remote host closed the connection]
josh^ has joined #ruby-lang
anon_456 has quit [Read error: Connection reset by peer]
anon_456 has joined #ruby-lang
wyhaines has quit [Remote host closed the connection]
Mellett68 has joined #ruby-lang
jperry2_ has joined #ruby-lang
spuk has quit [Changing host]
spuk has joined #ruby-lang
gmci has quit [Ping timeout: 246 seconds]
gmci has joined #ruby-lang
jtoy has joined #ruby-lang
A124 has joined #ruby-lang
justinseiter has joined #ruby-lang
corundum has quit [Disconnected by services]
corundum has joined #ruby-lang
nertzy has quit [Quit: This computer has gone to sleep]
jperry2_ has quit [Quit: jperry2_]
Criztian has quit [Remote host closed the connection]
jperry2_ has joined #ruby-lang
chrisco has joined #ruby-lang
jperry2_ has quit [Quit: jperry2_]
Firstmate has quit [Ping timeout: 255 seconds]
no_worries has joined #ruby-lang
jtoy has quit [Quit: jtoy]
esad has joined #ruby-lang
jtoy has joined #ruby-lang