<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| ?
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.]
<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?
<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
<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
<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
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]
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]
<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!!!
<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
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]
<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
<_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>'
<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
<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?
<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?)
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>
, [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
<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
<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" }
<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
<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>
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]
<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
<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
<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?
<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
<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]
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.
<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
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?
<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]
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]
<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
<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?
<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.
<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]
<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 ^[/]?$
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
<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}
<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
<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.
<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.
<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.
<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.
<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?
<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 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&y=6&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>
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
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