fflush changed the topic of #ruby to: Ruby 1.9.3-p194: http://ruby-lang.org || Paste > 3 lines of text on pastebin.com
jarred has quit [Quit: jarred]
<jrxiii> anybody here able to speak about cursor timeout within the ruby mongodb driver?
kenichi has quit [Remote host closed the connection]
choffstein has quit [Remote host closed the connection]
<jrxiii> I'm wondering why every one of my mongodb cursors have a cursor_id of nil.
QKO_ has joined #ruby
macmartine has joined #ruby
QKO has quit [Ping timeout: 272 seconds]
<jrxiii> never mind, had to send an initial query before the cursors received an id
<jrxiii> for some reason, this doesn't happen when I do cursor.next or iterate over the records for a cursor.
<jrxiii> Seems like it should.
rasbonics has quit [Quit: rasbonics]
awarner has joined #ruby
jarred has joined #ruby
cascalheira has joined #ruby
banisterfiend has quit [Read error: Connection reset by peer]
zeromodulus has joined #ruby
awarner has quit [Remote host closed the connection]
<matti> Hi jrxiii
<jrxiii> hey there!
<matti> :)
banisterfiend has joined #ruby
<matti> macer1: LOL
<jrxiii> thx for sending your cv
<macer1> huh?
<matti> jrxiii: No problem! Thanks for the opportunity ;]
<matti> macer1: Infinite fork in irb.
<macer1> xD
<jrxiii> I'm annoyed that the Mongodb gem doesn't believe I should be allowed to create mongo cursors where :timeout => false
<matti> macer1: ulimit -u 64 ; irb -- in new bash session, and you can fork-bomb the hell out of yourself ;]
<jrxiii> it's afraid I won't close them once I've opened them…
<matti> LOL
<matti> jrxiii: That's silly.
<macer1> ulimit doesnt worked for al2o3cr ^^
<matti> jrxiii: Does 0 for timeout work?
<jrxiii> the timeout arg takes a boolean
<matti> Ah, OK.
<macer1> >> "dead bot ;("
<al2o3cr> , [FATAL] Failed to create timer thread (errno: 11)
<matti> macer1: Don't break al2o3cr ;]
<macer1> too late
<macer1> :D
drago757 has joined #ruby
<chare> haskell > ruby
cj3kim has joined #ruby
<bperry> chare: are you bipolar?
<chare> am i right?
<bperry> no
<chare> so ruby > haskell?
<bperry> comparing apples and oranges?
<banisterfiend> chare: my ban hammer is pointing at your flat forehead
<matti> banisterfiend: LOL
awarner has joined #ruby
t51823 has quit [Remote host closed the connection]
<banisterfiend> chare: the only way u can save yourself is by writing another one of your beautiful poems
chare has left #ruby ["Leaving"]
t85131 has joined #ruby
recycle has joined #ruby
jasonLaster has joined #ruby
pu22l3r has quit [Remote host closed the connection]
<matti> banisterfiend: Boo.
vlad_starkov has quit [Remote host closed the connection]
<macer1> 1.9.3p194 :004 > "haskell" > "ruby"
<macer1> => false
<macer1> 1.9.3p194 :005 > "ruby" > "haskell"
<macer1> => true
<macer1> ^^
<matti> Right gents.
<matti> Sleep tight.
Foxandxss has quit [Quit: KVIrc 4.2.0 Equilibrium http://www.kvirc.net/]
awarner has quit [Remote host closed the connection]
tommyvyo has quit [Quit: Computer has gone to sleep.]
tommyvyo has joined #ruby
tatsuya_o has quit [Remote host closed the connection]
seanstickle has joined #ruby
<jrxiii> lates
mahmoudimus has quit [Quit: Computer has gone to sleep.]
reactormonk has quit [Ping timeout: 276 seconds]
punkrawkR has quit [Read error: Connection reset by peer]
awarner has joined #ruby
quest88 has joined #ruby
adam_ has joined #ruby
cj3kim has left #ruby ["Leaving"]
awarner has quit [Remote host closed the connection]
davidcelis has joined #ruby
pu22l3r has joined #ruby
<macer1> how can I kill all ruby zombies?
<macer1> >.>
<macer1> killall ruby says that there are no named ruby
<macer1> but they are ruby
adam__ has quit [Ping timeout: 252 seconds]
awarner has joined #ruby
tvw has quit [Ping timeout: 276 seconds]
wpaulson has joined #ruby
clocKwize has quit [Quit: clocKwize]
macer1_ has joined #ruby
<RegEchse> you can't kill zombies, they're already dead ;)
ken_barber1 has joined #ruby
wpaulson_ has joined #ruby
awarner has quit [Remote host closed the connection]
recycle has quit [Remote host closed the connection]
wpaulson has quit [Read error: No route to host]
wpaulson_ is now known as wpaulson
waxjar has quit [Quit: Computer has gone to sleep.]
macer1 has quit [Ping timeout: 260 seconds]
<joephelius> matti: for pid in `ps -A | grep ruby | grep -oE [0-9]{4}`; do pkill $pid; done ;)
<joephelius> arr
locriani has joined #ruby
pu22l3r has quit [Remote host closed the connection]
<joephelius> macer1_ I meant, sry
<macer1_> meh
<macer1_> I rebooted
<macer1_> ...
reactormonk has joined #ruby
<joephelius> lol
<macer1_> I tried for i in $(ps aux | awk "{print $2}"); do kill -9 $i; done
ken_barber has quit [Ping timeout: 245 seconds]
<macer1_> but that was taking forever
<joephelius> should be "kill -9" instead of "pkill" anyways
yaymukund has joined #ruby
<yaymukund> is there a nicer way to do ['', false, nil].all?(&:blank?)
awarner has joined #ruby
<joephelius> wouldnt that kill every single process and not only ruby?
<yaymukund> none? doesn't work on empty string
<macer1_> argh
<macer1_> I know I missed something
<macer1_> there was | grep ruby in there
<macer1_> >.>
jasonkuhrt has joined #ruby
robbyoconnor has quit [Ping timeout: 256 seconds]
ext3_nfs has joined #ruby
jezebel has joined #ruby
jasonkuhrt has quit [Client Quit]
<yaymukund> (in rails I could do .select(&:unblank?).any?)
Xpl01t has quit [Ping timeout: 246 seconds]
mrsolo has quit [Quit: Leaving]
NightMonkey has quit [Remote host closed the connection]
robbyoconnor has joined #ruby
anybody has joined #ruby
gmci has quit [Quit: Computer has gone to sleep.]
awarner has quit [Remote host closed the connection]
<anybody> is a hash an equivalent of an associative array?
gmci has joined #ruby
<wpaulson> anybody: Exactly
<anybody> thanks wpaulson, i'm just starting to learn ruby
mikepack has quit [Remote host closed the connection]
pskosinski has quit [Quit: http://www.redeclipse.net -- Fast-paced online FPS]
awarner has joined #ruby
cascalheira has quit [Quit: Linkinus - http://linkinus.com]
jjbohn has quit [Quit: Leaving...]
<jezebel> Do i need to learn ruby before i learn RoR? or will i learn it along the way of RoR?
<sr___> anyone know what should I do to report a windows specific Rake bug?
<anybody> jezebel, learn ruby with me :D http://tryruby.org/
jjang has quit [Ping timeout: 252 seconds]
<wpaulson> jezebel: Could do either way, I'd say
jjbohn has joined #ruby
jezebel has quit [Ping timeout: 244 seconds]
GoGoGarrett has joined #ruby
wvms has quit [Ping timeout: 268 seconds]
cassianoleal has joined #ruby
niklasb has quit [Ping timeout: 245 seconds]
jjbohn has quit [Client Quit]
cassianoleal has quit [Client Quit]
<RegEchse> macer1_, joephelius: actually i wasn't joking. Practically you _can't_ kill zombie processes, not even with -9; usually that just doesn't do anything. The only thing you can do: make the perent wait() for its zombie children (possibly by sending SIGCHLD manually) or kill the parent (which reparents the child under init which should periodically check all its children ...).
RegEchse has quit [Quit: good night]
<macer1_> x.X
macer1_ is now known as macer1
macer1 has quit [Changing host]
macer1 has joined #ruby
locriani has quit [Remote host closed the connection]
t85131 has quit [Remote host closed the connection]
jarred has quit [Quit: jarred]
t94049 has joined #ruby
graft has quit [Ping timeout: 272 seconds]
haxrbyte has quit [Remote host closed the connection]
liluo has quit [Remote host closed the connection]
jasonkuhrt has joined #ruby
jasonkuhrt has quit [Client Quit]
areil has quit [Remote host closed the connection]
<quazimodo> whats the difference betwen for foo in @bar and @bar.each do |foo| ?
aantix has quit [Ping timeout: 245 seconds]
jasonkuhrt has joined #ruby
jasonkuhrt has quit [Client Quit]
<anybody> good question
wpaulson_ has joined #ruby
wpaulson has quit [Quit: Colloquy for iPhone - http://colloquy.mobi]
wpaulson_ is now known as wpaulson
<banisterfiend> quazimodo: sc0p3
<wpaulson> bb
<banisterfiend> quazimodo: foo persists after the for, but for the each it disappears after the block
krusty_ar has quit [Read error: Connection reset by peer]
krusty_ar has joined #ruby
Z_Mass has quit [Quit: Leaving]
adeponte has quit [Remote host closed the connection]
verto|off is now known as verto
bhegel has joined #ruby
CloCkWeRX has joined #ruby
anybody has quit [Ping timeout: 245 seconds]
Squee- has joined #ruby
<CloCkWeRX> Question: Am I fighting a losing battle with the ruby oci-8 library, 1.8.*, and UTF-8? (using... the oracle enhanced adapter, rails, activerecord, etc - saving things doesn't seem to work too well, as the utf-8 characters never seem to make it to the DB)
locriani has joined #ruby
verto is now known as verto|off
<quazimodo> banisterfiend: oh cool thanks
ringotwo_ has quit [Remote host closed the connection]
ringotwo has joined #ruby
gtuckerkellogg has joined #ruby
chare has joined #ruby
AlienElite has joined #ruby
AlienElite has quit [Client Quit]
<yaymukund> basically, I just avoid for-in. but maybe I just odn't know how to use it
mrdodo has quit [Remote host closed the connection]
andrewhl has joined #ruby
ringotwo has quit [Ping timeout: 276 seconds]
<yaymukund> oo yeah, syntax sugar that is not very newb friendly.
uris has joined #ruby
beneggett has joined #ruby
ezra has quit [Ping timeout: 276 seconds]
recycle has joined #ruby
randomautomator has quit [Remote host closed the connection]
iori has joined #ruby
vitor-br has joined #ruby
Takehiro has joined #ruby
savage-_ has joined #ruby
voodoofish430 has quit [Quit: Leaving.]
gfontenot has quit []
savage- has quit [Ping timeout: 246 seconds]
liluo has joined #ruby
andrewhl has quit [Remote host closed the connection]
peregrine81 has joined #ruby
sterex has joined #ruby
luxurymode has joined #ruby
machty has quit [Ping timeout: 256 seconds]
brianpWins has quit [Quit: brianpWins]
SegFaultAX|work2 has joined #ruby
Hanmac has quit [Ping timeout: 244 seconds]
FiveGP has joined #ruby
peregrine81 has quit [Client Quit]
gtuckerkellogg has quit [Quit: Computer has gone to sleep.]
QKO_ has quit [Ping timeout: 246 seconds]
brasten has quit [Ping timeout: 276 seconds]
brasten has joined #ruby
specialGuest has quit [Ping timeout: 244 seconds]
QKO has joined #ruby
banisterfiend has quit [Remote host closed the connection]
butblack has joined #ruby
banisterfiend has joined #ruby
awarner has quit [Remote host closed the connection]
Sgeo_ has left #ruby ["Leaving"]
nari has joined #ruby
gmci has quit [Quit: Computer has gone to sleep.]
banisterfiend has quit [Ping timeout: 252 seconds]
Squee- has quit [Quit: This computer has gone to sleep]
cakehero has joined #ruby
gmci has joined #ruby
abahkaiyisah has joined #ruby
patient has quit [Quit: leaving]
apok has quit [Ping timeout: 276 seconds]
gtuckerkellogg has joined #ruby
Hanmac has joined #ruby
jjbohn has joined #ruby
gtuckerkellogg has quit [Client Quit]
`brendan has joined #ruby
opus has quit [Quit:]
Tearan has joined #ruby
jrxiii has quit [Quit: jrxiii]
emmanuelux has quit [Ping timeout: 276 seconds]
`brendan has quit [Client Quit]
sebicas has left #ruby [#ruby]
savage-_ has quit [Remote host closed the connection]
QKO_ has joined #ruby
shadoi has quit [Quit: Leaving.]
moshee has quit [Ping timeout: 248 seconds]
moshee has joined #ruby
moshee has joined #ruby
moshee has quit [Changing host]
wvms has joined #ruby
codabrink has quit [Quit: Konversation terminated!]
iori has quit [Read error: Connection reset by peer]
td123 has joined #ruby
maletor has quit [Quit: Computer has gone to sleep.]
macmartine has quit [Quit: ["Textual IRC Client: www.textualapp.com"]]
iori has joined #ruby
jjbohn has quit [Quit: Leaving...]
QKO has quit [Ping timeout: 268 seconds]
machty has joined #ruby
Tomasso has quit [Ping timeout: 245 seconds]
Juul has quit [Ping timeout: 244 seconds]
cousine has joined #ruby
beneggett has quit [Quit: Computer has gone to sleep.]
beneggett has joined #ruby
wendallsan has quit [Quit: No Ping reply in 180 seconds.]
t94049 has quit [Remote host closed the connection]
wendallsan has joined #ruby
t64019 has joined #ruby
Takehiro has quit [Remote host closed the connection]
ezra has joined #ruby
pu22l3r has joined #ruby
banisterfiend has joined #ruby
gen0cide_ has quit [Quit: Computer has gone to sleep.]
Banistergalaxy has quit [Ping timeout: 240 seconds]
cakehero has quit [Quit: Computer has gone to sleep.]
wendallsan has quit [Quit: No Ping reply in 180 seconds.]
wendallsan has joined #ruby
pu22l3r has quit [Remote host closed the connection]
bricker881 has quit [Quit: Leaving.]
sterex has quit [Quit: sterex]
luckyruby has quit [Remote host closed the connection]
jasonLaster has quit [Remote host closed the connection]
jasonLaster has joined #ruby
luckyruby has joined #ruby
recycle has quit [Remote host closed the connection]
macmartine has joined #ruby
wendallsan has quit [Quit: No Ping reply in 180 seconds.]
wendallsan has joined #ruby
luckyruby has quit [Remote host closed the connection]
jasonLaster has quit [Ping timeout: 260 seconds]
arvidkahl has quit [Quit: arvidkahl]
butblack has left #ruby [#ruby]
GoGoGarrett has quit [Remote host closed the connection]
dbe has joined #ruby
cj3kim has joined #ruby
macmartine has quit [Client Quit]
c0rn_ has quit [Quit: Computer has gone to sleep.]
Vert has quit [Ping timeout: 252 seconds]
peregrine81 has joined #ruby
Tref has joined #ruby
shadoi has joined #ruby
minijupe has joined #ruby
<minijupe> to all objects have a method that returns its self?
nirix has joined #ruby
<banisterfiend> minijupe: guess what it's called
perryh_away is now known as perryh
<minijupe> banisterfiend: not self
<otters> why would you have a method that returns itself?
apok has joined #ruby
flip_digits has quit [Quit: Computer has gone to sleep.]
<banisterfiend> minijupe: oh you want an actual method?
<banisterfiend> minijupe: can i ask why?
awarner has joined #ruby
macer1 has quit [Remote host closed the connection]
<quazimodo> somethnig weird guys
<minijupe> long story but I'd just like to know. This guy would too, but my situation requires the name of the method w/o a block: http://stackoverflow.com/questions/6308470/ruby-method-that-returns-itself
FiveGP has quit [Quit: Leaving]
<quazimodo> require "Product" works on my friends machine, but not on mine. I have to user require "product"
<quazimodo> whats with that?
<banisterfiend> minijupe: tap
<banisterfiend> oh
<banisterfiend> without a block
TNTshop has joined #ruby
<otters> ...
<otters> class Object; def id; self; end; end
GoldenCider has joined #ruby
<banisterfiend> quazimodo: because your friend is on windows? :)
<minijupe> otters: thought of making my own. I'm pretty pissed I even have to worry about this. It's a shortcoming in rails as far as I can tell. It's really really frustrating to try to have date form fields without a AR instance that has a method to call to get the date.
<quazimodo> banisterfiend: lol no hes on a mac, im in buntu
peregrine81 has quit [Quit: Goodbye.]
<chare> I need a laptop with ubuntu, macbook air has too many potential "not the same as linux" issues that i don't want to deal with
<chare> where do i get it
shadoi has quit [Quit: Leaving.]
<bperry> system76
<nirix> dual boot osx/ubuntu
shadoi has joined #ruby
jorge_ has quit [Remote host closed the connection]
TNTshop has quit [Read error: Connection reset by peer]
eywu has quit [Quit: Leaving.]
banisterfiend has quit [Remote host closed the connection]
FiveGP has joined #ruby
awarner has quit [Remote host closed the connection]
t64019 has quit [Remote host closed the connection]
t57116 has joined #ruby
Spooner has quit [Read error: Connection reset by peer]
krz has quit [Quit: krz]
k_89 has joined #ruby
alvaro_o has quit [Quit: Ex-Chat]
radic has quit [Disconnected by services]
radic_ has joined #ruby
reset has quit [Ping timeout: 252 seconds]
radic_ is now known as radic
Banistergalaxy has joined #ruby
fbernier has joined #ruby
jasonLaster has joined #ruby
Juul has joined #ruby
wpaulson has quit [Quit: wpaulson]
anybody has joined #ruby
ringotwo has joined #ruby
iamjarvo has joined #ruby
fbernier has quit [Ping timeout: 245 seconds]
jasonLaster has quit [Ping timeout: 276 seconds]
savage- has joined #ruby
abahkaiyisah has quit [Ping timeout: 245 seconds]
luxurymode has quit [Quit: Computer has gone to sleep.]
havenn has joined #ruby
adamkittelson has quit [Remote host closed the connection]
cakehero has joined #ruby
maletor has joined #ruby
<chare> lets talk about something
<otters> ruby?
<otters> that's what this channel is for
echosystm has joined #ruby
sillylogger has joined #ruby
wendallsan has quit [Read error: Connection reset by peer]
banisterfiend has joined #ruby
echosystm has left #ruby [#ruby]
adeponte has joined #ruby
seanstickle has quit [Quit: seanstickle]
<havenn> otters: Yes, Ruby and her struggle against weight loss.
Banistergalaxy has quit [Ping timeout: 265 seconds]
<chare> Will Ruby beat php and perl?
igotnolegs has joined #ruby
<havenn> chare: Yes. Next?
<chare> justify with evidence for why
<otters> because PHP and Perl suck
<otters> next
<banisterfiend> /ban chare
<bperry> chare: you ask stupid questions
<havenn> chare: Because the internet score for Ruby is way higher. The internet score is what matters.
mengu has quit [Read error: Connection reset by peer]
mengu has joined #ruby
mengu has quit [Changing host]
mengu has joined #ruby
<havenn> chare: internet > chare
beneggett has quit [Quit: Computer has gone to sleep.]
<chare> what internet score higher, link to prove it
<havenn> chare: THE internet.
havenn has left #ruby [#ruby]
localhost has quit [Quit: Do fish get thirsty?]
syamajala has quit [Remote host closed the connection]
k_89 has quit [Ping timeout: 272 seconds]
<sillylogger> hi, is there any way to parse part of an xml file?… i've got 800mb of xml and parsing the whole thing takes quite a while.. is it possible to parse N root entries?
fbernier has joined #ruby
<bperry> sillylogger: nokogiri
<bperry> stream parser
<sillylogger> i dont see a way to break
<sillylogger> i guess i can throw an exception...
<bperry> hmm?
shiki has quit [Remote host closed the connection]
GoldenCider has quit [Quit: GoldenCider]
GoldenCider has joined #ruby
GoldenCider has quit [Client Quit]
<sillylogger> bperry: i just want to process the first like… 10 mb… all of these parsing mechanisms that i see have a class method that is `parse` i dont see a way for it to parse anything other than the whole stream (i understand it doesn't open the whole file in memory… i'm just saying i want it to stop pretty early)
GoldenCider has joined #ruby
Araxia has joined #ruby
jenrzzz has quit [Ping timeout: 248 seconds]
v0n has joined #ruby
recycle has joined #ruby
ezra has quit [Ping timeout: 276 seconds]
beneggett has joined #ruby
jasonLaster has joined #ruby
pingfloyd has joined #ruby
wereHamster has quit [Remote host closed the connection]
savage- has quit [Read error: Connection reset by peer]
savage- has joined #ruby
dhruvasagar has joined #ruby
t57116 has quit [Remote host closed the connection]
t81637 has joined #ruby
wereHamster has joined #ruby
td123 has quit [Ping timeout: 260 seconds]
ananthakumaran has joined #ruby
td123 has joined #ruby
recycle has quit [Remote host closed the connection]
mengu has quit [Remote host closed the connection]
gmci has quit [Quit: Computer has gone to sleep.]
Caanon_ has joined #ruby
keppy has joined #ruby
Araxia has quit [Read error: Connection reset by peer]
Araxia has joined #ruby
Araxia has quit [Read error: Connection reset by peer]
ext3_nfs has quit []
Araxia has joined #ruby
i0n has joined #ruby
i0n has joined #ruby
i0n has quit [Changing host]
<chare> whats the difference between postgresql and mysql, which one do i want to default to on rails
<bnagy> sillylogger: nokogiri stream parser. Nokogiri has a stream parser. You could use the nokogiri stream parser. Try using the stream parser in nokogiri?
dhruvasagar has quit [Ping timeout: 272 seconds]
Cascador has joined #ruby
<Cascador> hi everyone
Araxia has quit [Read error: Connection reset by peer]
<sillylogger> I'm using the stream parser right now. i was just curious if i could tell it to parse only a portion of the file.. i pruned the stream down to make a smaller file to mess around.. so that's fine for testing for now
Araxia_ has joined #ruby
<sillylogger> hi Cascador
itcharlie has joined #ruby
xorox90 has joined #ruby
ezra has joined #ruby
ezra has joined #ruby
ezra has quit [Changing host]
<Cascador> I'm relatively new to ruby. All I've done with the language so far was working on some trivial and not-so-trivial Rails apps
<Cascador> My exposure to the Ruby language, thus, has been limited to the context of a Rails app
adamkittelson has joined #ruby
<Cascador> What would be some good toy projects to dive deeper into the language?
<bperry> metasploit!
kaiwren has joined #ruby
<banisterfiend> Cascador: write a game, http://libgosu.org
<Cascador> I was thinking about writing a bunch of crawlers just for fun
<itcharlie> I am reading about ruby and I want to start writing some ruby scripts. Which version of ruby should I install on Ubuntu machine? 1.9 or 1.8?
<Cascador> itcharlie, just do apt-get install ruby and get whatever is in the ubuntu repos
<banisterfiend> Cascador: no
<Cascador> which will probably be 1.9
<banisterfiend> itcharlie: install rvm or rbenv
<banisterfiend> dont use apt-get ;)
<itcharlie> rvm ?
<bnagy> itcharlie: rbenv is 'better' (opinion)
<banisterfiend> itcharlie: google rbenv
<Cascador> banisterfiend, i don't know about that. he's just getting started. wouldn't that complicate things unnecessarily for him?
<bnagy> Cascador: no, having retarded ubuntu packaged 1.8 would make things more complicated
reactormonk has quit [Ping timeout: 276 seconds]
<banisterfiend> Cascador: no, it's easy. it'll complicate things later on when everything is broken by using unbuntu packages
t81637 has quit [Remote host closed the connection]
<bnagy> cause then we get people saying 'why doesn't XYZ 5 year old snippet work?'
<Cascador> on the other hand maybe learning to use rvn from the beginning will pay off for him
<Cascador> in the long run, that is
<banisterfiend> or some gems dont work, for some reason
t90212 has joined #ruby
adamkittelson has quit [Remote host closed the connection]
<Cascador> the only thing i don't like about .rvn is that it generates very long stack traces (/home/cascador/.rvm/foo/bar/baz/somelibrary/somefile.rb: xxxxx)
<yaymukund> it overrides cd, doesn't it?
<Cascador> but it's something i can live with
Guedes has quit [Quit: Saindo]
<bnagy> yaymukund: yes, and other retarded things
<Cascador> banisterfiend, i'll look into libgosu
<bnagy> rbenv knows how to unix
pingfloyd has quit [Read error: Connection reset by peer]
<Cascador> any other toy ruby project ideas to get my ruby skills in shape?
jameshyde has joined #ruby
pingfloyd has joined #ruby
<bnagy> Cascador: puzzlenode
<Cascador> googling it
<bnagy> but they'll probably be too hard unless you've studied some programming
<bnagy> project euler is good tactical practice for any language
<banisterfiend> bnagy: hey, i got the dolphin emulator for osx
fbernier has quit [Ping timeout: 244 seconds]
<banisterfiend> bnagy: im playing super mario galaxy 2 on my imac :D
<bnagy> ha
<chare> omg you're using a warez version of super mario galaxy 2
<Cascador> bnagy, meh. i've solved a bunch of project euler problems. i'd rather do something I can apply not only my raw programming/problem-solving skills, but also my design skills
<keppy> cascador: do more of them with timers
<Cascador> something that ideally will force me to apply my object-oriented design skills using ruby
<Cascador> keppy, that's a neat idea but it's not what i'm really looking for
jasonLaster has quit [Remote host closed the connection]
tastycakeman has joined #ruby
a_a_g has joined #ruby
<keppy> cascador: learn more languages in your intended domain and build something bigger. Or if you just wanna do ruby dev, make a gem that does something useful.
<keppy> ;)
<Cascador> keppy, I have a gem in the works
<Cascador> a pretty simple wrapper around the imgur api
<tastycakeman> hello! I am doing the michael hartl tutorial, and I'm confused about a minor detail that I can't seem to understand.
<Cascador> but it's really just a bunch of restful api calls
<tastycakeman> I am playing the rails console by creating a new user, using User.create
andrewpthorp has joined #ruby
<tastycakeman> but when I create the user, it doesn't save with an id
<Cascador> i guess what i really want to do is to apply object-oriented design using the ruby language
<tastycakeman> in other words, the id column is 'nil', but I'm pretty sure that is wrong
gmci has joined #ruby
<bnagy> Cascador: you can do that with any problem at all
<banisterfiend> tastycakeman: join a rails channel, #rubyonrails
<keppy> cascador: what is your ideal project, what do you want to be building in a year or two?
<tastycakeman> oops ok, off to rails channel
mparodi has joined #ruby
macmartine has joined #ruby
<keppy> cascador: cause if you want to do rails/Internet related work you will need more languages and the cool thing about that is 1) they're fun to learn and 2) ruby makes sense as you learn supporting tech for your domain of programming. Just my 2c.
SCommette has joined #ruby
<Cascador> I'll probably be getting into machine learning and data mining soon - i basically want to be able to create models around complex data, apply machine learning algorithms, create applications that do work around user submitted data, probably serve these apps as a restful api that i can consume from a rails app or any kind of app really
<Cascador> keppy, i'm already a full stack web developer - i'm just still relatively new to both ruby and rails
tr4656_ has joined #ruby
mparodi_ has quit [Ping timeout: 240 seconds]
<chare> so what does machine learning have to do with rails
<Cascador> nothing at all, i'm talking about ruby here :)
<Cascador> I could just go and write a toy app that does just that
<Cascador> but!
<Cascador> maybe you guys have figured out what a good "learning" project is for someone who wants to get his ruby skills in line
<Cascador> so i decided to came here and ask you guys what would you recommend me to do, or what you'd do if you were in my shoes
reactormonk has joined #ruby
<Cascador> chare, i already know the language, i want to actually apply it to things other than rails apps
<chare> don't use it outside of rails
<Cascador> of course i want to use it outside of rails, what are you talking about?
uris has quit [Quit: leaving]
t90212 has quit [Remote host closed the connection]
t2981 has joined #ruby
<Cascador> okay, let's try a different approach
mike4__ has joined #ruby
jowens_ has joined #ruby
<Cascador> what's a non-trivial, non-webapp open source ruby application that I can study to get a feel of how things are done "the ruby way"?
<bnagy> Cascador: historically, 'tell me what 2 code pls!' questions always end badly
luckyruby has joined #ruby
<Cascador> bnagy, that's why i'm switching to a different strategy :)
brianpWins has joined #ruby
<Cascador> bnagy, i should've known better though, you're right
td123 has quit [Ping timeout: 244 seconds]
<bnagy> check out celluloid on github
<Cascador> anyways, any suggestions?
<itcharlie> hmm compiling ruby on a netbook is not a great idea
<Cascador> celluloid? looking it up
td123 has joined #ruby
<bnagy> it's an interesting idea, code is not too complicated and it's pretty well designed
<keppy> casador: you should do the ruby koans? maybe too easy but they come to mind.
SegFaultAX|work2 has quit [Ping timeout: 276 seconds]
<Cascador> keppy, I've already done all the ruby koans
<Cascador> bnagy, it's a nice example of a well-designed library
<Cascador> i'm looking for applications though
<Cascador> any ideas?
<keppy> casador: celluloid is really cool and fun to work with. maybe build a chat server with it?
mike4_ has quit [Ping timeout: 276 seconds]
<keppy> casador: you could build a concurrent chat server in ruby with celluloid and ZeroMQ
<Cascador> keppy, that's actually a good idea, maybe i'll d oit
<Cascador> okay, back to my second question now
<bnagy> dcell is the sister lib for distributed stuff
<bnagy> already uses 0mq under the hood
<Cascador> what would be a good open source application that i can study to get a good feel of the ruby way of things?
<Cascador> not a library but an app
<bnagy> Cascador: I tire of this
ringotwo has quit [Remote host closed the connection]
ddouglas has joined #ruby
<Cascador> bnagy, you tried this?
gen0cide_ has joined #ruby
<bnagy> no tire, like bored
charliesome has joined #ruby
<Cascador> well, i'm bored of it too
<banisterfiend> Cascador: you've been asking the same q. for the last 40 mins
<Cascador> I've done a bunch of github searches to see if I can find good examples, but nothing interesting came up
kristopolous has quit [Ping timeout: 276 seconds]
<Cascador> I thought it wouldn't be a bad idea to come here an ask
CannedCorn has joined #ruby
<banisterfiend> np asking, but asking and asking and asking the same thing again and again
<Cascador> sorry if i'm boring you, but i think it's a legitimate question
<banisterfiend> is kind of annoying
<Cascador> i understand, and i apologize
<Cascador> seems like i didn't explain myself well
<Cascador> maybe i'll ask again later when there's more activity in this room
<Cascador> thanks anyways, you've given me good advice on what kind of projects to get into
cousine has quit [Remote host closed the connection]
wvms has left #ruby [#ruby]
machty has quit [Ping timeout: 276 seconds]
banisterfiend has quit [Remote host closed the connection]
mike4__ is now known as mike4_
khakimov has joined #ruby
tr4656_ is now known as tr4656
kristopolous has joined #ruby
Banistergalaxy has joined #ruby
tayy has quit [Ping timeout: 244 seconds]
CloCkWeRX has quit [Quit: Leaving.]
CloCkWeRX has joined #ruby
kaiwren has quit [Quit: kaiwren]
kaiwren has joined #ruby
kaiwren has quit [Client Quit]
itcharlie has quit [Quit: Leaving]
xaxxon has joined #ruby
jasonkuhrt has joined #ruby
wangr_ has joined #ruby
wangr has quit [Ping timeout: 245 seconds]
ananthakumaran has quit [Quit: Leaving.]
v0n has quit [Ping timeout: 265 seconds]
<Banistergalaxy> Chare watch out http://www.bbc.co.uk/newsbeat/19269353
sillylogger has left #ruby [#ruby]
CannedCorn has quit [Ping timeout: 244 seconds]
<anybody> where's the best place to get started learning ruby?
<Cascador> tryruby.org
keppy has quit [Ping timeout: 246 seconds]
<Cascador> after that, head to http://rubykoans.com/
<anybody> i just finished tryruby.org, rubykoans you're next then :D
<reactormonk> anybody: grab a book and read code
<Cascador> anybody, good luck
<bnagy> what are these 'books' you speak of?
t2981 has quit [Remote host closed the connection]
<anybody> I second bnagy's question
t19193 has joined #ruby
zx has joined #ruby
burgestrand has quit [Quit: Leaving.]
tastycakeman has quit [Ping timeout: 248 seconds]
<Banistergalaxy> Anybody get eloquent ruby
seitensei has joined #ruby
<Banistergalaxy> If you already know another language
dhruvasagar has joined #ruby
<Banistergalaxy> Otherwise get learn to program
schleppy has joined #ruby
<anybody> well, I know PHP. I should get Eloquent Ruby then?
<Cascador> Banistergalaxy, solid advice
gtuckerkellogg has joined #ruby
<bnagy> PHP is a disease, not a language
<anybody> :o why do u say so bnagy
<Cascador> AFAIK, eloquent ruby is targetted to people already writing ruby code with significant experience in other languages, that want to learn "the ruby way" of things
ezra has quit [Ping timeout: 276 seconds]
<schleppy> Total ruby newb. Is there a way to do this? http://bpaste.net/show/kESlMXSgaeYqYtDIfC47/
<bnagy> anybody: just pretend I linked to that fractal of bad design article and then talked about ridiculous security and retarded developers
<bnagy> schleppy: no, you would have to serialize or something to get an instance
<bnagy> or use some kind of IPC (but you'd have to serialize to pass it between processes), or you could give access to the instance "directly" using DRb
<schleppy> The "Fractal of bad design" article harped on some points that are language features. But I agree. If I never have to use PHP again it will be too soon.
<anybody> I also know java, so I think I'll go with Eloquent Ruby.
drago757 has quit [Quit: drago757]
<bnagy> for quick ruby -> ruby comms DRb is great
<schleppy> bnagy: I will likely need to google DRb. But why do you mention IPC?
keppy has joined #ruby
reactormonk has quit [Ping timeout: 276 seconds]
<bnagy> cause you have two processes?
<schleppy> This isn't meant to be multi-process
<Cascador> anybody, it's still a good idea to finish the ruby koans first
<schleppy> How do I have two processes?
<bnagy> well you make an instance in one, you want to use it in another
<bnagy> whether or not the first one is still running isn't really relevant
<anybody> Cascador, I don't know how it works :( I only see assert_equals assert_match,
<schleppy> Well, surely a "require" doesn't launch in another process.
chessguy has joined #ruby
<Cascador> anybody, it's a bunch of test cases that you gotta fix until they all pass
<bnagy> it's in a second .rb, no?
yakko has joined #ruby
<schleppy> It is, yes.
<bnagy> soo...
<bnagy> add puts $$ to both files ;)
<schleppy> So, a separate rb means a sep process?
<bnagy> not always, no
<schleppy> I'm not saying you're wrong (because you certainly have more insight than I do), but that seems very strange to me.
kaiwren has joined #ruby
<schleppy> So, wouldn't communication between different rbs have to be some sort of IPC?
<bnagy> actually I am wrong, I misremembered what you had in the paste
<schleppy> #thankgoodness
<schleppy> :D
<bnagy> but you still don't get locals when you require
<schleppy> Understood.
c0rn_ has joined #ruby
<bnagy> so more or less everything still holds
SCommette has quit [Quit: SCommette]
bhegel has quit [Quit: Leaving]
drago757 has joined #ruby
havenn has joined #ruby
<bnagy> in general, if you're making files to be required, whoever requires them makes their own instances
nobitanobi has joined #ruby
<hemanth> Errno::EACCES: Permission denied, on File#unlink in window$ machine, easy fix?
<bnagy> hemanth: yes, give yourself access
<hemanth> bnagy, tried, that did not refeclt
<hemanth> *reflect
ddouglas has quit [Quit: Ex-Chat]
laen_ has quit [Ping timeout: 240 seconds]
<bnagy> probably file in use, then IME
<hemanth> :|
<bnagy> I am 90% sure windows doesn't have the *nix unlink while in use trick
<bnagy> I think unlink is just an alias to rm
<bnagy> like delete, in windows
Tref has quit [Quit: Tref]
mohits has joined #ruby
t19193 has quit [Remote host closed the connection]
Eldariof-ru has joined #ruby
t80830 has joined #ruby
cakehero has quit [Quit: Leaving...]
krz has joined #ruby
<nobitanobi> I am building a gem that interacts with an API using Oauth. How can I manage the keys, so the tests can be run? I don't want to make the gem public with my keys...
tnk1 has joined #ruby
ananthakumaran has joined #ruby
Hanmac has quit [Ping timeout: 252 seconds]
kaiwren has quit [Quit: kaiwren]
anybody has quit [Ping timeout: 248 seconds]
Takehiro has joined #ruby
i0n has quit [Quit: Lost terminal]
keppy has quit [Ping timeout: 265 seconds]
laen_ has joined #ruby
anybody has joined #ruby
anybody has joined #ruby
anybody has quit [Changing host]
gmci has quit [Quit: Computer has gone to sleep.]
td123 has quit [Quit: WeeChat 0.3.8]
Takehiro has quit [Remote host closed the connection]
himsin has quit [Ping timeout: 276 seconds]
<schleppy> Is there a way to assign during a conditional check, like `if foo = bar['baz']`
<Banistergalaxy> Yes, just like that
<schleppy> I must have typo'd something.
<bnagy> it's a bad habit though
<anybody> won't that assign the value of foo to bar['baz']?
<bnagy> -wc will bitch about it, too
<yaymukund> vice versa.. it will assign bar['baz'] to foo
<hemanth> system("DEL #{file}") in resuce hmm
<yaymukund> (right??)
maletor has quit [Quit: Computer has gone to sleep.]
<schleppy> what is proper rubyistical approach? foo = bar['baz']; if foo;
CloCkWeRX has quit [Read error: Connection reset by peer]
<schleppy> or: if bar['baz']; foo = bar['baz'];
CloCkWeRX has joined #ruby
<bnagy> either
<bnagy> depends if you definitely need to use foo
tommyvyo has quit [Quit: Computer has gone to sleep.]
fearoffish has quit [Quit: Computer has gone to sleep.]
zx has quit [Ping timeout: 276 seconds]
s1n4 has joined #ruby
andrewpthorp has quit [Quit: Leaving...]
jhunter_ has joined #ruby
yakko has quit [Quit: No Ping reply in 180 seconds.]
yakko has joined #ruby
jhunter has quit [Read error: Operation timed out]
havenn has quit [Remote host closed the connection]
anybody has quit [Ping timeout: 272 seconds]
maletor has joined #ruby
<hemanth> bnagy, File.delete seems to work
yasushi has joined #ruby
banisterfiend has joined #ruby
seitensei has quit [Remote host closed the connection]
answer_42 has joined #ruby
<bnagy> hemanth: ahh ok, looks like I was wrong about unlink then
<bnagy> I always use FileUtils.rm / rm_f
yakko has quit [Quit: No Ping reply in 180 seconds.]
<bnagy> but you can still get NOACCESS when the file is in use
yakko has joined #ruby
<bnagy> normally if I am SURE nobody is accessing the file I spin a thread that just does rm_f in a loop until it's gone
adeponte has quit [Ping timeout: 246 seconds]
<hemanth> hmm files!
Goles has quit [Quit: Textual IRC Client: http://www.textualapp.com/]
macmartine has quit [Read error: Connection reset by peer]
<bnagy> there are some rare racy type conditions where you would expect delete to work but windows hasn't decided the handle is closed yet
laen_ has quit [Read error: Connection reset by peer]
ringotwo has joined #ruby
reactormonk has joined #ruby
yakko has quit [Client Quit]
yakko has joined #ruby
jameshyde has quit [Remote host closed the connection]
nobitanobi has quit [Quit: Leaving.]
ar_ has joined #ruby
chessguy has quit [Remote host closed the connection]
t80830 has quit [Remote host closed the connection]
Hanmac has joined #ruby
randomautomator has joined #ruby
t89124 has joined #ruby
randomau_ has joined #ruby
Caanon_ has quit [Quit: Page closed]
Juul has quit [Ping timeout: 246 seconds]
keppy has joined #ruby
s1n4 has quit [Quit: Lost terminal]
iamjarvo has quit [Ping timeout: 244 seconds]
lurch_ has quit [Quit: lurch_]
greenysan has joined #ruby
randomautomator has quit [Ping timeout: 260 seconds]
drago757 has quit [Quit: drago757]
yaymukund has quit [Ping timeout: 244 seconds]
maletor has quit [Quit: Computer has gone to sleep.]
yxhuvud has joined #ruby
s1n4 has joined #ruby
Eldariof-ru has quit []
carrythezero has quit [Quit: leaving]
GoldenCider has quit [Quit: GoldenCider]
adeponte has joined #ruby
yasushi has quit [Remote host closed the connection]
ph^ has joined #ruby
ph^ has quit [Remote host closed the connection]
randomau_ has quit [Remote host closed the connection]
dhruvasagar has quit [Ping timeout: 248 seconds]
kaiwren has joined #ruby
nirix has quit [Quit: Computer has gone to s…zZzZz]
kaiwren has quit [Client Quit]
keppy has quit [Ping timeout: 245 seconds]
jasonkuhrt has quit [Quit: Leaving...]
<schleppy> I have a hash with a couple keys, values. Is there a rubyistical way of applying those key, vals as named arguments?
<schleppy> like `call_function(my_hash)`
answer_42 has quit [Ping timeout: 276 seconds]
<bnagy> schleppy: that just works, also the 1.9 hash syntax 'looks like' named arguments
andrewhl has joined #ruby
mike4_ has quit [Quit: bbl]
<schleppy> But it isn't?
<bnagy> frob_widget(direction: :clockwise, turns: 4)
<bnagy> def frob_widget( opts={:turns=>2} ) # default value for one param
<schleppy> bnagy, if it `just works`, then how would you define a function/method that takes a hash as an argument.
cloud|droid has joined #ruby
<Hanmac> schleppy:def frob_widget( opts={}); opts=opts.merge(:turns=>2);end
hakunin has quit [Read error: Connection reset by peer]
khakimov has quit [Quit: Computer has gone to sleep.]
anybody has joined #ruby
hakunin has joined #ruby
<schleppy> So I can do this if I am in control of the method being called then, right?
<Hanmac> oh no, this is better: def frob_widget( opts={}); opts={:turns=>2}.merge(opts);end
brianpWins has quit [Quit: brianpWins]
khakimov has joined #ruby
khakimov has quit [Client Quit]
<Hanmac> schleppy what do you mean "in control of the method"?
<schleppy> Well, let me put it this way.
c0rn_ has quit []
<schleppy> I am creating a single configuration strategy for a project which uses Python and Ruby. To do this, I am using YAML. This project does a lot of communication back and forth with AWS, so it uses aws-sdk (Ruby) and boto (Python).
<schleppy> What I want to do, it load the credentials for AWS, then just do something like: AWS.config(**credientials)
banisterfiend has quit [Read error: Connection reset by peer]
<bnagy> just use ENV imho
<bnagy> that's what aws-sdk expects anyway
<schleppy> that would be the Pythonic way to do it. ** would unpack the dictionary (hash) into named arguments.
<schleppy> bnagy, yeah, I know.
<schleppy> Problem is I want to be able to switch back and forth between different environments / projects.
<schleppy> There are 4 projects (all with different credentials) and 3 environments (all different credentials)
<schleppy> that's 12 sets.
tastycakeman has joined #ruby
<schleppy> Also, is being worked on by 3 other devs, who all have their own creds for at least one or two of these projects.
tastycakeman1 has joined #ruby
<schleppy> so, the approach is just: ./executable.rb -p project1 -e dev
tastycakeman1 has quit [Client Quit]
<schleppy> fior example.
k_89 has joined #ruby
yakko has quit [Remote host closed the connection]
vectorshelve has joined #ruby
opus has joined #ruby
opus has quit [Client Quit]
<vectorshelve> Hi
<luckyruby> what is idiomatic in ruby for finding whether x is a substring of y?
tastycakeman has quit [Ping timeout: 244 seconds]
<luckyruby> y.index(x) ?
<bnagy> include?
<luckyruby> thanks
banisterfiend has joined #ruby
adurity has joined #ruby
pingfloyd has quit [Quit: pingfloyd]
zamboli has joined #ruby
fantazo has quit [Remote host closed the connection]
SegFaultAX|work2 has joined #ruby
t89124 has quit [Remote host closed the connection]
t46457 has joined #ruby
<anybody> is this a good ebook? http://book.rubylearning.org/
cousine has joined #ruby
adurity has quit [Remote host closed the connection]
cloud|droid has quit [Ping timeout: 252 seconds]
banisterfiend has quit [Read error: Connection reset by peer]
deo has joined #ruby
banisterfiend has joined #ruby
gen0cide_ has quit [Quit: Computer has gone to sleep.]
burgestrand has joined #ruby
yaymukund has joined #ruby
elhu has joined #ruby
tagrudev has joined #ruby
_bart has joined #ruby
djdb has joined #ruby
lurch_ has joined #ruby
locriani has quit [Remote host closed the connection]
shell0x_ has joined #ruby
<shell0x_> hi
maesbn has joined #ruby
<shell0x_> does anyone an idea why it won't load any tests in this setup? https://gist.github.com/0da9a9ee38fae9015dbb#comments
<shell0x_> have an idea*
<vectorshelve> anybody: Yes.. :) as long as you WRITE code and not read through it :)
<shell0x_> vectorshelve: i think capybara/rspec causes the trouble
<shell0x_> but I'm not sure how to fix it
<vectorshelve> shell0x_: well, even I am new to rspec and test cases.. sorry cant help you with it.. you could try asking it on #ruby-lang room
elhu has quit [Quit: Computer has gone to sleep.]
jwang has quit [Quit: Leaving]
tonini has joined #ruby
andrewhl has quit [Remote host closed the connection]
masoudd has joined #ruby
krusty_ar has quit [Ping timeout: 276 seconds]
senny has joined #ruby
Azure has quit [Excess Flood]
Azure has joined #ruby
Goles has joined #ruby
MarGarina has joined #ruby
jwang has joined #ruby
brianpWins has joined #ruby
xnm has joined #ruby
gmci has joined #ruby
Morkel has joined #ruby
t46457 has quit [Remote host closed the connection]
t86992 has joined #ruby
burgestrand has quit [Quit: Leaving.]
workmad3 has joined #ruby
flexoid has joined #ruby
chussenot has joined #ruby
aganov has joined #ruby
nari has quit [Ping timeout: 245 seconds]
<flexoid> Hi, does ruby have some method to use like this: "over, not_over = all.select { |i| i.value > 5 }"?
<flexoid> i mean, to separate array to two by condition
<flexoid> one pass
<banisterfiend> flexoid: Enumerable#partition
<flexoid> banisterfiend, thanks a lot
greenysan has quit [Ping timeout: 260 seconds]
Stalkr_ has joined #ruby
<shell0x_> banisterfiend: are you familar with capybara, sinatra and rspec?
<banisterfiend> shell0x_: why are you msging me directly?
xorox90 has quit [Remote host closed the connection]
<banisterfiend> ask your question to the channel
<shell0x_> i did before :P
<shell0x_> but no one seems to be here
_bart has quit [Quit: _bart]
pskosinski has joined #ruby
sspiff has quit [Remote host closed the connection]
answer_42 has joined #ruby
locriani has joined #ruby
nari has joined #ruby
cloud|droid has joined #ruby
mahmoudimus has joined #ruby
xorigin has joined #ruby
<aces1up> i know I can do *(0..10) to create a [0,1,2,3 -- etc..] how can I do it with a variable ? like : *(0..len) ???
Stalkr_ has quit [Read error: Connection reset by peer]
<banisterfiend> aces1up: x = (0..10).to_a
<banisterfiend> aces1up: x = *(0..10)
<aces1up> I need 10 in that last example to be a variable.. of length
maletor has joined #ruby
dhruvasagar has joined #ruby
<banisterfiend> aces1up: that's fine..
Banistergalaxy has quit [Ping timeout: 268 seconds]
<aces1up> len = 10
nobdraisentone has quit [Ping timeout: 272 seconds]
<aces1up> *(0..len) doesn't seem to
<aces1up> compile
Hanmac has quit [Ping timeout: 244 seconds]
nobdraisentone has joined #ruby
<banisterfiend> aces1up: works fine for me
workmad3 has quit [Ping timeout: 240 seconds]
dangerousdave has joined #ruby
<shevy> *(0..10)
<shevy> SyntaxError: compile error
<shevy> does not seem to work for me at all aces1up
CloCkWeRX has left #ruby [#ruby]
noyb has quit [Ping timeout: 240 seconds]
dekronin1 has joined #ruby
juha_ has joined #ruby
zburt has quit [Read error: Connection reset by peer]
zburt has joined #ruby
DuoSRX has joined #ruby
Araxia_ has quit [Quit: Araxia_]
thomas is now known as miggle
FlyingFoX has quit [Read error: Connection reset by peer]
cjk101010 has quit [Quit: ZNC - http://znc.sourceforge.net]
FlyingFoX has joined #ruby
naquad has quit [Ping timeout: 240 seconds]
cjk101010_ has joined #ruby
masoudd has quit [Ping timeout: 276 seconds]
miggle is now known as thomas
maletor has quit [Quit: Computer has gone to sleep.]
tris has quit [Excess Flood]
adac has joined #ruby
rakunHo has joined #ruby
hoelzro|away is now known as hoelzro
laen_ has joined #ruby
rtj has joined #ruby
naquad has joined #ruby
Majost has quit [Ping timeout: 244 seconds]
<anybody> can someone please tell me what's wrong with line 28 and 32? http://dpaste.com/789395/
pozic has joined #ruby
<hoelzro> anybody: looks fine to me
<hoelzro> what error do you get?
afd__ has joined #ruby
<pozic> If I have a value like "abc.com/foo/bar/../../oh", how can I turn that into "abc.com/oh"?
<pozic> I don't need the algorithm, I'd only be interested in a library which already does that.
<hoelzro> pozic: you could use a regular expression
<anybody> hoelzro, http://dpaste.com/789397/
nari has quit [Ping timeout: 245 seconds]
nari has joined #ruby
<hoelzro> anybody: that's the verbatim source you're running?
pskosinski has quit [Quit: http://www.redeclipse.net -- Fast-paced online FPS]
<hoelzro> no indents or anything?
<anybody> hoelzro, i don't know what you are talking about.
<hoelzro> heredocs don't take kindly to indents.
elhu has joined #ruby
dbe has quit [Remote host closed the connection]
<quazimodo> g.respond_to?("methodname") ... can this be done like g.respond_to?(:method_name); where :method_name => "my_method" ?
<pozic> hoelzro: I am searching to solve the general problem.
<anybody> what's wrong with my indentation hoelzro
<pozic> hoelzro: I fail to see how regular expressions would solve this problem.
<hoelzro> anybody: nothing, as far as I can see
clocKwize has joined #ruby
<hoelzro> pozic: s.gsub!(%r{/.*/}, '/')
<hoelzro> that would be a regex that would solve your problem, afaik
<hoelzro> oh
<hoelzro> I understand
<hoelzro> you have a path
<anybody> hoelzro, ah it doesn't like a space after END_STR
<anybody> haha
<hoelzro> and you're trying to canonicalize it
<hoelzro> anybody: I didn't see that
<hoelzro> but that's correct
<hoelzro> heredocs expect the exact same string as the delimiter
<hoelzro> I think there's a trick with <<-END, though
<hoelzro> haven't used it enough to say
jprovazn_away is now known as jprovazn
<pozic> I already found a perfect solution.
<hoelzro> pozic: I was just about to recommend Pathname =)
<pozic> hoelzro: uri is much better
insecurlex has joined #ruby
<pozic> hoelzro: are you sure you are experienced in Ruby?
masoudd has joined #ruby
answer_42 has quit [Quit: WeeChat 0.3.8]
tessi has joined #ruby
tessi has joined #ruby
tessi has quit [Changing host]
tris has joined #ruby
<hoelzro> pozic: I'm not
<hoelzro> I never said I was =)
answer_42 has joined #ruby
alta has quit [Ping timeout: 246 seconds]
<shevy> pozic is a good man
<shevy> he is able to answer his own questions
<shevy> :P
lkba has quit [Read error: Operation timed out]
lkba has joined #ruby
<pozic> shevy: perhaps I should just create a Markov chain and talk against that; same effect :)
shiki has joined #ruby
und3f has joined #ruby
<hoelzro> there's always http://www.developerduck.com/ =)
seitensei has joined #ruby
<shevy> anyone of you using openssl + sockets? and got a working example?
aces1up has quit []
qwerxy has joined #ruby
igotnolegs has quit [Quit: Computer has gone to sleep.]
shiki has quit [Read error: Connection reset by peer]
alta has joined #ruby
apeiros_ has joined #ruby
<quazimodo> what happenns when I make
<quazimodo> class Foo; @bar = "bla"; end
<quazimodo> does @bar ... exist anywhere?
<hoelzro> sure it is
<hoelzro> s/is/does/
* hoelzro needs coffee
shiki has joined #ruby
<quazimodo> hoelzro: how do I list the variables I have?
cezar has joined #ruby
<hoelzro> well, first you need to understand that that's not a "conventional" instance variable
<hoelzro> it's what's known as a class instance variable
<banisterfiend> quazimodo: : ls -i Foo
cezar has quit [Read error: Connection reset by peer]
<banisterfiend> quazimodo: (in pry)
<hoelzro> it's a instance variable on the class object
<quazimodo> ohhh they are instance variables
<apeiros_> quazimodo: Foo is an object
<apeiros_> Foo.instance_variables
<quazimodo> why arent they class variables?
<apeiros_> class Foo; class << self; attr_accessor :bar; end; end
<apeiros_> because @vars are instance variables
<apeiros_> @@cvars are class variabiables
<apeiros_> gah
<apeiros_> *variables
<quazimodo> ,lol
<quazimodo> hrm
<quazimodo> ill need to look at the differences between the two, thank you apeiros_
<quazimodo> bbl
<apeiros_> quazimodo: it's not too bad to just forget about @@cvars
<apeiros_> they're usually more pain than gain
shadoi has quit [Quit: Leaving.]
AllStruck has quit [Ping timeout: 252 seconds]
thone_ has joined #ruby
minijupe has quit [Quit: minijupe]
AllStruck has joined #ruby
Majost has joined #ruby
wobr has joined #ruby
mahmoudimus has quit [Quit: Computer has gone to sleep.]
ephemerian has joined #ruby
TPFC-SYSTEM has joined #ruby
thone has quit [Ping timeout: 272 seconds]
kaiwren has joined #ruby
ProT-0-TypE has joined #ruby
<shevy> apeiros_! you surely meant variababies!
quest88 has quit [Quit: quest88]
chriskk has quit [Quit: chriskk]
<shevy> quazimodo why don't you initialize your @foo variables within initialize() ?
Criztian has joined #ruby
nari has quit [Ping timeout: 240 seconds]
dbe has joined #ruby
jeff_sebring has joined #ruby
dangerousdave has quit [Quit: Leaving...]
savage- has quit [Remote host closed the connection]
Criztian has quit [Remote host closed the connection]
DuoSRX has quit [Remote host closed the connection]
Criztian has joined #ruby
lkba has quit [Quit: Bye]
Criztian has quit [Ping timeout: 268 seconds]
khakimov has joined #ruby
greenysan has joined #ruby
pskosinski has joined #ruby
ringotwo has quit [Remote host closed the connection]
sspiff has joined #ruby
sspiff has joined #ruby
nari has joined #ruby
insecurlex has quit [Remote host closed the connection]
dpk has joined #ruby
<quazimodo> shevy, apeiros_ : well its not that I want to use them, I want to understand how it all works. Class variables seem..... scary
<quazimodo> I suppose some things could use them
<shevy> @@foo is absolutely useless
<quazimodo> but the way they are scoped for the superclass... why was that put into ruby?
<quazimodo> oh actually
<quazimodo> i can see if its on the base class why it may be useful
<quazimodo> like a big global variable of sorts I suppose
_bart has joined #ruby
<shevy> we already have $globals
<shevy> @@foo's are just attached globals to classes
<hoelzro> with funny scoping rules.
<hoelzro> ;)
<shevy> the pickaxe example uses them as a counter
DuoSRX has joined #ruby
<shevy> every time a certain class is instantianted, they add +1 to a @@foo variable
<shevy> how useful... :P
<quazimodo> lol
<hoelzro> I wish that @@foo were the same as class.class_eval { @foo }
<hoelzro> seems cleaner to me
zamboli has quit [Quit: leaving]
Hama has joined #ruby
Takehiro has joined #ruby
FlyingFoX has quit [Ping timeout: 260 seconds]
kyb3r has joined #ruby
gtuckerkellogg has quit [Ping timeout: 268 seconds]
gen0cide_ has joined #ruby
<shevy> hmm
qwerxy has quit [Quit: offski]
<shevy> to replace one ugly thing with one eval
<shevy> I'd prefer to see @@foo removed altogether but I guess it's easier to add features than remove them
artOfWar has quit [Ping timeout: 244 seconds]
<shevy> like the ->
<hoelzro> indeed
<hoelzro> what's ->?
<shevy> hmm trying to find a working example
<quazimodo> I still dont know what the heck :bla => "bar" means
<hoelzro> quazimodo: it's shorthand for a Hash
<hoelzro> hash = :bla => 'bar'
<hoelzro> puts hash[:bla] # prints bar
nilg has joined #ruby
workmad3 has joined #ruby
<quazimodo> hoelzro: i kinda guessed that. these hash keys are used so much in rails...
banseljaj has quit [Ping timeout: 260 seconds]
masoudd has quit [Ping timeout: 268 seconds]
elaptics`away is now known as elaptics
BiHi has joined #ruby
paulm_ has joined #ruby
<shevy> hoelzro, my_lambda = -> { return 'Freddy' } vs. my_lambda = lambda { return 'Freddy' }
<shevy> I think
<hoelzro> ah, that
<hoelzro> yeah, I'm not too stoked about that syntax.
<shevy> hehe
<shevy> ->{ "foo" }.meow->->{ "bar" }.die
<shevy> oops
<shevy> one too many ->
<shevy> hmm come to think about it, this screams for .tap inclusion
dapangro has joined #ruby
dapangro has quit [Read error: Connection reset by peer]
t86992 has quit [Remote host closed the connection]
t49382 has joined #ruby
* quazimodo misses the simplicity of python @_@
<shevy> yeah
<shevy> well
<quazimodo> its like whoever wrote ruby was like "ill add this, and this and OOO this and omg have to have that"
<shevy> python's explicit self stinks
chare has quit [Quit: Leaving]
Quadrant has quit [Quit: Leaving]
<shevy> it's good that new ideas are tried
<workmad3> python is too verbose IMO
<shevy> but things tend to stay for too long before they are removed or deprecated
<shevy> like autoload
<quazimodo> meh
<quazimodo> why cant the world just go back to using lisp :/
<workmad3> quazimodo: 'go back'? heh
malcolmva has quit [Ping timeout: 246 seconds]
tomku has quit [Ping timeout: 246 seconds]
cout has quit [Ping timeout: 246 seconds]
<quazimodo> workmad3: yeah it has blody everything
<shevy> quazimodo lisp has an awful syntax and it also failed to conquer the niche of scripting languages (perl ruby python php)
<workmad3> quazimodo: yeah... but it was never particularly mainstream
<workmad3> quazimodo: so it wouldn't be 'going back' to it :P
babinho has quit [Ping timeout: 276 seconds]
<quazimodo> at one point it was doing ok, then it died in the ass
<shevy> the last lisp survivor is emacs
<shevy> :D
<quazimodo> the syntax isnt so bad, you dont really go by brackets
<quazimodo> indentation levels kinda much more important
<shevy> yeah I hear this a lot, people claim that your brain tends to ignore the ()
<quazimodo> also that's the end of lisps syntax
<shevy> but this is like xml <>
<shevy> and no matter how often I look at xml, it still is a pile of ugly shit
<shevy> actually
<quazimodo> nah lisp becomes easy, you dontreally have any syntax, per se
cout has joined #ruby
<shevy> XML syntax is 1000x worse than lisp syntax
babinho has joined #ruby
<workmad3> shevy: when I did a bit of lisp, the parentheses did tend to disappear... but I'm with you with XML :)
<shevy> I wonder right now which one is more complex
<shevy> all the XML attributes in addition
<shevy> wesnoth, the game, uses WML (wesnoth markup language) like a programming language
<shevy> they have things like:
<shevy> [if
<shevy> :)
<workmad3> shevy: just use XSLT... that provides a nice, turing complete, completely insane, programming language use XML valid markup...
<shevy> argh
<workmad3> shevy: it's *shudder* wonderful...
* workmad3 vomits
<shevy> this is so insane
<shevy> look:
<shevy> #define DOUBLE; [event]; name=multiply_by_2; {VARIABLE_OP 2_becomes_4 multiply 2}; [/event]; #enddef
<hoelzro> damn
<hoelzro> that's like, m4 bad
<workmad3> shevy: looks pretty
<shevy> hehe
<shevy> I understand it partially in that they wanted to be flexible, in order to allow people write campaigns for wesnoth
<shevy> and the campaigns are quite fun
<shevy> just that syntax is so awful...
BiHi has quit [Ping timeout: 244 seconds]
<workmad3> shevy: in all honesty... it looks rules-enginey
gmci has quit [Quit: Computer has gone to sleep.]
<workmad3> shevy: a 'not a' programming language type thing... it's exactly like a programming language, but it's 'markup' and 'rules definitions' so that makes it 'not programming' and therefore anyone can do it... honest...
<shevy> uh
Banistergalaxy has joined #ruby
<shevy> I'd find it easier to learn python from 0, than this markup stuff
* hoelzro doesn't understand why they didn't just use Lua
<shevy> [set_variables]; name=arr
Phlogistique has quit [Quit: leaving]
<shevy> here they assign to... variables :P
<shevy> yeah hoelzro good question
anybody has left #ruby ["Leaving"]
<workmad3> because lua is a programming language, but WML is just markup!!!
<shevy> oh here are the conditionals: http://wiki.wesnoth.org/ConditionalWML
<shevy> [switch]
<shevy> :)
<shevy> lol
<shevy> the switch example is even more verbose than the switch used in C
<workmad3> oh wow, that looks so awesome...
ar_ has quit [Read error: Connection timed out]
<shevy> hoelzro I wonder if mruby has a chance against lua one day
<workmad3> it makes me want to go and gouge out my eyes with a claw hammer...
<shevy> right now I would *think* that lua would retain a speed advantage over mruby
<shevy> workmad3 hehehe
<shevy> the game Zak McKracken used a nice DSL
<hoelzro> shevy: well, the advantage that Lua has is that the language is *extremely* simple
<shevy> cant find the example on the www anymore though :(
<hoelzro> but also quite powerful
etank has quit [Ping timeout: 246 seconds]
moshee has quit [Ping timeout: 265 seconds]
<hoelzro> that simplicity probably helps the implementation in being fast
<shevy> hmm
moshee has joined #ruby
moshee has joined #ruby
moshee has quit [Changing host]
<hoelzro> ex. if I want to do a search and replace in Ruby, I have to call a method
haxrbyte has joined #ruby
<hoelzro> so that method needs to be looked up in a table somewhere
bluebie has joined #ruby
<hoelzro> in Lua, it's common to store string.gsub in a local variable
<hoelzro> which, at runtime, it just an array index
apok has quit [Quit: apok]
gmci has joined #ruby
<shevy> I once wanted to write a MUD in ruby
BiHi has joined #ruby
<shevy> but I was like... write for ~2 weeks, then make a break for 6 months
malcolmva has joined #ruby
<shevy> and almost every time I tried to continue I was like "this sucks. I am going to rewrite this completely..."
<hoelzro> heh
tomku has joined #ruby
t49382 has quit [Remote host closed the connection]
M- has quit [Quit: This computer has gone to sleep]
t32421 has joined #ruby
<shevy> rewrites distract me way too much
<shevy> perhaps it is better to accept that things can suck at any time
<hoelzro> that's one of the hardest programming skills to learn, imo
<hoelzro> I'm still learning it as well ;)
<shevy> which one
<shevy> to accept that code can suck?
<hoelzro> yes =)
<shevy> yeah
<shevy> :(
<shevy> my old php code sucked a lot more
<hoelzro> back on the subject of Lua/Ruby, I've always kinda wanted to write a Ruby implementation that sits on top of Lua
<shevy> I think in the days of when autoconf, m4 and so on was still "relatively" new, people did not mind ugly code that much
<shevy> because m4 is *really* ugly
<shevy> lua is really beautiful compared to m4
<bluebie> hoelzro: Make it work on javascript and I'll give you ten bucks
<shevy> I wonder why they don't allow # as comments though
banisterfiend has quit [Read error: Connection reset by peer]
<bluebie> TEN AUSTRALIAN DOLLARS
<Muz> That's like what? £1?
<bluebie> 8.48 euros
<bluebie> or 10.48 USD
<Muz> Oh how forex has changed.
banisterfiend has joined #ruby
<bluebie> they're better than regular dollars very slightly!
<bluebie> yeah, few years back a friend came from the EU and his euros trippled when converted to dollars
<bluebie> he felt very rich
* hoelzro shrugs
davidroy has quit [Quit: davidroy]
<hoelzro> they just felt like -- would be better, I guess?
<shevy> everything is better than US dollars today :P
<matti> joephelius: pkill? :)
<bluebie> the australian dollar is only better sometimes xD
jgrevich has quit [Quit: jgrevich]
alekst has joined #ruby
mklappstuhl has joined #ruby
<shevy> I want to force the UK folks to accept the euro
<shevy> :)
swair has joined #ruby
<bluebie> why?
<shevy> because only shared pain is good pain
<Muz> So we can all sit in that sinking ship together?
<shevy> YES!
<bluebie> mmm that's true
<Muz> Thanks Greece, Portugal, Spain, Ireland and Italy.
alekst has quit [Client Quit]
LouisGB has joined #ruby
<shevy> we must sink together
tiripamwe has joined #ruby
<shevy> we'll sing 3 lions
seanholden has joined #ruby
<seanholden> .
<joephelius> :D
khakimov has quit [Quit: Computer has gone to sleep.]
etank has joined #ruby
seanholden has quit [Quit: Page closed]
Takehiro has quit [Remote host closed the connection]
haxrbyte has quit [Read error: Connection reset by peer]
adac has quit [Ping timeout: 240 seconds]
haxrbyte has joined #ruby
Takehiro has joined #ruby
dbe has quit [Remote host closed the connection]
qwerxy has joined #ruby
alekst has joined #ruby
specialGuest has joined #ruby
adac has joined #ruby
rump has quit [Quit: rump]
dangerousdave has joined #ruby
Takehiro has quit [Ping timeout: 244 seconds]
Jackneill has joined #ruby
Jackneill is now known as Guest37999
Tearan has quit [Quit: Sleepy Badger....]
knirhs has quit [Ping timeout: 268 seconds]
tatsuya_o has joined #ruby
banseljaj has joined #ruby
paulm_ has left #ruby [#ruby]
dpk has quit [Quit: Asleep at the keyboard.]
tonini has quit [Remote host closed the connection]
t32421 has quit [Remote host closed the connection]
t49052 has joined #ruby
nari has quit [Ping timeout: 245 seconds]
specialGuest has quit [Changing host]
specialGuest has joined #ruby
xorox90 has joined #ruby
knirhs has joined #ruby
gen0cide_ has quit [Quit: Computer has gone to sleep.]
haxrbyte_ has joined #ruby
<fasta_> Is this valid? `command --a 'a bc cbd'`
nari has joined #ruby
<bluebie> fasta_: should be!
locriani has quit [Remote host closed the connection]
haxrbyte has quit [Ping timeout: 260 seconds]
locriani has joined #ruby
locriani has joined #ruby
locriani has quit [Changing host]
ananthakumaran has quit [Read error: Connection reset by peer]
ananthakumaran has joined #ruby
Foxandxss has joined #ruby
locriani has quit [Ping timeout: 252 seconds]
Xeago has joined #ruby
gmci has quit [Quit: Computer has gone to sleep.]
elhu has quit [Ping timeout: 265 seconds]
d3vic3 has joined #ruby
elhu has joined #ruby
cloud|droid has quit [Quit: Leaving]
deo has quit [Read error: Connection reset by peer]
berserkr has joined #ruby
fermion has joined #ruby
Speed has joined #ruby
SegFaultAX has quit [Ping timeout: 260 seconds]
SegFaultAX has joined #ruby
jprovazn has quit [Quit: Leaving]
kyb3r has quit []
gmci has joined #ruby
joephelius has quit [Quit: WeeChat 0.3.8]
wallerdev has quit [Quit: wallerdev]
a_a_g has quit [Ping timeout: 240 seconds]
fastred has joined #ruby
jackiechan0 has joined #ruby
simao has quit [Changing host]
simao has joined #ruby
d3vic3 has quit [Quit: leaving]
r1chelt has joined #ruby
jenrzzz has joined #ruby
simao has quit [Quit: ZNC - http://znc.in]
simao has joined #ruby
jackiechan0 has quit [Quit: Sto andando via]
bluenemo has joined #ruby
simao has quit [Changing host]
simao has joined #ruby
mklappstuhl has quit [Ping timeout: 276 seconds]
simao has quit [Client Quit]
simao has joined #ruby
d3vic3 has joined #ruby
x0F has quit [Disconnected by services]
x0F_ has joined #ruby
r1chelt has quit [Quit: r1chelt]
_bart has quit [Quit: _bart]
x0F_ is now known as x0F
krz has quit [Quit: krz]
ly_gs has joined #ruby
habib has joined #ruby
habib has quit [Ping timeout: 246 seconds]
simao has quit [Quit: Out.]
simao has joined #ruby
simao has quit [Changing host]
simao has joined #ruby
tatsuya_o has quit [Remote host closed the connection]
tatsuya_o has joined #ruby
Markvilla has joined #ruby
cjk101010_ is now known as cjk101010
t49052 has quit [Remote host closed the connection]
banisterfiend has quit [Read error: Connection reset by peer]
t59080 has joined #ruby
mklappstuhl has joined #ruby
banisterfiend has joined #ruby
cascalheira has joined #ruby
reactormonk has quit [Ping timeout: 276 seconds]
banisterfiend has quit [Read error: Connection reset by peer]
Axsuul has quit [Ping timeout: 244 seconds]
adam_ is now known as aspiers
banisterfiend has joined #ruby
<shevy> fasta_ seems legit
chussenot has quit [Quit: chussenot]
ly_gs has quit [Remote host closed the connection]
BiHi has quit [Quit: Computer has gone to sleep]
<quazimodo> is there a neat way to do this
<quazimodo> if some.thing_one? then @foo = some.thing_one else @foo = some.thing_two end
habib has joined #ruby
<hoelzro> quazimodo: @foo = some.thing_one? ? some.thing_one : some.thing_two
<hoelzro> or:
<JonnieCache> @foo = some.thing_one || some.thing_two
<hoelzro> @foo = if some.thing_one? then some.thing_one else some.thing_two end
<JonnieCache> or just define a getter some called the_thing
<fowl> @foo = some.thing_one
CodeFriar has joined #ruby
<quazimodo> hoelzro: i knew there was some insane arcane shit there i could do
<JonnieCache> *a getter on some
<fowl> @foo ||= some.thing_two
peterhellberg has joined #ruby
<fowl> :>
<quazimodo> fowl: your version SUCKS FOWL
<fowl> why
<JonnieCache> my first one is clearly the best but it only works if some.thing_one? casts thing_one to a boolean sensibly
<Mon_Ouie> Because it doesn't work?
Vert has joined #ruby
<Mon_Ouie> JonnieCache's works exactly the same way as hoelzro's
<fowl> Mon_Ouie: how the hell do you know what thing_one and thing_two are
dr0id has joined #ruby
<fowl> unless i missed something
<JonnieCache> Mon_Ouie: my first one never calls the ? method so the behaviour could be different
dhruvasagar has quit [Ping timeout: 248 seconds]
<hoelzro> I opted for ?:/if+then because of thing_one? vs thing_one
<Mon_Ouie> There's no such thing as a "?" method
<JonnieCache> the method with ? on the end
<hoelzro> I wanted to portray the more general case
<quazimodo> JonnieCache: nah yours is lame
dhruvasagar has joined #ruby
<fowl> sticklers
<JonnieCache> quazimodo: how so
<Mon_Ouie> Well yeah, it should be @foo = som.thing_one? || some.thing_two
Patteh has joined #ruby
<hoelzro> JonnieCache's is pretty idiomatic
<bnagy> apart from not working
<Mon_Ouie> JonnieCache's doesn't repeat some.thing_one
<hoelzro> I would prefer his version to my own if the predicate were just some.thing_one
<Mon_Ouie> fowl: Oh nevermind, I just didn't see yours was in two lines
<fowl> @foo = if false then if true then if false then true else false end else true end else false end
<fowl> ^ valid
tayy has joined #ruby
<quazimodo> JonnieCache: idno :'(
<quazimodo> how do I get an order instance to check all other order instances in the current week and find which number it is
<quazimodo> HRM
* quazimodo ponders
gmci has quit [Quit: Computer has gone to sleep.]
<bnagy> sounds like backasswards encapsulation
ananthakumaran has quit [Ping timeout: 244 seconds]
nari has quit [Ping timeout: 245 seconds]
<quazimodo> bnagy: well, my order object needs to see how many other orders there are :/
<bnagy> quazimodo: what a weird thing for an order to know how to do
tatsuya__ has joined #ruby
andrewpthorp has joined #ruby
<quazimodo> oh it works
<habib> .ощшт фгыекфдшф
<quazimodo> :D
<bnagy> lotys of bad design works
<bnagy> basically the only way to make that work, is for your order to know about your order container (db whatever)
Progster has joined #ruby
tatsuya_o has quit [Ping timeout: 260 seconds]
<bnagy> so you've coupled your order to your container
<bnagy> for no reason
<bnagy> now you can't change container without rewriting your order class
<banisterfiend> bnagy: watch dis wit me http://www.putlocker.com/file/2DF5205BEAB87720#
<bnagy> banisterfiend: no, I need to work out how to invoke stupid windows stupid GDI from ruby
<quazimodo> on another note
nirix has joined #ruby
peterhellberg has quit [Remote host closed the connection]
nathandim has joined #ruby
mikalv has joined #ruby
<mikalv> &wc
tayy has quit [Remote host closed the connection]
ananthakumaran has joined #ruby
tayy has joined #ruby
mikalv has quit [Client Quit]
Takehiro has joined #ruby
mikalv has joined #ruby
r1chelt has joined #ruby
Speed has quit [Remote host closed the connection]
mikalv has left #ruby [#ruby]
kaiwren has quit [Quit: kaiwren]
deo__ has joined #ruby
<quazimodo> if i have an array of orders = Order.all can I do something like
<quazimodo> orders.each do |order|; if order.size != 10 then remove order from orders ?
nathandim has quit [Quit: Leaving]
<bnagy> orders.select {|o| o.size==10}
<JonnieCache> you should do that in your activerecord query
t59080 has quit [Remote host closed the connection]
<JonnieCache> not in ruby
<JonnieCache> thats what databases are for
t58194 has joined #ruby
<quazimodo> hrrrrmmm
<quazimodo> bnagy: i like
<bnagy> well it doesn't modify your orders array
<bnagy> just gets you the ones that are size 10 in a new array
<quazimodo> bnagy: so orders_ten = orders.select blabla
<quazimodo> kk
<JonnieCache> a big problem with ORMs is that a lot of devs now dont know the difference between array filtering and sql queries
deo__ has quit [Read error: Connection reset by peer]
deo__ has joined #ruby
<JonnieCache> its a mad world
<Xeago> Anyone with elasticsearch/tire experience?
<Xeago> I am experiencing an issue where filters don't seem to get applied. https://gist.github.com/3414106 running the curl command yields no results at all, while using Tire gives the same result as without any filter I get the same ordering of my results, using the filter or no filter at all
gmci has joined #ruby
kaiwren has joined #ruby
emmanuelux has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
eighty4 has left #ruby ["Textual IRC Client: http://www.textualapp.com/"]
r1chelt has quit [Quit: r1chelt]
liluo has quit [Remote host closed the connection]
M- has joined #ruby
chussenot has joined #ruby
otters has quit [Read error: Connection reset by peer]
ohm has joined #ruby
weasels has joined #ruby
v0n has joined #ruby
justinmcp has joined #ruby
knirhs has quit [Ping timeout: 248 seconds]
<ohm> Hi all. How can I use a previously declared array as a set of acceptable arguments for an option in OptionParser (for instance, the of strings called "tests_list" in the following line)?
<ohm> opts.on( '-t', '--test TEST', tests_list, 'Specify the test TEST to run from the list of available tests' ) do |test|
binaryplease has joined #ruby
bluenemo has quit [Remote host closed the connection]
<pozic> What is $SAFE?
<Mon_Ouie> A global variable that prevents certain operations from being done
<Mon_Ouie> >> $SAFE = 3; eval("puts 'test'")
<al2o3cr> , [FATAL] Failed to create timer thread (errno: 11)
<Mon_Ouie> >> 3
<al2o3cr> , [FATAL] Failed to create timer thread (errno: 11)
<Mon_Ouie> Nevermind, the bot is still dead.
shell0x_ has quit [Quit: Page closed]
<shevy> lol
virunga has joined #ruby
<pozic> >> $SAFE = 0; eval("puts 'test'")
<al2o3cr> , [FATAL] Failed to create timer thread (errno: 11)
<Mon_Ouie> It can't evaluate anything for some reason
tvw has joined #ruby
<pozic> >> puts 'test'
<al2o3cr> , [FATAL] Failed to create timer thread (errno: 11)
<Mon_Ouie> (it was like that yesterday, but I thought he'd have been reset since then)
<pozic> Yeah, because fixing it is too much of a problem.
<pozic> lol
<pozic> Just kick the bot out.
<pozic> Let it in when you see that it has been fixed.
<JonnieCache> oops
<shevy> the poor bot
<JonnieCache> that may have been me. has it been like that since friday?
<shevy> SO IT WAS YOU!!!
* shevy hands JonnieCache a cookie
<Mon_Ouie> No, it was someone else who used require 'dl'
cousine has quit [Remote host closed the connection]
<shevy> lol
<Mon_Ouie> ged
<JonnieCache> that wasnt me.
<JonnieCache> but that is clever
<shevy> ged you evil evil man
<JonnieCache> i was just forkbombing it/symbol bombing and stuff. i managed to get it to give me lots of those timer thread errors but it wouldnt stick
ohm has left #ruby ["Found an answer, thanks."]
knirhs has joined #ruby
<quazimodo> back
<shevy> top
<quazimodo> so I have anew question
alindeman has quit [Ping timeout: 244 seconds]
<shevy> the answer is
<shevy> 42?
<quazimodo> in Order.find() how does the Order class actually do the search?
alindeman_ has joined #ruby
<quazimodo> how is the method implemented
* quazimodo needs to find thisout
TomRone_ has quit [Read error: Connection reset by peer]
<Mon_Ouie> How could we guess that when knowing nothing about your Order class?
shell0x has quit [Quit: Connection closed for inactivity]
<quazimodo> i guess in rails it would be part of the activerecord base class eh
ezra has joined #ruby
<bnagy> quazimodo: it sounds like you would do better in #rubyonrails
<Mon_Ouie> Then it would just do an SQL query
TomRone has joined #ruby
<quazimodo> yeah bnagy
graspee has quit [Quit: leaving]
pvh has quit [Quit: Connection closed for inactivity]
dotemacs has quit [Quit: Connection closed for inactivity]
<JonnieCache> thats a big question.
kaichanvong has quit [Quit: Connection closed for inactivity]
<JonnieCache> theres the arel algebra that builds the sql
<JonnieCache> then theres the mysql adapter that talks to the database
<JonnieCache> its several different gems
tnk1 has quit [Ping timeout: 240 seconds]
<JonnieCache> youre not even supposed to use .find() anymore its deprecated
a_a_g has joined #ruby
Xeago has quit [Read error: Connection reset by peer]
<quazimodo> hrm
FiveGP has quit [Read error: Connection reset by peer]
mengu has joined #ruby
lxsameer has joined #ruby
<shevy> quazimodo rails is complicated
<shevy> usually when you see something like Upcased.method_name()
<shevy> it's done via def self.method_name
<shevy> class Order; def self.find
tiripamwe has quit [Ping timeout: 240 seconds]
<shevy> if rails has good documentation, you can click on that method name to see the source implementation of it
TNTshop has joined #ruby
<JonnieCache> its much more complicated than that im afraid
<JonnieCache> rails is so crazy inside now that the rdoc is almost useless
<shevy> hehehe
<shevy> the railsers are voodoo rubyists
<shevy> they give you the evil stare and bad mojo happens
<shevy> quazimodo, do you really want to pick up the path to doom and despair?
<rking> Hrm. I wonder if there's a way to make a gem depend on a github version of another gem.
fowl has quit [Ping timeout: 245 seconds]
fowl has joined #ruby
fowl has quit [Changing host]
fowl has joined #ruby
<JonnieCache> voodoo was actually healing magic. the missionarys made up all that stuff we think of as voodoo, taking it from european witchcraft
<JonnieCache> so actually its white people that look at you and give you bad mojo ;)
<shevy> rking whoa the github connection
<shevy> JonnieCache, the winners write history!!!
<shevy> even if this means to sometimes have to rewrite it
adac has quit [Ping timeout: 276 seconds]
<shevy> at least their rewrites are more fun than code-rewrites :(
rking has left #ruby ["WeeChat 0.3.9-dev"]
rking has joined #ruby
s1n4 has quit [Quit: leaving]
vlad_starkov has joined #ruby
<quazimodo> shevy: i guess
<quazimodo> find is deprecated EH
adac has joined #ruby
axl_ has quit [Ping timeout: 240 seconds]
lxsameer has quit [Ping timeout: 276 seconds]
nanderoo has joined #ruby
mahlon has quit [Read error: Connection reset by peer]
Guedes_out is now known as Guedes
BiHi has joined #ruby
charliesome has quit [Quit: Textual IRC Client: www.textualapp.com]
erichmenge has joined #ruby
Hanmac has joined #ruby
ged has quit [Read error: Connection reset by peer]
binaryplease has quit [Quit: WeeChat 0.3.8]
lxsameer has joined #ruby
ged has joined #ruby
deo__ has quit [Quit: Leaving]
mahlon has joined #ruby
erichmenge has quit [Client Quit]
<JonnieCache> youre supposed to use where(), limit(), order() and so on to build a query object with different method calls
specialGuest has quit [Ping timeout: 276 seconds]
nirix has quit [Quit: root$ sudo rm -rf /]
<JonnieCache> theres all sorts of delegation and lazy execution going on in there. its complex
binaryplease has joined #ruby
<Hanmac> >> "bot test"
<al2o3cr> , [FATAL] Failed to create timer thread (errno: 11)
<Hanmac> :'(
<JonnieCache> who owns it?
adac has quit [Ping timeout: 256 seconds]
s1n4 has joined #ruby
justinmcp has quit [Remote host closed the connection]
adac has joined #ruby
MrWGW has quit [Ping timeout: 265 seconds]
<Hanmac> JonnieCache: https://github.com/jrajav/al2o3cr/ << its jrajav ... but he is not online
<JonnieCache> maybe ill make a github issue telling him its broken
MrWGW has joined #ruby
<JonnieCache> Mon_Ouie: what exactly did ged do to it? simply `require 'dl'` ?
<Mon_Ouie> Yeah
nirix has joined #ruby
Markvilla has quit [Quit: Computer has gone to sleep.]
<Hanmac> JonnieCache: i thought it was some bad loop that macer1 did
xaxxon has quit [Ping timeout: 240 seconds]
<JonnieCache> Mon_Ouie: says it was ged requiring dl
<JonnieCache> i gave it some pretty bad loops and it gave that error but never permenantly
<Mon_Ouie> The bot seemed to still be able to answer after macer1's loops
beneggett has quit [Quit: Computer has gone to sleep.]
<JonnieCache> god knows how its happened because it spawns a new process with `ruby -e` for each command
<JonnieCache> how can that infect the parent ruby VM?
<JonnieCache> or has it just spawned so many hanging VMs that it cant do any more?
<Mon_Ouie> ged's require is the first line the bot wasn't able to answer
t58194 has quit [Remote host closed the connection]
krusty_ar has joined #ruby
t69206 has joined #ruby
sepp2k has quit [Remote host closed the connection]
vlad_starkov has quit [Remote host closed the connection]
`brendan has joined #ruby
vlad_starkov has joined #ruby
gmci has quit [Quit: Computer has gone to sleep.]
vlad_starkov has quit [Ping timeout: 246 seconds]
v0n has quit [Ping timeout: 252 seconds]
_bart has joined #ruby
Takehiro has quit [Remote host closed the connection]
swair_ has joined #ruby
swair has quit [Read error: Connection reset by peer]
paulovittor23 has joined #ruby
bluenemo has joined #ruby
bluenemo has joined #ruby
bluenemo has quit [Changing host]
jmampost has joined #ruby
gmci has joined #ruby
Takehiro has joined #ruby
lxsameer has quit [Quit: Leaving]
tatsuya_o has joined #ruby
jorge_ has joined #ruby
vectorshelve has quit [Quit: Page closed]
ezra has quit [Ping timeout: 276 seconds]
vlad_starkov has joined #ruby
tatsuya__ has quit [Ping timeout: 256 seconds]
MrWGW has quit [Ping timeout: 240 seconds]
Jake232 has joined #ruby
rakunHo has quit [Remote host closed the connection]
a_a_g has quit [Quit: Leaving.]
MrWGW has joined #ruby
erichmenge has joined #ruby
Morkel has quit [Quit: Morkel]
iamjarvo has joined #ruby
tk_ has joined #ruby
ly_gs has joined #ruby
fantazo has joined #ruby
ged_ has joined #ruby
mahlon has quit [Read error: Connection reset by peer]
anekos has quit [Ping timeout: 244 seconds]
mahlon_ has joined #ruby
BrokenCog has quit [Ping timeout: 240 seconds]
ged has quit [Read error: Connection reset by peer]
anekos has joined #ruby
<shevy> hehe
jrajav has joined #ruby
<shevy> I am very happy with you guys that you managed to break the bot again
<shevy> Hanmac couldn't do it for days
<jrajav> I'm not
<jrajav> :<
BrokenCog has joined #ruby
BrokenCog has joined #ruby
BrokenCog has quit [Changing host]
<shevy> jrajav \o/
<shevy> jrajav where is our reward!!!
al2o3cr has quit [Remote host closed the connection]
<jrajav> What.
<jrajav> Did I promise a reward
<jrajav> :P
al2o3cr has joined #ruby
<shevy> no but we broke it and deserve something
<jrajav> >> "You okay buddy? :("
<al2o3cr> (String) "You okay buddy? :("
bowlowni has joined #ruby
<Muz> >> require 'ld'
<al2o3cr> -e:1:in `eval': cannot load such file -- ld (LoadError), from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require', from (eval):1:in `<main>', from -e:1:in `eval', from -e:1:in `<main>'
<Mon_Ouie> Did you fix it?
<jrajav> Your reward is that you get to go hack at the code on github
<jrajav> And fix it
robustus has joined #ruby
<Muz> >> require 'dl'
<al2o3cr> (TrueClass) true
<Hanmac> >> require "dl"
<al2o3cr> (TrueClass) true
<jrajav> And enjoy unending adulation
<jrajav> That wasn't what broke it btw
xorox90 has quit [Ping timeout: 276 seconds]
<jrajav> It was whatever came right before that
<jrajav> (Possibly in a PM)
<shevy> jrajav, it is more fun when you are offline
t69206 has quit [Remote host closed the connection]
<Hanmac> what was the broker?
<jrajav> I don't know
<jrajav> I don't log it
t27384 has joined #ruby
<Mon_Ouie> The line right before on the channel was puts "hi" so I kinda doubt it was here
<shevy> >> puts "hi"
<al2o3cr> (NilClass) nil, Console: hi
<shevy> >> puts require 'dl'
<al2o3cr> (NilClass) nil, Console: true
<shevy> :(
<shevy> damn... the fun is over...
<jrajav> Who emailed me btw?
<JonnieCache> i made a github issue
<jrajav> Yes, I wanted to ask you what exactly you did
<Mon_Ouie> It's just github that sends email notifications by defaults
<jrajav> And to reproduce it if you can
<jrajav> The scripts should be fork-limited
<dr0id> shevy!
<JonnieCache> it was something like... hold on
<shevy> dr0id they make the bot better and better :(
<jrajav> They are NOT memory-limited, so that's more likely the issue
<shevy> \o/
nathandim has joined #ruby
<jrajav> shevy: Go ahead and try to break it before JonnieCache finds his :P
Xeago_ has joined #ruby
<jrajav> We have a winner
<jrajav> >> puts "hi"
<al2o3cr> , [FATAL] Failed to create timer thread (errno: 11)
<Mon_Ouie> I know how to break it :)
geekbri has joined #ruby
<JonnieCache> damn
bowlowni has quit [Ping timeout: 240 seconds]
<Mon_Ouie> You just use sleep
<JonnieCache> lol
<jrajav> sleep while true
<Mon_Ouie> And for some reason the timeout will never be reached
<jrajav> That makes sense
<jrajav> Because the timeout isn't actually a timeout
<jrajav> It's a cpu limit
<jrajav> And sleep while true cleverly circumvents that
<dr0id> its raining heavily, someone might die
<jrajav> I'm still confused about why it stops other scripts from starting up though
nari has joined #ruby
<JonnieCache> ok so i did something like `a=[]; loop {a << rand((2**(0.size * 8 -2) -1)).to_s.to_sym}`
al2o3cr has quit [Remote host closed the connection]
nilg has quit [Remote host closed the connection]
<JonnieCache> but i put that inside a load of recursive calls to Thread.new and stuff
<jrajav> Let's try that too
<JonnieCache> there were different variations
<Mon_Ouie> I assume it's because the other processes are still alive, so you can't create new ones
al2o3cr has joined #ruby
<jrajav> Go ahead and try em JonnieCache
<JonnieCache> >> a=[]; loop {a << rand((2**(0.size * 8 -2) -1)).to_s.to_sym}
<jrajav> >> 1
<al2o3cr> (Fixnum) 1
<jrajav> bzzzzt
<JonnieCache> ok hold on
kaiwren_ has joined #ruby
<jrajav> To be fair that probably DOES fill up memory but it hits the cpu limit and dies
liluo has joined #ruby
<JonnieCache> >> a=[]; def foo; Thread.new {loop {a << rand((2**(0.size * 8 -2) -1)).to_s.to_sym}};foo; end;
macer1 has joined #ruby
macer1 has joined #ruby
<al2o3cr> (NilClass) nil
<jrajav> That's the main reason I didn't bother with a memory limit
tatsuya__ has joined #ruby
<JonnieCache> bzzt
<jrajav> >> 1
<al2o3cr> (Fixnum) 1
reactormonk has joined #ruby
<JonnieCache> the thing is i definitely managed at one point to make it think for like 30 seconds and then return that same timer thread error
<JonnieCache> and then i took that and put it inside more recursive spawning loops and shit
k_89 has quit [Ping timeout: 244 seconds]
BrokenCog has quit [Ping timeout: 240 seconds]
<JonnieCache> then i realised it was 6pm on friday and went to the pub, so i cant remember exactly what i did
<jrajav> Anything that defers or blocks CPU computation will be able to take longer than 1 second
<jrajav> haha
kaiwren has quit [Ping timeout: 252 seconds]
kaiwren_ is now known as kaiwren
<jrajav> Well, I've messed around with the resource limits before and barely managed to find the magic formula to stop forkbombing
<jrajav> I don't really feel like messing with this a ton
<jrajav> So what I'll do instead is make a reset command
<JonnieCache> yeah i tried forkbombing and that had limited success
<JonnieCache> why not just put god or monit or something to watch over it all?
<JonnieCache> or is that already the kind of thing youre doing
<jrajav> I'm just going to put it on something like Node.js' 'forever'
BrokenCog has joined #ruby
<jrajav> And make the reset command exit it
<jrajav> Is there a forever counterpart written in Ruby? :O
specialGuest has joined #ruby
<jrajav> Oh hey what do you know
specialGuest has quit [Client Quit]
tommyvyo has joined #ruby
<jrajav> gem install forever
<jrajav> ;)
tatsuya_o has quit [Ping timeout: 276 seconds]
nateberkopec has joined #ruby
xorox90 has joined #ruby
<dr0id> nice
<JonnieCache> jrajav: so shall i close that github issue with a message saying it was actually sleep() that broke it?
<dr0id> altho iirc, forever is not constricted to node, so you could us ethe js version with ruby too I think
tiripamwe has joined #ruby
yasushi has joined #ruby
Nanuq has quit [Quit: leaving]
<jrajav> I'll close it
<jrajav> dr0id: I could indeed, and I actually was in a previous incarnation, but that would require me to have node and its libs in the chroot
fabrice31 has joined #ruby
<jrajav> Ruby is already there
theRoUS has quit [Remote host closed the connection]
<JonnieCache> yeah but then youd end up with people like us trying to spawn node processes from ruby and its a whole other layer of stuff to lock down
<jrajav> It wouldn't be hard to set node to be readable only by root
<jrajav> I'm just too lazy to copy it to the chroot
<jrajav> :P
<jrajav> Besides I have to write the forever script in either case
Layke has joined #ruby
<JonnieCache> hmm of course. i need to get better at unix...
<JonnieCache> i still dont understand chroots properly
<Layke> Does anyone know/see why, the last group isn't being captured? http://rubular.com/r/bo5RmXY2WX
<jrajav> Unix permissions are the main sandboxing mechanism for the bot
<jrajav> Why isn't rubydoc.info responding :<
<jrajav> I have no idea how to use Ruby's forever XD
<JonnieCache> im ok with unix perms but its how it all interacts with chroot and running processes in/out of the chroot that i dont grok
answer_42 has quit [Remote host closed the connection]
Nanuq has joined #ruby
Takehiro has quit [Remote host closed the connection]
weasels is now known as otters
answer_42 has joined #ruby
Takehiro has joined #ruby
jrist has joined #ruby
saispo has joined #ruby
t27384 has quit [Remote host closed the connection]
<jrajav> This is pretty hilarious how unresponsive rubydoc.info is
t2874 has joined #ruby
<jrajav> It's up, but apparently it only responds to 5% of requests
<jrajav> Someone could stand to upgrade their hosting a little I think
jgarvey has joined #ruby
Takehiro has quit [Ping timeout: 240 seconds]
shiki has quit [Remote host closed the connection]
<JonnieCache> rdoc.info
<JonnieCache> or maybe thats the same site
<jrajav> Same site
fastred has quit [Quit: fastred]
don1 has joined #ruby
don1 has quit [Client Quit]
<JonnieCache> gem install yard; yard server --gems; open http://localhost:8808
<JonnieCache> oops replace the last ; with & heh
jorge_ has quit [Remote host closed the connection]
techsurvivor has quit [Ping timeout: 246 seconds]
verto|off is now known as verto
iamjarvo has quit [Ping timeout: 244 seconds]
<jrajav> Soooo apparently Ruby forever isn't the same as Node forever?
<jrajav> It says it's a daemon framework but doesn't have an obvious way to actually manage seamless restarting :S
carloslopes has joined #ruby
<jrajav> It's mostly focused on scheduling jobs
niklasb has joined #ruby
laen_ has quit [Ping timeout: 268 seconds]
laen_ has joined #ruby
jrist has quit [Ping timeout: 272 seconds]
shiki has joined #ruby
<banisterfiend> jrajav: relax and watch some of dis http://www.youtube.com/watch?v=tqUBkCAmldM&feature=related
jeff_sebring has quit [Quit: Leaving]
<jrajav> >_>
locriani has joined #ruby
<jrajav> My irc client shows me previews of YT and images… but I still wasn't prepared for that :P
yasushi has quit [Remote host closed the connection]
<JonnieCache> wtf is the command for ctcp client again?
hynkle has joined #ruby
<JonnieCache> havent done such a thing in a long time haha
<jrajav> Neither have I
<shevy> old forgetful man
xargoon has quit [Ping timeout: 272 seconds]
<jrajav> Did you try /ctcp ? P
<JonnieCache> i tried /ctcp client jrvav
<JonnieCache> i now realise its /ctcp jrvav client haha
<shevy> hmm I just had ruby generate a 100.000 lines of shell code file
adeponte has quit [Remote host closed the connection]
lkba has joined #ruby
<JonnieCache> hmm no reply. your client is obviously too elite for 90s technology of ctcp
fmcgeough has joined #ruby
Squarepy has joined #ruby
erichmenge has quit [Quit: Be back later]
Squarepy has quit [Changing host]
Squarepy has joined #ruby
<JonnieCache> aha its VERSION not CLIENT
Eldariof-ru has joined #ruby
xargoon has joined #ruby
<drizz> alelele fuuuck
jjbohn has joined #ruby
jjbohn has quit [Client Quit]
kaiwren has quit [Quit: kaiwren]
<JonnieCache> textual. i looked at that then i thought no im not paying for an irc client. paying for an editor is bad enough
<jrajav> It's open source
MrWGW has quit [Ping timeout: 252 seconds]
<jrajav> And it's way better than the non-terminal alternatives for mac
<JonnieCache> is it? whats the super fancy one for os x that costs money?
vlad_starkov has quit [Remote host closed the connection]
<jrajav> Oh, it costs money and it's great
<jrajav> But you can also build it from source
tatsuya__ has quit [Remote host closed the connection]
<JonnieCache> ah ok. must have missed that
<JonnieCache> im using irssi now anyway
MrWGW has joined #ruby
<lectrick> good morning, greybeards
<jrajav> Hmm, what's a clever way to check a string against one of several possibilities and return true if it equals any of them?
<fowl> ha
<jrajav> Chaining .eql? and 'or' is way too boring
tatsuya_o has joined #ruby
<JonnieCache> strings.any? {|s| s =~ query}
<JonnieCache> dunno if that counts as clever
Mon_Ouie has quit [Ping timeout: 260 seconds]
<jrajav> Close enough :P
Mon_Ouie has joined #ruby
<JonnieCache> or strings.include? query
<JonnieCache> depends on the kind of matching you want
<jrajav> Even better
theRoUS has joined #ruby
theRoUS has joined #ruby
theRoUS has quit [Changing host]
s1n4 has quit [Quit: peace out]
<JonnieCache> include? I guess checks object_id maybe that wont work
<JonnieCache> or does include call == maybe i dont know
<jrajav> It's ==
samuel02 has joined #ruby
GoGoGarrett has joined #ruby
al2o3cr has quit [Remote host closed the connection]
<Hanmac> ... i think include use hash for checking too ... :/
<Hanmac> or eql?
al2o3cr has joined #ruby
locriani has quit [Remote host closed the connection]
<jrajav> The docs say ==
<jrajav> >> sleep while true;
<jrajav> >> 1
<al2o3cr> (Fixnum) 1
<jrajav> -__
<jrajav> >> sleep while true;
<jrajav> >> sleep while true;
<al2o3cr> , [FATAL] Failed to create timer thread (errno: 11)
<jrajav> >> sleep while true;
<al2o3cr> , [FATAL] Failed to create timer thread (errno: 11)
<jrajav> There we go
<jrajav> haha
<jrajav> !reset
<lupine_85> EAGAIN ?
<Hanmac> :P you put him asleep :P
al2o3cr_ has joined #ruby
* jrajav eyes al2o3cr_
verto is now known as verto|off
<jrajav> Well exec didn't quite work as I expected it to
jrist has joined #ruby
nirix has quit [Quit: Computer has gone to s…zZzZz]
gvz has joined #ruby
LouisGB has quit [Ping timeout: 268 seconds]
gvz has quit [Read error: Connection reset by peer]
gvz has joined #ruby
al2o3cr has quit [Ping timeout: 240 seconds]
M- has quit [Read error: Connection reset by peer]
hynkle has quit [Ping timeout: 245 seconds]
Tomasso has joined #ruby
<JonnieCache> by the way people the rumour is that the price of bitcoin is about to undergo something of a crash
vlad_starkov has joined #ruby
<JonnieCache> so if youre looking to buy in, your time may be coming up :)
obryan has joined #ruby
<JonnieCache> apparently some major investors are about to cash out and there may be a large transfer of ownership of a lot of bitcoins
miho has joined #ruby
<JonnieCache> i think someone is shutting down their ponzi scheme or something as well. its a murky world haha
robustus has quit [Quit: robustus]
nixmaniack has quit [Ping timeout: 252 seconds]
t2874 has quit [Remote host closed the connection]
t68759 has joined #ruby
andrewhl has joined #ruby
hynkle has joined #ruby
al2o3cr_ has quit [Remote host closed the connection]
<bnagy> or you just shorted BTC, one way or the other
techsurvivor has joined #ruby
answer_42 has quit [Remote host closed the connection]
<JonnieCache> yeah i was thinking how to try and show thats not the case
verto|off is now known as verto
<JonnieCache> ive been idling in #bitcoin-otc its quite enlightening
al2o3cr has joined #ruby
<JonnieCache> basically this guy called pirateat40 has been running a "saving scheme" with ridiculous payouts for some time
<JonnieCache> and now he's shut it down, and everyones going crazy
<jrajav> >> 1
<al2o3cr> (Fixnum) 1
<jrajav> >> sleep while true;
<jrajav> >> sleep while true;
<jrajav> >> sleep while true;
<al2o3cr> , [FATAL] Failed to create timer thread (errno: 11)
<jrajav> >> 1
<al2o3cr> , [FATAL] Failed to create timer thread (errno: 11)
<jrajav> !reset
al2o3cr has quit [Remote host closed the connection]
al2o3cr has joined #ruby
<jrajav> Hurray
<JonnieCache> >> 1
<al2o3cr> , [FATAL] Failed to create timer thread (errno: 11)
<jrajav> Alright, so al2o3cr's first real !bang command is !reset
jmampost has quit [Remote host closed the connection]
<jrajav> :O
<jrajav> Um.
<jrajav> Wow
answer_42 has joined #ruby
<jrajav> What.
erichmenge has joined #ruby
<jrajav> So even exiting the script entirely and bringing it back up doesn't work
robustus has joined #ruby
<Mon_Ouie> Because the other processes are still there I assume
<jrajav> Because that apparently blocks the entire freaking process?
<jrajav> Ugh
SCommette has joined #ruby
<jrajav> Well it's probably blocking the parent process somehow -- so by extension, the bot script and even the forever script
<Mon_Ouie> No more working around, it has to be fixed properly :p
<JonnieCache> id love to know how thats happening
<jrajav> I'm open to suggestions
<JonnieCache> replaced forever with something proper, like god or monit
<Mon_Ouie> Actually making it timeout when it takes too long?
<jrajav> There's no way to limit the actual running time of a process or thread in Ruby as far as I know
BlakeRG has joined #ruby
<jrajav> Just the cpu time
infinitiguy has joined #ruby
<BlakeRG> how do i get a random number within a range?
<Mon_Ouie> require 'timeout'; begin; Timeout.timeout(2) { … }; rescue Timeout::Error; …; end
<_br_> is there some nice library to help me to asynchronious tasks in the background? kind of cron jobs?
<JonnieCache> how can it infect the parent processes though? arent you shelling out to brand new ruby interpreters?
uris has joined #ruby
axl_ has joined #ruby
Advocation has joined #ruby
<dr0id> BlakeRG: (1..10).to_a.sample
<Mon_Ouie> The user isn't allowed to create more than n processes as I understand
<jrajav> 4, yeah
<Mon_Ouie> BlakeRG: rand(1..10)
<Mon_Ouie> dr0id's needs to generate an array with all the elements — which is much slower if there are many
<BlakeRG> awesome, that works Mon_Ouie
fris has joined #ruby
<dr0id> my mind was just behaving like shevy's
jmampost has joined #ruby
yasushi has joined #ruby
kaiwren has joined #ruby
robbyoconnor has quit [Read error: Connection reset by peer]
jmampost has quit [Remote host closed the connection]
robbyoconnor has joined #ruby
<bnagy> hmm why rand( Range ) no work jruby?
<Hanmac> jrajav: you bot runs on a quadcore right? or its only looks like that
johnlcox has joined #ruby
<dr0id> does rand accept ranges in 1.9.2 and below, Mon_Ouie ? I guess that's a 1.9.3 thingie ;D
<Hanmac> bnagy maybe jruby is outdated? :'P
<dr0id> glad I upgraded to 1.9.3 from 1.9.2 yesterday ;d
timonv has joined #ruby
<JonnieCache> the behaviour of rand() has definitely changed in various verions of 1.9
<Mon_Ouie> Yeah, in 1.9.2 and before you can use Random.rand
<jrajav> Hanmac: Erm. I think so?
<jrajav> Hanmac: It's on a VM
zxc__ has joined #ruby
<bnagy> jruby says 1.9.3-p203
jasonkuhrt has joined #ruby
yasushi has quit [Remote host closed the connection]
hynkle has quit [Ping timeout: 265 seconds]
<Hanmac> jrajav i thought that the sleep while true blocks each one CPU (or the power of one) ... and when all cpus are blocked, no new process can be spawn ... (or something similar)
<fris> im using the hub gem to create a github repo it used to work, but since i did an upgrade it stopped working, here is the error output http://pastie.org/4557678
<jrajav> Hanmac: I thought sleep by definition would *not* block
<jrajav> Hanmac: Since sleep usually gives up the rest of its cpu allocation
dhruvasagar has quit [Ping timeout: 245 seconds]
hynkle has joined #ruby
cantbecool has joined #ruby
ly_gs has quit [Remote host closed the connection]
<Hanmac> it was only thoughts
<lectrick> What is the alias global for $0 again? the more user-friendly one?
A124 has joined #ruby
kaiwren has quit [Quit: kaiwren]
erichmenge has quit [Quit: Be back later]
<banisterfiend> lectrick: $PROGRAM_NAME
fearoffish has joined #ruby
<lectrick> aha ty banister
tiripamwe has quit [Ping timeout: 245 seconds]
al2o3cr has quit [Remote host closed the connection]
al2o3cr has joined #ruby
ananthakumaran1 has joined #ruby
<jrajav> >> 1
<al2o3cr> (Fixnum) 1
<jrajav> >> sleep while true;
<jrajav> >> sleep while true;
<jrajav> >> sleep while true;
<al2o3cr> , [FATAL] Failed to create timer thread (errno: 11)
<jrajav> -_-
<jrajav> >> 1
<al2o3cr> , [FATAL] Failed to create timer thread (errno: 11)
<jrajav> Mon_Ouie: No dice
al2o3cr has quit [Remote host closed the connection]
v0n has joined #ruby
ananthakumaran has quit [Read error: Connection reset by peer]
al2o3cr has joined #ruby
yasushi has joined #ruby
<jrajav> >> sleep while true;
asteve has joined #ruby
Squarepy has quit [Read error: Connection reset by peer]
<jrajav> It doesn't even stop a single one!
<jrajav> This is currently running on Timeout::timeout(2)
Squarepy has joined #ruby
Squarepy has quit [Changing host]
Squarepy has joined #ruby
workmad3 has quit [Ping timeout: 245 seconds]
<jrajav> That sleep while true; is some deep magic
t68759 has quit [Remote host closed the connection]
t86843 has joined #ruby
jmorton has joined #ruby
<JonnieCache> is the ; important? you always seem to include it
awarner has joined #ruby
timonv has quit [Remote host closed the connection]
<jrajav> No
d3vic3 has quit [Ping timeout: 260 seconds]
wangr_ has quit [Remote host closed the connection]
timonv has joined #ruby
Stalkr_ has joined #ruby
<shevy> he just likes the ; very much
mmitchell has joined #ruby
d3vic3 has joined #ruby
<jrajav> A ; saved my dog's life a long time ago
<jrajav> Okay so I think the problem is actually with Cinch
<shevy> ; is a heroic token
<jrajav> Because every time I do sleep while true; I can see that it's adding a new thread and never exiting it
<jrajav> The bot, that is
<jrajav> It's currently sitting at 3
<shevy> dr0id I have a beautiful mind, even though I am often confused
<jrajav> When it hits 4 it goes boom
A124 has left #ruby [#ruby]
fmcgeough has quit [Quit: fmcgeough]
<JonnieCache> whats cinch?
<fowl> >> 1
<al2o3cr> , [FATAL] Failed to create timer thread (errno: 11)
<fowl> wh
<jrajav> JonnieCache: al2o3cr's mama
al2o3cr has quit [Remote host closed the connection]
<dominikh> jrajav: for every handler invocation, Cinch creates a new thread, so yes, obviously doing lots of infinite loops will cause you lots of threads. it failing after 4 is not a Cinch issue though, it can handle hundreds if not thousands without problem.
<fowl> >> sleep while true
<jrajav> dominikh: What I'm a lot more confused about is why Timeout isn't working
<fowl> Timeout only works 1/10 times
<fowl> fact
verto is now known as verto|off
<jrajav> I believe it
<banisterfiend> only works 1/10th of the time, every time.
<jrajav> Let's try the "genuine" linux timeout command instead
iamjarvo has joined #ruby
tiripamwe has joined #ruby
richardcreme has quit [Read error: Connection reset by peer]
al2o3cr has joined #ruby
BlakeRG has quit [Quit: Leaving.]
<jrajav> >> 1
<al2o3cr> (Fixnum) 1
<jrajav> >> sleep while true;
<jrajav> HA
<jrajav> Winning
Sirecote is now known as sirecote
<jrajav> Now let's see if that can recover it from locking up, too
<JonnieCache> >> 1
<al2o3cr> (Fixnum) 1
<jrajav> >> sleep while true;
<jrajav> >> sleep while true;
<jrajav> >> sleep while true;
<al2o3cr> , [FATAL] Failed to create timer thread (errno: 11)
<jrajav> >> sleep while true;
<al2o3cr> , [FATAL] Failed to create timer thread (errno: 11)
<jrajav> >> sleep while true;
<al2o3cr> , [FATAL] Failed to create timer thread (errno: 11)
al2o3cr has quit [Killed (idoru (Spam is off topic on freenode.))]
<Hanmac> :(
<jrajav> >> 1
<jrajav> Whoa.
niko has joined #ruby
<Hanmac> you spamed it :P
<JonnieCache> >> 1
bowlowni has joined #ruby
<JonnieCache> crazy
<jrajav> Oh crap >_>
<jrajav> Wow
<jrajav> It breaks spectacularly
<jrajav> I'm not really liking Cinch a lot right now
<Hanmac> no ... it was killed by "idoru"
<JonnieCache> i know what we need is another bot that exists purely to reboot your vps using an api call
<fowl> lol
emmanuelux has quit [Read error: No route to host]
<fowl> idoru is a staff bot apparently
<jrajav> Oh.
<jrajav> That makes more sense
<jrajav> Yeah it was just klined
<jrajav> "just"
<JonnieCache> lol
<JonnieCache> so more rate limiting is needed, now at the other ned
<fowl> if anybody wondered if you were being monitored, rest assured, you are safe and secure :)
<JonnieCache> *end
<niko> he should be able to reconnect
<jrajav> Why the hell was the bot klined for just three lines though?
al2o3cr has joined #ruby
<jrajav> *I* spammed more than that
<jrajav> It didn't send me any PM either
<niko> i doubt a pm from a bot will help anyway :)
<jrajav> al2o3cr sends a PM if stdout or stderr are too long
BlakeRG has joined #ruby
<fowl> jrajav: first it starts at limit being 3 lines, nobody objects, later you are required to get a genetic scan to connect to freenode
<jrajav> That's what I meant
<jrajav> Oh wait, no it doesn't, I changed that
habib has quit [Ping timeout: 240 seconds]
<dominikh> the bot connects, repeat two lines, then repeats another 3 lines within a second. yeah, I am really surprised why it's spam score was so bad.
BiHi has quit [Read error: Connection reset by peer]
cgag_ has joined #ruby
<dominikh> *its
BiHi has joined #ruby
<JonnieCache> maybe it should be tested on one of the anon irc servers or something
<jrajav> Well, in any case, it will attempt to reconnect with incrementally larger wait periods
binaryplease has quit [Ping timeout: 246 seconds]
<JonnieCache> i was going to suggest running your own ircd but fuck that
<jrajav> So as long as the kline is removed it will recover
aldodelgado has joined #ruby
<jrajav> This situation is still better than it simply breaking forever
t86843 has quit [Remote host closed the connection]
t12399 has joined #ruby
<jrajav> I think I'll reduce the timeout, too.. it's currently 5 seconds
joshman_ has joined #ruby
<dominikh> jrajav: the reconnect delay maxes out at 300 seconds.
<jrajav> By the way, it only breaks horribly if you spam it. If you do sleep while true; and let it time out it's fine
<jrajav> dominikh: I just realized you're the author of cinch :P
<dominikh> heh
<Muz> Ged'dim!
<jrajav> Great bot
wangr has joined #ruby
<jrajav> I'm just pissed it doesn't magically solve all my problems in life
<lectrick> If I want to hook into the method_added event for all objects, do I def self.method_added on Module, or?
BlakeRG has left #ruby [#ruby]
cantonic has joined #ruby
<jrajav> *bot framework
binaryplease has joined #ruby
al2o3cr has quit [Remote host closed the connection]
al2o3cr has joined #ruby
<jrajav> Okay, so.. no one spam sleep while true; in quick succession to the bot.
Spooner has joined #ruby
<jrajav> You would actually have to be trying, now, because you have to send it 4 times within 2 seconds
<jrajav> And it will STILL recover, it just might get marked as spamming for whatever reason.. even though it isn't sending that much
paolooo has joined #ruby
busybox42 has quit [Quit: Leaving.]
kaiwren has joined #ruby
<JonnieCache> its flagged now
busybox42 has joined #ruby
flexoid has quit [Quit: Ухожу я от вас (xchat 2.4.5 или старше)]
rump has joined #ruby
jorge_ has joined #ruby
<jrajav> Well that's not cool :/
emmanuelux has joined #ruby
linoj has joined #ruby
macer1 has quit [Remote host closed the connection]
Jay_Levitt has joined #ruby
jorge_ has quit [Ping timeout: 245 seconds]
tvw has quit [Remote host closed the connection]
kuzushi has quit [Ping timeout: 248 seconds]
internet_user has joined #ruby
vitoravelino is now known as vitoravelino`afk
DrShoggoth has joined #ruby
<jrajav> Well, I can't reproduce it with the current timeout, and it's been unflagged
<jrajav> All is now right with the world
<JonnieCache> so it starts now?
<JonnieCache> restarts i mean
<lectrick> Why is there a Class.instance_methods but not a Class.class_methods ?
<jrajav> No
<jrajav> It never dies
<hoelzro> lectrick: Class.singleton_methods
<lectrick> Would that be Class.singleton_class.instance_methods?
<jrajav> Don't go trying this yourself, but I spammed sleep while true; as fast as I could
<jrajav> And definitely got 5-6 threads out of it
<lectrick> hoelzro: Thanks. Is what I said basically the same?
<JonnieCache> ah so you got the timeout working then? or fixed the thread implementation?
<jrajav> When it crasehd before the timeout was 5 seconds; apparently 2 is short enough that it never crashes
<JonnieCache> ah ok
<jrajav> I'm sure if you spammed the bot enough it still might
<jrajav> But human spamming won't do it
<hoelzro> lectrick: class methods are just singleton methods on a Class object
<jrajav> And Freenode will throttle you eventually
<jrajav> Well, I'm heading out for now
<jrajav> I'll update the bot on github soon and close that one issue
<JonnieCache> >> "bye!"
<al2o3cr> (String) "bye!"
jrajav has quit [Quit: The best darkness is strange and surprising]
fris has left #ruby [#ruby]
<JonnieCache> thanks for your work :)
clocKwize has quit [Quit: clocKwize]
gfontenot has joined #ruby
yakko has joined #ruby
vitoravelino`afk is now known as vitoravelino
erichmenge has joined #ruby
wangr has quit [Read error: Connection reset by peer]
zxc__ has quit [Quit: Page closed]
ackz has joined #ruby
meskyanichi has quit [Quit: Leaving...]
<shevy> ok good
<shevy> he is gone
<shevy> time to break the bot
<shevy> >> require 'dl'; sleep while tree; require 'dl';
<al2o3cr> -e:1:in `eval': undefined local variable or method `tree' for main:Object (NameError), from -e:1:in `eval', from -e:1:in `<main>'
Michael has joined #ruby
workmad3 has joined #ruby
<shevy> >> require 'dl'; sleep while tree; Thread.new { sleep 589; 5/0; }.join
<al2o3cr> -e:1:in `eval': undefined local variable or method `tree' for main:Object (NameError), from -e:1:in `eval', from -e:1:in `<main>'
<shevy> dieeeeeee
<shevy> :(
Michael is now known as Guest15223
<JonnieCache> it was never dl that broke it
<shevy> that bot is like a vampire
<shevy> it drains away resources
pskosinski has quit [Read error: Connection reset by peer]
<shevy> I didn't pay too much attention :)
Morkel has joined #ruby
jonathanpenn has joined #ruby
ackz has left #ruby [#ruby]
pskosinski has joined #ruby
mahmoudimus has joined #ruby
pozic has quit [Quit: leaving]
und3f has quit [Quit: Leaving.]
bbttxu has joined #ruby
<JonnieCache> thinking about it im sure it would still be easy enough to break it
<JonnieCache> but im keeping quiet ;)
<workmad3> >> def method_missing(*args) puts args.join("\n"); end; hello world how are you?
<al2o3cr> , -e:1: stack level too deep (SystemStackError)
<workmad3> >> def method_missing(*args); puts args.join("\n"); end; hello world how are you?
<al2o3cr> , -e:1: stack level too deep (SystemStackError)
<workmad3> aww :(
<JonnieCache> ok ok
<workmad3> >> def method_missing(*args); args.join("\n"); end; hello world how are you?
<JonnieCache> >> while(true) {sleep while true}
<al2o3cr> , -e:1: stack level too deep (SystemStackError)
<al2o3cr> -e:1:in `eval': (eval):1: syntax error, unexpected '{', expecting keyword_do_cond or ';' or '\n' (SyntaxError), while(true) {sleep while true}, ^, (eval):1: syntax error, unexpected '}', expecting $end, while(true) {sleep while true}, ^, from -e:1:in `<main>'
<workmad3> JonnieCache: heh :)
<JonnieCache> >> while(true) {sleep while true;}
<al2o3cr> -e:1:in `eval': (eval):1: syntax error, unexpected '{', expecting keyword_do_cond or ';' or '\n' (SyntaxError), while(true) {sleep while true;}, ^, (eval):1: syntax error, unexpected '}', expecting $end, while(true) {sleep while true;}, ^, from -e:1:in `<main>'
<JonnieCache> >> loop {sleep while true}
<workmad3> while(true); sleep while true; end;
<workmad3> >> while(true); sleep while true; end;
<apeiros_> JonnieCache: please do bot tests in pm again
ananthakumaran1 has quit [Quit: Leaving.]
<JonnieCache> ok sorry
<dekronin1> I need to pass some objects (datastructures really) to some remote machines. Now I was already working out a protocol, on how to structure this information into a datastructure, but then I was wondering if there where some protocols for this already, then I found AVRO, has anyone ever used avro ruby gem, online I keep reading it's buggy
<apeiros_> or get a dedicated #crash_al2o3cr
bbttxu has quit [Remote host closed the connection]
<apeiros_> I'm sure jrajav gladly puts the bot there too :)
<JonnieCache> dekronin1: try something like 0mq
bbttxu has joined #ruby
<dekronin1> JonnieCache: intrestting, may I ask why? out of curiosity
<JonnieCache> its a popular solution to your problem
mohits has quit [Ping timeout: 276 seconds]
<JonnieCache> theres also http://www.rabbitmq.com/
<JonnieCache> i think thats what youre asking for
<JonnieCache> anyway i have lunch to eat. laters
<dekronin1> jonathanpenn: thanks man
a_a_g has joined #ruby
<dekronin1> JonnieCache: thanksman
yasushi has quit [Remote host closed the connection]
nari has quit [Ping timeout: 265 seconds]
tagrudev has quit [Quit: wiskey]
ViperMaul|_ has joined #ruby
<JonnieCache> dekronin1: maybe get a second opinion though because im not an expert in such matters
mahmoudimus has quit [Quit: Computer has gone to sleep.]
tomsthumb_ has quit [Quit: Leaving.]
tayy_ has joined #ruby
verto|off is now known as verto
zodiak has joined #ruby
jonathanpenn has quit [Remote host closed the connection]
iori has quit [Remote host closed the connection]
t12399 has quit [Remote host closed the connection]
t61201 has joined #ruby
jonathanpenn has joined #ruby
tayy has quit [Ping timeout: 240 seconds]
fantazo has quit [Remote host closed the connection]
poga has joined #ruby
<shevy> lol
<shevy> that was a bot massacre there
<shevy> this bot is like children toy - and #ruby is filled with kids!
gfontenot has quit []
emmanuelux has quit [Ping timeout: 260 seconds]
cantbecool has quit [Quit: Textual IRC Client: www.textualapp.com]
<rcassidy> >> p "did it die?"
<al2o3cr> (String) "did it die?", Console: "did it die?"
djdb has quit [Quit: Ухожу я от вас (xchat 2.4.5 или старше)]
<rcassidy> ^^;
Nickz has joined #ruby
<bluebie> how cool would it be to be photosynthetic! http://www.wired.com/wiredscience/2012/08/green-aphid-photosynthesis/
<xclite> i prefer to gather my energy from dead animals
tatsuya_o has quit [Remote host closed the connection]
dekronin1 is now known as dekroning
<Hanmac> bluebie: that would be the only reason to go into the sun :P
tatsuya_o has joined #ruby
<bluebie> hm
tatsuya_o has quit [Remote host closed the connection]
<bluebie> I'm a vegetarian nearly vegan, so I need sunlight for vitamin d!
tatsuya_o has joined #ruby
dkr has joined #ruby
<bluebie> or I get a bad case of the sadfaces
aldodelgado has quit [Quit: aldodelgado]
<shevy> hmm
b26 has joined #ruby
<shevy> even meat eaters need sunlight as far as I know
mmitchell has quit [Remote host closed the connection]
timonv has quit [Remote host closed the connection]
<bluebie> yeah but less of it
wangr has joined #ruby
`brendan has quit [Ping timeout: 240 seconds]
b26 is now known as `brendan
<bluebie> most of an average meat eater's vitamin d intake is supplied by eating other things which spend lots of time in the sun
stopbit has joined #ruby
moshee has quit [Ping timeout: 265 seconds]
<shevy> damn these cow leechers anyway
<bluebie> of course that works better if you go for free range type things
moshee has joined #ruby
moshee has joined #ruby
moshee has quit [Changing host]
<workmad3> bluebie: when in doubt, there's always supplements :P
locriani has joined #ruby
<bluebie> or.. outside o_o
<shevy> man bluebie
<shevy> look at this:
<bluebie> come on guys, these new LCDs are so bright you can kind of read them in the sun!
<shevy> "The researchers also crushed the orange aphids and purified their carotenoids"
<workmad3> bluebie: that's crazy talk!
<shevy> that's some kind of crushing research
<bluebie> yeah so?
<bluebie> SCIENCE!
timonv has joined #ruby
<shevy> well
<bluebie> if you're going to crush something it might as well be for science!
<shevy> that would be some kind of truly new OLEDs
<shevy> really living organic LEDs
jrajav has joined #ruby
<bluebie> LED backlit LCDs can be pretty good these days
<bluebie> the kind of thing that gives you a headache indoors if you forget to turn down the brightness
<bluebie> my desktop LCD.. I never turn it above the minimum brightness o_o
kvirani has joined #ruby
haxrbyte_ has quit [Ping timeout: 246 seconds]
savage- has joined #ruby
virunga has quit [Ping timeout: 245 seconds]
locriani has quit [Ping timeout: 240 seconds]
haxrbyte has joined #ruby
jonathanpenn has quit [Remote host closed the connection]
dekroning has quit [Disconnected by services]
chimkan has joined #ruby
CodeFriar has quit [Quit: Linkinus - http://linkinus.com]
CodeFriar has joined #ruby
samuel02 has quit [Remote host closed the connection]
<rcassidy> seems like a silly question... i'm using IPAddr in ruby 1.8.5. i can specify it with a mask as a suffix (say, "10.5.0.3/16")
TPFC-SYSTEM has quit [Quit: TPFC-SYSTEM]
<rcassidy> is the only way to then get at the mask length/address via "instance_variable_get"?
aldodelgado has joined #ruby
<Muz> 1.8.5?!
<rcassidy> well OK let's assume 1.8.7
<rcassidy> i can at least upgrade to that much
vlad_starkov has quit [Remote host closed the connection]
aldodelgado has quit [Client Quit]
<rcassidy> but yeah... sadly, currently 1.8.5. old centos machine.
haxrbyte_ has joined #ruby
Takehiro has joined #ruby
<shevy> hey I got a question
<rcassidy> i mean even in 1.9, the docs look the same
<shevy> I can have plenty of @foo variables in a class
<rcassidy> >> require 'ipaddr'; a=IPAddr.new("10.5.0.3/16");
<al2o3cr> (IPAddr) #<IPAddr: IPv4:10.5.0.0/255.255.0.0>
<shevy> but may it not be simpler to just use a @hash instead, and use keys for it, rather than several different @instance variables?
<rcassidy> >> require 'ipaddr'; a=IPAddr.new("10.5.0.3/16"); a.instance_variable_get("@mask_addr")
dekroning has joined #ruby
<al2o3cr> (Fixnum) 4294901760
jjbohn has joined #ruby
tk_ has quit [Quit: ばいばい]
<hoelzro> shevy: I suppose it depends
<shevy> hmm
<rcassidy> >> require 'ipaddr'; a=IPAddr.new("10.5.0.3/16"); IPAddr.new(a.instance_variable_get("@mask_addr"), Socket::AF_INET).to_s
<al2o3cr> (String) "255.255.0.0"
<hoelzro> that's two hash lookups when you look up an attribute vs one
savage- has quit [Remote host closed the connection]
<rcassidy> can anyone shorten that? lol
jbw has quit [Read error: Connection reset by peer]
locriani has joined #ruby
locriani has joined #ruby
locriani has quit [Changing host]
dkr has left #ruby ["Leaving"]
<hoelzro> also, why not encapsulate the stuff you're putting into @hash into another object?
verto is now known as verto|off
iori has joined #ruby
apeiros_ has quit [Remote host closed the connection]
haxrbyte has quit [Ping timeout: 260 seconds]
<rcassidy> there's gotta be a better way to get at the mask than instance_var_get
aldodelgado has joined #ruby
aldodelgado has quit [Client Quit]
bbttxu has quit [Quit: bbttxu]
jjbohn has quit [Remote host closed the connection]
<shevy> hoelzro but that's just shifting the complexity around
<shevy> I'd still have to access the data I store
dpk has joined #ruby
adac has quit [Ping timeout: 276 seconds]
<rcassidy> so now the only way i can think of to get a masked base address when a user types in an IP with a mask is
<rcassidy> >> require 'ipaddr'; a=IPAddr.new("10.5.0.3/16"); a.mask(IPAddr.new(a.instance_variable_get("@mask_addr"), Socket::AF_INET).to_s)
<al2o3cr> (IPAddr) #<IPAddr: IPv4:10.5.0.0/255.255.0.0>
<hoelzro> shevy: perhaps
<hoelzro> just a thought
<shevy> well I do that already in a few projects
<shevy> CONFIG = Config.new
<shevy> cd CONFIG.base_directory
geekbri has quit [Read error: Connection reset by peer]
<shevy> bit ugly to read :P
<hoelzro> let's say I have a JSON document
locriani has quit [Ping timeout: 244 seconds]
<hoelzro> { "foo":17, "bar":18, etc }
<hoelzro> and I have a class: class MyDocument attr_accesor :foo attr_accessor :bar end
<hoelzro> is there a module I can mix in to tell initialize to automatically initialize the object's attribute from a provided document/hash?
<hoelzro> so MyDocument.new :foo => 17, :bar => 18 would DWIM
Guest15223 has quit [Quit: Leaving...]
deo__ has joined #ruby
aganov has quit [Quit: aganov]
ezra has joined #ruby
ezra has joined #ruby
ezra has quit [Changing host]
yakko_ has joined #ruby
xclite has quit [Remote host closed the connection]
jbw has joined #ruby
nathandim has quit [Read error: Connection reset by peer]
<Hanmac> recassidy it seems to me that you dont need the mask method ...
jasonkuhrt has quit [Quit: Leaving...]
_iori_ has joined #ruby
yakko has quit [Ping timeout: 272 seconds]
binaryplease has quit [Quit: WeeChat 0.3.8]
iori has quit [Ping timeout: 250 seconds]
yasushi has joined #ruby
xclite has joined #ruby
radic has quit [Ping timeout: 244 seconds]
<Hanmac> hoelzro hm do you want look at openstruct?
jorge_ has joined #ruby
yakko_ has quit [Client Quit]
kuzushi has joined #ruby
Jake232 has quit [Quit: Computer has gone to sleep.]
yakko has joined #ruby
<workmad3> hoelzro: otherwise, there's a gem 'active_attr' that provides some of that sort of stuff... it might do what you want :)
ckrailo has joined #ruby
kpshek has joined #ruby
bluebie has quit [Quit: Linkinus - http://linkinus.com]
clocKwize has joined #ruby
<hoelzro> OpenStruct seems ok
<hoelzro> I was hoping for something with a *little* more structure
vlad_starkov has joined #ruby
<hoelzro> OpenStruct allows arbitrary attrs
Nickz has left #ruby [#ruby]
fermion has quit [Ping timeout: 246 seconds]
macer1 has joined #ruby
macer1 has joined #ruby
macer1 has quit [Changing host]
chimkan has quit [Quit: chimkan]
kaiwren has quit [Quit: kaiwren]
tomsthumb_ has joined #ruby
a_a_g has quit [Quit: Leaving.]
emmanuelux has joined #ruby
jasonLaster has joined #ruby
<Hanmac> hoelzro: look at this:
<Hanmac> >> class A < Struct.new(:foo, :bar);def initialize(opt = {}); super(*members.map{|k| opt[k]});end;end; A.new(:foo=>17, :bar=>18)
<al2o3cr> (A) #<struct A foo=17, bar=18>
maesbn has quit [Remote host closed the connection]
dr0id has left #ruby [#ruby]
shiki has quit [Remote host closed the connection]
<hoelzro> ah
cantonic has quit [Quit: cantonic]
davidcelis has quit [Quit: K-Lined.]
<hoelzro> I took a look at active_attr; it looks nice, but it may be a bit heavy for my needs
maesbn has joined #ruby
andrewhl has quit [Remote host closed the connection]
<Hanmac> and what about my idea?
thunderstrike has joined #ruby
jorge_ has quit [Remote host closed the connection]
cantonic has joined #ruby
<hoelzro> Hanmac: yours looks pretty good so far =)
t61201 has quit [Remote host closed the connection]
t15492 has joined #ruby
<JonnieCache> whoever was talking about overbright monitors, check this out: http://stereopsis.com/flux/
cj3kim has quit [Quit: This computer has gone to sleep]
<JonnieCache> it lowers the colour temperature of your monitor after sundown to match your indoor lighting
yakko has quit [Quit: No Ping reply in 180 seconds.]
<JonnieCache> so you can actually sleep after staring at the screen til 1AM :)
yakko has joined #ruby
jorge_ has joined #ruby
chimkan has joined #ruby
SCommette has quit [Quit: SCommette]
maesbn has quit [Ping timeout: 272 seconds]
hashpuppy has joined #ruby
radic has joined #ruby
SCommette has joined #ruby
iori has joined #ruby
_iori_ has quit [Ping timeout: 260 seconds]
<macer1> jrajav: hi
yakko has quit [Quit: No Ping reply in 180 seconds.]
yakko has joined #ruby
ananthakumaran has joined #ruby
lurch_ has quit [Quit: lurch_]
virunga has joined #ruby
verto|off is now known as verto
cousine has joined #ruby
swair_ has quit [Ping timeout: 244 seconds]
<JonnieCache> macer1: he thought he'd fixed that :)
<macer1> no
<macer1> >> "no"
<al2o3cr> , [FATAL] Failed to create timer thread (errno: 11)
<macer1> :D
chussenot_ has joined #ruby
<macer1> (I am so evil)
macmartine has joined #ruby
nwest has joined #ruby
<JonnieCache> macer1: did you spam lots of those commands quickly? he said that it should recover from `sleep while true` unless it was spammped
<JonnieCache> i guess the forking defeats it
<macer1> no, no spam
<macer1> just forks
<JonnieCache> nice
<JonnieCache> i wonder if he left this in?
<macer1> just limiting execution time to 30 seconds will be good fix
jorge_ has quit [Remote host closed the connection]
<JonnieCache> !restart
<macer1> >> !restart
<al2o3cr> , [FATAL] Failed to create timer thread (errno: 11)
<JonnieCache> no it was just !restart
<JonnieCache> i think he disabled it
<macer1> hmm timeout(30) do popen3?
<JonnieCache> he claimed to have set a timeout of 2 seconds
<macer1> I don't see anything like this in master
<JonnieCache> but there was some issue of cpu time vs real time and the timeout not behaving or something
poga has quit [Remote host closed the connection]
<JonnieCache> nah he hasnt updated it yet
emmanuelux has quit [Ping timeout: 268 seconds]
<JonnieCache> he was here literally an hour ago fixing it :)
<macer1> :D
thunderstrike has quit [Read error: Connection reset by peer]
companion has joined #ruby
mikepack has joined #ruby
<workmad3> >> fix me!
<al2o3cr> , [FATAL] Failed to create timer thread (errno: 11)
chussenot has quit [Ping timeout: 245 seconds]
chussenot_ is now known as chussenot
peterhellberg has joined #ruby
thunderstrike has joined #ruby
bigkevmcd has quit [Quit: outta here]
bigkevmcd has joined #ruby
peterhellberg has quit [Remote host closed the connection]
<JonnieCache> yeah if you didnt gather Mon_Ouie was breaking it with `sleep while true` and that took a while to fix. adding a fork loop to that is just evil
bbttxu has joined #ruby
<macer1> :D
johnlcox has quit [Read error: Operation timed out]
wobr has quit [Ping timeout: 248 seconds]
dekroning has quit [Quit: leaving]
Matt_ has joined #ruby
Matt_ is now known as Guest10927
gvz has quit [Quit: Leaving]
yakko has quit [Quit: No Ping reply in 180 seconds.]
tayy_ has quit [Remote host closed the connection]
dpk has quit [Quit: Asleep at the keyboard.]
yakko has joined #ruby
<otters> >> 1
<al2o3cr> , [FATAL] Failed to create timer thread (errno: 11)
tayy has joined #ruby
johnlcox has joined #ruby
iori has quit [Ping timeout: 252 seconds]
<jrajav> Oi
<jrajav> What'd you do to my bot :<
<macer1> it's atters! it's him!
tayy has quit [Remote host closed the connection]
<JonnieCache> lol
<JonnieCache> hes gone and forked it
<JonnieCache> forked it completely
tayy has joined #ruby
<JonnieCache> its forked up
t15492 has quit [Remote host closed the connection]
<macer1> jrajav, forked sleepds don't exit
vlad_starkov has quit [Remote host closed the connection]
<macer1> sleeps*
<jrajav> So apparently linux's 'timeout' isn't smart enough to extend to forked processes?
<jrajav> That's pretty silly
t14019 has joined #ruby
<macer1> hm
<macer1> can you show how it works now?
<macer1> I mean push it to github
<hoelzro> jrajav: what are you using to implement timeout?
<jrajav> Yeah one sec
<jrajav> hoelzro: I just said -- linux's 'timeout' command
<jrajav> /usr/bin/timeout
erichmenge has quit [Quit: Be back later]
al2o3cr has quit [Remote host closed the connection]
* hoelzro was not aware of this command
<jrajav> …. Why is the bot script gone? :/
SegFaultAX|work2 has quit [Ping timeout: 276 seconds]
<hoelzro> that doesn't surprise me
<hoelzro> (that it doesn't kill child processes)
<JonnieCache> jrajav: what linux is that? i dont see that on centos
a_a_g has joined #ruby
<jrajav> Arch
<JonnieCache> hmm
<macer1> <3 Arch
<hoelzro> are rlimit settings inherited by children?
<jrajav> It's in coreutils
<jrajav> hoelzro: I thought they were
Morkel has quit [Quit: Morkel]
<hoelzro> you might be able to use those
<macer1> jrajav: maybe limits.conf?
<hoelzro> but that's based on CPU time, iirc
luckyruby has quit [Remote host closed the connection]
<macer1> there was some execution time afaik
al2o3cr has joined #ruby
<jrajav> kay, I've pushed the latest code
<jrajav> github.com/jrajav/al2o3cr
yakko has quit [Ping timeout: 245 seconds]
rippa has joined #ruby
<jrajav> The only change is putting "timeout", "2" in front of the sudo command that calls the scripts
yakko has joined #ruby
<macer1> maybe ruby timeout
carloslopes has quit [Quit: Leaving.]
<jrajav> I tried the Timeout module if that's what you mean
<macer1> yeah
<jrajav> That didn't even work to stop a normal infinite while loop :P
<rcassidy> anyone see my Q ealirier regarding IPAddr? :)
<jrajav> It's pretty useless
<jrajav> I'm guessing that the Timeout module wasn't designed to work with Open3 or other Process.spawn variants
gfontenot has joined #ruby
<JonnieCache> jrajav: maybe have a separate script which calls ps every second and just nukes ruby processes which have been going too long
randomautomator has joined #ruby
<jrajav> That's hacky as hell
<jrajav> lol
Guedes has quit [Read error: Connection reset by peer]
<hoelzro> I wonder if you could limit it using cgroups?
<JonnieCache> the point is to have it totally separate though
<JonnieCache> obviously the ps thing is hacky
<jrajav> Yeah I know
<rcassidy> i've actually been dealing a lot with killing processes lately... been doing very hacky things
<jrajav> I would prefer that the bot be completely detached from the scripts
<JonnieCache> also, isnt that basically what a lot of really fancy sysadmins tools do?
<jrajav> Except for getting output
<jrajav> I'm not sure how to do that though
<jrajav> It has to start them SOMEHOW
<JonnieCache> a queue!
chimkan has quit [Quit: chimkan]
<JonnieCache> queues solve everything
<jrajav> That's brilliant
<jrajav> And also a lot of work
<jrajav> Be my guest
<jrajav> :P
paolooo has quit [Quit: Page closed]
Takehiro has quit [Remote host closed the connection]
<rcassidy> the one i left in place is just to do System.kernel("killall [proc names]") after a bunch of forks
<rcassidy> -___-
randomau_ has joined #ruby
paolooo has joined #ruby
<JonnieCache> classy
<rcassidy> not happy with it but stuck with it for now, esp. since not in 1.9
mparodi_ has joined #ruby
<rcassidy> so i have a ludiscrously lengthy statement to apply the subnet mask in an IPAddr object to the IP addr in that object
<rcassidy> to get a base address. and it's super clunky.
Guest10927 has quit [Quit: leaving]
<rcassidy> can anyone think of a nicer way to be phrasing this?
<rcassidy> >> require 'ipaddr'; a=IPAddr.new("10.5.0.3/16"); a.mask(IPAddr.new(a.instance_variable_get("@mask_addr"), Socket::AF_INET).to_s)
<al2o3cr> , [FATAL] Failed to create timer thread (errno: 11)
johnlcox has quit [Quit: Computer has gone to sleep.]
<macer1> ruby sandbox
<rcassidy> welp. that worked earlier. lol.
<macer1> jrajav: sandbox
erichmenge has joined #ruby
Matt__ has joined #ruby
randomautomator has quit [Ping timeout: 244 seconds]
greenysan has quit [Ping timeout: 240 seconds]
<JonnieCache> rcassidy: is instance_variable_get really the best way? thats unfortunate
<hoelzro> jrajav: have you considered disabling the creation of child processes?
<rcassidy> JonnieCache: there has to be a better one
<rcassidy> but i can't find it
a_a_g has quit [Quit: Leaving.]
johnlcox has joined #ruby
<JonnieCache> there are some really crappy neighborhoods in stdlib/core
<jrajav> hoelzro: I have. That disables a lot of things that sneakily rely on threads to work
<rcassidy> JonnieCache: word
<jrajav> I have no clue why but it does
<jrajav> macer1: ?
<hoelzro> jrajav: what sorts of things?
mparodi has quit [Ping timeout: 248 seconds]
<macer1> it is sandbox for running ruby code
<jrajav> hoelzro: Can't remember :P
<macer1> much better than spawning processes
<jrajav> macer1: I've already gone the sandbox route
<jrajav> macer1: WAY too annoying
<macer1> why?
<jrajav> Trust me
<jrajav> It is
<jrajav> haha
jorge_ has joined #ruby
infinitiguy has quit [Read error: Operation timed out]
<jrajav> Besides, that wouldn't solve this problem
chimkan has joined #ruby
adeponte has joined #ruby
infinitiguy has joined #ruby
jorge_ has quit [Remote host closed the connection]
<macer1> I'll try something with sandbox
<jrajav> If anything it would make it worse
<macer1> if I timeout
<JonnieCache> rcassidy: only thing i can think of to solve your issue is to monkey patch IPAddr
<macer1> that dont worked >.>
<jrajav> Sure, go ahead, you might have more luck with it than I did
<jrajav> I'll stick with the chroot for now
<hoelzro> jrajav: I would look into cgroups
andrewhl has joined #ruby
<hoelzro> I think you can set CPU limits on a group, and you can also kill an entire group
<macer1> => ["NameError: undefined local variable or method `fork' for main:Object"]
<macer1> ^^
<jrajav> hoelzro: I think someone mentioned that before and I remember it looking horribly complicated to set up
<macer1> sandRBox
<hoelzro> I can't speak to that, but it probably is =)
<jrajav> macer1: The first incarnation of the bot was in sandrbox
spg has joined #ruby
spg has left #ruby [#ruby]
<jrajav> macer1: You must have missed all the "fun" we had with that
<macer1> what was wrong in it :(
<macer1> Sandrbox.perform(["code"])
<jrajav> It was full of holes
<macer1> holes like?
<rcassidy> macer1: getting a hold of IO objects and using them to write to files
<jrajav> And it still did nothing to prevent locking up threads and processes
<jrajav> And forkbombs
<macer1> but sandrbox inside chroot
yasushi has quit [Remote host closed the connection]
<jrajav> That all has to be managed externally, and the more separation from the bot itself, the better
<jrajav> Yes, but when I put it in a chroot, why bother sandboxing? That's needlessly limiting, and the limits can usually be circumvented anyway
<jrajav> And again, the current problem doesn't have a lot to do with Ruby code that we don't want running, it's more to do with out-of-control processes
mmitchell has joined #ruby
<macer1> disable fork
<jrajav> I'm sure someone would find a way to lock a process even if we disable fork
<macer1> and sleep
<macer1> ...
hoelzro is now known as hoelzro|away
<macer1> sandrbox do that
ryan0x2 has joined #ruby
<JonnieCache> you dont need a fancy lib to disable fork
savage- has joined #ruby
<macer1> and sleep
<Mon_Ouie> There are ways of working around sandrbo
<Mon_Ouie> +x
<jrajav> macer1: Well, for one thing, no matter WHAT method you disable there are ways to call them anyway without patching a few holes. And even after you patch those holes there are still ways to get to specific methods that should be disabled too
<jrajav> macer1: You can see precisely what I mean in the issues I opened with Sandrbox
<jrajav> Mon_Ouie knows how to break Sandrbox very well by now
<jrajav> I find "chroot it and forget it" more secure and more elegant
<macer1> Can obtain reference to IO class through STDOUT
<macer1> :D
<macer1> haha
liluo has quit [Remote host closed the connection]
<shevy> ok jrajav
<macer1> haha its working
<macer1> nice
<jrajav> shevy: ?
hadees has quit [Quit: hadees]
adeponte has quit [Remote host closed the connection]
<shevy> jrajav you admit that your bot is faulty :>
mmitchell has quit [Ping timeout: 260 seconds]
<macer1> :D
<macer1> >> ""
<al2o3cr> (String) ""
<macer1> !restart
<shevy> !quit
t14019 has quit [Remote host closed the connection]
<macer1> !g
<jrajav> I'm adding a reset command to it that should work for real
SeanLazer has joined #ruby
<jrajav> Instead of restarting the bot entirely I'm just going to kill all the user scripts
<macer1> meh we need a cool channel supybot
t34450 has joined #ruby
<shevy> what language is supybot
<jrajav> Which is easy because they're the only ones running as user jrajav
<jrajav> I just do 'pkill -u jrajav"
<SeanLazer> okay am I crazy or should "if organization.respond_to?(collection) && !organization.send(collection).empty?" never attempt the second condition if the first condition returns false?
<rcassidy> macer: mucking with ObjectSpace was fun, too
<jrajav> I was thinking of adding some more useful ! commands to it
<jrajav> Any suggestions?
<macer1> anyone know a free vps hosting?
<shevy> SeanLazer, I think it won't evaluate the second. but perhaps you need a () before the !
BiHi has quit [Ping timeout: 268 seconds]
<jrajav> Would we actually use an aliasing system? To set custom ! commands to repeat back stock replies?
<fowl> oh yeah, i'll set up some aliases
<SeanLazer> shevy: if organization.respond_to?(collection) && !(organization.send(collection).empty?)
<rcassidy> jrajav - maybe a "!howto" for how to use the bot, with instructionss and a friendly reminder to take longer banter to PM
<SeanLazer> like that?
<macer1> jrajav: can you setup supybot?
<jrajav> macer1: What is supybot
<SeanLazer> or if organization.respond_to?(collection) && (!organization.send(collection).empty?)
Takehiro has joined #ruby
timonv has quit [Remote host closed the connection]
adeponte has joined #ruby
<macer1> it has plugins to everything
BiHi has joined #ruby
mohits has joined #ruby
mohits has quit [Changing host]
mohits has joined #ruby
<JonnieCache> macer1: amazon ec2 does free vps for 1 year
<macer1> but it needs to give it credit card..
<JonnieCache> youre not going to get root on a vps for free without at least giving up a cc#
luckyruby has joined #ruby
yonggu has joined #ruby
xorox90 has quit [Ping timeout: 244 seconds]
luckyruby has quit [Read error: Connection reset by peer]
JStoker has quit [Excess Flood]
<JonnieCache> unless you go ker-azy on bandwidth youre not going to get charged
luckyruby has joined #ruby
shevy has quit [Ping timeout: 240 seconds]
axl_ has quit [Read error: Connection reset by peer]
<JonnieCache> and even then its so damn cheap anyway :)
<jrajav> macer1: Well, considering I'm already using Cinch…. :P
axl_ has joined #ruby
knirhs is now known as Shrink
davidcelis has joined #ruby
Shrink has quit [Changing host]
Shrink has joined #ruby
mklappstuhl has quit [Ping timeout: 272 seconds]
al2o3cr has quit [Remote host closed the connection]
apeiros_ has joined #ruby
davidcelis has quit [Read error: Connection reset by peer]
apok has joined #ruby
davidcelis has joined #ruby
ringotwo has joined #ruby
xorox90 has joined #ruby
al2o3cr has joined #ruby
<lectrick> Is there any way to make all statements after a certain statement use a different scope?
<lectrick> But only for the current scope? Like, I want to add methods but only for the current scope
ringotwo has quit [Remote host closed the connection]
mc0e has joined #ruby
aantix has joined #ruby
<jrajav> Okay
<jrajav> Someone do that fork sleep command agian
<jrajav> To lock the bot up
<JonnieCache> >> fork { sleep until false} while true
<jrajav> >> 1
<al2o3cr> , [FATAL] Failed to create timer thread (errno: 11)
<jrajav> Good job
<jrajav> !panic
<al2o3cr> AAAAAAAAH
<al2o3cr> All better
<jrajav> >> 1
<al2o3cr> , [FATAL] Failed to create timer thread (errno: 11)
<jrajav> :/
<JonnieCache> lol
<jrajav> it didn't actually kill the processes
<JonnieCache> that aah, all better couple of lines is asking to set off the flood protection again
eywu has joined #ruby
Hanmac1 has joined #ruby
apeiros_ has quit [Ping timeout: 260 seconds]
eywu has left #ruby [#ruby]
<jrajav> I'm not sure why it "flooded" but I don't think that was it
Xeago_ has quit [Ping timeout: 246 seconds]
<jrajav> I had the bot routinely sending 2 or 3 lines instantly before
mahmoudimus has joined #ruby
<mc0e> A noob question. I have an array and I want to map it to an array. In perl I'd do it as %hash = map { $_ => fn($_) } @array; What's the ruby equivalent?
<JonnieCache> jrajav: i think that might have been because it said the same line 3 times actually
<Mon_Ouie> [1,2,3].map { |n| * 2 }
flip_digits has joined #ruby
hoelzro|away is now known as hoelzro
zemanel has joined #ruby
al2o3cr has quit [Remote host closed the connection]
<jrajav> Aww dammit
<mc0e> what i want though is a hash table i can look values up in quickly. I think what you give me returns an array?
<jrajav> pkill is giving a segmentation fault
Hanmac has quit [Ping timeout: 245 seconds]
Hanmac1 is now known as Hanmac
<dominikh> mc0e: considering you said you wanted to map it to an array, yes it does.
<Mon_Ouie> Yeah, but you did ask for an array
t34450 has quit [Remote host closed the connection]
<mc0e> my bad
t92806 has joined #ruby
<mc0e> perl code is right though.
<mc0e> I meant I want a hash table back
<Mon_Ouie> But I can't read perl :p (I could have guessed from the %hash, but still)
<macer1> btw jrajav want to see a cool tricks?
<macer1> trick*
<Mon_Ouie> You can just use each and insert keys in the hash
<mc0e> The stuff I've seen in rubydoc only seems to return an array of the same length as the original
<jrajav> macer1: What's that
<Mon_Ouie> h = {}; each { |k| h[k] = f(k) }
<Mon_Ouie> Or each_with_object({}) { … }
<macer1> wait sec
Jay_Levitt has quit [Quit: Jay_Levitt]
maletor has joined #ruby
<mc0e> ok. Thought there might have been a cleaner way. thanks.
<macer1> >> require 'openssl' and OpenSSL::PKey::RSA.new.public_encrypt("pwn'd")
stkowski has joined #ruby
<fowl> Hash[arr.map{|a| [a, f(a)]}]
<macer1> oh cmon bot
<macer1> D:
<macer1> segfault anyway
<macer1> >> "hi"
<macer1> oh
<macer1> bot return back :(
<macer1> anyway that cool piece of code segfaults ruby :)
<JonnieCache> it segfaults openssl surely
apeiros_ has joined #ruby
<macer1> but ruby crashes
<fowl> macer1: congrats
shevy has joined #ruby
al2o3cr has joined #ruby
<JonnieCache> there are plenty of ways to do that but it wont take out the whole bot like that other line did
<jrajav> >> 1
<al2o3cr> (Fixnum) 1
<mc0e> thanks fowl
<macer1> >> require 'openssl' and OpenSSL::PKey::RSA.new.public_encrypt("pwn'd")
<al2o3cr> (eval):1: [BUG] Segmentation fault, ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux], , -- Control frame information -----------------------------------------------, c:0007 p:---- s:0019 b:0019 l:000018 d:000018 CFUNC :public_encrypt, c:0006 p:0040 s:0015 b:0015 l:001328 d:000014 EVAL (eval):1, c:0005 p:---- s:0013 b:0013 l:000012 d:000012 FINISH, c:0004 p:---- s:0011 b:0011 l:000010 d:...,
<jrajav> >> fork { sleep until false} while true
<macer1> :D
<macer1> >> "dead"
<al2o3cr> , [FATAL] Failed to create timer thread (errno: 11)
<jrajav> !zomg
<al2o3cr> AAAAAAAAH
<al2o3cr> , [FATAL] Failed to create timer thread (errno: 11)
<al2o3cr> All better
JStoker has joined #ruby
<jrajav> >> 1
<macer1> fowl: thanks :D
<al2o3cr> (Fixnum) 1
<wunz> i'd like to actively montior a sql table for any new items coming in... whichw ould be the best way to do so? timer?
<jrajav> MUAHAHA
<jrajav> Fixed
<JonnieCache> yay!
kn330 has joined #ruby
<macer1> em
<macer1> >> "ping"
<al2o3cr> (String) "ping"
<macer1> :D
<JonnieCache> so its !zomg then next time someone breaks it
<otters> !zomg
yonggu has quit [Quit: yonggu]
<al2o3cr> AAAAAAAAH
<al2o3cr> All better
<jrajav> macer1: That's an impressive segfault, but as mentioned, it will only kill the script, not the bot
<otters> oh
Advocation has quit [Quit: Advocation]
<macer1> jrajav: I know
<macer1> :/
<macer1> but it crashes other ruby bots
<macer1> using sandbox
apok has quit [Quit: apok]
<jrajav> Well then why the hell would I use a sandbox :P
<macer1> because it will be fun to break it
<macer1> :D
<jrajav> Okay, so I should probably add this to a !help command or something, but I'm telling everyone now: !reset will kill all currently running scripts under the bot
<jrajav> !reset
<al2o3cr> All better
<macer1> !zomg
<al2o3cr> AAAAAAAAH
<al2o3cr> All better
hadees has joined #ruby
<jrajav> And !zomg, !panic, !dammit, and !apocalypse do the same thing except the bot also screams while it does it
wallerdev has joined #ruby
<macer1> jrajav if you don't have better things to do I suggest giving link titles on channels, and !g displaying first results from google
alekst has quit [Quit: Computer has gone to sleep.]
<macer1> !panic
<al2o3cr> AAAAAAAAH
<al2o3cr> All better
chussenot has quit [Quit: chussenot]
<macer1> !dammit
<al2o3cr> AAAAAAAAH
<al2o3cr> All better
<macer1> !apocalypse
<al2o3cr> AAAAAAAAH
<al2o3cr> All better
al2o3cr has quit [Killed (idoru (Spam is off topic on freenode.))]
<jrajav> ....
<macer1> :D
<macer1> *epic win*
<jrajav> Yes. Win. That's what you did
verto is now known as verto|off
<JonnieCache> right ok now to get the bot to open a socket back to freenode and start issuing forkbomb commands to itself.
<macer1> jrajav: I'll suggest while true; do ruby bot.rb; done
<Hanmac> !42
<macer1> or cron watcher
<jrajav> macer1: The bot's still running. It's trying to reconnect now
<jrajav> macer1: Except that you got it klined for spamming
<macer1> at least you know at which point it can be crashed
<macer1> some day, some day it will be uncrashable
<jrajav> It can be crashed with spamming in quick succession. You could do that with scripts too
<jrajav> How about we just not spam it
moshee has quit [Ping timeout: 260 seconds]
<macer1> hm sound like a good idea
<JonnieCache> yeah this isnt efnet circa 1996
moshee has joined #ruby
<JonnieCache> unfortunately
moshee has quit [Changing host]
moshee has joined #ruby
<jrajav> I could add in rules to check if it's spamming
Marzhac has joined #ruby
<macer1> maybe
<jrajav> But apparently spamming the same two lines counts too
<jrajav> It would be nontrivial
<macer1> lastsendmsg = Time.now
<macer1> if lastsendmsg-time.now < 5 then cancel
<JonnieCache> just have it pick from an array of different exclamations instead of just saying AAAAAAH
<JonnieCache> you could even just vary the number of As perhaps
Matt__ has quit [Ping timeout: 240 seconds]
<macer1> >> puts ["AAAAA","OMGOMGOMG","OH NOES!!","AAAAAH"].sample
<jrajav> Well, I could just have it not send a message on !reset
<jrajav> But the only use case for that is macer1 being an idiot
<macer1> :(
<apeiros_> lol
<JonnieCache> you could just blacklist certain users from !reset ;)
<jrajav> Good idea ;D
<macer1> >> 100.times { puts "I will not crash the bot" }
ericcoleman has joined #ruby
<lectrick> Any way to have a method implicitly receive the context of the caller?
<jrajav> haha
<macer1> sorry jrajav :D
<JonnieCache> lectrick: you dont want that.
<lectrick> JonnieCache: :)
<apeiros_> jrajav: how about you add a #crash-al2o3cr channel and let people crack your bot there?
<macer1> please forgive me jrajav :D
robbyoconnor has quit [Read error: Connection reset by peer]
<macer1> apeiros_: good idea
ProT-0-TypE has quit [Ping timeout: 246 seconds]
shadoi has joined #ruby
robbyoconnor has joined #ruby
Matt_ has joined #ruby
Matt_ is now known as Guest69310
<jrajav> apeiros_: This will be the last, most secure, bestest incarnation of the bot and won't need any more testing! :D
<apeiros_> lol
<jrajav> By the way anyone can PM it
<apeiros_> famous last words :-p
bricker88 has joined #ruby
fabrice31 has quit [Remote host closed the connection]
yakko has quit [Read error: Connection reset by peer]
<fowl> jrajav: can you guarantee that this bot wont become sentient and kill us all?
<apeiros_> skyruby
<apeiros_> skyruby.net - this bot doesn't run on ironruby, or does it?
xorigin has quit [Quit: leaving]
s1n4 has joined #ruby
clocKwize has quit [Quit: clocKwize]
<JonnieCache> >> puts RUBY_VERSION
<JonnieCache> oh is it still klined
adamkittelson has joined #ruby
tayy has quit [Remote host closed the connection]
daniel_hinojosa has joined #ruby
<macer1> I searched for textmate2 builds and I found this..http://textmate2.org/ ehh I need to build it myself
tayy has joined #ruby
kenichi has joined #ruby
<jrajav> Yeah I just retried now
<jrajav> Still banned
<fowl> why dont you ask one of your Geniuses to build it for you macer1
<macer1> :D
<shevy> COMPILING IS ONLY FOR THE BRAVE AT HEART
<JonnieCache> HAHAHA textmate.org is amazing
<JonnieCache> thats an utter joy
nobitanobi has joined #ruby
<Hanmac> JonnieCache: the bot is "1.9.3"
<JonnieCache> "text your wife into bed"
<JonnieCache> wtf
ringotwo has joined #ruby
<macer1> haha
<JonnieCache> if your wife isnt sleeping in bed with you then its going to take more than sms
<nobitanobi> I have a gem that is basically a wrapper for an API. In my tests I use my personal keys to connect to the API, but once I publish the gem I want to avoid that. What's a good way to do so?
<macer1> dafaq we just watched, JonnieCache?
yakko has joined #ruby
<JonnieCache> oops textmate2.org
<macer1> nobitanobi: make an initialize method that sets the key
<macer1> like MyApi.new("asdasdasdasdlongkey")
<JonnieCache> nobitanobi: remove the keys and ask anyone who wants to run their tests to insert their own key into spec_helper.rb or whatever
<Spooner> nobitanobi : Same as last time you asked. Just keep the key in a separate file and don't commit it to github.
<JonnieCache> or, use the VCR gem to make all the tests run locally without touching the api using stored http requests
<Spooner> And exclude it from the gem, of course.
carloslopes has joined #ruby
<macer1> btw, anyone is running mountain lion here?
schleppy has quit [Quit: Leaving.]
<Sou|cutter> I really like using VCR to minimize external deps in tests
senny has quit [Remote host closed the connection]
<shevy> I am running mountain squirrel
<macer1> damn
<macer1> is mountain squirell good?
azm has joined #ruby
<Spooner> I am running away from a mountain lion at this very moment. Why I'm pausing to type is a question I shall ask myself later if I get away.
chimkan has quit [Quit: chimkan]
<macer1> update from mountain dog?
<macer1> Spooner: haha
<nobitanobi> Spooner: JonnieCache: Thanks.
ananthakumaran has quit [Ping timeout: 244 seconds]
<shevy> apple is like a dark cult where you have to sign a pact with the blood of your firstborn
<macer1> maybe it is
<JonnieCache> im really unhappy about the way theyre going with extending the walled garden to os x, and soldering in all the ram
ananthakumaran has joined #ruby
<JonnieCache> but i cant write music on linux, so a new macbook pro it is
<nobitanobi> JonnieCache: I am using VCR, but if they want to re run the tests, I should allow that.
<shevy> :(
carloslopes has quit [Client Quit]
carloslopes has joined #ruby
al2o3cr has joined #ruby
mrsolo has joined #ruby
<wmoxam> JonnieCache: why can't you write music on Linux?
<macer1> hey al2o3cr
<JonnieCache> wmoxam: the software doesnt exist
<macer1> sorry for crashing you
<jrajav> wmoxam: Because open source media software blows donkey ass
<JonnieCache> wmoxam: when http://bitwig.com/ itll be a lot closer
<wmoxam> JonnieCache: Renoise works well
hoelzro is now known as hoelzro|away
<Sou|cutter> JonnieCache: I don't blame apple too much about the hardware... it's sorta inevitable that hardware is going to get less and less modular
<wmoxam> JonnieCache: and has a Linux version
<jrajav> >> 1
<al2o3cr> (Fixnum) 1
<jrajav> !panic
<al2o3cr> SAVE YOURSELF
<al2o3cr> Still alive~
<Sou|cutter> JonnieCache: the walled garden stuff upsets me though :)
<jrajav> Okay.
thunderstrike has quit [Remote host closed the connection]
gmci has quit [Quit: Computer has gone to sleep.]
Morkel has joined #ruby
<wmoxam> JonnieCache: http://www.renoise.com/
<shevy> what is "walled garden"
<jrajav> I've asked in #cinch how I can ratelimit a handler; the alternative, which I'll avoid if I can, is to simply not send a message in response to !reset
<Sou|cutter> shevy: app store
<jrajav> So please just don't spam !reset ;)
<jrajav> But it exists now if anyone locks up the bot
<macer1> jrajav: OK
Morkel has quit [Client Quit]
Guest69310 has quit [Ping timeout: 244 seconds]
<JonnieCache> wmoxam: even assuming i was able to be creative in the way i want using a tracker, its all about the plugins
* macer1 will not crash the bot
<jrajav> Thanks ;)
<rcassidy> shevy: also the model of non-user-serviceable-hardware
richardcreme has joined #ruby
liluo has joined #ruby
<macer1> >> 100.times { puts "I will not crash the bot" }
<al2o3cr> (Fixnum) 100, Console: I will not crash the bot, I will not crash the bot, I will not crash the bot, I will not crash the bot, I will not crash the bot, I will not crash the bot, I will not crash the bot, I will not crash the bot, I will not crash the bot, I will not crash the bot, I will not crash the bot, I will not crash the bot, I will not crash the bot, I will not crash the bot, I will not crash the bot, I will not ...
Morkel has joined #ruby
<shevy> so who can not resist playing with the bot again... :P
<jrajav> I didn't know .times returns the number of times it ran
* wmoxam shrugs
<jrajav> Haha
<shevy> YOU KIDS
<shevy> yeah that is odd
<jrajav> shevy: Interpreting anything is fine; the problem was spamming the !reset command
<macer1> jrajav: and sleep returns number of seconds it sleeped
<shevy> oh wait
<shevy> in IRB it returns 100 as well
i0n has joined #ruby
i0n has joined #ruby
i0n has quit [Changing host]
mc0e has left #ruby [#ruby]
<JonnieCache> wmoxam: when i have more money and therefore lots of actual music hardware then maybe ill be able to move to linux
<shevy> yup... x = 100.times { puts "I will not crash the bot" }
Foxandxss has quit [Quit: KVIrc 4.2.0 Equilibrium http://www.kvirc.net/]
<shevy> x == 100
<shevy> JonnieCache \o/
<shevy> JonnieCache teach me to become a mini Hans Zimmer please
<JonnieCache> wmoxam: that bigwig studio thing will be out for linux then, using that to drive loads of outboard gear under linux would be a dream
<shevy> he has a huge-ass analog synthesizer... I wanna do the same with an AI and digital only
BiHi has quit [Quit: Computer has gone to sleep]
<Hanmac> x = 1.upto(Float::Infinity) { puts "I will not crash the bot" }
<Hanmac> >> x = 1.upto(Float::Infinity) { puts "I will not crash the bot" }
<al2o3cr> -e:1:in `eval': uninitialized constant Float::Infinity (NameError), from -e:1:in `eval', from -e:1:in `<main>'
<macer1> ^^
<JonnieCache> shevy: thats a modular synth. loads of separate components which you patch together with wires
<JonnieCache> theyve VERY VERY expensive because theyre hand-made
<Hanmac> x = 1.upto(Float::INFINITY) { puts "I will not crash the bot" }
liluo has quit [Remote host closed the connection]
<Hanmac> >> x = 1.upto(Float::INFINITY) { puts "I will not crash the bot" }
<al2o3cr> I will not crash the bot, Console: I will not crash the bot, I will not crash the bot, I will not crash the bot, I will not crash the bot, I will not crash the bot, I will not crash the bot, I will not crash the bot, I will not crash the bot, I will not crash the bot, I will not crash the bot, I will not crash the bot, I will not crash the bot, I will not crash the bot, I will not crash the bot, I will not crash the bot, I will not ...
tayy_ has joined #ruby
vlad_starkov has joined #ruby
<macer1> >> ??
<al2o3cr> (String) "?"
<Hanmac> oO
<macer1> :D
tewecske has joined #ruby
tewecske has quit [Max SendQ exceeded]
<macer1> this is cool
<Hanmac> where is my other output?
<JonnieCache> in that pic is probably at least $100,000 worth of synth
<shevy> JonnieCache I would not have the room for it anyway :(
<jrajav> Hanmac: It truncates it
<Hanmac> :'(
<shevy> JonnieCache, you filled your flat with music instruments?
GraemeLion has joined #ruby
<macer1> how ?? works
<JonnieCache> deadmau5, the awful house producer, has his whole apartment full modular
<macer1> (I have no idea)
<jrajav> Hanmac: Sorry, that really WOULD open the door to a nice speedy spam kline
radic has quit [Read error: Connection reset by peer]
<jrajav> Hanmac: Even if I PM it
ken_barber1 is now known as ken_barber
<JonnieCache> no in my flat i just have a crappy macbook and a crappy little 2 octave keyboard it sucks
<macer1> I remember changing nick
<Hanmac> macer1 ?a returns the same as "a"[0]
<macer1> because it was so much spam
<macer1> :D
<shevy> hehe
<macer1> on PM
<JonnieCache> shevy: getting one of these soon though http://www.vintagesynth.com/waldorf/microwavext.php
<jrajav> github.com/jrajav/al2o3cr
jrist has quit [Remote host closed the connection]
<jrajav> Latest incarnation of the bot
<macer1> Hanmac: thanks
<jrajav> With !reset added
<Spooner> macer ?a or ?? is equivalent to 'a' or '?' (in 1.9) but gave the ASCII in 1.8
<shevy> cool
<macer1> jrajav: I suggest adding !g
<macer1> display first result frm google
<jrajav> g for google? :/
<macer1> from
<macer1> yes
<Hanmac> macer use ?a when you == the result of string[n]
Vert has quit [Read error: Connection reset by peer]
tayy has quit [Ping timeout: 252 seconds]
<jrajav> I'm not inclined to do anything more with the bot right now unless I have to fix something (like just now)
apok has joined #ruby
<jrajav> But even if I did add something I want to avoid generic cool bot commands
<jrajav> And focus on useful things
<JonnieCache> i was going to suggest a command to give a link to this but the site is down: http://www.catb.org/esr/faqs/smart-questions.html
<jrajav> Like making aliases for common replies or searching ruby docs
emmanuelux has joined #ruby
radic has joined #ruby
elaptics is now known as elaptics`away
br4ndon has joined #ruby
deryl has joined #ruby
elaptics`away is now known as elaptics
vlad_starkov has quit [Ping timeout: 244 seconds]
pzol has left #ruby ["Sayonara!"]
<JonnieCache> jrajav: ooh a good feature might be returning a gist url instead of truncating the output. youd then have to rate limit that as well though...
ngoldman has joined #ruby
mXr has joined #ruby
<mXr> hello, can someone maybe help me with a class / instance / inheritance veriable issue? :)
<mXr> (that is probably rooted by my lack of understanding)
GraemeLion has quit [Quit: o]
<shevy> mXr what is the issue
<mXr> well, i have a bunch of classes here. its actually part of a rails project, but that shouldnt matter, just for sake of completeness
<mXr> i have a "base" class (that is a rails controller)
cousine has quit [Remote host closed the connection]
<mXr> this base class defines a private method that "is supposed to do something" with a variable;
duply has joined #ruby
<mXr> now i have a class that inherits from said base class; and i would somehow like to set - for this child class - a "global" variable that the inherited method can access
cakehero has joined #ruby
<mXr> in my base class i have something like this
haxrbyte_ has quit [Remote host closed the connection]
<Spooner> mXr : Hard to inherit a private method though :)
<mXr> def sort_column
<mXr> end
<mXr> @sort_model.column_names.include?(params[:sort]) ? params[:sort] : @sort_default_col
<mXr> is it?
<mXr> why?
<mXr> i read that private is not the same in ruby as it is in eg java
wpaulson has joined #ruby
<mXr> and that private does get inherited
<Spooner> Do you not want a protected one instead?
<mXr> i might, i'm not sure
<mXr> in java i would have said yes i do :p
<mXr> to complete my paste, in my child model i would like to define @sort_model and @sort_default_col with something, and the inherited "sort_column" function is supposed to do its thing
<Hanmac> you can do that, even when sort_column is private
bier has quit [Ping timeout: 245 seconds]
wpaulson has quit [Client Quit]
jrist has joined #ruby
<mXr> mh for some reason @sort_model is always undefined
<mXr> and i just realize it is already nil in my instance method in "childclass"
<Hanmac> make a pastie or an gist of all of your files (you could make an multi-file pastie)
<jrajav> JonnieCache: Someone else has suggested doing stuff with gist too
azm has quit [Ping timeout: 252 seconds]
<jrajav> JonnieCache: It sounds neat but it also sounds complicated
<jrajav> JonnieCache: Feel free to implement it and send a pull request ;)
vlad_starkov has joined #ruby
vlad_starkov has quit [Read error: Connection reset by peer]
mxbtty has joined #ruby
alvaro_o has joined #ruby
vlad_starkov has joined #ruby
yaymukund has quit [Ping timeout: 244 seconds]
macmartine has quit [Quit: Computer has gone to sleep.]
<mXr> maybe what i'm trying to do is crazy in the first place, i'm not sure :p
cousine has joined #ruby
waxjar has joined #ruby
<Hanmac> @sort_model = Device  @sort_default_col = 'blah' are in the WRONG context ...
quazimodo has quit [Read error: No route to host]
tww has joined #ruby
<mXr> do i need to class << self?
<Spooner> mxr Er, the @ variables in the main class are instance variable, on the inherited class, they are class instance variables.
<mXr> i keep reading the meaning of that over and over in examples but somehow keep screwing that up..
jorge_ has joined #ruby
<mXr> i know the diff between a class and an instance
luxurymode has joined #ruby
vectorshelve has joined #ruby
SegFaultAX|work2 has joined #ruby
<Hanmac> hm you could do class.sort_model.column_names.include?(params[:sort]) ? params[:sort] : class.sort_default_col
vlad_starkov has quit [Remote host closed the connection]
qwerxy has quit [Ping timeout: 240 seconds]
<workmad3> mXr: you do? awesome... so, what is the difference in ruby? because I can't see one :P
xorox90 has quit [Quit: 전 이만 갑니다.]
<vectorshelve> Hanmac: rails in ruby room ? :)
<mXr> it starts to get complicated with inheritance :p
TPFC-SYSTEM has joined #ruby
burgestrand has joined #ruby
<Spooner> Class instance variables are per-class. instance variables are per-object.
<Hanmac> and then you need class << self attr_reader,sort_model,sort_default_col;end
<mXr> Spooner: yeah, so far so good
<Mon_Ouie> It starts to get ambiguous with classes being objects, instances of the Class class
<Spooner> If, however, you are setting them when you define your class, then what you actually want are regular constants.
andrewh has joined #ruby
t92806 has quit [Remote host closed the connection]
jorge_ has quit [Read error: Operation timed out]
<Hanmac> mxr: instances have classes, classes are instances
chussenot has joined #ruby
<mXr> ok now i'm spacing out :p
t31485 has joined #ruby
<mXr> and yes, i was gonna try doing it with constants, btw
quest88 has joined #ruby
<Spooner> Yes, classes are objects too, but we aren't talking about them in that context here.
tnk1 has joined #ruby
<Mon_Ouie> String.is_a? Class #=> True
<mXr> would using constants make it any easier/different?
<Mon_Ouie> Well, we are, if we set instance variables rather than on their instances
<waxjar> does someone know of a simple 'option parser' that turns `haha --option1 value --option2 value --option3 value` into a Hash (:option => 'value')?
<waxjar> i don't need any help messages or anything
<mXr> Hanmac: undefined method `column_names' for nil:NilClass
chussenot_ has joined #ruby
<mXr> self.class::SORT_MODEL wtf :p
<Spooner> If you tried it without the self.class::, then the parent methods won't find the constant as defined on the child class.
Eldariof59-ru has joined #ruby
GoldenCider has joined #ruby
Matt__ has joined #ruby
<matled> waxjar: if your requirements are really that simple just write a something evaluating ARGV yourself. otherwise use something like optparse (dunno if they support --option value or only --options=value)
<Spooner> But there is no reason to use class instance variables if the values are constant at the point of class definition.
<waxjar> i was hoping someone would have done the work for me already, matled :p
<rcassidy> optparse supports --option value
<matled> waxjar: I'm sure there are some libraries out there that do that
apok has quit [Read error: Connection reset by peer]
<mXr> Spooner: yeah i agree, i just failed with constants to i tried switching to normal vars :p
<rcassidy> it's a pretty simple template...
<Spooner> waxjar : slop gem is the usual replacement for the rather verbose optparse
<Mon_Ouie> waxjar: optparser in stdlib, slop or trollop (available as gems)
apok has joined #ruby
<matled> but they probably have also other features (like printing a message)...
<waxjar> from what i gather from their readme's, you have to define all options and stuff, i don't need that
<rcassidy> opts.on("-x", -"xtra-cool-flag", "this is the coolest flag ever!") do |value| options[:xtracool] = value end
artOfWar has joined #ruby
<mXr> Spooner: i still get undefined method `column_names' for nil:NilClass
<rcassidy> for optparse
<mXr> Spooner: however, the debug clearly outputs the Device class, so .. hm
<Mon_Ouie> ARGV.each_slice(2) { |k, v| … }
artOfWar has quit [Remote host closed the connection]
Eldariof-ru has quit [Ping timeout: 252 seconds]
<Spooner> I probably just introduced a simple syntax bug, mxr :)
bier has joined #ruby
chussenot has quit [Ping timeout: 260 seconds]
chussenot_ is now known as chussenot
ttilley has quit [Quit: ttilley]
macmartine has joined #ruby
DuoSRX has quit [Remote host closed the connection]
Criztian has joined #ruby
<Spooner> Er, I mean logical bug. I'm sure you can find it since the code is meaningless to me :)
jasonkuhrt has joined #ruby
elaptics is now known as elaptics`away
brianpWins has quit [Quit: brianpWins]
<mXr> no, it was evil rails caching something :x
<mXr> it seems to work like that
<mXr> yes it does, awesome
<waxjar> i'll have a closer look at slop
<mXr> thanks everyone :)
<Spooner> Oh, Rails is a dirty word in here, so you are on your own :)
<mXr> i know :p
verto|off is now known as verto
<mXr> but the issue at hand was not a rails issue until.. just now :p
<nobitanobi> Spooner: I am sorry, but I don't get how would I do this key hidding in my gem. Here is how I set the keys: https://github.com/novito/yelpi/blob/master/lib/yelpi/configuration.rb ~~ I need to commit that file though, it's part of the gem.
<mXr> just for my understanding, the "sort_column" method is an INSTANCE method
<Spooner> nobitanobi : you've just given the world your keys :)
CannedCorn has joined #ruby
CannedCorn has quit [Client Quit]
<nobitanobi> they are fake
<Spooner> mXr : Yes.
<nobitanobi> ~
vlad_starkov has joined #ruby
<mXr> when i do "self.variablename" in an instance method, i still access an instance variable, right?
<mXr> basically its the same as just using "variablename"
<Spooner> No, you are accessing a reader method.
<mXr> ah
<mXr> yes
<mXr> ok
<Spooner> Which may be the same, but obviously needs to be defined as such.
<mXr> so there is always a reader method called class that will give me..
<mXr> in this case, "DeviceController", since that is the .. "object" of that class
<Spooner> class isn't a reader method (not in the attr_reader) sense.
<mXr> ok, a somewhat special method that every object has
<Spooner> The reason you need to explicitly use self.class is that class on its own is a keyword.
<mXr> ic
<mXr> so the inherited instance methods.. are still instance methods in the child class
<Spooner> Same as if you had a method called "if" or similar.
jrajav has quit []
<mXr> if i were to define class methods in "base", i would still get class methods in a child class?
<mXr> juh, got that
<Spooner> Yes, you would.
erichmenge has quit [Quit: Be back later]
<mXr> are constants .. in the context of being "instance variables".. the same as normal variables?
t31485 has quit [Remote host closed the connection]
<Spooner> Class instance methods are defined on every class separately though (just as instance methods are defined on each object separately).
t7456 has joined #ruby
schleppy has joined #ruby
<Spooner> @@variables are "class variables" but follow very messy rules and so are pretty much avoided by everyone nowadays.
<mXr> ic
<mXr> is there something like a @CLASS_INSTANCE_CONSTANT ? :)
<mXr> or why am i using no @ in this case
<Spooner> Constants are defined on the class, but are available from the instances too. In your case, you are trying to access a child constant from a parent object, so you have to explicitly ask the instance's class for the value, rather than getting the value defined on the class where the method is being run.
<davidcelis> class instance constant?
<davidcelis> they're available both from the class and instances
<mXr> "the class where the method is being run"
<mXr> does that mean my sort_column method is actually run in the base class?
<mXr> or exactly the opposite
tcopp has left #ruby [#ruby]
gen0cide_ has joined #ruby
Eldariof27-ru has joined #ruby
gmci has joined #ruby
enricostn has joined #ruby
<mXr> davidcelis: please clarify; are constants defined as "MY_CONSTANT" available in both or only constants defined with "@MY_CONSTANT" (if that even exists)
<Spooner> nobitanobi : Two easy options. One is reopen the class in another file and set those 4 constants. This being the file you don't commit. The other is config = YAML.load("config.yml"); CONSUMER_KEY = donfig[:consumer_key]; etc - and then you'd have the yaml file not committed.
<lectrick> Is there any way I can compare contexts with == ?
graft has joined #ruby
<enricostn> hi, I'm in irb with ruby installed via RVM and if I write something like "hello_baby".camelize I get NoMethodError: undefined method `camelize' for "hello_baby":String
<davidcelis> mXr: MY_CONSTANT = "blah" # available from the context of the class and instances
<Spooner> @MY_CONSTANT is just a regular instance variable (it is the first character that says what something is; @ => instance, capital => constant, lower case => local)
mark296 has joined #ruby
<mXr> ah
<davidcelis> mXr: As in you can refer to MY_CONSTANT from within instance methods (but do not prepend with a self.)
<mXr> rgr
<mXr> ok, got it
<Spooner> enricostn : Camelize is a Rails method, not a Ruby one.
elhu has quit [Ping timeout: 245 seconds]
Eldariof59-ru has quit [Ping timeout: 240 seconds]
<Spooner> Or at least I suspect that is where you are used to having String#camelize available
<enricostn> ah.. ooops ok. could you point me to correct docs?
mmitchell has joined #ruby
<mXr> think thats what you are looking for
<mark296> I have an array of hashes, I am trying to merge all of them into a single hash in the following way, for each hash, I want to merge it with the next hash modified where the values have all been incremented by the largest value of the previous hash. I am trying the following but it doesnt work: all.insert({ }){ |a,b| a.merge!(b.each{ |key,value| b[key] = (value+a.values.sort.last)}){ |key, left, right| left.to_f + right.to_f }}
<enricostn> thank you Spooner and mXr
<mXr> might be enough to require 'active_support' to get what you want
<Spooner> Or do you mean the correct docs for Ruby String (not String extended elsewhere?).
yakko has quit [Quit: No Ping reply in 180 seconds.]
<infinitiguy> Hi there - I have an object question. I'm using a soap api (gem from a vendor - f5), and if I query the load balancer I get a soap mapping object back (actually an array of objects). If I inspect the variable that holds the object I get output such as… #<SOAP::Mapping::Object:0x3f99ee722d34 {}address="/Common/10.0.20.168" {}port=8080>]]
<nobitanobi> Spooner: Thank you. I assume that if I don't commit the file, I def need to let the people know that they have to create that file.
<infinitiguy> my question is - How can I just get the value of address out of it?
<nobitanobi> So I am wondering why not just set the keys to NIL and let people know that they need to set them.
yakko has joined #ruby
<enricostn> Spooner: I'm working with Rails, and i get the same error that I get in irb...
<Spooner> nobitanobi : Yes, of course. Maybe have something where you load that file (before the require or YAML.load_file) to check for its existance and explain what it needs to contain.
rcassidy has quit [Quit: leaving]
<nobitanobi> Spooner: ok, makes sense. Thanks a lot.
<enricostn> mXr, if I use require 'active_support' I get the same error
<mXr> nobitanobi: that configuration.rb has alot of non-config stuff in it, i guess thats what makes it "part of the gem", not part of the "Local config"
<Spooner> mark296 : Your question is a bit too complex to grok. Can you give a minimal example (and say what your input and expected output is?)
jasonLaster has quit [Remote host closed the connection]
<mXr> which means its not obvious for people that they need to input stuff there
jasonLaster has joined #ruby
<nobitanobi> mXr: What do you mean? All it has is configuration stuff...
insecurlex has joined #ruby
<mark296> can anyone find what's wrong with what I tried above? For example I want to send this array [{:a=>1,b=>2},{:a=>1,:c=>3},{:d=>2,:e=>3}] to this hash {:a=>11,b=>8,c=>6,d=>2,e=>3}
<Spooner> mXr : the question, however, was how to decouple the config data from that file (I said make a second ruby file that just adds those constants or a yaml file, the latter probably a better optin).
<nobitanobi> Spooner: I am going to go for the YAML option.
<mXr> nobitanobi: (i'm a noob so please dont take my comments too seriously but) it would appear that if i install your gem on a system wide basis, that config file would be somewhere in my /var/lib/gems.. blah directory - where there should not be any config stuff at all
binaryplease has joined #ruby
eywu has joined #ruby
<Synthead> can I state a new Array with specific indexes in one line? like a = [ 5 => 'that' ] or something?
gen0cide_ has quit [Quit: ["rm -rf $ME"]]
<mXr> thats a hash, not an array
<nobitanobi> mXr: uhm...
<Synthead> mXr: it's an example
<mXr> a = { 5 => 'that' }
<Synthead> mXr: I'm looking for an Array
<shevy> the whole debian /var/lib scheme is insanity anyway
<mXr> Synthead: err i think arrays cannot have "user defineable indexes" or something..
<Synthead> mXr: I'm trying to get the effect of a[5] = 'that', but with a new array and multiple indexes
<Spooner> mxr Yeah, you are quite right and I'm quite wrong. Should be looking at something like ~/.my_gem/config.yml (for global config) or possibly per-project way to specify where that config file is.
yakko has quit [Quit: No Ping reply in 180 seconds.]
yakko has joined #ruby
<mXr> Spooner: yeah i agree with the yaml decoupling stuff, and move it .. somewhere into the project dir where the gem is actually used in
<mXr> i guess? :)
flip_digits has quit [Quit: Computer has gone to sleep.]
<mXr> and raise exceptions if that yaml file does not exist
<Spooner> Synthead : No. You'd need [nil, nil, nil, nil, "that"] or multiline it (a = []; a[5] = "that")
<Synthead> Spooner: right on, thanks
jasonLaster has quit [Ping timeout: 272 seconds]
<Spooner> If you want an array with a lot of nils in it, you may actually want a hash though.
insecurlex has quit [Remote host closed the connection]
hoelzro|away is now known as hoelzro
<mXr> thx again everyone, semi afk for food :)
erichmenge has joined #ruby
tcopp has joined #ruby
workmad3 has quit [Ping timeout: 252 seconds]
macer1_ has joined #ruby
macer1 has quit []
macer1_ is now known as macer1
<mark296> Ok simpler question, if I have [{:a=>1,:b=>2},{:c=>1,:d=>3},{:e=>1,f=>4}] how would I produce the following array: [{:a=>8,:b=>9},{:c=>5,:d=>7},{:e=>1,f=>4}]
Matt__ has quit [Ping timeout: 240 seconds]
<Spooner> mark296 : well, one quickie is "values.sort.last" => "values.max", but I'm struggling to get my head around the question
jorge_ has joined #ruby
macer1 has quit [Changing host]
macer1 has joined #ruby
<mark296> where every value in each hash is increased by the largest value in the previous hash
<mark296> or rather subsequent
<mark296> then i can just merge the values in that array and that would give my answer
qwerxy has joined #ruby
<mark296> I think i was trying to do too much at once
<mark296> if there is a way I could do it with a single inject that would be ideal complexity wise
enricostn has left #ruby [#ruby]
jgrevich has joined #ruby
timonv has joined #ruby
timonv has quit [Remote host closed the connection]
macer1 has quit [Quit: ZNC - http://znc.in]
timonv has joined #ruby
<mark296> any ideas?
<apeiros_> reverse_each with values.max
macer1 has joined #ruby
Tearan has joined #ruby
jorge_ has quit [Remote host closed the connection]
pskosinski has quit [Read error: Connection reset by peer]
headius has joined #ruby
<apeiros_> actually reverse_each.each_cons(2) will make your life a bit easier than just reverse_each
<savage-> omg i love Enumerable#each_cons
<savage-> and #slice_before
<savage-> and #chunk
ttilley has joined #ruby
chussenot has quit [Quit: chussenot]
ttilley has quit [Changing host]
ttilley has joined #ruby
randomau_ has quit [Read error: Connection reset by peer]
yakko has quit [Remote host closed the connection]
tatsuya_o has quit [Remote host closed the connection]
binaryplease has quit [Quit: WeeChat 0.3.8]
<mark296> but logically what I am doing is right for a single inject though right? It seems really bady to transform the array by pairs and then merge it, rather than just do an inject. Can anyone figure out what's wrong with the inject I had above?
opus__ has joined #ruby
opus has joined #ruby
<Spooner> mark296 : also when building collections with_object is cleaner/simpler than inject
c0rn_ has joined #ruby
<apeiros_> mark296: no. inject makes no sense there.
<apeiros_> at least not for the last question
<mark296> here it is again: all.insert({ }){ |a,b| a.merge!(b.each{ |key,value| b[key] = (value+a.values.sort.last)}){ |key, left, right| left.to_f + right.to_f }}
jasonLaster has joined #ruby
[eko] has quit [Ping timeout: 265 seconds]
<mark296> I'm confused why the merge with the modified b value doesn't work, like normally if you were just merging you would have a.merge!(b), but here I have replaced b with the hash modified by the largest value of the a hash, shouldn't that work?
axl_ has quit [Ping timeout: 272 seconds]
brianpWins has joined #ruby
azm has joined #ruby
azm has joined #ruby
azm has quit [Changing host]
cousine has quit [Remote host closed the connection]
s1n4 has quit [Quit: peace out]
<apeiros_> aaaah
<apeiros_> damn people
nohonor has joined #ruby
axl_ has joined #ruby
<apeiros_> learn what inject does before misusing it! :-p
<apeiros_> if you use merge! there's absolutely no point in inject
beneggett has joined #ruby
<mark296> haha, I don't pretend to be an expert by any means, do you have the solution then I take it?
<apeiros_> I don't know what problem you try to solve
virunga has quit [Ping timeout: 252 seconds]
<davidcelis> holy fuck what is that code even doing?
<apeiros_> but take note that obj.each *always* returns obj
<davidcelis> why would you write a triple one-liner block like that? :(
t7456 has quit [Remote host closed the connection]
<apeiros_> davidcelis: because one liners are cool!
<apeiros_> and provide job security!
Jay_Levitt has joined #ruby
<apeiros_> also: y u no classes?
t27971 has joined #ruby
<Spooner> And encourage your employer to buy you a bigger monitor, so you can fit it all on a single screen :)
mrdodo has joined #ruby
geekbri has joined #ruby
<mark296> I was trying to merge an array of hashes it a single hash where every value of the hash is increased by the largest value of the subsequent hash before the merge
Matt_ has joined #ruby
Matt_ is now known as Guest99720
yaymukund has joined #ruby
rking has quit [Quit: Upgrading to latest Weechat build.]
<mark296> [{a=>1},{b=>2},{c=>3}] goes to [{a=>6},{b=>5},{c=>3}] goes to {a=>6,b=>5,c=>3}
rking has joined #ruby
<mark296> didnt' seem that hard when I started
<apeiros_> mark296: davidcelis is right. try it without doing it all in one line. it might actually be readable.
<apeiros_> it's not
<apeiros_> you're trying to do it very cleverly. that's hard.
<apeiros_> (and there's little point to it)
<davidcelis> one-liners are only good when they're still parsable by human eyes. otherwise anyone else reading your code will just think "what is this dick doing"
<savage-> mark296: apeiros_ even gave you a wonderful hint to use #reverse_each / #each_cons(2)
recycle has joined #ruby
naz has joined #ruby
<mark296> I was trying to account for the possibility of having really really large arrays so doing it without passing through twice
<Spooner> Doesn't mean you have to do it on one line though.
ShiintoRyuu has joined #ruby
<mark296> that was for copy and pasting here mostly
pskosinski has joined #ruby
<davidcelis> naw dawg that's what gist is for
cgag_ has quit [Remote host closed the connection]
<Spooner> Perhaps, but it made things a lot harder for us to read. gist/pastie is your friend.
k_89 has joined #ruby
deryl has quit [Quit: deryl]
Goles has quit [Quit: Textual IRC Client: http://www.textualapp.com/]
<apeiros_> mark296: http://pastie.org/4563409 - note that both, ary and all its hashes are mutated. if you don't want that, the solution is not usable.
<apeiros_> I may have misunderstood the merge part
<apeiros_> you probably can just remove the block
kn330 has quit [Ping timeout: 245 seconds]
<mark296> Ah that works, thanks!
QKO has joined #ruby
inteq has joined #ruby
<fowl> greybeards, lul
QKO_ has quit [Ping timeout: 248 seconds]
<apeiros_> che?
cousine has joined #ruby
QKO_ has joined #ruby
cousine has quit [Remote host closed the connection]
kn330 has joined #ruby
JonnieCache|home has joined #ruby
QKO has quit [Ping timeout: 248 seconds]
nobitanobi has quit [Read error: Connection reset by peer]
nobitanobi has joined #ruby
machty_ has joined #ruby
RegEchse has joined #ruby
bluenemo has quit [Remote host closed the connection]
<lectrick> JonnieCache: It seems to me that something like Binding.of_caller (which I know someone wrote) would be useful
<fowl> lectrick: you are wrong, binding.of_caller fell out of a tree
<lectrick> lol
<JonnieCache|home> it has the power to make your code utterly impossible to reason about
<JonnieCache|home> iirc binding_of_caller exists to facilitate pry. things like that are the only good reasons to do that kind of evil shit
brasten has quit [Quit: brasten]
Jay_Levitt has quit [Quit: Jay_Levitt]
Guest99720 has quit [Ping timeout: 256 seconds]
qwerxy has quit [Quit: offski]
<lectrick> JonnieCache: But it seems to be part of the ruby extensions library... how would I even play with it? (also fowl)
tww has quit [Ping timeout: 246 seconds]
<JonnieCache|home> just make a method that does different things depending on who calls it. put it into an important place in a big complex app. call it from lots of different places. give this code to someone else to maintain. wait until they kill you in your sleep
t27971 has quit [Remote host closed the connection]
brasten has joined #ruby
t6037 has joined #ruby
khakimov has joined #ruby
MarGarina has quit [Read error: Operation timed out]
emmanuelux has quit [Ping timeout: 252 seconds]
dbe has joined #ruby
mparodi_ has quit [Quit: Leaving]
elhu has joined #ruby
flak has joined #ruby
flak is now known as Guest69441
<JonnieCache|home> oh sorry i read "how would i play evil with it"
tommyvyo is now known as [mtftw]tommyvyo
beneggett has quit [Quit: Computer has gone to sleep.]
enroxorz-work has joined #ruby
enroxorz-work has quit [Changing host]
enroxorz-work has joined #ruby
daster has joined #ruby
cakehero has quit [Quit: Computer has gone to sleep.]
rippa has quit [Ping timeout: 245 seconds]
adac has joined #ruby
nobitanobi has quit [Read error: Connection reset by peer]
greenysan has joined #ruby
cantonic has quit [Quit: cantonic]
ericcoleman has quit [Quit: ericcoleman]
FlyingFoX has joined #ruby
summation has joined #ruby
summation has quit [Client Quit]
zamboli has joined #ruby
<zamboli> i am looking for a good book to learn how to build web apps
<davidcelis> zamboli: Uhh, using what?
daster has quit []
Layke2 has joined #ruby
<zamboli> well i want to make a note taking app, browser based. so JS frontend, postgre DB
inteq has quit [Ping timeout: 244 seconds]
tbrock has joined #ruby
<zamboli> i figure some folks here might be familiar. doesn't have to be ruby in the middle, but it could be, i guess?
<davidcelis> Okay, but I'm so far failing to see how this is Ruby related. How are you bringing Ruby into it? What framework do you want to learn?
<tbrock> hey guys how would you distribute an executable in a gem that worked like a Rakefile and made files
<JonnieCache|home> tbrock: have a look at thor
<davidcelis> tbrock: Add the executable to your gemspec as an executable. put it in bin/ ?
<wmoxam> ah, the classic note taking app
<tbrock> so like rails new?
* wmoxam has built one of those
<JonnieCache|home> rails new is a thor script
<tbrock> im more trying to figure out how to get rake-like functionality in something that isn't a rakefile
<zamboli> did you use ruby wmoxam
<davidcelis> tbrock: So yeah, checkout wycats/thor
<tbrock> cool
Layke has quit [Ping timeout: 265 seconds]
gmci has quit [Quit: Computer has gone to sleep.]
deo__ has quit [Quit: Leaving]
paolooo has quit [Ping timeout: 245 seconds]
<wmoxam> zamboli: yes
swebb has joined #ruby
<zamboli> AJAX?
gmci has joined #ruby
jorge_ has joined #ruby
<wmoxam> zamboli: some
<shevy> rake-like functionality
<shevy> I use ruby methods in .rb files and call them via aliases from the shell
BrokenCog has quit [Quit: leaving]
<JonnieCache|home> zamboli: http://ruby.railstutorial.org/ is very good
<davidboy> There's so many http client libraries out there... xD Which do you guys recommend?
<JonnieCache|home> for learning webapps in rails
<davidcelis> davidboy: httparty or faraday, depending on your needs
jasonLaster has quit [Remote host closed the connection]
<zamboli> i'll check it out jonnie
<tbrock> when you add dependencies should you have a line for each?
jasonLaster has joined #ruby
<davidcelis> tbrock: yes
<tbrock> gotcha
BrokenCog has joined #ruby
BrokenCog has joined #ruby
BrokenCog has quit [Changing host]
<davidboy> davidcelis: Alright, I was leaning towards httparty, guess I'll go with it
<davidboy> Thanks!
[mtftw]tommyvyo is now known as tommyvYo
nobitanobi has joined #ruby
cakehero has joined #ruby
savage-_ has joined #ruby
luxurymode has quit [Quit: Computer has gone to sleep.]
<nobitanobi> What am I doing wrong on loading the YAML document? https://github.com/novito/yelpi/blob/master/lib/yelpi/configuration.rb ~~ I can't access the keys in the file.
jgrevich_ has joined #ruby
tiripamwe has quit [Ping timeout: 260 seconds]
<davidcelis> nobitanobi: YAML::load_file
<davidcelis> otherwise it expects a string of actual YAML
tayy_ is now known as tayy
<nobitanobi> ags
<davidcelis> nobitanobi: so you'd have to read the file otherwise. But YAML::load_file is better
joephelius has joined #ruby
jgrevich has quit [Ping timeout: 265 seconds]
jgrevich_ is now known as jgrevich
t6037 has quit [Remote host closed the connection]
<nobitanobi> davidcelis: let me try that tout.
<nobitanobi> *out
t73155 has joined #ruby
jasonLaster has quit [Ping timeout: 244 seconds]
any-key is now known as eric-wood
savage- has quit [Ping timeout: 260 seconds]
<nobitanobi> davidcelis: Sweet! 21 test passed, finally
reset has joined #ruby
<nobitanobi> thanks
kirun has joined #ruby
waxjar has quit [Quit: Textual IRC Client: www.textualapp.com]
<zamboli> JonnieCache|home, this book looks great
Russell^^ has joined #ruby
TheFuzzball has joined #ruby
berserkr has quit [Read error: Connection reset by peer]
Guest69441 is now known as rippa
<JonnieCache|home> its very good. you can read it for free online as well theres a link, i think on the right
sterex has joined #ruby
erichmenge has quit [Quit: Be back later]
DuoSRX has joined #ruby
<nobitanobi> JonnieCache|home: which book ~~
Hanmac has quit [Read error: Operation timed out]
jjbohn has joined #ruby
Takehiro has quit [Read error: Connection reset by peer]
<Spooner> nobitanobi : File.expand_path('../config.yml', __FILE__) # Bit terser, but you may find it a bit less clear. As someone said, you should be taking the path from the user, not a file inside the gem, since that is a really bad place to put it. That means you probably want to use class instance variables rather than constants though, since you'll need to set them after the class is defined
Takehiro has joined #ruby
<Spooner> (just read them in in your #reset method instead, rather than having the constants)
savage- has joined #ruby
nobitanobi has quit [Read error: Connection reset by peer]
nobitanobi has joined #ruby
joephelius has quit [Quit: WeeChat 0.3.8]
phinfonet has joined #ruby
joephelius has joined #ruby
Hanmac has joined #ruby
Hama has quit [Remote host closed the connection]
<nobitanobi> Spooner: let me see what you say.
Vert has joined #ruby
Eldariof27-ru is now known as eldariof
<enroxorz-work> crap, i forget how to call a method via a string with parameters passed.
<enroxorz-work> is it the send method?
Whoop has quit [Remote host closed the connection]
<JonnieCache|home> yes
<joephelius> >> puts "test"
<al2o3cr> (NilClass) nil, Console: test
<joephelius> :D
k_89 has quit [Ping timeout: 245 seconds]
<Spooner> enroxorz-work : Yeah (or send_public) - try to have a pry/irb session open to "just try" rather than asking simple stuff like that :)
<nobitanobi> Spooner: You mean opening the class in another file and set the class instance variable there with the keys?
cascalheira has quit [Quit: Linkinus - http://linkinus.com]
<nobitanobi> Spooner: and just require that file in the class definition itself?
krz has joined #ruby
qwerxy has joined #ruby
savage-_ has quit [Ping timeout: 260 seconds]
<enroxorz-work> but Spooner, how else am i going to be sociable here? ;) (sometimes i forget about irb)
gen0cide_ has joined #ruby
<Spooner> enroxorz-work : You should forget irb. Pry is the way forward :D
quazimodo has joined #ruby
Layke2 has quit [Remote host closed the connection]
Whoop has joined #ruby
Whoop has quit [Changing host]
Whoop has joined #ruby
<shadoi> Spooner: hah
<shadoi> was just typing that
<enroxorz-work> Spooner: until a couple of months from now...then something else will be more awesome
<nobitanobi> Spooner: I don't even have a class for the Configuration, I have a module though.
<shadoi> not likely
<Spooner> enroxorz-work: Not really. We spent a decade without a commonly used replacement for irb (irb extensions existed).
<Spooner> *decades
<enroxorz-work> im just busting chops. out of all the languages i have ever messed with, ruby changes so much i have to follow 5 blogs and listen to 2 podcasts just to keep up.
<Spooner> nobitanobi : No, I meant remove those 4 constants entirely. Just read the yaml file in #reset, since they aren't used anywhere else
<Spooner> enroxorz-work : I agree that, in general, the flavour-of-the-month does change every week in Ruby-land :P
<enroxorz-work> thats why i dig it so much. time to get pry
<enroxorz-work> im way behind now
paolooo has joined #ruby
workmad3 has joined #ruby
vectorshelve has quit [Quit: Page closed]
<JonnieCache|home> actually i dont think it changes as much as it used to
<JonnieCache|home> between rails 2.2 and rails 3.0 it was insane but i think its calmed down now
<JonnieCache|home> i have no real evidence for that though
<nobitanobi> Spooner: is that just a good habit? I mean, why do those constants hurt there/
<nobitanobi> ?
<Spooner> Does anyone actually use Rails? I think it is just a conspiracy and it died out years ago.
duply has quit [Remote host closed the connection]
qwerxy has quit [Quit: offski]
<apeiros_> Spooner: don't say that too loudly
<Spooner> nobitanobi : Just seems odd to have constants and module variables that are identical. Use one or the other.
<apeiros_> they might come after you…
<Spooner> apeiros_ : I think I can safely say it in here. Everyone knows Rails people don't realise it is something for Ruby, but rather than Ruby is a module for Rails :D
duply has joined #ruby
17SABR2Q2 has joined #ruby
t73155 has quit [Remote host closed the connection]
duply has quit [Excess Flood]
t97587 has joined #ruby
pricees has joined #ruby
Eldariof-ru has joined #ruby
<Hanmac> imo this channel should be purified from rails :P
<nobitanobi> Spooner: Ok. I see what you mean. Thanks
duply has joined #ruby
<Spooner> nobitanobi : However, was suggested, you probably want the user to provide the file, so constants make no sense. Better for the user to do something like Yelpi.config_file = "frog.yml" or Yelpi.consumer_key = "sdf79asdf7sd9" (the latter lets the user decide how to store the key's value - either direct in code or in yaml or whatever)
savage-_ has joined #ruby
peregrine81 has joined #ruby
bluenemo has joined #ruby
bluenemo has joined #ruby
bluenemo has quit [Changing host]
bluenemo has quit [Remote host closed the connection]
<nobitanobi> Spooner: Ok.
<Spooner> Hanmac : Maybe we should get the bot to autokick on /Active\w+|Rails/ :P
notVert has joined #ruby
TPFC-SYSTEM has quit [Quit: TPFC-SYSTEM]
qwerxy has joined #ruby
eldariof has quit [Ping timeout: 248 seconds]
Vert has quit [Ping timeout: 252 seconds]
<Hanmac> hm ... cant we make the user autojoined to #rubyonr**s and autokick there? :P
<Spooner> Just as long as it doesn't kick on someone giving bad advice more than 50 times. I'd be long gone :$
jorge_ has quit [Remote host closed the connection]
Queristan has joined #ruby
jorge_ has joined #ruby
savage- has quit [Ping timeout: 265 seconds]
khakimov has quit [Quit: Computer has gone to sleep.]
brasten has quit [Quit: brasten]
<nobitanobi> Spooner: I was planning on letting the User doing something like Yelpi.configure do |config| config.consumer_key = …. end ~~ But that stills is if you are planning on user the gem. I am just worried about the tests.
mneorr has joined #ruby
<nobitanobi> Spooner: I mean, if you download the gem, and run rspec. I want to make it easier so you can add your keys somewhere.
<Spooner> Ah yes, I'd forgotten about that.
<nobitanobi> Spooner: I was even thinking on letting doing something in the bash
<Spooner> Bash?
<nobitanobi> setting the keys and then just use ENV['key'] in a test helper.
<Spooner> Oh, I see.
zamboli has quit [Quit: leaving]
<fowl> ahoy Spooner
<fowl> are you doing ludum dare
<Spooner> I don't think so, no.
<Spooner> When is it?
<fowl> weds or thurs i think
notVert has quit [Remote host closed the connection]
<Spooner> I probably should do them again. My first proper real-time game in 48 hours has been better than anything I've spent months working on since :D
havenn has joined #ruby
<Queristan> In test-unit 2.5.0 (not sure about others), assert_match takes a string or regexp, whereas assert_no_match only takes a regexp. Does anyone know if this is intentional or just overlooked?
verto is now known as verto|off
<Spooner> fowl : It says in 3 days and 5 hours, so that is midnight on Friday. Makes a lot more sense to do it over the weekend than mid-week!
wobr has joined #ruby
mark296 has quit [Ping timeout: 240 seconds]
<Spooner> fowl I expect a really terrible and uninspiring theme again though.
ezra has quit [Ping timeout: 276 seconds]
workmad3 has quit [Ping timeout: 272 seconds]
<fowl> yeah i wish they would tell you before it came up so you could get a head start :)
<Spooner> That rather breaks the whole premise, fowl, but yeah, it would be nice to have a day to mull over your ideas rather than having the coding and designing time start at precisely the same time.
joephelius has quit [Ping timeout: 272 seconds]
machty_ has quit [Ping timeout: 260 seconds]
nobitanobi has quit [Read error: Connection reset by peer]
gen0cide_ has quit [Quit: ["rm -rf $ME"]]
machty__ has joined #ruby
nobitanobi has joined #ruby
macmartine has quit [Quit: ["Textual IRC Client: www.textualapp.com"]]
voodoofish430 has joined #ruby
moshee has quit [Ping timeout: 245 seconds]
moshee has joined #ruby
moshee has joined #ruby
moshee has quit [Changing host]
mohits has quit [Ping timeout: 256 seconds]
jasonLaster has joined #ruby
Patteh has quit [Ping timeout: 240 seconds]
beneggett has joined #ruby
eighty4 has joined #ruby
invisime has joined #ruby
nobitanobi has quit [Read error: Connection reset by peer]
nobitanobi has joined #ruby
<invisime> I'm trying to create a gem with a c extension to ruby. however, the extension needs to be linked to another c library that I've written. how do I tell my extconf.rb where to look for this other library so that it creates the correct Makefile on gem install?
nobitanobi has quit [Read error: Connection reset by peer]
<Mon_Ouie> have_library "somelib" will make it try to link -lsomelib
nobitanobi has joined #ruby
<Mon_Ouie> (Alternatively, you can change $LDFLAGS and $CFLAGS manually)
mmitchell has quit [Remote host closed the connection]
Matt_ has joined #ruby
mmitchell has joined #ruby
zemanel has quit [Quit: Remote hottie closed the connection]
Matt_ is now known as Guest57314
<Hanmac> invisime has your first lib an *.pc file?
<invisime> no, it's also a .so.
jenrzzz has joined #ruby
Vert has joined #ruby
<invisime> I guess a better question might be, "how do I compile my other library so that it's easy to link to from my extconf.rb?"
hynkle has quit [Ping timeout: 240 seconds]
<Hanmac> invisime: some libs has an *.pc file in /usr/lib/pkg-config or in /usr/lib/<arch>/pkg-config
<Hanmac> PS: oh you mean : your second gem needs your first gem?
Guest57314 has quit [Ping timeout: 256 seconds]
banghouse has joined #ruby
verto|off is now known as verto
beneggett has quit [Quit: Computer has gone to sleep.]
awarner has quit [Remote host closed the connection]
<nullsign> i need to hire someone to write a 5-10 line simple ruby script, $80/hr for your time over skype, anyone interested? will just be a CSV file import on 3 columbs of data, and making a hash lookup table for the data.. very basic.
ananthakumaran has quit [Quit: Leaving.]
<Hanmac> invisime: gems should not compiled against eachother ... use "extern" for that
<invisime> one of the c libs isn't a gem, it's an IO interface.
<invisime> the gem I'm writing is a ruby wrapper for the IO interface.
hynkle has joined #ruby
<Hanmac> wants your os? an debianoid system?
banisterfiend has quit [Read error: Connection reset by peer]
<invisime> yeah.
<invisime> linux-ish. but we're targeting multiple architectures.
<Hanmac> tell me the package name ... it should have an pc file installed
sailias has joined #ruby
sailias has quit [Client Quit]
ezyang has joined #ruby
banisterfiend has joined #ruby
<invisime> it's not a standard package, it's a proprietary wireless IO library.
<invisime> that we're also writing.
<ezyang> Is there a way to write 'if [1,2].map { |x| nil }.any?' in a way that makes the precedence of .any? clearer?
<ezyang> it looks like it's bound to the block when it's actually bound to the entire map expression
<lectrick> LOL at instance_variable_set documentation: "Sets the instance variable names by symbol to object, thereby frustrating the efforts of the class’s author to attempt to provide proper encapsulation."
<Hanmac> invisime: and your c-lib guys not make an pkg-config package right? :(
pdtpatrick has joined #ruby
havenn has quit [Remote host closed the connection]
havenn has joined #ruby
<invisime> Hanmac: I believe that's correct, but let me check.
brasten has joined #ruby
<Hanmac> i mean an pkg-config file ... with an "pc" extendion
brasten has quit [Client Quit]
sazboom has joined #ruby
<nullsign> i need to hire someone to write a 5-10 line simple ruby script, $80/hr for your time over skype, anyone interested? will just be a CSV file import on 3 columns of data, and making a hash lookup table for the data.. very basic.
<invisime> Hanmac: I don't believe that's part of the current plan. are there any other types of files can mkmf link to nicely?
<fowl> ezyang: what messages would send to a block besides #call ?
DefV has quit [Ping timeout: 272 seconds]
GoldenCider has quit [Read error: Connection reset by peer]
gmci has quit [Quit: Computer has gone to sleep.]
gmci has joined #ruby
williamcotton has joined #ruby
t97587 has quit [Remote host closed the connection]
t76705 has joined #ruby
redgetan has joined #ruby
mike4_ has joined #ruby
wobr has quit [Quit: Leaving.]
GoldenCider has joined #ruby
wobr has joined #ruby
Axsuul has joined #ruby
<ezyang> fowl: I dunno, but I feel like ruby is dynamic enough that, in principle, I could send any message I want!
<nullsign> Hanmac: interested? :)
<ezyang> unless blocks are special?
elhu has quit [Quit: Computer has gone to sleep.]
havenn has quit [Remote host closed the connection]
<Hanmac> i never did a "hash lookup table" before
<Hanmac> (as far as i knew)
<invisime> nullsign: do you just mean a hash?
Adran has quit [Excess Flood]
<nullsign> yeah.. basically ill have a CSV file with 3 columns, ipaddress,location,device type.
<nullsign> i need to make it so i can query the hash with ipaddress and get variables returned for the other two that i can echo out when needed.
<fowl> ezyang: there isnt anything useful to do with them besides call them, they're just blocks of code and you cant mess with their ast or anyhign cool like that
<nullsign> i know i start with method require 'csv'; CSV::read ('filename')
jmorton has quit [Quit: jmorton]
<ezyang> oh, I can't do shit like, x = { |x| x }; x.foo = bang?
havenn has joined #ruby
<ezyang> ok, handy
<invisime> nullsign: that should put everything into an array of arrays.
wobr has quit [Ping timeout: 260 seconds]
<nullsign> so how do i query that array? what is the array called?
<invisime> then you just do something like hash[line[0]] = {location: line[1], device_type: line[2]} inside a loop.
<invisime> it's called whatever you call it. or nothing.
theRoUS has quit [Ping timeout: 265 seconds]
<invisime> I'd probably do something like CSV::read('filename').each do |line|
erichmenge has joined #ruby
erichmenge has quit [Client Quit]
<nullsign> right but.. so how do i query the other 2 columns based on the value of the first one? ie: a lookup table.
ezyang has left #ruby [#ruby]
<invisime> you put them in a ruby hash.
<nullsign> in the hash a line has ipaddress=X, how would i write, query X, assign each column to tempvar1, 2, 3
<nullsign> etc.
adac has quit [Ping timeout: 268 seconds]
workmad3 has joined #ruby
macmartine has joined #ruby
jromine` has joined #ruby
<invisime> nullsign: http://rubylearning.com/satishtalim/ruby_hashes.html you can read/write to a hash via the [] and []= methods.
jromine` has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
twigmorewelsh has joined #ruby
<nullsign> ill read it..
azm has quit [Ping timeout: 252 seconds]
Squarepy has quit [Quit: Leaving]
jenrzzz has quit [Ping timeout: 240 seconds]
Adran has joined #ruby
banisterfiend has quit [Read error: Connection reset by peer]
<Hanmac> nullsign: require 'csv'; hash={}; CSV::foreach('test.csv') {|l|hash[l[0]]={:location=>l[1],:device=>l[2]}}
<Hanmac> with my test data it the hash looks like this: #=> {"1.2.3.4"=>{:location=>"home", :device=>"handy"}, "2.3.4.5"=>{:location=>"work", :device=>"pc"}}
jromine` has joined #ruby
banisterfiend has joined #ruby
beneggett has joined #ruby
<nullsign> testing.
<invisime> looks about right, Hanmac. :-D
jgarvey has quit [Quit: Leaving]
<Hanmac> shevy ... i found a "bug" in the stdlib csv: CSV::foreach('test.csv').with_object({}) does not work
arvidkahl has joined #ruby
bbttxu has quit [Quit: bbttxu]
nobitanobi has quit [Read error: Connection reset by peer]
t76705 has quit [Remote host closed the connection]
nobitanobi has joined #ruby
banisterfiend has quit [Read error: Connection reset by peer]
t68195 has joined #ruby
tatsuya__ has joined #ruby
tatsuya__ has quit [Remote host closed the connection]
chessguy has joined #ruby
banisterfiend has joined #ruby
<tbrock> hey guys im trying to use thor and having trouble invoking taks
<tbrock> tasks
<Hanmac> maybe loki is interfering?
<tbrock> its giving me an underifned method '<=' for nil:NilClass
jorge_ has quit [Remote host closed the connection]
jlogsdon has joined #ruby
Adran has quit [Excess Flood]
<nullsign> so Hanmac; the ipaddress column 1, becomes line[0] ?
<invisime> tbrock: you're doing a comparison between two things and the thing on the left of the "<=" is nil.
<tbrock> im not doing that anywhere in the code
<Hanmac> yeah
hoelzro is now known as hoelzro|away
<invisime> tbrock: are you sure? what's the stack trace look like?
elhu has joined #ruby
chriskk has joined #ruby
<invisime> check line 27 of task.rb.
ibash has joined #ruby
<tbrock> invisime, i've got the invoked tasks as private methods
<tbrock> but making them public doesn't change the error
<invisime> tbrock: no, I don't suspect it would. what arguments do you pass to the create method?
Guest37999 has quit [Ping timeout: 244 seconds]
adac has joined #ruby
Foxandxss has joined #ruby
<tbrock> name
<tbrock> i think that might be tripping it up
redgetan has quit [Quit: This computer has gone to sleep]
<invisime> tbrock: actually, check line 106 of invocation.rb what's on the lefthand sign of the <= on that line?
<invisime> lefthand side*
jlogsdon_ has joined #ruby
wallerdev has quit [Quit: wallerdev]
<tbrock> its the class
<tbrock> klass rather
<invisime> tbrock: the error message makes it seem like klass is nil. is that possible?
dpk has joined #ruby
<tbrock> hrm
<tbrock> well you should be able to invoke methods withing the same class right?
<tbrock> so i haeve one method and then invoke another method in that very same class which extends thor
beneggett has quit [Quit: Computer has gone to sleep.]
SCommette has quit [Quit: SCommette]
<invisime> tbrock: yeah, but scoping is tricking. for instance, if you're within a class method and you say "self" you get the class, not the instance.
<invisime> tbrock: remember that everything is an object in ruby. even classes. even methods.
<Hanmac> tbrock show me your mongo-hadoop file
Eldariof59-ru has joined #ruby
<lectrick> Does a class_eval'd block have access to variables defined before I called Classname.class_eval do..end ?
rippa has quit [Ping timeout: 240 seconds]
qwerxy has quit [Quit: offski]
jlogsdon has quit [Ping timeout: 245 seconds]
<nullsign> hanmac: "odd number list for hash" ? is that error significant?
<Hanmac> i didnt see it before
<apeiros_> Hash[1,2,3] will raise that
<apeiros_> and if "it stops your app from working and indicates a bug in your app" is significant, then yes, that error is significant.
<nullsign> it's also getting me syntax errors on those :'s in the labels for the hasehs
<invisime> nullsign: be careful where you use square brackets vs. curly braces.
Eldariof-ru has quit [Ping timeout: 245 seconds]
Liothen has joined #ruby
Liothen has joined #ruby
Liothen has quit [Changing host]
Beoran__ has quit [Read error: Connection reset by peer]
<tbrock> Hanmac, above
mxbtty has quit [Quit: Leaving.]
<nullsign> i have; hash[line[0]] = {location: line[1], device_type: line[2]}
<nullsign> it doesnt like the :'s
Beoran__ has joined #ruby
<invisime> nullsign: what version of ruby are you using?
<nullsign> 1.8.7
<invisime> ah. you can't use that syntax then.
<invisime> key: 'value' is syntax sugar for :key => 'value'
<invisime> so move the colons to the other side of the key and insert the => arrow between the key and the values.
<invisime> or update to ruby 1.9. :-P
IrishGringo has joined #ruby
workmad3 has quit [Ping timeout: 252 seconds]
brasten has joined #ruby
robbyoconnor has quit [Read error: Connection reset by peer]
<tbrock> Hanmac, any ideas?
robbyoconnor has joined #ruby
nobitanobi has quit [Read error: Connection reset by peer]
<Hanmac> tbrock: no ... there should be wrong with "invocation" :(
answer_42 has quit [Quit: WeeChat 0.3.8]
nobitanobi has joined #ruby
nobitanobi has quit [Client Quit]
<nullsign> moving columns works... oh bah, 'unitialized constant CSV' (nameerror) ..
mssola has joined #ruby
pricees has quit [Read error: Operation timed out]
<Hanmac> tbrock ... the creator of thor ... i think he is "nuts" oO
<invisime> nullsign: you need to: require 'csv'
<nullsign> oops..
<tbrock> yehuda?
<Hanmac> tbrock he used case without an value inside ... i wonder why ruby does not show it as an syntaxerror :P
Queristan has quit [Ping timeout: 245 seconds]
krusty_ar has quit [Remote host closed the connection]
Adran has joined #ruby
Marzhac has quit [Ping timeout: 245 seconds]
jjbohn is now known as jjbohn|afk
br4ndon has quit [Quit: Lorem ipsum dolor sit amet]
clocKwize has joined #ruby
nwest has quit [Quit: Textual IRC Client: http://www.textualapp.com/]
ibash has quit [Quit: ibash]
<tbrock> Hanmac, hrm
<tbrock> im not sure about this
cj3kim has joined #ruby
<shevy> Hanmac I use yaml myself, dont think I have a single csv-format file here
nanderoo has quit [Quit: Leaving.]
krusty_ar has joined #ruby
ibash has joined #ruby
hadees has quit [Read error: Connection reset by peer]
bowlowni has quit [Remote host closed the connection]
jwg2s has joined #ruby
sebicas has joined #ruby
ibash has quit [Client Quit]
bowlowni has joined #ruby
enroxorz-work has quit [Quit: Leaving]
<hashpuppy> i can do this fairly simply/sloppily imperatively, by maintaining the state of the last record, count, and start. do you guys know of a cleaner way: http://pastie.org/private/2ekqdsfg55irpwzvu7jq
bowlowni has quit [Remote host closed the connection]
<Hanmac> shevy what did you think about this? http://pastebin.com/yiKGbB2f
mneorr has quit [Quit: Leaving.]
jbw has quit [Ping timeout: 252 seconds]
sent-hil has joined #ruby
robustus has quit [Quit: ZNC - http://znc.in]
yxhuvud has quit [Ping timeout: 245 seconds]
<Hanmac> imo the missing variable at case feels like a missing tooth inside a mouth ...
andrewh has quit [Ping timeout: 244 seconds]
<Mon_Ouie> Plus it doesn't bring anything over just using if … elsif
<Hanmac> Mon_Ouie i think he only do it to fool us
hadees has joined #ruby
randomautomator has joined #ruby
<nullsign> hanmac: 'hash' wrong number of arguments 0 for 1 ?
<nullsign> hash(:hostname => line[0], :location => line[1], :device_type => line[3])
<Hanmac> no wrong
<Spooner> Hanmac : Yeah, I don't see that if/elsif/else is any more clunky than a naked case
hadees has quit [Remote host closed the connection]
hadees has joined #ruby
superjoe has left #ruby ["Leaving"]
zii has quit [Ping timeout: 240 seconds]
t68195 has quit [Remote host closed the connection]
t78357 has joined #ruby
mxbtty has joined #ruby
vlad_starkov has quit [Remote host closed the connection]
ndngvr has joined #ruby
<Hanmac> okay ... i used sometimes fake rb_define_attr inside an #if 0 to fool rdoc ... but its only for good , ... but an naked case? thats SO wrong
erichmenge has joined #ruby
dpk has quit [Quit: Asleep at the keyboard.]
<sent-hil> How do I get haproxy to match just the root url. I tried: acl root path_reg ^[/]{0,1}$, but that matches everything
Eldariof59-ru has quit []
<nullsign> hanmac: so once i've built the array, say i have values ST101,Dallas,Chicago in the hash, how do i call Dallas/Chicago by referencing ST101[0] ?
<nullsign> is dallas/chicago ST101[1], and ST101[2] ?
Takehiro has quit [Remote host closed the connection]
<hashpuppy> sent-hil: this is not #haproxy, but that should work. you ? is the same as {0,1}. try acl root path_reg ^[/]?$
swebb has left #ruby ["["Textual IRC Client: www.textualapp.com"]"]
jbw has joined #ruby
chessguy has quit [Remote host closed the connection]
chare has joined #ruby
Takehiro has joined #ruby
<sent-hil> hashpuppy: it seems to match match everything, i.e. /blog, /word etc.
<nullsign> ug.. this is painful
<shevy> Hanmac, looks awful code :D
<sent-hil> hashpuppy: i tried in #haproxy but its a graveyard there
jjbohn|afk is now known as jjbohn
<shevy> Hanmac, agree about the missing case variable
chessguy has joined #ruby
MarGarina has joined #ruby
elhu has quit [Quit: Computer has gone to sleep.]
beneggett has joined #ruby
<lectrick> oh my metaprogramming. What does "self" refer to in a define_method block? I want to get a hold of the instance of the instance method I'm dynamically defining
<lectrick> Inside it.
<nullsign> hanmac: http://pastie.org/4564172
<nullsign> hanmac: what im having trouble with, is joining the later forach whereby i have a hostname being printed as #{hostname} to call the earlier hash table by the hostname output.
<nullsign> basically, later on for each line i print data, one bit of data is the hostname; in knowing this, how can i call the hash table from the beginning to get the values for that hostname's location/device type
luxurymode has joined #ruby
eywu has quit [Quit: Leaving.]
17SABR2Q2 has quit [Quit: 17SABR2Q2]
Hanmac has quit [Ping timeout: 260 seconds]
<Spooner> hashpuppy : data.group_by {|h| h.values.first }.map {|v, a| {"start" => a.first.keys.first, "end" => a.last.keys.first, "value" => v } }} # Horrible, but I'm sure it could be done better.
mxbtty has quit [Ping timeout: 245 seconds]
<Synthead> What's wrong with this? a = [ '1.pdf', '2.pdf' ]; PDF::Toolkit.pdftk(*a, 'output', '3.pdf')
<hashpuppy> Spooner: ha. thanks. let me check that out
ryan0x2 has quit [Remote host closed the connection]
twigmorewelsh has quit [Ping timeout: 260 seconds]
<Spooner> And I might prefer to use a Range than start/end as separate values.
twigmorewelsh has joined #ruby
geekbri has quit [Remote host closed the connection]
Takehiro has quit [Remote host closed the connection]
greenysan has quit [Ping timeout: 248 seconds]
<Spooner> Really depends what you actually want it for, of course :)
<hashpuppy> Spooner: that was actually really creative
<hashpuppy> thanks
wallerdev has joined #ruby
<Synthead> running it in pry with a test method works
<Spooner> For example, I'd probably create a hash {"A" => 1..1, "B" => 2..3, etc}
<Synthead> syntax error, unexpected tSTRING_BEG, expecting tAMPER
<Spooner> And that would make constructing it simpler too.
banisterfiend has quit [Read error: Connection reset by peer]
mxbtty has joined #ruby
jonathanwallace has quit [Remote host closed the connection]
<Spooner> But again, that might not fit your requirement overall.
jonathanwallace has joined #ruby
banisterfiend has joined #ruby
asteve has quit []
Hanmac has joined #ruby
fantazo has joined #ruby
banseljaj is now known as imami|afk
t78357 has quit [Remote host closed the connection]
andrewhl has quit [Remote host closed the connection]
t63825 has joined #ruby
haxrbyte has joined #ruby
chessguy has quit [Remote host closed the connection]
<Synthead> how can I pass an array of arguments to a "normal" method?
mxbtty has quit [Client Quit]
atmosx has joined #ruby
jonathanwallace has quit [Ping timeout: 240 seconds]
twigmorewelsh has quit [Ping timeout: 260 seconds]
<Hanmac> Synthead meth(*args)
<JonnieCache|home> /ignore -channels #mwsf * JOINS PARTS QUITS NICKS
<JonnieCache|home> fuck
<JonnieCache|home> sorry
<JonnieCache|home> copy/paste fail
qwerxy has joined #ruby
<Synthead> Hanmac: that doesn't seem to be working
<Synthead> a = [ '1.pdf', '2.pdf' ]; PDF::Toolkit.pdftk(*a, 'output', '3.pdf')
<Synthead> syntax error, unexpected tSTRING_BEG, expecting tAMPER
elaptics`away is now known as elaptics
Foxandxss has quit [Quit: KVIrc 4.2.0 Equilibrium http://www.kvirc.net/]
SeanLazer has quit [Quit: SeanLazer]
chessguy has joined #ruby
Foxandxss has joined #ruby
dbe has quit [Remote host closed the connection]
<Hanmac> Synthead ... whats your ruby version?
graspee has joined #ruby
<Spooner> Synthead : Very possible that your code is failing somewhere else. That line is fine.
cj3kim has quit [Quit: This computer has gone to sleep]
beneggett has quit [Quit: Computer has gone to sleep.]
<nullsign> hanmac: one question; with - hash(:name => line[0], :location => line[1], :device_type => line[3])
Goles has joined #ruby
punkrawkR has joined #ruby
<Synthead> Hanmac: : 1.8.7
<Hanmac> nullsign: WHY do you think its hash() ?
<nullsign> do i call the hash as hash[0]/hash[1]/hash[2] or by name[0] / name[1] / name[3], etc?
<nullsign> to get the values
dbe has joined #ruby
<Hanmac> Synthead: and thats is acactly your problem :P
<JonnieCache|home> Synthead: do youself a favor and upgrade to 1.9.3
<Synthead> Hanmac, JonnieCache|home: can't upgrade yet :p
<nullsign> hanmac: that was how it was typed to me as an example.
<Synthead> 1.8.7 can't take *args ?
<Hanmac> nullsign no
hadees has quit [Read error: Connection reset by peer]
hadees has joined #ruby
<Spooner> I thought it could? Or is it just that it can't take *args except as the _last_ argument?
<Hanmac> Synthead: not in that way ... but this works: a = [ '1.pdf', '2.pdf' ]; PDF::Toolkit.pdftk(*(a + ['output', '3.pdf']))
ryan0x2 has joined #ruby
<JonnieCache|home> yuck
<tbrock> guys can someone help me with thor
<tbrock> ?
<nullsign> hanmac: im confused then
<atmosx> What you wanna bang him?
lurch_ has joined #ruby
<Spooner> nullsign : Depends who typed it as an example to you and/or if you were able to copy-paste from the example or just decided to superimpose another language's constructor syntax on Ruby.
<Hanmac> nullsign you missread some example ... hash(….) is wrong
verto is now known as verto|off
obryan has quit [Quit: Konversation terminated!]
cj3kim has joined #ruby
cj3kim has joined #ruby
cj3kim has quit [Changing host]
<nullsign> Hanmac: im trying to make a hash for each line in the csv file im reading
<nullsign> i want to reference the hash by the first column
imami|afk is now known as everyone
everyone is now known as banseljaj
tommyvYo has quit [Quit: Textual IRC Client: http://www.textualapp.com/]
<Spooner> hash = Hash.new; and then for each line as you read it: hash[line[0]] = { :location => line[1], :device_type => line[3])
* apeiros_ smacks Spooner for using Hash.new instead of {}
Guedes has joined #ruby
Guedes has quit [Changing host]
Guedes has joined #ruby
* apeiros_ has aggressive urges :)
<Spooner> Or rather hash[line[0].to_sym] = { :location => line[1], :device_type => line[3]) - then you can reference with hash[:frog][:location] or hash[:frog][:device_type]
* Hanmac smacks Spooner because he counted device_type maybe wrong
iamjarvo has quit [Ping timeout: 244 seconds]
duply has quit [Read error: Connection reset by peer]
<Spooner> Hanmac : I was just copying from the example :P
<apeiros_> ze frogs are comming…
nullsign has quit [Quit: Lost terminal]
jonathanwallace has joined #ruby
scriabin has joined #ruby
nullsign has joined #ruby
<mmitchell> Anyone else have troubles installing ruby on the new macbook pros under os x 10.8. Wow, this sucks.
<nullsign> lost connect..
recycle has quit [Remote host closed the connection]
<nullsign> hanmac: if you replied to me, can you repost? my connection dropped.
<apeiros_> mmitchell: nope. worked fine. used rvm.
<Spooner> I'll pastie. One sec.
t63825 has quit [Remote host closed the connection]
<apeiros_> don't forget to install the readline package, though. default on osx is sucky editline
t9438 has joined #ruby
<mmitchell> apeiros_: I'm using rvm too, but I need ruby 1.8.7. Maybe that's my real problem. RVM says something something about the built-in gcc is not compatible.
haxrbyte_ has joined #ruby
<JonnieCache|home> that sucks
<davidcelis> mmitchell: what OS you on
<davidcelis> oh
<Spooner> nullsign : https://gist.github.com/3419440
<davidcelis> mmitchell: did you install the XCode command line tools
<apeiros_> yeah, somewhen around xcode 4.2 the gcc supplied by apple would no longer work to compile ruby <1.9.3
<mmitchell> davidcelis: os x, yeah latest
<mmitchell> davidcelis: yes got all that
<davidcelis> ah yep
hynkle has quit [Quit: Computer has gone to sleep.]
<davidcelis> you cant go below 1.9.3
<apeiros_> mmitchell: you have to install an older gcc
<JonnieCache|home> can you not compile an older gcc from homebrew or somesuch
jasonkuhrt has quit [Quit: Leaving...]
<mmitchell> rats ok
<apeiros_> afaik it should work with e.g. kenneth's gcc package
<Synthead> Hanmac: ooh, ok
<apeiros_> I think it can even be installed from brew
<JonnieCache|home> theres that osx-gcc-installer package but that got replaced by the xcode command line tools
<apeiros_> the OS ruby is still 1.8.7
<mmitchell> ahhh yeah, i did install "apple-gcc42" -- but even after that I had the same problems
shadoi has quit [Quit: Leaving.]
bgupta has joined #ruby
haxrbyt__ has joined #ruby
hynkle has joined #ruby
gavit has joined #ruby
<JonnieCache|home> you will probably need to specify that gcc when you compile ruby
<JonnieCache|home> with some flag to configure
<Synthead> Hanmac: works great, thanks!
gavit has quit [Client Quit]
Juul has joined #ruby
<mmitchell> JonnieCache|home: ahh ok, would you happen to know how to do that with rvm?
<JonnieCache|home> rvm is supposed to do that kind of stuff on its own
<JonnieCache|home> ask in the rvm channel its supposed to be quite active
kvirani has quit [Remote host closed the connection]
<JonnieCache|home> theres probably some flag or env variable
<Hanmac> my OS ruby has 1.9.3p194
haxrbyte has quit [Ping timeout: 272 seconds]
<mmitchell> JonnieCache|home: ahh good idea
<mmitchell> thanks!
greenysan has joined #ruby
<Spooner> nullsign : Ask if you want me to explain fastercsv https://gist.github.com/3419440 - I assume that is what you were actually wanting to do.
haxrbyte_ has quit [Ping timeout: 260 seconds]
gavit has joined #ruby
joephelius has joined #ruby
<nullsign> Spooner: im close now, .. now i just need a way to reference the hash by outputting another matching variable.
hynkle has quit [Ping timeout: 248 seconds]
<nullsign> im getting hash[:S1570AP103][:location] for my output; because im trying to assign the variable im outputing like so ### location = 'hash[:#{hostname}][:location]'
lee_ has joined #ruby
tommyvYo has joined #ruby
<nullsign> basically later on i parse the hostname, but i need to reference the original hash by that variable #{hostname}
<Spooner> You will do. You don't use quotes like that...
Hanmac has quit [Ping timeout: 240 seconds]
lee_ is now known as carrythezero
<Spooner> location = hash[hostname.to_sym][:location] (though is hostname is a string, it might be better not to use to_sym in my original code).
carrythezero has left #ruby [#ruby]
<nullsign> it is a string yes.
linoj has quit [Quit: linoj]
greenysan has quit [Ping timeout: 265 seconds]
<Spooner> Just take the to_sym out of my original code. It makes more sense to reference that as a string (though :location and :device_type make more sense as symbols).
Hanmac has joined #ruby
<Spooner> You could also use Struct, but I don't want to make things more complex by trying to simplify them :D
paolooo has quit [Quit: Page closed]
andrewh has joined #ruby
jorge_ has joined #ruby
tayy_ has joined #ruby
<nullsign> Spooner: im messing up when trying to call my hash; instead im printing/assigning what im using to call the hash, rather than interpret it.
<nullsign> 1570AP103,10.37.95.103,2012-08-20,3.08,329.28,hash[:S1570AP103][:location],hash[:S1570AP103][:location]
qwerxy has quit [Quit: offski]
carrythezero has joined #ruby
<Spooner> I really have no idea what you are doing. Honestly, I think you need to get a more solid grounding in Ruby before you try to do this. It isn't complex, but if you don't understand strings and hashes on a fundamental level, you are going to struggle to manipulate them.
tiripamwe has joined #ruby
<nullsign> Spooner: i agree with you, but im very close to finishing... i just need to call the hash and assign the output to a variable.
v0n has quit [Quit: Leaving]
<nullsign> location = 'hash[hostname][:location]'
<Spooner> Why are you adding the quotes?
<nullsign> the hostname variable at this point in the script will match the line[0] hash hostname from rarlier
<nullsign> if i dont, it breaks the script.
<Spooner> If you don't add the quotes, then something somewhere else is broken.
Juul has quit [Ping timeout: 260 seconds]
<Hanmac> l'owl? :P
<Spooner> Please don't just throw code at the wall until some of it sticks :D
<JonnieCache|home> for all our sakes
<Spooner> nullsign : I'd suggest you gist your code because something is going very wrong, but we have no idea where.
tayy has quit [Ping timeout: 268 seconds]
<nullsign> the hostname call will match line[0] of the CSV for each foreach later on
carloslopes has quit [Quit: Leaving.]
t9438 has quit [Remote host closed the connection]
t6054 has joined #ruby
<nullsign> so basically, by the end of the script i have a value for hostname, this value will match some line from the hash, i should be able to call the hash by the hostname itself, in theory to get keys [1] and [2]
<Spooner> nullsign : In actual code, calling a Hash "hash" is not very helpful. Maybe it should be called something like hosts?
<nullsign> sure.
<nullsign> wait, my hash is named hash?
<nullsign> i thought it was named for each hostname in the file, line by line?
<Spooner> And using a bit clearer indentation (NO hard tabs) would make things a lot clearer.
andrewhl has joined #ruby
<Spooner> hash = {} # this creates a variable called "hash" which is an instance of Hash
jjbohn has quit [Ping timeout: 240 seconds]
patient has joined #ruby
hadees has quit [Quit: hadees]
<patient> hey guys, is there a way to ask the user to input some text, but have it masked as he types? For example "Enter pin: ****"
<nullsign> Spooner: so there is my problem i need to make a hash for every line of the CSV file, named for the first column.. i see.
<eam> patient: in what context? in a terminal?
gavit has quit [Read error: Connection timed out]
<Spooner> nullsign : Anyway, make that file readable and tell us what the actual error is and we might get somewhere.
paulovittor23 has quit [Remote host closed the connection]
SCommette has joined #ruby
<nullsign> the error isn't important now, basically - i need a way to read in the CSV file, 3 columns, so that every line's first column becomes a hash named for the value of the column
<Spooner> nullsign : No, the hash should be named based on what it contains. As it is, its keys are hostnames and values are information about those hosts. Thus, hosts or host_data or something is more meaningful.
<nullsign> then i can reference the other 2 columns by calling the first column's name
<Spooner> It is now a hash of hashes and you can reference it as you have there (hash[hostname][:location])
<nullsign> spooner: then maybe a hash is the wrong method for making a lookup table.
<nullsign> basically, later on in the script i have a hostname, and i need a way to lookup data about that hostname.
recycle has joined #ruby
ninegrid has quit [Quit: leaving]
cj3kim has quit [Ping timeout: 276 seconds]
<Spooner> Yes, which is what you have now.
<nullsign> ah.
jenrzzz has joined #ruby
<Spooner> All I was saying was that hosts = {} has meaning. hash = {} doesn't have any meaning at all.
<Spooner> Any more than string = "frog" has meaning, but animal = "frog" has some.
sent-hil has quit [Remote host closed the connection]
<nullsign> alright.. so.. lets just stick with hash for now since it's in the paste
<nullsign> how do i call location if i have to call the hash by referencing another variable's content?
tiripamwe has quit [Quit: Leaving]
gavit has joined #ruby
<nullsign> ie: i have another variable with the data called 'hostname' i need the output of hostname to reference the hostname (line[0]) from the hash
jlogsdon_ has quit [Remote host closed the connection]
shadoi has joined #ruby
jmorton has joined #ruby
jlogsdon has joined #ruby
<patient> eam, yes, on terminal
<patient> i remember java having a similar feature
recycle has quit [Remote host closed the connection]
<Spooner> nullsign: like this ===> hash[hostname][:location] # you know, the way I already said to do it.
greenysan has joined #ruby
opus has quit [Quit:]
opus__ has quit [Quit:]
clocKwize has quit [Quit: clocKwize]
<nullsign> spooner: hrm, thats what i thought, but i had to wrap the thing in double quotes to avoid syntax errors.
<nullsign> which doesn't work.
<Spooner> No, as I said, the problem is not in that line, but elsewhere.
<nullsign> this error; http://pastie.org/4564477
<nullsign> ah.
<Spooner> I don't know where, because you haven't said which line the error repor...right.
meoblast001 has joined #ruby
<meoblast001> hi
DrShoggoth has quit [Quit: Leaving]
jmorton has quit [Client Quit]
<nullsign> Spooner: unfortunate it's somewhere in the giant each_line blob
Morkel has quit [Quit: Morkel]
opus has joined #ruby
<meoblast001> is it possible in a Gemfile to define a different source for only one gem?
<eam> patient: I believe the highline module will echo stars for you -- if that doesn't work what you can do is system "stty -echo raw"; then use getc() and print("*") in a loop until done, and use system "stty echo cooked" to get back to normal
qwerxy has joined #ruby
<eam> which will work in any language
lurch_ has quit [Quit: lurch_]
greenysan has quit [Ping timeout: 252 seconds]
luckyruby has quit [Remote host closed the connection]
<patient> wow, thanks a lot for the tips eam, will give it a try
wvms has joined #ruby
<Synthead> Magick::ImageList.new(jpg).write(jpg + '.pdf') seems to make my script crash. It hangs with no output. Any ideas?
hadees has joined #ruby
<Spooner> nullsign : I tried to make your code look like Ruby - is this any help? https://gist.github.com/3419649
rtl_ is now known as rtl
macmartine has quit [Quit: ["Textual IRC Client: www.textualapp.com"]]
luckyruby has joined #ruby
lurch_ has joined #ruby
<JonnieCache|home> meoblast001: you can specify :path :git many different options to the gem method
<meoblast001> ah, ok. thanks :D
jasonLaster has quit [Remote host closed the connection]
jasonLaster has joined #ruby
t-mart has joined #ruby
<Spooner> But again, I am not sure if that helps. For example: Dir['./report.csv'].each do |line| actually gives just gives "./report.csv" not a line of anything - not sure what you are trying to do there. Again, it makes it a lot easier if your code is readable.
jrist has quit [Ping timeout: 260 seconds]
ylluminate has joined #ruby
<gogiel> using gnu tools inside ruby is just stupid
t6054 has quit [Remote host closed the connection]
t81335 has joined #ruby
ianbrandt has joined #ruby
<Hanmac> gogiel so ... what is your better idea? using windows?
recycle has joined #ruby
<nullsign> Spooner: sadly, that code just errors all over.
lurch_ has quit [Client Quit]
Takehiro has joined #ruby
<Spooner> gogiel : Although that could be true in a lot of cases, if there are a million lines in the files, it could be a lot faster using command line tools. Also, if the writer understands unix tools, but not ruby, it avoids a lot of re-learning (and can be "optimised" later when the code works).
deryl has joined #ruby
Criztian has quit [Remote host closed the connection]
deryl has quit [Client Quit]
Criztian has joined #ruby
ken_barber has quit [Remote host closed the connection]
axl__ has joined #ruby
qwerxy has quit [Quit: offski]
jasonLaster has quit [Ping timeout: 252 seconds]
lurch_ has joined #ruby
<nullsign> spooner: also, i dont think the hash is populating right, if what we did was what i understood we did, my datafile.csv, which has a hostname of 157AP103; should work as follows### location = hash[157AP103][:location] to get the location?
<Spooner> No.
<Spooner> hash["157AP103"][:location]
<Spooner> As I say, you need to learn what strings are a bit :) Just a bit :)
axl_ has quit [Ping timeout: 252 seconds]
axl__ is now known as axl_
<nullsign> oh right, otherwise it trys to call a variable named 157AP103
shiki has joined #ruby
<Spooner> No, it probably thinks it is 157 (integer) and AP103 (variable name)
<Spooner> And/or just gets confused.
<gavit> if I have a list of 3 apples, 2 pears, 7 bannanas, 12 tangerines, 2 apples , 2 bannas, can I somehow *add* these up?
miho has quit [Remote host closed the connection]
GoGoGarrett has quit [Remote host closed the connection]
<Spooner> gavit : That isn't Ruby, so it is hard to know how to "add" them up.
Criztian has quit [Ping timeout: 240 seconds]
havenn has quit [Ping timeout: 246 seconds]
gavit_ has joined #ruby
Takehiro has quit [Ping timeout: 240 seconds]
Stalkr_ has quit [Quit: Leaving...]
<gogiel> Hanmac: using ruby?
gavit_ is now known as gvt
eywu has joined #ruby
havenn has joined #ruby
<gvt> if I have a list of 3 apples, 2 pears, 7 bannanas, 12 tangerines, 2 apples , 2 bannas, can I somehow *add* these up?
infinitiguy has quit [Ping timeout: 245 seconds]
<Spooner> gvt: same answer That isn't Ruby, so it is hard to know how to "add" them up.
mmitchell has quit [Ping timeout: 252 seconds]
<Spooner> Are they an array of strings? Fruit object instances?
<gvt> Spooner, I would look for all items that are the same and add those up
<gvt> Spooner, well, actual customers with many sales_orders with many order_lines (objects)
<Spooner> gvt : But again, that isn't Ruby, so I have no idea how to manage that.
banisterfiend has quit [Read error: Connection reset by peer]
gavit has quit [Ping timeout: 260 seconds]
<gvt> Spooner, i want a list of all items and qties the customer has ordered
alanp_ has joined #ruby
atmosx has quit [Quit: ["Textual IRC Client: www.textualapp.com"]]
<Spooner> So it is an array containing a number of Customers, each with a number of sales - and you want the number of sales of each type of thing?
macmartine has joined #ruby
banisterfiend has joined #ruby
<gvt> Spooner, yah
ShiintoRyuu has quit [Quit: Textual IRC Client: http://www.textualapp.com/]
<gvt> I suppose this isnt a ruby speciffic question, but I would like to know how to implement it in ruby :)
DuoSRX has quit [Remote host closed the connection]
luckman212 has quit [Remote host closed the connection]
gfontenot has quit []
`brendan has quit [Quit: - nbs-irc 2.39 - www.nbs-irc.net -]
<Spooner> apple_sales = customers.count {|c| c.sales_orders.count {|o| o.type = :apple ? o.num_items : 0 } }
alanp has quit [Read error: Connection reset by peer]
internet_user has quit [Remote host closed the connection]
<Spooner> Although that is a guess based on how the objects work, of course.
thone_ has quit [Ping timeout: 260 seconds]
f3ttX] has joined #ruby
<gvt> Spooner, tha would require me to iterate through all items the company sells which would be a longer list than just going through all order_lines I sppose
<Spooner> def sales_of(type); customers.count {|c| c.sales_orders.count {|o| o.type == type ? o.num_items : 0 } }; end # Might make more sense
flexoid has joined #ruby
iamjarvo has joined #ruby
<Spooner> If you can go through the orders, that would make more sense than going through customers, of course.
yoklov has joined #ruby
apeiros_ has quit [Remote host closed the connection]
<gvt> Spooner, doing this through RoR, so I have a database which I suppose could sum it up for me rather than rails, dunno if its "faster" or if it even matters
<flexoid> help please, how can I decode url like this "somewhere.net?x=4&#38;y=6&#38;z=3" to the normal view
<Spooner> def sales_of(type); orders.select {|o| o.type == type }.count(&:num_items); end
t81335 has quit [Remote host closed the connection]
<Spooner> gvt I don't know how to optimise for Rails. I'm giving the Ruby answer, not the Rails one :)
thone has joined #ruby
t3562 has joined #ruby
sepp2k has joined #ruby
mikepack has quit [Remote host closed the connection]
<Spooner> gvt : There is a #rails and #rubyonrails if you want a more Railsy answer :)
lurch_ has quit [Quit: lurch_]
<gvt> Spooner, ty, gonna go check if it works :0
<nullsign> Spooner: i found the error; it thinks location = hosts["157AP103"][:location] is Nil
<nullsign> which means it's not able to lookup
<scriabin> I need to write a complex rake task that essentially clones a scaffold, adds a resource in routes.rb and makes a few changes to helpers and jquery scripts. I don't know the first thing about rake tasks. Anybody have any "getting started" pages?
<Spooner> nullsign : It probably is nil. Why not print out hosts after it is created, to see if it holds what you expect it to?
recycle has quit [Remote host closed the connection]
<nullsign> just print hosts
<nullsign> ?
<Spooner> (that is "p hosts")
<nullsign> oh wow, it's nothing but {}
<nullsign> empty.
<Spooner> You do that after the CSV.read block?
<nullsign> no, i did it later on
<nullsign> lemme see
<Spooner> Well, it won't change. I thought you might have done hosts = {}; p hosts :D
luckyruby has quit [Remote host closed the connection]
<Spooner> Ah, CSV.read doesn't do what you think it does.
<nullsign> hosts is not getting populated from the hash CSV thingy
<nullsign> oh
Juul has joined #ruby
luckyruby has joined #ruby
<nullsign> what i want to do is read a csv with data on each line as follows hostname,location,device_type; and call it lines values based on the hostname
<Spooner> You want 'CSV.read(filename).each do', not 'CSV.read(filename) do'
bowlowni has joined #ruby
jeff_sebring has joined #ruby
hynkle has joined #ruby
<nullsign> oh wow.. that's starting to look better
<Spooner> or you could use CSV.open(filename) do
<nullsign> oh my.. by george, that may have done it.
<Spooner> I expect half of your paycheck this month :D
<nullsign> well i had a starting offer of 80/hour, i figure 160 is owed to your paypal
bradhe has joined #ruby
<nullsign> just message me your email to send funds to
<krz> is there shorthand way to find out how many seconds there are in 24 hours?
banisterfiend has quit [Read error: Connection reset by peer]
<krz> shorthand = direct method
<Spooner> Youmean other than just doing 60 * 60 * 24 ?
<krz> yea
<nullsign> assuming i can make the rest work.. almost there.
banisterfiend has joined #ruby
MrWGW has quit [Ping timeout: 245 seconds]
kpshek has quit []
bowlowni has quit [Ping timeout: 252 seconds]
<Spooner> nullsign : I got as far as this: https://gist.github.com/3419649
banachtarski has joined #ruby
<banachtarski> Hey guys, is there an easy way in ruby 1.9.3 to output the current utc time in the same format as ruby 1.8.7?
<bperry> Time.now
<bperry> ?
MrWGW has joined #ruby
<banachtarski> It doesn't look the same
<banachtarski> Tue Aug 21 21:58:53 UTC 2012 from 1.8.7
<banachtarski> Time.now.utc
<banachtarski> 2012-08-21 21:41:44 UTC from 1.9.3
nateberkopec has quit [Quit: Linkinus - http://linkinus.com]
luxurymode has quit [Quit: Computer has gone to sleep.]
<Spooner> banachtarski : You should probably not rely on Time#to_s. Use strftime, perhaps, so it is consistent?
peregrine81 has quit [Quit: Computer sleeping.]
GoGoGarrett has joined #ruby
<krz> ah. 24.hours.to_i
Juul has quit [Ping timeout: 260 seconds]
<banachtarski> yea going with strftime now
<Spooner> banachtarski : Time.now.utc.strftime "%c"
<Spooner> Taht should be identical in both Rubies.
<banachtarski> well, the old legacy code uses to_s
<banachtarski> %c is very close, but misses the utc tag
<banachtarski> Time.now.utc.strftime("%a %b %d %H:%M:%S UTC %Y") might have to do
<Spooner> There is probably another one that does it.
<nullsign> Spooner: one last issue, how do i assign the ouput of hosts[hostname][:location] to a variable? if i just do "location = hosts[hostname][:location] ## then it makes location = hash[:S1570AP104][:location] (exact string)
gvt has quit [Read error: Connection timed out]
<nullsign> do i need call the hash like {#hash[: etc?
`damien has joined #ruby
<nullsign> er #P
GoldenCider has quit [Quit: GoldenCider]
<nullsign> #{
<Spooner> nullsign : Not sure what you are doing to get it to do that. Pastie?
gvt has joined #ruby
<`damien> Hey all, anybody have experience with the active_model_serializers gem?
<Spooner> `damien : People in #rubyonrails probably have
<`damien> Good point, I'll check there. Thanks!
krusty_ar has quit [Read error: Connection reset by peer]
<nullsign> it's not seeing hosts as a hash, it thinks it's just text.
<Synthead> has anyone seen RMagick hang when doing .write('file.pdf') ?
<nullsign> it's not interpreting it.
<Spooner> That looks fine to me, but there were several improvements in my clean up of the code (such as not manually generating csv files).
krusty_ar has joined #ruby
<nullsign> Spooner: grr.. i wonder why it's failing then
<eam> Are there any good modules in ruby for temporarily dropping euid and restoring later?
hynkle has quit [Quit: Computer has gone to sleep.]
beneggett has joined #ruby
<JonnieCache|home> rmagick goes wrong all the time
<Spooner> I gave up on it a long time ago (rmagick :D).
<Synthead> hm
jonathanwallace has quit [Remote host closed the connection]
<Spooner> But then, I don't need it any more, so it matters less :)
<Synthead> any other gem I could use to make a PDF out of a jpeg ?
recycle has joined #ruby
<Spooner> Should I ask - why not just make a jpeg out of the jpeg and cut out RMagick?
cakehero has quit [Quit: Computer has gone to sleep.]
<Synthead> Spooner: I'm looking to make a pdf
cousine has joined #ruby
Michael has joined #ruby
Michael is now known as meskyanichi
t3562 has quit [Remote host closed the connection]
t35551 has joined #ruby
chessguy has quit [Remote host closed the connection]
yasushi has joined #ruby
dbe has quit [Remote host closed the connection]
iamjarvo has quit [Ping timeout: 244 seconds]
<Synthead> gonna try pdf-writer
Juul has joined #ruby
kirun has quit [Quit: Client exiting]
yasushi has quit [Ping timeout: 268 seconds]
jonathanwallace has joined #ruby
dbe has joined #ruby
stopbit has quit [Quit: Leaving]
kpshek has joined #ruby
cj3kim has joined #ruby
sazboom has quit [Ping timeout: 246 seconds]
Goles has quit [Quit: Computer has gone to sleep.]
gvt has quit [Read error: Connection timed out]
joshman_ has quit [Ping timeout: 252 seconds]
<Synthead> pdf = PDF::Writer.new; pdf.image('/home/max/pics/sham021809.jpg') RuntimeError: Unsupported Image Type
<Synthead> :p Any thoughts?
Goles has joined #ruby
gavit has joined #ruby
tayy_ has quit [Remote host closed the connection]
mmitchell has joined #ruby
mike4_ has quit [Ping timeout: 276 seconds]
tommyvYo has quit [Quit: Computer has gone to sleep.]
mmitchell has quit [Remote host closed the connection]
Juul has quit [Ping timeout: 260 seconds]
mmitchell has joined #ruby
itnomad has joined #ruby
qwerxy has joined #ruby
opus has quit [Quit:]
Nisstyre has quit [Quit: Leaving]
moshee has quit [Ping timeout: 240 seconds]
moshee has joined #ruby
moshee has quit [Changing host]
moshee has joined #ruby
chriskk has quit [Ping timeout: 260 seconds]
rump has quit [Quit: rump]
Nisstyre has joined #ruby
ylluminate has quit [Quit: Bye!]
verto|off is now known as verto
opus has joined #ruby
Affix has quit [Ping timeout: 260 seconds]
beneggett has quit [Ping timeout: 244 seconds]
banisterfiend has quit [Read error: Connection reset by peer]
dangerousdave has quit [Quit: Leaving...]
Goles has quit [Quit: Textual IRC Client: http://www.textualapp.com/]
gavit has quit [Read error: Connection timed out]
techsurvivor has quit [Quit: WeeChat 0.3.8]
banisterfiend has joined #ruby
Juul has joined #ruby
cj3kim has quit [Quit: This computer has gone to sleep]
beneggett has joined #ruby
gavit has joined #ruby
ngoldman has quit [Ping timeout: 244 seconds]
Jay_Levitt has joined #ruby
jlogsdon has quit [Remote host closed the connection]
luckyruby has quit [Remote host closed the connection]
butblack has joined #ruby
shadoi has quit [Quit: Leaving.]
chriskk has joined #ruby
ngoldman has joined #ruby
nari has joined #ruby
stkowski has quit [Quit: stkowski]
rump has joined #ruby
erichmenge has quit [Quit: Be back later]
Juul has quit [Ping timeout: 245 seconds]
jjang has joined #ruby
lkba has quit [Ping timeout: 265 seconds]
Chryson has joined #ruby
jenrzzz has quit [Quit: leaving]
jenrzzz has joined #ruby
adac has quit [Quit: Leaving]
adac has joined #ruby
macmartine has quit [Quit: Computer has gone to sleep.]
banseljaj is now known as imami|afk
jenrzzz has quit [Client Quit]
kpshek has quit []
<maletor> Is there a way in ruby to figure out which classes are taking up the most memory?
jenrzzz has joined #ruby
andrewh has quit [Ping timeout: 260 seconds]
RegEchse has quit [Quit: <3 WeeChat (v0.3.9-dev)]
banisterfiend has quit [Read error: Connection reset by peer]
mike4_ has joined #ruby
andrewhl has quit [Read error: Connection reset by peer]
MarGarina has quit [Ping timeout: 245 seconds]
banisterfiend has joined #ruby
nirix has joined #ruby
<voodoofish430> so mixins are like interfaces with implemented methods...?
hadees has quit [Quit: hadees]
andrewhl has joined #ruby
machty__ has quit [Ping timeout: 260 seconds]
rump has quit [Quit: rump]
<fowl> voodoofish430: mixins are the solution to single inheritance, they give your classes genetic diversity
theRoUS has joined #ruby
g_rotbart has joined #ruby
<voodoofish430> is it typical to have a module as a mixin on multiple classes?
<canton7> yeah, e.g. Enumerable
khakimov has joined #ruby
zodiak has quit [Remote host closed the connection]
Russell^^ has quit [Quit: Russell^^]
andrewhl has quit [Remote host closed the connection]
<Spooner> maletor : Memory, not directly, but you can play with ObjectSpace to, for example, count how many of each class exist in Ruby.
lkba has joined #ruby
locriani has joined #ruby
locriani has joined #ruby
locriani has quit [Changing host]
<maletor> interesting
gavit has quit [Read error: Connection timed out]
gavit has joined #ruby
mxbtty has joined #ruby
locriani has quit [Remote host closed the connection]
khakimov has quit [Quit: Computer has gone to sleep.]
locriani has joined #ruby
locriani has joined #ruby
locriani has quit [Changing host]
davidcelis has quit [Quit: K-Lined.]
adac has quit [Ping timeout: 240 seconds]
chichou has joined #ruby
qwerxy has quit [Quit: offski]
Juul has joined #ruby
sebicas has quit [Quit: sebicas]
cantonic has joined #ruby
tomsthumb_ has quit [Quit: Leaving.]
Progster has quit [Ping timeout: 260 seconds]
<shevy> voodoofish430 via include Name you can include a module. this is also called "mixin"
<shevy> and you can include as many modules as you want in a class
uris has quit [Quit: leaving]
butblack has quit [Quit: butblack]
axl_ has quit [Quit: axl_]
t35551 has quit [Remote host closed the connection]
t44393 has joined #ruby
haxrbyt__ has quit [Remote host closed the connection]
johnlcox has quit [Ping timeout: 245 seconds]
<maletor> Spooner: I'm trying to debug why my rails app has such high memory usage right at boot
<Spooner> maletor : Probably because it is Rails (which I know nothing about, so that is as much help as I can give :D).
M- has joined #ruby
xbayrockx has quit []
ringotwo has quit [Read error: Connection reset by peer]
banghouse is now known as banghouseFood
<Axsuul> maletor: how muhc memory
ringotwo has joined #ruby
xnm has quit [Quit: WeeChat 0.3.7]
kvirani has joined #ruby
specialGuest has joined #ruby
specialGuest has joined #ruby
specialGuest has quit [Changing host]
<maletor> 512 - 600mb
<maletor> throws R14 (memory freakout) at about 600
<Axsuul> what app server are you using?
<Axsuul> and so it just starts out @ 512 immediately? or does it grow
Affix has joined #ruby
andrewhl has joined #ruby
<maletor> pretty starts at 512 immediately
quest88 has quit [Quit: quest88]
<Axsuul> could it be that you're initializing some crazy stuff in one of your initializers
gavit has quit [Read error: Connection timed out]
mmitchel_ has joined #ruby
gavit has joined #ruby
<shevy> he initializes bunnies!
quest88 has joined #ruby
<Spooner> 1000.times { Bunny.generate :extra_fluffy }
butblack has joined #ruby
<Spooner> That would only use up about 50MB though, so that can't be it, shevy.
<shevy> the bunnies make MORE bunnies!
<Axsuul> The bunnies reproduce like crazy
mmitchell has quit [Ping timeout: 260 seconds]
<Axsuul> which explains the memory issue
<Spooner> Making them :shaved does save about 7MB too.
Matt__ has joined #ruby
rakunHo has joined #ruby
Foxandxss has quit [Quit: KVIrc 4.2.0 Equilibrium http://www.kvirc.net/]
andrewhl has quit [Remote host closed the connection]
<shevy> lol
jwmann has joined #ruby
jwmann has quit [Max SendQ exceeded]
recycle has quit [Remote host closed the connection]
<Axsuul> 1.times { Bunny.generate :extra_fluffy } # forever alone
jwmann has joined #ruby
butblack has quit [Client Quit]
Juul has quit [Ping timeout: 268 seconds]
rump has joined #ruby
ringotwo has quit [Remote host closed the connection]
i0n has quit [Quit: Lost terminal]
banisterfiend has quit [Read error: Connection reset by peer]
ckrailo has quit [Quit: Computer has gone to sleep.]
punkrawkR has quit [Read error: Connection reset by peer]
banisterfiend has joined #ruby
<bricker88> What is the "correct" way to set default values for an options hash? I know there are about 100 ways to do it, but I'm wondering what you guys do
ringotwo has joined #ruby
invisime has quit [Quit: Leaving.]
<fowl> bricker88: options = defaults.merge(options)
banghouseFood is now known as banghouse