apeiros_ changed the topic of #ruby to: programming language || ruby-lang.org || Paste >3 lines of text in http://pastie.org || Rails is in #rubyonrails
randym has joined #ruby
BryanWB has joined #ruby
mikeycgto_ has joined #ruby
rhce7320 has joined #ruby
CombatWombat has joined #ruby
kalv has joined #ruby
two- has joined #ruby
JC_SoCal has joined #ruby
artOfWar_ has joined #ruby
quest88 has joined #ruby
noyb has joined #ruby
tomzx has joined #ruby
tdelam_ has joined #ruby
tdelam_ has quit [#ruby]
jhowarth has joined #ruby
artOfWar has joined #ruby
dbgster has joined #ruby
sarmiena_ has joined #ruby
noyb has joined #ruby
shevy has joined #ruby
goodieboy has joined #ruby
affix has joined #ruby
Matt_S_G has joined #ruby
<jsonperl> in a c extension i've created, ruby is calling the free function the first time the garbage collector runs
chrislgibson has joined #ruby
<jsonperl> im unclear on how to mark the object appropriately so that the GC leaves it alone, anywhere anyone can point me?
frishi has joined #ruby
frishi has joined #ruby
davidboy has joined #ruby
John_____ has joined #ruby
eko has joined #ruby
eko has joined #ruby
wallerdev has joined #ruby
chrislgibson has joined #ruby
<jrhorn424> what's the short, idiomatic way to pull items from one array into a new array conditionally?
<jsonperl> .select
<jrhorn424> excellent. thank you.
<jsonperl> sure thing
savage- has joined #ruby
freeayu has joined #ruby
sj26 has joined #ruby
<jacktrick> Night all!
two- has joined #ruby
manizzle has joined #ruby
lukevisinoni has joined #ruby
CheeToS has joined #ruby
gtuckerkellogg has joined #ruby
wilmoore has joined #ruby
goodieboy has joined #ruby
pu22l3r has joined #ruby
S1kx has joined #ruby
MetaCosm has joined #ruby
liluo has joined #ruby
keymone has joined #ruby
baroquebobcat has joined #ruby
noyb has joined #ruby
helichopter has joined #ruby
ZachBeta has joined #ruby
noyb_ has joined #ruby
keymone has joined #ruby
friskd has joined #ruby
Nathandim has joined #ruby
robkinyon has joined #ruby
<swarley> [25] pry(main)> 3.moles_of :Hydrogen
<swarley> => 3.03
<fowl> nice
<fowl> what unit is 3.03 tho
<swarley> moles
jsonperl has quit [#ruby]
<swarley> err
<swarley> grams
<swarley> you can do
ZachBeta has joined #ruby
havenn has joined #ruby
<swarley> Chemistry.molar_mass("H", Chemistry::Units::Molecules)
<swarley> or Units::Liters, or Units::Grams
<fowl> Chemistry::Units::Molecules is a bit much to type out imo
<swarley> you can just include Chemistry :p
<swarley> and it assumes Units::Grams anyway
<fowl> a more ruby way would be like 3.moles_of(:Hydrogen).to_grams
<swarley> yeah i know
liluo has joined #ruby
<fowl> i never include things
<fowl> i leave all of the modules feeling left out
<swarley> but 1 mole of Hydrogen is 1
<swarley> lol
<fowl> there's only room on my super nintendo for 1 player, and thats me
<fowl> i went too far :/
<fowl> killed the joke
sam113101 has joined #ruby
<swarley> lol
sam113101 has quit [#ruby]
sam113101 has joined #ruby
nikhil_ has joined #ruby
joukokar has joined #ruby
tomzx has joined #ruby
nari has joined #ruby
banisterfiend has joined #ruby
savage- has joined #ruby
porto00 has joined #ruby
porto00 has quit [#ruby]
jcrossley3 has quit ["ERC Version 5.3 (IRC client for Emacs)"]
fbernier has joined #ruby
shtirlic_ has joined #ruby
MopMopperton14 has joined #ruby
gtuckerkellogg has joined #ruby
t0mmyvyo has joined #ruby
Tearan has joined #ruby
wroathe has joined #ruby
superguenter has joined #ruby
<wroathe> It's been a long time since I've turned off my laptop and for some reason I have like 30 ruby processes listed in Activity Monitor. Does anyone know why ruby seems incapable of closing it's own processes?
<wroathe> Or is it something I'm doing wrong?
<banisterfiend> wroathe: becuase you forgot to close them ;)
<banisterfiend> applications dont close by themselves, they need to be told ;)
lewix has joined #ruby
lewix has joined #ruby
<wroathe> So if I execute a file with ruby filename.rb I'm also responsible for force quitting that process if it doesn't shut down :P
<Veejay> banisterfiend: Now that you mention it, I have to say that I don't have the background to verify that what he's saying is true
<Veejay> But nothing looks too far fetched
<banisterfiend> wroathe: the program only shuts down when it's finished running or it's told to close; are you saying you tried to exit it but it didnt, and you had to resort to force quit?
<Veejay> banisterfiend: Do YOU think it's bullshit?
<banisterfiend> Veejay: i didnt read it ;)
<Veejay> OK
<Veejay> It's a nice video I think
<banisterfiend> Veejay: cool
andrewhl has joined #ruby
wyhaines has joined #ruby
bryricker has joined #ruby
ZachBeta has joined #ruby
lukevisinoni has joined #ruby
banisterfiend has joined #ruby
jbhewitt has joined #ruby
t0mmyvyo has joined #ruby
lewix has joined #ruby
lewix has joined #ruby
lewix_ has joined #ruby
jmfcool has joined #ruby
groovehunter has joined #ruby
wicchan has joined #ruby
maletor has joined #ruby
wicchan has quit [#ruby]
ZachBeta has joined #ruby
w_chan has joined #ruby
lordzero has joined #ruby
fayimora_ has joined #ruby
w_chan has quit [#ruby]
ZachBeta has joined #ruby
John has joined #ruby
sam113101 has joined #ruby
krz has joined #ruby
paradisaeidae has joined #ruby
acekiller has joined #ruby
<Quadlex> I'm creating wrapper objects for an XML web service response
<Quadlex> Is there a cleaner way then just creatting an attr_accessor for each bit of the response?
<Quadlex> I'm trying to come up with something less manual but not having any success
<lordzero> Wish I knew Quad, but then again I'm about as fresh with Ruby as one can be
radic_ has joined #ruby
blueadept` has quit ["Leaving"]
<paradisaeidae> Quadlex: How about a hash or array?
<paradisaeidae> What needs to be done with the response fragments?
adeponte has joined #ruby
ZachBeta has joined #ruby
tolland has joined #ruby
c0rn has joined #ruby
<tolland> is there a windows idiom or feature that could be used similarly to the inode number, as a check as to whether some file has been deleted and recreated?
ZachBeta has joined #ruby
pygmael has joined #ruby
<Quadlex> paradisaeidae: various things, depending on what they're for
<Quadlex> Basically, the web service bundles lots of info together
<Quadlex> a status retrieval call, for instance, returns 2 times, an enum, several bits of locational information, some information about the entire job, some address information
<Quadlex> At the low level I'm writing a method to take a job_id and return a wrapper object with all the information
<Quadlex> which can then be passed to business logic methods
<paradisaeidae> Hokay. So you expect a xml-valid response?
<tolland> i mean as a ruby call
<paradisaeidae> The righ bat to hit this with is Nokogiri.
superguenter has joined #ruby
<paradisaeidae> It could be used to accept buffer string until the xml is valid.
<paradisaeidae> Concat response until xmlDoc.errors == nil.
<Quadlex> Oh, the actual XML handling is not a problem
<Quadlex> I'm at the level just above that. I'm getting back hashes and trying to decide whether or not to wrap them into a data object
<otters> I need an SSH client that doesn't create a new session for every command
<Quadlex> I'm from Java/C# Land so I'm trying to make sure I'm not holding onto insufficent tropes
<lordzero> otters: awha?
<otters> sorry, wrong channel
<lordzero> rgr
wyhaines has joined #ruby
ZachBeta has joined #ruby
nfluxx has joined #ruby
zandt has joined #ruby
swarley has joined #ruby
looopy has joined #ruby
CheeToS has joined #ruby
zandt has joined #ruby
artOfWar_ has joined #ruby
eisenhowerz has joined #ruby
<eisenhowerz> how come i can't do puts "current Time: " + Time.now but instead i have to pass it to a var time2 = Time.now and then do puts time2 ?
<eisenhowerz> nvm. puts Time.now.inspect does it. erg
baroquebobcat has joined #ruby
<Boohbah> eisenhowerz: puts "current Time: #{Time.now}"
<Boohbah> also works
igotnolegs has joined #ruby
Guest97939 has joined #ruby
prometheus has joined #ruby
rippa has joined #ruby
Zolrath has joined #ruby
CheeToS` has joined #ruby
Guest97939 has joined #ruby
prometheus has joined #ruby
yoklov has joined #ruby
cha1tanya has joined #ruby
gtuckerkellogg has joined #ruby
tonini has joined #ruby
indeterminate has joined #ruby
nemesit has joined #ruby
nemesit|osx has joined #ruby
emmanuelux has joined #ruby
joukokar has joined #ruby
CheeToS has joined #ruby
Morkel has joined #ruby
ur5us has joined #ruby
bier has joined #ruby
havenn has joined #ruby
Cache_Money has joined #ruby
lordzero has joined #ruby
yxhuvud has joined #ruby
kW_ has joined #ruby
Maxou56800 has joined #ruby
acts_as_david has joined #ruby
abstrusenick has joined #ruby
nikhil_ has joined #ruby
sarmiena_ has joined #ruby
<krz> ruby gurus! i need to turn a one dimensional array into a hash.
<krz> so far I've got: Hash[*a.collect { |v| [v, v] }.flatten]
<krz> any better way to do this?
andrewhl has joined #ruby
c0rn has joined #ruby
<rippa> krz: Hash[a]
<rippa> actually, Hash[*a]
Indian has joined #ruby
deadly_hcs has joined #ruby
x0F_ has joined #ruby
<fowl> krz, ruby <3s you
gen0cide_ has joined #ruby
deadly_hcs| has joined #ruby
<matled> krz: so you want a hash with the same values as the keys are?
tomku has joined #ruby
<krz> its fine. i think i was able to manage :-)
acts_as_david has joined #ruby
baroquebobcat has joined #ruby
baroquebobcat has joined #ruby
n1x has joined #ruby
ghosTM55 has joined #ruby
senthil has joined #ruby
Spring_M_ has joined #ruby
ph^ has joined #ruby
swarley has joined #ruby
jgrevich has joined #ruby
russfrank has joined #ruby
waxjar has joined #ruby
adman65 has joined #ruby
Banistergalaxy has joined #ruby
bigkevmcd has joined #ruby
gtuckerkellogg has joined #ruby
tewecske has joined #ruby
JohnBat26 has joined #ruby
`gregorg` has joined #ruby
DPP has joined #ruby
mafolz has joined #ruby
nemesit has joined #ruby
KL-7 has joined #ruby
chovy has joined #ruby
trivol has joined #ruby
arvidkahl has joined #ruby
bglusman has joined #ruby
<Sp4rKy> /W 16
trivol has joined #ruby
twqla has joined #ruby
AxonetBE has joined #ruby
zommi has joined #ruby
acekiller has joined #ruby
chimkan has joined #ruby
trivol has joined #ruby
pzol has joined #ruby
cobranet has joined #ruby
davidpk has joined #ruby
alup has joined #ruby
blacktulip has joined #ruby
eldariof has joined #ruby
ChampS_ has joined #ruby
zykes- has joined #ruby
sa125 has joined #ruby
Ammar01 has joined #ruby
flou has joined #ruby
sam113101 has joined #ruby
acekiller has joined #ruby
ukwiz has joined #ruby
DarthGandalf has joined #ruby
eldariof has joined #ruby
fivetwentysix has joined #ruby
dhruvasagar has joined #ruby
<fivetwentysix> how do i make my gem install copy the bin into the gem set bin directory on install?
sam113101 has joined #ruby
<pzol> fivetwentysix: are you using bundler?
<fivetwentysix> pzol: i manually created all my files: https://github.com/PatrickMa/playbook.rb
<fivetwentysix> pzol: if do i have a gem file, then yes
francisfish has joined #ruby
<pzol> fivetwentysix: just asking… bundler has this handy bundler gem command which does a lot of the bulk stuff for you
<pzol> fivetwentysix: look at the gemspec definition: s.executables = ['bundle']
<fivetwentysix> pool, sweet that did it
<fivetwentysix> pzol: *
LMolr has joined #ruby
_jak has joined #ruby
<fivetwentysix> pzol: am i suppose to ignore the .gem file?
shyam has joined #ruby
artm has joined #ruby
<pzol> fivetwentysix: em… no why would you do that? the gem file is the output of your gem
arturaz has joined #ruby
heftig has joined #ruby
KL-7 has joined #ruby
<fivetwentysix> pzol: yeah but do i commit that to github?
<fivetwentysix> or what do i do with it
<fivetwentysix> I'm not ready to release my gem yet
<fivetwentysix> cuz it doesn't really do anything lol
<pzol> fivetwentysix: use github as source repo… don't publish the .gem there…
<fivetwentysix> pzol: and publish the gem to rubygems
<fivetwentysix> pzol: right?
<shyam> im getting this error undefined method `pdf_from_string' for #<WickedPdf:0x7f7513c55d70>
francisfish has joined #ruby
jgrevich has joined #ruby
<shyam> any on one used WickedPdf
<pzol> fivetwentysix: true… if you'd use `bundle gem` it would pregenerate a rake task to build a gem, install it locally and publish to rubygems… might be a good starting point
<fivetwentysix> pool thats awesome
_null has joined #ruby
_null has joined #ruby
_null has joined #ruby
<thomasfedb> Hey, is there any equivalent of [1,2,3].map {|el| el * 2} #=> [2,4,6] in Java?
_null has joined #ruby
_null has joined #ruby
<swarley> thomasfedb, you'd fare better asking in #java or something
BiHi has joined #ruby
_null has joined #ruby
ephemerian has joined #ruby
hzlocky has joined #ruby
<hzlocky> Guys I got problem with http://pastebin.com/XDUWrXD9 . I understand that class variable is beeing setted into module, but how I can set class variables of extended classes instead?
<arturaz> thomasfedb, there was some functional library for java :)
_null has joined #ruby
KL-7_ has joined #ruby
mxweas has joined #ruby
timonv has joined #ruby
deadly_hcs has joined #ruby
_null has joined #ruby
bluenemo has joined #ruby
_null has joined #ruby
stefanp has joined #ruby
stefanp has joined #ruby
_null has joined #ruby
bier has joined #ruby
<thomasfedb> arturaz, I've asked there also. Though I know at least here people will know what I'm looking for.
jlebrech has joined #ruby
_null has joined #ruby
_null has joined #ruby
roolo has joined #ruby
_null has joined #ruby
mxweas has joined #ruby
_null has joined #ruby
workmad3 has joined #ruby
jds has joined #ruby
_null has joined #ruby
c0rn has joined #ruby
codespectator has joined #ruby
jsaak has joined #ruby
mcwise has joined #ruby
bluenemo has joined #ruby
artm has joined #ruby
KL-7_ has joined #ruby
KL-7__ has joined #ruby
fabrice31 has joined #ruby
tatsuya_o has joined #ruby
mxweas_ has joined #ruby
_jak has joined #ruby
_jak_ has joined #ruby
jonteru has joined #ruby
DuoSRX has joined #ruby
<jonteru> hi, does anyone know how to properly deploy app to heroku, because i'm having problems with my clock events not firing.
Dreamer3 has joined #ruby
ziyadh has joined #ruby
<TTilus> jonteru: heroku support/faq?
a_a_g has joined #ruby
shruggar has joined #ruby
<jonteru> TTilus: Didn't seem find anything related to my problem
deadly_hcs has joined #ruby
d3vic3 has joined #ruby
sdeobald has joined #ruby
KL-7 has joined #ruby
xrfang has joined #ruby
KL-7_ has joined #ruby
Banistergalaxy has joined #ruby
Liothen has joined #ruby
Guest_ has joined #ruby
<xrfang> I encountered strange problem with ActiveRecord::Base.send(). it seems is a rails problem, but I would like to confirm if send() method is really rails defined, or a basic ruby method?
KL-7 has joined #ruby
mdw has joined #ruby
francisfish has joined #ruby
Shrink has joined #ruby
<arturaz> xrfang, basic ruby method, but it can be redefined
polysics has joined #ruby
<pooffck12342> arturaz do u know anything about whenever by javan?
stefanp_ has joined #ruby
<arturaz> javan?
eldariof has joined #ruby
<pooffck12342> cron asks
<pooffck12342> tasks8
kesor_ has joined #ruby
visof has joined #ruby
<visof> hello
<visof> is there anyone using aws-sdk ?
gyre007 has joined #ruby
arnihermann has joined #ruby
gjaldon has joined #ruby
majoh has joined #ruby
DarkFoxDK has joined #ruby
Nathandim has joined #ruby
ecolitan has joined #ruby
gianlucadv has joined #ruby
falena has joined #ruby
Guest__ has joined #ruby
josephwilk has joined #ruby
ap0gee has joined #ruby
KL-7_ has joined #ruby
ccapndave3 has joined #ruby
fearoffish has joined #ruby
a_a_g has joined #ruby
c0rn has joined #ruby
relix has joined #ruby
Foxandxss has joined #ruby
fr0gprince_mac has joined #ruby
<hemanth> Anyone on Watir 2.0.4 ?
scalebyte has joined #ruby
Guest87241 has joined #ruby
<scalebyte> how can I make this concise ? https://gist.github.com/2204307
<scalebyte> shevy: RubyPanther rippa : how can I make this concise ? https://gist.github.com/2204307
<banisterfiend> scalebyte: you cant your'e lost forever in a realm of verbosity
berserkr has joined #ruby
havenn has joined #ruby
<RubyPanther> scalebyte: you can golf it with a ternary but it will be the same amount of complexity to the computer
<scalebyte> RubyPanther: yes thanks just wanted to know if I can make it anyfurther neat and short !!
<shevy> scalebyte you could use the ternary ? operator
<shevy> you can also use ;
<shevy> :)
<RubyPanther> !!?!??!:!!?!
<shevy> if (current_user == @user); puts "A"; else; puts "B"; end
<shevy> see now it is all on one line
<shevy> ARE YOU HAPPY scalebyte
<RubyPanther> you can take out the parens too
<shevy> it may even be that you wont need all ;
<shevy> and that too
<shevy> WE HAVE KILLED SOME CHARACTERS scalebyte ARE YOU HAPPY
<shevy> he is silent :(
<keymone> scalebyte: puts current_user == @user ? "A" : "B" if @communities.empty?
<scalebyte> shevy: yes I am happy.. I love ruby this way I <3 ruby
<shevy> good!
shtirlic has joined #ruby
archivebot has joined #ruby
<RubyPanther> puts wtf = if current_user == @user ; "A" else "B" end if @communities.empty?
<shevy> he is already happy
<RubyPanther> I just thought an uglier way might be possible
dbgster has joined #ruby
foo-bar- has joined #ruby
kesor_ has joined #ruby
arvidkahl has joined #ruby
Nss has joined #ruby
shift_ has joined #ruby
<RubyPanther> scalebyte: puts @communites.blank?&&([])||false&&'A'||'B'
<RubyPanther> fore!
gtuckerkellogg has joined #ruby
<banisterfiend> RubyPanther: can you sing me something lovely
<RubyPanther> I dunno why I put those parens in
<RubyPanther> puts @communites.blank?&&[]||false&&'A'||'B'
<RubyPanther> ah, much better! be-oi-ti-foal
fbernier has joined #ruby
foo-bar- has joined #ruby
_jak has joined #ruby
<shevy> well done uglified
<matti> Um.
<matti> Emacs?!
<matti> :)
tonini has joined #ruby
<kesor_> thanks a really great presentation
<shevy> well
<shevy> we need an editor for ruby written in ruby
<matti> :)
<kesor> there is vim, with +ruby …
<matti> I like Matz's presentations.
<kesor> is there a good refactoring tool for ruby, like rope for python?
<matti> They have a very humble outlook.
kW_ has joined #ruby
<shevy> kesor well neither vim nor emacs are written in ruby :(
<shevy> extending a ruby editor should be able with .rb files
<shevy> *extending a ruby editor should be possible with .rb files
<kesor> my point being you can extend vim with .rb files
<kesor> textmate too for that matter
<scalebyte> matti: That was a cool presentation :)
<scalebyte> shevy: rubymine is a good one
a_a_g1 has joined #ruby
<shevy> that one requires java or?
<scalebyte> shevy: no try rubymine.. its really a good one
Guedes has joined #ruby
shellox has joined #ruby
<TTilus> emacs needs ruby-bindings too (~/.emacs.rb \o/)
<shevy> System requirements
<shevy> Sun JDK 1.6. (OpenJDK is not supported)
<shevy> yeah, java shit
<shevy> I managed to avoid java for the last ten years, I'll manage for at least ten more years
_jak has joined #ruby
<jlebrech> i have an array of hashes, how can I check the name of each hash k in |k,v| gives me the whole hash, I want to check the hash name.
<shevy> what is a "hash name"
<shevy> jlebrech I think you need to give an example
<jlebrech> h = {"a"=> 2}
<shevy> and the array is where?
<jlebrech> how can i check if it's "a"
<jlebrech> it's an array of hashes
<jlebrech> i'm selecting from the array where the hashes are "a"
<shevy> all your hashes are like that? just one key, one value?
_jak_ has joined #ruby
nari has joined #ruby
<shevy> like that? array = [{"a"=>2}, {"b"=>3}, {"c"=>4}]
sspiff has joined #ruby
frishi has joined #ruby
<jlebrech> yes
<jlebrech> shevy: maybe a big hash is better
<pooffck12342> jlebrech
kesor_ has joined #ruby
<pooffck12342> do u use heroku?
My_Hearing has joined #ruby
<jlebrech> pooffck12342 why you ask?
<pooffck12342> im having some issues with my app on heroku
dekom has joined #ruby
<pooffck12342> do you know how to remove heroku git from my application and start a fresh on on heroku?
<jlebrech> pooffck12342 git remore delete heroku
<jlebrech> remote*
<jlebrech> shevy a hash of hashes i much easier ;)
<pooffck12342> its an unknown command :(
baroquebobcat has joined #ruby
<shevy> well if you want to select something you can usually do via .select
leekspin has joined #ruby
<pooffck12342> is it rm? or delete
<shevy> {"FgH"=>6, "i"=>7, "j"=>7, "d"=>4, "e"=>5, "c"=>3, "a"=>1, "b"=>2}.select {|key, value| key.size < 2 } # => [["b", 2], ["a", 1], ["c", 3], ["e", 5], ["d", 4], ["j", 7], ["i", 7]]
<shevy> hmm
<shevy> my hash got truncated :P
<shevy> oh, seems to be fine
<leekspin> Hey, how does one work with binary data in ruby ? Should I hold them as strings ? Because I need to unpack this data after reading, for example with string#unpack
pkondzior has joined #ruby
ZachBeta has joined #ruby
<scalebyte> shevy: why do you hate java so much ?
baroquebobcat has joined #ruby
nikhil_ has joined #ruby
<shevy> scalebyte it is a language that sells itself by the amount of lines a java programmer can create. the more lines, the better, the more worth things are that were created
PsiliPharm has joined #ruby
ZachBeta has joined #ruby
jmfcool has joined #ruby
nanderoo has joined #ruby
deadly_hcs has joined #ruby
deadly_hcs has joined #ruby
deadly_hcs has joined #ruby
deadly_hcs has joined #ruby
boram has joined #ruby
pawdro has joined #ruby
deadly_hcs has joined #ruby
deadly_hcs has joined #ruby
<pawdro> hello, can anyone point me direction how to start writing parser of logical expressions in ruby?
<matti> pawdro: Define "logical expressions"
<pawdro> matti: i want to build the tree of expression like: (a&b) | (~b&c)
<Sp4rKy> .W 1
deadly_hcs has joined #ruby
zetm has joined #ruby
<RubyPanther> emacs is written mostly in C, it should be easy enough to replace LISP with Ruby for scripting
arium has joined #ruby
davidpk has joined #ruby
<arium> Hey guys. Are there some tools to profile ruby scripts to see execution time for each method and see call graphs? I would like to see general image how Sinatra framework works
a_a_g has joined #ruby
<arium> keymone: nice, thanks
<matti> pawdro: Read about building parsers and lexers in Ruby, and about BNF / AST Tree.
arium has quit [#ruby]
<matti> pawdro: Or go crazy with regular expressions.
pi3r has joined #ruby
<pawdro> matti: good point about regular expressions - it's like madness for me ;]
<pawdro> matti: thanks, i'll surely read about all this
<matti> Hold on.
<matti> Eh, I never remember this project.
<matti> There is a lexer for use in Ruby.
ZachBeta has joined #ruby
neohunter has joined #ruby
<neohunter> Hey im using rails, i want to put a script that doesnt use the framework, just a small script, where (what fodler) should i put it on?
fixl has joined #ruby
boram has quit ["Leaving"]
<keymone> neohunter: scripts?
KL-7 has joined #ruby
<neohunter> yeah, a file with code o.o?
<neohunter> i just want to do some testing
<neohunter> im absolutly new to ruby
<keymone> then put it anywhere if it's just testing
neohunter has quit [#ruby]
neohunter has joined #ruby
BiHi has joined #ruby
greywolf` has joined #ruby
abstrusenick has joined #ruby
eldariof has joined #ruby
phantomfakeBNC has joined #ruby
gtuckerkellogg has joined #ruby
<JohnBat26> hello
<JohnBat26> Does anybody get error in native.so: undefined symbol: curl_multi_init in typhoeus
<JohnBat26> ?
dkamioka has joined #ruby
dekom has joined #ruby
`brendan has joined #ruby
iamjarvo has joined #ruby
pu22l3r has joined #ruby
Guest23751 has joined #ruby
waxjar has joined #ruby
Sailias has joined #ruby
Guedes has joined #ruby
Guedes has joined #ruby
KL-7 has joined #ruby
dbgster has joined #ruby
KL-7 has joined #ruby
_null has joined #ruby
d3vic3 has joined #ruby
Nss_ has joined #ruby
_null has joined #ruby
KL-7_ has joined #ruby
cobranet has joined #ruby
_null has joined #ruby
KL-7__ has joined #ruby
_null has joined #ruby
KL-7__ has joined #ruby
<cpasmoi> Hi
waxjar has joined #ruby
heftig has joined #ruby
cha1tanya has joined #ruby
<cpasmoi> Do you use a particular conf file in vi(m) in order to have a ruby indent ?
td123 has joined #ruby
<telling> cpasmoi: "a ruby indent"?
_null has joined #ruby
wefawa has quit [#ruby]
<telling> cpasmoi: i would guess that 'filetype indent on' is enough.
<cpasmoi> well, I can auto indent a ruby file (through the indent fonction) but it seems quite awful (everything on one column)
<cpasmoi> i'll see if this conf is enabled
_null has joined #ruby
adman65 has joined #ruby
delinquentme has joined #ruby
heftig_ has joined #ruby
<Tasser> cpasmoi, gg=G
twinturbo_ has joined #ruby
greywolf` has joined #ruby
_null has joined #ruby
<cpasmoi> yup Tasser
<cpasmoi> that's what I use
<Tasser> cpasmoi, :filetype ruby
<cpasmoi> ok
<Tasser> or :set filetype ruby
<cpasmoi> I'm on a laptop I don't regulary use for dev, the filetype plugin indent was disabled
twinturbo has joined #ruby
<cpasmoi> thank you =)
sspiff has joined #ruby
sspiff has joined #ruby
twinturbo has joined #ruby
_null has joined #ruby
antonishen has joined #ruby
<visof> i'm using ruby aws-sdk for creating ec2 instance but i can't access the instances via ssh also i added security_group and key_pairs
<visof> but i got connection time out on port 22
<visof> can anyone help me in that pleasE?
moeSeth has joined #ruby
simpleharmonicmo has joined #ruby
[[thufir]] has joined #ruby
shruggar has joined #ruby
<[[thufir]]> https://gist.github.com/2204838 works kinda ok, but I'm only after the message ID. do I need a regex to find the message ID line first?
Sailias has joined #ruby
dn2k has joined #ruby
gtuckerkellogg has joined #ruby
<rippa> yes
<rippa> next unless <your regexp here>
<rippa> if message ID is on one lijne
<[[thufir]]> yes, it's a usenet message.
<[[thufir]]> ok, err, unfair question, can you just tell me the regex for that particular one?
<rippa> I don't know what message id line looks like
yoklov has joined #ruby
gianlucadv has joined #ruby
<[[thufir]]> Message-ID: <ce804b16969af8cb282f84efa6574c79@msgid.frell.theremailer.net>
<rippa> /^Message-ID:/
foo-bar- has joined #ruby
<[[thufir]]> ok. thanks.
bglusman has joined #ruby
bglusman has joined #ruby
acekiller has joined #ruby
bglusman_ has joined #ruby
apeiros_ has joined #ruby
heftig_ has joined #ruby
Beoran_ has joined #ruby
ChampS666 has joined #ruby
<[[thufir]]> http://rubular.com/r/ifiTuJNNDo how are the forward slashes escaped?
<Tasser> [[thufir]], \/
<nw> rubular inserts the forward slashes automatically
<Tasser> oh, right
<nw> so you can just leave them out
<nw> also, the string doesn't actually begin with "M", so it still won't match
dv310p3r has joined #ruby
<relix> hey guys
<nw> so you'll have to do something like ^\s*Message-ID:
<relix> I have a string that is a representation of a binary file (a JPEG file to be exact)
adaoraul has joined #ruby
<relix> e.g. here's the first few characters: "ÿØÿà\u0000\u0010JFIF..."
<nw> or, if you want to avoid fighting with regexps, you could just do next unless line.include?('Message-ID:')
liluo has joined #ruby
<[[thufir]]> thx
<relix> note how \u0000 and \u0010 represent the null-byte and the 16-byte respectively
<relix> what's the easiest way to convert this to binary?
<relix> so that instead of \u0000, an actual null-byte is in its stead
<[[thufir]]> well, I don't a tussle, provided I win. (need to figure it out someday)
philcrissman has joined #ruby
<nw> [[thufir]]: well, http://ruby.runpaint.org/regexps is quite detailed
greywolf` has joined #ruby
<[[thufir]]> thanks. I think I sorta am getting it.
wyhaines has joined #ruby
mdw has joined #ruby
geekbri has joined #ruby
jrist has joined #ruby
releod has joined #ruby
badelat has joined #ruby
<scalebyte> This method works fine but how can I improve it further to check for only LinkedIn URLs alone. -> https://gist.github.com/2205006
Ammar01 has joined #ruby
<nw> uri.host.include?("linkedin.com")
<[[thufir]]> if (line =~ ^\s*Message-ID:) gives unexpted tlabel. is it better to use scan?
crankycoder has joined #ruby
<nw> [[thufir]]: you need to use forward slashes there... if (line =~ /^\s*Message-ID:/)
kremiak has joined #ruby
alanp_ has joined #ruby
dbgster_ has joined #ruby
<[[thufir]]> aha, thanks, guys for the help. my masterpiece: https://gist.github.com/2205083
jgarvey has joined #ruby
Teomari has joined #ruby
shtirlic has joined #ruby
theRoUS has joined #ruby
theRoUS has joined #ruby
<geekbri> Anybody have any clue why File.executable? would return false on a file that is clearly exectuable.
Synthead has joined #ruby
<geekbri> ugh nevermind.
robkinyon has joined #ruby
<cpasmoi> hum, i don't understand why require 'getoptlong' creates an error 'no such file to load' where I have the getoplong.rb in my laptop....
llaskin has joined #ruby
<llaskin> is there a way to require a file that is "one up" in the directory tree"?
<cpasmoi> and when i create a GetoptLong.new I have an error 'uninitialized constant Object::GetoptLong (NameError)'
Morkel has joined #ruby
bbttxu has joined #ruby
<cpasmoi> llaskin: require_relative
<cpasmoi> i guess
phantasm66 has joined #ruby
qwerxy has joined #ruby
Sailias has joined #ruby
sbanwart has joined #ruby
kevinbond has joined #ruby
<llaskin> cpasmoi: yea but ruby 1.8.7 so no require relative, so another question why can't i do something like "require 'dir/dir2/dir3/file.rb'" ?
<llaskin> it seems it won't let me go down multiple folders...
polysics has joined #ruby
<cpasmoi> mhe
nanderoo has joined #ruby
Jackneill has joined #ruby
MetaCosm has joined #ruby
<llaskin> mhe?
pkondzior has joined #ruby
liluo_ has joined #ruby
internet_user has joined #ruby
<shevy> she
<shevy> llaskin in ruby just use the absolute path. if you want the relative, use "../../bla"
<llaskin> ok
<llaskin> i guess is what i will have to do
araujo has joined #ruby
araujo has joined #ruby
crodas has joined #ruby
nemesit has joined #ruby
brandoncordell has joined #ruby
<cpasmoi> I still don't understand why require 'getoptlong' creates an error 'no such file to load' where I have the getoplong.rb in my laptop....
Teomari has joined #ruby
<cpasmoi> (i've tried a symbol link from 1.9.2 to 1.9.1 and the absolute path as well)
tatsuya_o has joined #ruby
<brandoncordell> Sorry for the newbish question but I'm trying to write a loop that I don't exactly know how to tackle. Basically I have a list of proxies (host and port) in a hash. I want to loop through the hash, and only continue to the next key-value pair if an exception is not raised. What's the best way to approach that?
<cpasmoi> .each , rescue, break ?
ryannielson has joined #ruby
pyreal has joined #ruby
<shevy> set a flag variable, then use .each_pair, and dont continue if the flag variable has the wrong value
rbanffy has joined #ruby
<brandoncordell> cpasmoi: do I need to use a begin block?
<brandoncordell> or can I just use recuse
<brandoncordell> rescue*
senthil has joined #ruby
moeSeth has joined #ruby
EvanR has joined #ruby
<senthil> is it code smell to use Module for singleton pattern?
<shevy> brandoncordell you use rescue when you want to rescue an exception that occurs
waxjar has joined #ruby
<shevy> begin; faulty_code_that_can_break_goes_here; rescue; end
patricksroberts has joined #ruby
mafolz has joined #ruby
greywolf` has joined #ruby
sbanwart has joined #ruby
DrShoggoth has joined #ruby
Dreamer3 has joined #ruby
<scalebyte> This works fine but how can I improve it and do more stronger validation ? https://gist.github.com/2205006
saidin has joined #ruby
csavola has joined #ruby
<shevy> why are you not happy with this scalebyte
EvanR has joined #ruby
Guest38111 has joined #ruby
PaciFisT has joined #ruby
Drewch has joined #ruby
spanx has joined #ruby
svnlto has joined #ruby
davidboy has joined #ruby
avandendorpe has joined #ruby
mengu has joined #ruby
davidpk has joined #ruby
BryanWB_ has joined #ruby
<banisterfiend> Tasser: hey tazz
<scalebyte> shevy: I guess there should be better ways of improving the validation especially the string validation rather than the url validation
carlyle has joined #ruby
<shevy> aha
cjlicata has joined #ruby
si14 has joined #ruby
<scalebyte> shevy: How can I add a custom error message to rescue here https://gist.github.com/2205006 ? "Invalid Linkedin URL" ?
flingbob has joined #ruby
lateau has joined #ruby
<shevy> rescue URI::BadURIError
axl_ has quit [#ruby]
<shevy> you rescue it. you can use the block.
<shevy> either use puts "blablabla error happened" in that block
<shevy> or handle it via your error class
ziyadh has joined #ruby
kalv has joined #ruby
arnihermann has joined #ruby
<scalebyte> shevy: thanks
jhowarth has joined #ruby
randym has joined #ruby
alex__c2022 has joined #ruby
maletor has joined #ruby
alx- has joined #ruby
kapowaz has joined #ruby
Sailias_ has joined #ruby
tvw has joined #ruby
LMolr has joined #ruby
adambeynon has joined #ruby
relix has joined #ruby
Sailias_ has joined #ruby
s14 has joined #ruby
zetm has joined #ruby
Sailias_ has joined #ruby
aeu has joined #ruby
Sailias_ has joined #ruby
ed_hz_ has joined #ruby
chimkan has joined #ruby
gokul has joined #ruby
pdtpatr1ck has joined #ruby
Vert has joined #ruby
io_syl has joined #ruby
daniel_hinojosa has joined #ruby
rippa has joined #ruby
Sailias has joined #ruby
jay has joined #ruby
ghvandoorn has joined #ruby
jml75 has joined #ruby
<jml75> Hi guys !
<jml75> I need some help with a little problem I have with md5 hases.
ph^ has joined #ruby
fmcgeough has joined #ruby
<jml75> I need to be able to convert existing md5 hexdigests to raw digests. Is this possible?
uris has joined #ruby
<jml75> I'll explain. If I do : Digest::MD5.digest('password'), I get a raw MD5 digest...
lkba has joined #ruby
<jml75> Then if I do : Digest::MD5.digest('password').unpack("H*")[0], then I get the same output that if I did Digest::MD5.hexdigest('password')...
tatsuya_o has joined #ruby
eldariof has joined #ruby
<jml75> But how can I do the opposite in ruby ? How can I go from an hexdigested MD5 string to the raw form ?
lectrick has joined #ruby
gokul has joined #ruby
cha1tanya has joined #ruby
williamcotton_ has joined #ruby
mcwise has joined #ruby
polysics has joined #ruby
yoklov has joined #ruby
<lectrick> What's the best way to debug the require order in a ruby/rails app?
Nathandim has joined #ruby
devinus has joined #ruby
bondar has joined #ruby
jangell has joined #ruby
<scalebyte> How can I Handle such exception ? https://gist.github.com/2205006
wilmoore has joined #ruby
drake10 has joined #ruby
gift has joined #ruby
wyhaines has joined #ruby
bricker88 has joined #ruby
jonathan__ has joined #ruby
eph3meral has joined #ruby
phantomfakeBNC has joined #ruby
Nathandim has joined #ruby
jgrevich has joined #ruby
hydrozen has joined #ruby
Limb has quit [#ruby]
Limb has joined #ruby
pdtpatr1ck has joined #ruby
<zaargy> not sure why you wouldn't just use a regexp there
<zaargy> put the uri parse bit in a begin rescue block and add to errors when it's invalid
snip_it has joined #ruby
<matti> zaargy: +1
davidcelis has joined #ruby
troessner has joined #ruby
froy has joined #ruby
stringoO has joined #ruby
Richmond has joined #ruby
kpshek has joined #ruby
Tomasso has joined #ruby
Jake232 has joined #ruby
jangell has joined #ruby
<zaargy> matti: you're everywhere ;)
<matti> zaargy: :)
llaskin has quit [#ruby]
<matti> zaargy: Don't look under your bed then ;p
carlyle has joined #ruby
artOfWar has joined #ruby
gianlucadv has joined #ruby
chimkan_ has joined #ruby
cbuxton has joined #ruby
<LMolr> is it possible to hijack a gem requirement? I am trying to install gem metric_fu on MRI 1.9.3 , which requires 'rcov', which doesn't compile on 1.9.3
SegFaultAX|work has joined #ruby
<LMolr> rcov suggests "Please switch to simplecov", so i assume i can use that as dependency
nari has joined #ruby
artm has joined #ruby
srid has joined #ruby
<zaargy> matti: ek scary
eka has joined #ruby
artOfWar has joined #ruby
savage- has joined #ruby
eywu has joined #ruby
pawdro_ has joined #ruby
Eiam has joined #ruby
fbernier has joined #ruby
<shevy> penis
cha1tanya has joined #ruby
cloke has joined #ruby
superguenter has joined #ruby
ipoval has joined #ruby
superguenter1 has joined #ruby
jbw has joined #ruby
<matti> zaargy: :)
mxweas_ has joined #ruby
<matti> shevy: Oh noess!
<matti> shevy: s/penis/pants/
<matti> shevy: There might be women with small children here!
<matti> ;p
<shevy> that should have scared them away
<shevy> now we can talk about the real things again
<shevy> fast cars
<shevy> beer
<RubyPanther> chics dig Ruby
<shevy> digging ruby chicks
antillas21 has joined #ruby
timonv has joined #ruby
<shevy> I hate gnome 3
<shevy> we need something new
<shevy> this bounty system ...
<shevy> pledge or what's its name
snearch has joined #ruby
<shevy> we need that to assign to developers
<shevy> go and shoot em down
DrShoggoth has joined #ruby
<[[thufir]]> trying to match message-id: https://gist.github.com/2205083 but it reports "no match" . regex or ruby problem?
Nathandim has joined #ruby
_adeponte has joined #ruby
<shevy> you should use rubular
<RubyPanther> shevy: why something new not something old?
<shevy> RubyPanther because we dont have anything working to kill devs right now :(
<davidcelis> LMolr: fork the gem on github, change the dependency on your repo, then link your Gemfile up to that repo
<shevy> [[thufir]] http://rubular.com/
<shevy> [[thufir]] you can see your regex matches to the given strnig
<davidcelis> LMolr: People have reported this issue to the gem authors https://github.com/jscruggs/metric_fu/issues/79
<[[thufir]]> ok
Liothen has joined #ruby
<RubyPanther> [[thufir]]: it is very strange to use the else to assign the result of puts to the var. Maybe it is intended but it looks like a bug.
<davidcelis> LMolr: But it looks like metric_fu hasn't been touched for seven months.
eldariof has joined #ruby
<davidcelis> LMolr: Hell, looks like the gem author hasn't even touched GitHub for ten months
zakwilson_ has joined #ruby
deryl has joined #ruby
fbernier has joined #ruby
robkinyon1 has joined #ruby
bluenemo has joined #ruby
bluenemo has joined #ruby
kaichanvong has joined #ruby
<[[thufir]]> RubyPanther: oh, I'm probably using case wrong.
<[[thufir]]> ok, so it's not the regex. in the first pass, no match, second pass, same file, same regex, it matches. so the case is wrong/buggy? https://gist.github.com/2205083
<LMolr> davidcelis: thank you, i take a try :)
jrgifford has joined #ruby
jrgifford has joined #ruby
<RubyPanther> [[thufir]]: think about what case does. What is the when shorthand for?
<[[thufir]]> when is for if.
<RubyPanther> yes but what sort of if? case foo ; when bar that is like saying if bar === foo
<RubyPanther> so you have if (line =~ /^\s*Message-ID:/) === line
<RubyPanther> that is unlikely to become true
<RubyPanther> shorter: don't use case, use if/elsif
<RubyPanther> unless you really do have some reason to prefer === over == _and_ you have a lot of whens that need to have repetition removed
<[[thufir]]> oh, == versus = . doh. ok, plus, well, what I want to do isn't what I coded.
sandGorgon has joined #ruby
<RubyPanther> Mostly when case is useful is when you say case foo ; when String ...
sandGorgon_ has joined #ruby
<RubyPanther> But that only works for base classes in the rare case where you're totally sure that it wouldn't be a duck
yoklov has joined #ruby
<shevy> I like ducks
<[[thufir]]> right, the line. case (message id) then h.id = something, case (content) hten content = something else is what I want. kinda sorta getting syntax.
<[[thufir]]> line is a string here.
<RubyPanther> yeah, ducks are awesome, and they hate case
* [[thufir]] goes off to futz with case
<RubyPanther> use backspace
kreantos has joined #ruby
<kreantos> hi
<kreantos> did anyone of you ever tried to query dbpedia with ruby?
<RubyPanther> [[thufir]]: Consider, if it isn't already clear: puts case Object.new ; when true ; "true" else "false" end
<shevy> my code is duck approved and the longest case when menu I have is about 2000 lines of proud code
<RubyPanther> true === Object.new will always be false.
mcwise has joined #ruby
pastjean has joined #ruby
pastjean has joined #ruby
pooffck12342 has joined #ruby
jmfcool has joined #ruby
sonkei has joined #ruby
ringotwo has joined #ruby
nfluxx has joined #ruby
<RubyPanther> [[thufir]]: if you do use case with regexes, this is how: case "zomg" ; when /(omg)/ ; "O M G" else "fail" end => "O M G"
<RubyPanther> because it will do /(omg)/ === "zomg" which is another way to match
apok has joined #ruby
<[[thufir]]> the "if" for cats works, but the case doesn't. https://gist.github.com/2206528 ok, let me read all your helpful posts, pardon I was googling stuff. thanks for the help.
ChampS666 has joined #ruby
<RubyPanther> It ___literally___ converts that to (s =~ /Cats(.*)/ ) === s before it runs it
Jake232 has joined #ruby
<[[thufir]]> I don't know ===. I know == and = . need to google that.
<RubyPanther> Just don't use case and you won't have to worry what it does. ;)
<[[thufir]]> lol. I want === because that's used for case. so, what's wrong with === operator. that's specific for testing within case
Maxou56800 has joined #ruby
<RubyPanther> You're trying to put a whole condition into the when, you already are trying to do an if elsif you just think it is called case
<[[thufir]]> can I use begin/end or something?
bragh has joined #ruby
<RubyPanther> *boggle*
sacarlson has joined #ruby
<[[thufir]]> ok. maybe I'm going at this the wrong way. the e-mail/usenet post/whatever has values like "message-id" on each line. case:messageid, then h.id= something. case:from, then h.from = whatever. like that, does that make sense for the desired result?
ringotwo has joined #ruby
ringotwo has joined #ruby
<RubyPanther> [[thufir]]: if you just listen and stop using case and use the normal Ruby idiom which is if, then it will be _easy_
<[[thufir]]> hmm.
<rippa> or you can use case
<rippa> without argument
<rippa> not "case line"
<rippa> just "case"
<[[thufir]]> oh? how so pls?
<LMolr> davidcelis: found latest metric_fu fork: https://github.com/japgolly/metric_fu .. the issue about RCov looks fixed (now i try it)
<RubyPanther> Maybe in some other language case does something different than what it does in Ruby, and is useful for general cases. In Ruby it is useful for only specific cases, and even then, it does nothing extra. It is not faster than the if/elsif would be. It saves a small amount of typing when all you want, for every condition, is to call the === method on the new object with the old object as the argument
Notimik has joined #ruby
ballpointcarrot has joined #ruby
artm has joined #ruby
<rippa> like this
iamjarvo has joined #ruby
<Notimik> hi, is it possible to list or set breakpoint in sub modules with the ruby debugger?
greenarrow has joined #ruby
adamkittelson has joined #ruby
<[[thufir]]> it's not the typing. I'm just not using it right. no worries, thank you all for the patience.
froy has joined #ruby
<Notimik> or do have to use require 'ruby-debug' ?
Oog_ has joined #ruby
<Oog_> in a my class' initialize i call a function with a block and in the block i access an instance variable @properties. there is no accessor for @properties. is it thus accessible in the block?
<RubyPanther> if it wasn't about typing you would have switched to if/elsif as soon as you found out it is the appropriate idiom
stkowski has joined #ruby
shadoi has joined #ruby
<RubyPanther> Oog_: yes, accessors are only accessors because you're going to use them that way, they have no special magic and instance variables are never protected or hidden
bbttxu has joined #ruby
<Oog_> it seems like it isnt though...
<Oog_> if i add attr_accessor :properties then my code works...
<Oog_> let me paste
<RubyPanther> attr_accessor it just metaprogramming that creates a getter and setter
<RubyPanther> the instance var still doesn't exist until you assign to it
<Oog_> with line 15 commented out nothing is printed via the puts and i see @properties={"hi"=>"test", nil=>nil}
Araxia has joined #ruby
<Oog_> hmm well with line 15 in the code the puts works
<RubyPanther> Oog_: and you're never even calling self.properties or self.properties= so the attr_accessor doesn't even matter
<Oog_> but i still get @properties={"hi"=>"test", nil=>nil}> ...
<Oog_> so this code should be the same regardless of line 15 right...?
<RubyPanther> yeah
<Oog_> it isnt...
<RubyPanther> step back and ask yourself... are you sure?
<Oog_> that is why im perplexed
releod has joined #ruby
<Oog_> ive tested it twice now...
<RubyPanther> something else probably changed
<[[thufir]]> RubyPanther: http://www.tutorialspoint.com/ruby/ruby_if_else.htm at the bottom :) I think that's what I want
<Oog_> hmm ok i think you are right there must hbeen a network problem...
<shevy> Oog_, "Pastebin.com is under heavy load right now"
<shevy> why dont you use pastie.org it has nicer colours and doesnt complain about traffic
<RubyPanther> [[thufir]]: (3..6) === 5
<RubyPanther> => true
<Oog_> something else is wrong with my code :(
<Oog_> ill figure it out but i have another question - in ruby do people do lazy instantiation via the getters/setters
<Oog_> like in objectivec - is taht good style?
<Oog_> and to not directly access the ivars
<shevy> what is lazy instantiation
<RubyPanther> Oog_: many do, yes
<Oog_> in the getter you do if x == nil then x = Blah.new end return x
<RubyPanther> I often use only the getters/setters even directly inside my class
<shevy> in the method - yes
<shevy> you get more options when you use methods to access important ivars
c0rn has joined #ruby
<RubyPanther> it makes it more monkey(patch)-friendly
theRoUS has joined #ruby
theRoUS has joined #ruby
<Oog_> what is monkey patch
<shevy> god patching
<shevy> I dont know what it has to do with using methods however, let RubyPanther explain his ponies and unicorns to you
<RubyPanther> When you re-open the class and change stuff.
<csavola> Oog_: fiddling with a defined class
<RubyPanther> so if you want to method chain your setter, you can
<shevy> my cat conquered my worktable :(
<RubyPanther> and the class itself then respects the changes. It loves your monkey! Good idea, add a Star-Monkey!
zodiak has joined #ruby
<shevy> Oog_ don't read that page, it is purely propaganda
<csavola> shevy: propaganda?
<shevy> yes
<csavola> shevy: care to elaborate?
linoj has joined #ruby
<shevy> csavola sure. it is a feature simply where you modify the behaviour of already existing code classes/methods. that's it.
<csavola> shevy: how does that make the wikipedia page propaganda? It simply moves into common uses and pitfalls
<RubyPanther> If they try to describe monkey patching as "duck punching" you know you've left the Pride Lands and should hurry home.
voodoofish430 has joined #ruby
randomperson has joined #ruby
<randomperson> hey guys--how would I install this https://github.com/dkastner/Socket.io-ruby and use it in Cramp like it says?
<shevy> csavola the term itself is pure propaganda as it has a negative connotation.
<csavola> The etymogology is retarted I agree..
<csavola> *etymology
<shevy> why aren't modifications to singletons called monkey patching?
cjlicata has joined #ruby
codespectator has joined #ruby
<shevy> aside from singletons not being as powerful as when you apply god patching ;)
<[[thufir]]> RubyPanther: https://gist.github.com/2205083 the case which I was after :)
<shevy> duck punching is even worse. I dont think I know anyone using that term
swarley has joined #ruby
<[[thufir]]> rippa: thx
<shevy> why would you want to punch ducks anyway?
<swarley> because
<swarley> damn ducks and their smug faces
<csavola> shevy: cause they are scarey and always watching?
<swarley> thinking theyre better than me
<shevy> swarley, I'd take a duck into bath, not sure I'd take you :)
<RubyPanther> [[thufir]]: honestly that is awful code, there is _no_reason_ not to just use an if there, and lots of reasons not to... for example, the giant pit you already fell into trying to use case for an if
<shevy> but you are right, they have smug faces
<RubyPanther> When a duck gets out of hand, you don't punch it, you give it a strict lesson... http://stuff.rubypanther.com/images/ducktyping.png
Ankhers has joined #ruby
<shevy> what is that cat doing with the stick
<shevy> and why is it masked
<shevy> what is it trying to hide
looopy has joined #ruby
<shevy> we should help the poor duck
<csavola> It's Tiger Zoro... who doesn't use a sword cause Tigers don't need swords
<[[thufir]]> RubyPanther: yes, probably. I don't know how to write nice code. thanks, again.
<shevy> I swear this is the first gay cat I ever saw in my life
<shevy> for cats with style, watch aristocats
<Oog_> ok back to my accessor... should self.accessor work in a block?
<shevy> hmm or that movie where there is the cat detective examining a murder
<shevy> Oog_ what are you doing
<shevy> why do you want to do self.accessor
<shevy> who gave you that idea Oog_
<Oog_> NoMethodError: undefined method `[]=' for nil:NilClass
<shevy> we need to identify these people and kill them
<Oog_> shevy: bad habits from objectivec...
<shevy> no that cant be
<shevy> because you must have seen self. before
<csavola> Oog_: I am going to go with the fact that the accessor is at the bottom of the file it is shadowing your getter
<Oog_> well im use to this in c++
<Oog_> csavola: ah
<Oog_> interesting
<shevy> you should try to make the code shorter
<shevy> @properties = Hash.new if @properties == nil
<csavola> Oog_: change attr_accessor to attr_writer
davidd___ has joined #ruby
<shevy> if element rather than if (element)
<Notimik> hi, is it possible to list or set breakpoint in sub modules with the ruby debugger?
<csavola> Oog_: which will only define a setter since you are defining the getter manually
eric_crane has joined #ruby
Faris has joined #ruby
<swarley> i think its funny i use ruby so much, and know nothing at all about rails
<shevy> Oog_ usually initialize is the first method
dhruvasagar has joined #ruby
<shevy> swarley, hah same here
mdw has joined #ruby
<shevy> I know there is model view controllers. that's it I know about rails
<Oog_> it works!
<swarley> yeah
<swarley> i know basic application
baroquebobcat has joined #ruby
<shevy> perhaps I should write a browser game with rails one day
<Oog_> so shevy besides it working is this a bad way to do things
<shevy> I am just so lazy :(
<swarley> im going to make something in it now
<shevy> Oog_ dunno. yeah. I dont like your code. so it is bad :)
<csavola> Oog_: a dive into meta-programming will explain why it happened
<shevy> swarley code a web shop
<swarley> wut
<Oog_> csavola: i get the basic idea
mdw_ has joined #ruby
aantix has joined #ruby
<swarley> Oog_, you dont need the then
<davidcelis> Oog_: @properties ||= {}
<swarley> if its a multiline
<davidcelis> is a wayyyy shorter way to do `def properties`
<swarley> also
<swarley> yeah
<swarley> i was about to say that
<shevy> I want matz to make a video on youtube
<swarley> about?
<davidcelis> Oog_: And why is your multiline block using curly braces?
<shevy> the future
<Oog_> davidcelis: because im new to this
<davidcelis> Oog_: either make that block in initialize a single line (which it's short enough to do so) or switch to do-end
<swarley> it could easily be a one line as well
<shevy> davidcelis, because curly braces are cuter than round ones :>
<swarley> lol
<Oog_> ok ive made it one line
jxpx777_ has joined #ruby
<Oog_> looky this i went all fancy element.each { |child| self.properties[child.name] = strip_tags(child.text) } if element
<Oog_> i put the if at the end
wilmoore has joined #ruby
<swarley> very nice
<Oog_> swarley: what do yo umean i dont need the then
<swarley> the `then'
releod has quit [#ruby]
superguenter has joined #ruby
<swarley> you only need `then' if you do if(blah) then puts 'hi' else puts ':[' ende
<swarley> end*
<davidcelis> Oog_: In your `def properties`
<swarley> if its a multiline if, then is assumed
<Oog_> so you only need then when there is an else?
<swarley> no
<davidcelis> Oog_: you never need then
<swarley> if its a one line expression you need it
<Oog_> ohhhhh
<Oog_> i see
<Oog_> i changed it to simply @properties ||= {}
<davidcelis> Oog_: But really, def properties should just do `@properties ||= {}`
<davidcelis> good
<davidcelis> :)
<davidcelis> you know what ||= does right?
deadly_hcs has joined #ruby
<Oog_> makes it equal itself if it is non nil else {}
<davidcelis> right
<Oog_> properties = properties || {} right?
<davidcelis> it also returns @properties
releod has joined #ruby
<Oog_> yes
releod has quit [#ruby]
<Oog_> ruby is quite different from all the languages im used to so this should be intersting...
<davidcelis> that's way better, by the way
<swarley> yes much
<davidcelis> your second pastie
<davidcelis> one nitpick though, i don't think people tend to reduce the indentation of `protected` or `private` like that
<davidcelis> or at least, i don't. i don't actually know what the convention on that is.
<Oog_> everything should be indented one more level?
<Oog_> or i guess just protected and down
shruggar has joined #ruby
<swarley> i've never used protected
<swarley> or public, or private
<davidcelis> Oog_: No I mean, it should be at the same indentation level as your method definitions
<Oog_> oh
<Oog_> ok i can do that thanks
<davidcelis> Oog_: It's doesn't start a block itself, so it would just sit at the same indentation level
<davidcelis> It doesn't*
<rippa> public, private and protected are just methods
<davidcelis> yep
<swarley> lolwut
<swarley> there is an emoji file in the ruby source?!
<Oog_> can you have one line method efs?
<Oog_> defs ?
<swarley> yes
<swarley> you use ; to denote where the newline would be
<Oog_> def params; @params ||= {}; end
<Oog_> good or bad?
<swarley> uh
<swarley> tough call
<csavola> Oog_: ugly
<Oog_> ok ill avoid that
ycy has joined #ruby
<ycy> hi there
<davidcelis> Oog_: If it's just a one-liner that returns a boolean, it's perfectly fine
<davidcelis> though something like this is better
<ycy> I have a class (FooClass) with two class variable (@@A, @@B): is there a way to declare a public access to these class variables? Something like attr_reader :A, :B
<shevy> no
<ycy> so i have to manually declare a def function that returns the values?
<davidcelis> Oog_: You can avoid the semicolons if you stick parens on the method def
<davidcelis> Oog_: def method() true end
dkamioka has joined #ruby
gysi has joined #ruby
<swarley> def A; return @@A; end; def A=(a); @@A = a; end
<gysi> ciao
<gysi> !list
<swarley> o/
<gysi> \list
<ycy> oh god
<ycy> i'm italian too
<swarley> lol
<ycy> ok, thanks davidcelis, swarley
<gysi> cm faccio a far comparire la lista raga?
<rippa> but you can do it with instance vars
<Oog_> interesting
<ycy> non e' un canale dove scaricare
<rippa> class << klass; attr_accessor :foo; end
<ycy> ti conviene uscire, gysi
<rippa> *Klass
<ycy> (sorry for the italian, i was just saving you some other dumb questions from him)
<Oog_> ok last question for now - when should you use self and when not? it is optional like 'this' in c++ right unless you need to differentiate between shadowing right?
<gysi> ma che dici ho scaricato una versione di mirk dove non sono abituato rippa
<Oog_> ie if i have a private method config should i self.config or config in init
<shevy> ycy you can return those class variables via a method, but a more important question is why you really need class vars and not instance vars
twinturbo has joined #ruby
<swarley> Oog_, self isnt needed unless you're doing something like
<swarley> self[]
<swarley> if you have the [] method define
<swarley> or
<shevy> I think active record has cattr_reader specifically for class variables, but it is such an ugly hack
<rippa> or self.class
<RubyPanther> shevy: You don't have to be gay to be a Madonna fan, haven't you seen the Human Nature video?
<swarley> if you are doing an operation on the instance
<davidcelis> Oog_: yep, most of the time self is explicit if you've defined a method that you're calling
<ycy> shevy: they are constant but must be accessed from another class
<csavola> Oog_: Correct you only "need" it for shadowing or the bracket methods... you may want it for clarity though
<davidcelis> er, implicit*
gysi has quit [#ruby]
<RubyPanther> And for the record, we don't know this duck's gender, we only know it looks and quacks like a duck
<shevy> RubyPanther I dont think I have seen that video. and madonna today is a shadow of her former self
<RubyPanther> even Goddesses age
eric_crane has joined #ruby
<ycy> given the question by swarley , I can change my point of view: is there a way that a class access the class variable from another class (without specifying getters/setters)?
schovi has joined #ruby
<Oog_> wait one more question... i want my object to respond to foo.X where x is anything... is there like a wildcard method
<csavola> Oog_: method_missing
<davidcelis> ^
<RubyPanther> ycy: not without asking the class that owns it, so yes or no depending on what you meant
<davidcelis> Oog_: that sounds like a bad idea though
<davidcelis> Oog_: you cannot possibly define infinite methods
<ycy> RubyPanther: what do you mean by "asking the class" ?
<rippa> you don't need to
<davidcelis> Oog_: why would you want to do that?
<rippa> with method_missing
<davidcelis> rippa: correct, but WHY would he want to do this?
<Oog_> so there is a Hash @properties but i dont want to make @properties public
<Oog_> but i dont want to define all the getters for the properties that are valid
<Oog_> so i just want to do foo.a or foo.b and if a exists then i return self.properties["a"]
banisterfiend has joined #ruby
<Oog_> if not itll just return nil or ""
<rippa> davidcelis: at Aperture Science we don't ask "why?", we ask "why not?"
<davidcelis> Oog_: sounds like you're trying to turn Ruby into JavaScript ;)
<RubyPanther> ycy: Foo.class_variable_get('@@zomg')
<csavola> rippa: 'cause I do not want rocket fuel blood?
<rippa> Oog_: I'd rather define #[]
<ycy> thank
<ycy> you
<RubyPanther> (usually not advised)
<Oog_> [] sounds like a good idea
Faris1 has joined #ruby
sarmiena_ has joined #ruby
IrishGringo has joined #ruby
RORgasm has joined #ruby
brianpWins has joined #ruby
asuka has joined #ruby
sepp2k has joined #ruby
Prezioso has joined #ruby
statix has joined #ruby
superguenter1 has joined #ruby
<Oog_> so if i have attr_accessor :location and in an instance method i do location = "blah" that is using the accessor right? it wont create a "local" variable ala string local; in c++ and shadow the accessor?
<Oog_> is there anyway to explicitly define a local var?
<baroquebobcat> Oog_: location = "blah" will create a local var location, to use the accessor you need self.location = "blah"
<Oog_> ah...
<Oog_> i thought since the accessor was in scope it would use it. so for accessors you ahve to always use self?
<shadoi> no, don't use self.location, use @location
<shadoi> @location is an instance variable.
<csavola> shadoi: he's using lazy instatiation and would like everything to be pushed through accessors
<Oog_> yes
qwerxy has joined #ruby
ghvandoorn has joined #ruby
sacarlson has joined #ruby
wmoxam has joined #ruby
TNTechnoHermet has joined #ruby
hadees has joined #ruby
<shadoi> Sounds more like you want OpenStruct
Tomasso has joined #ruby
ben225 has joined #ruby
<shadoi> Yeah… from reading back, you definitely want to use OpenStruct
gvd has joined #ruby
gianlucadv has joined #ruby
LMolr has joined #ruby
ReachingFarr has quit [#ruby]
<Oog_> shadoi: interesting... well it is working with a hash.. this will do for now but that is good to know of
<Oog_> with open struct though can i use [] ?
<Oog_> because when i set i will have the key value in a variable
<Oog_> and i cant do mystruct.variable = value
<Oog_> mystruct[variable] = value
<shadoi> yeah it'd work fine
JohnBat26 has joined #ruby
<shadoi> you'd just call the accessors with the [] key
<Oog_> hmm
cmarques has joined #ruby
<chovy> how do i test if a string contains 2 or more vowels?
straind has joined #ruby
interne__ has joined #ruby
<Oog_> shadoi: im trying OpenStruct TypeError: superclass mismatch for class XMLBase
<Oog_> class XMLBase < OpenStruct
<Oog_> hmm i guess it doesnt like reloading files when the superclass changes
Squarepy has joined #ruby
Squarepy has joined #ruby
akemrir has joined #ruby
Aaton has joined #ruby
LowKey has joined #ruby
TTilus has joined #ruby
timonv has joined #ruby
hooper has joined #ruby
ycy has quit [#ruby]
yoklov has joined #ruby
<shadoi> Oog_: odd, I do the same thing
shruggar has joined #ruby
<shadoi> Oog_: unless XMLBase is a subclass, that's probably the difference
<Oog_> yep
theRoUS has joined #ruby
theRoUS has joined #ruby
cha1tanya has joined #ruby
<Oog_> how odd... with private accessors you cant call self.X
<shadoi> because .X are always public instance methods
<shadoi> that's… sort of the definition of public.
Nisstyre has joined #ruby
<shadoi> You can go in the backdoor with .send()
<shadoi> bad habit though
<Oog_> but someone else told me doing location="" with a location accessor would make a local location variable... now this doesnt seem to be true
foo-bar-_ has joined #ruby
<shadoi> it makes a local
<shadoi> but that's just a normal local
<shadoi> same with or without an accessor
<csavola> Oog_: you called the meta method after declaring private methods... which mean that you cannot have an explicit receiver
x1337807x has joined #ruby
<Oog_> shadoi: i swithed to OpenStruct but using [] gives an error NoMethodError: undefined method `[]=' for #<NRD::Job>
<shadoi> you need to define []=
<shadoi> it's not a normal accessor
ilyam has joined #ruby
nemesit has joined #ruby
<x1337807x> I think it would make sense for my program to have class methods on a module that I mixin to add search functionality. Is it possible to do that without some horrific code?
<Oog_> shadoi: ok once i define it how do i actually do the set value on OpenStruct
artm has joined #ruby
<shadoi> Oog_: def []=(key,value); self.send("#{key}=", value); end
emmanuelux has joined #ruby
<Oog_> it works! thanks everyone hoepfully now ill be a little faster at things...
<shadoi> x1337807x: yes.
<x1337807x> shadoi: thank you
<shadoi> I used to recommend people look at ActiveRecord::Base#find but …. not so much anymore.
wallerdev has joined #ruby
kirun has joined #ruby
internet_user has joined #ruby
williamcotton has joined #ruby
williamcotton_ has joined #ruby
baroquebobcat has joined #ruby
havenn has joined #ruby
mcwise has joined #ruby
williamcotton has joined #ruby
Tearan has joined #ruby
<RubyPanther> Oog_: because location = "" doesn't call the accessor, it sets a local, you'd need self.location = "" to hit the accessor
<Oog_> RubyPanther: but the accessor is private
jrist has joined #ruby
<Oog_> or do accessors when you use attr_* have no visiblity? maybe my problem is i self defined the "accessor" ?
<RubyPanther> Oog_: normally nothing should ever be "private" in Ruby, you should be using protected in 99%+ cases
davidpk has joined #ruby
rbrooks_ has joined #ruby
pgpkeys has joined #ruby
<Oog_> RubyPanther: ah :) ok... let me read up on this.
ScottNYC has joined #ruby
csprite has joined #ruby
<shadoi> ugh… -w is super anal about initialization.
<shadoi> should I really initialize everything to nil before doing defaults and such?
dylukes has joined #ruby
<dylukes> Am I the only one unable to get the nowrap option to pygments.rb working?
looopy_ has joined #ruby
<Tasser> dylukes, depends
<dylukes> It just seems it's ignoring options other than :lexer
MasterIdler has joined #ruby
wyhaines_ has joined #ruby
chico has joined #ruby
davidd___ has joined #ruby
MrGando has joined #ruby
<Oog_> RubyPanther: yeah private does not seem like what i need it just seems problematic...
<chico> if you clone an openstruct, why it doesn't carry its methods to the cloned object?
wyhaine__ has joined #ruby
<Oog_> when would you use it?
<Oog_> create singleton?
francisfish has joined #ruby
justinmcp has joined #ruby
<RubyPanther> Oog_: it is useful in the core Ruby classes for implementation-specific details that aren't part of the API and shouldn't be relied on/documented
twinturbo has joined #ruby
<shadoi> chico: you're duplicating the whole object, which includes all the data (which in this case creates dynamic methods, etc)
Sly__ has joined #ruby
<RubyPanther> or if you're creating a large library that already has a lot of "protected" stuff and then you really do need to hide something further... like in Rails for example you might have a private method in application_controller.rb that is only used for the (protected) methods there and isn't available to real controllers
<RubyPanther> in 7+ years with rails I think I've needed to do that... zero times.
<chico> shadoi: i'm not sure i understand
dknight has joined #ruby
<shadoi> chico: if you read the docs on the clone method it tells you it copies the instance variables
<chico> shadoi: shouldn't the 'triggers' for dynamic methods be duplicated too?
<dknight> if I have a gem installed at /usr/lib/ruby i.e. installed by root, is it not available to other users in liux?
<shadoi> chico: not sure what you mean by triggers
Sly__ has quit ["Leaving"]
<dknight> ]/j #archlinux
<chico> shadoi: ah, i see, thank you
fukushima has joined #ruby
JNZ` has joined #ruby
<shadoi> chico: you can override the initialize_copy to change the behavior
<dknight> I have installed some gems as root but my normal user is unable to access it
<dknight> please help me understand how my normal user can access them?
Evixion has joined #ruby
CombatWombat has joined #ruby
virunga has joined #ruby
parus has joined #ruby
superguenter has joined #ruby
Jackneill has joined #ruby
waxjar has joined #ruby
KL-7 has joined #ruby
pygmael has joined #ruby
dylukes has quit ["Pipes are broken. Sending packets via Fedex."]
albemuth has joined #ruby
foo-bar- has joined #ruby
apeiros_ has joined #ruby
virunga_ has joined #ruby
hukl has joined #ruby
ipoval has joined #ruby
dzhulk has joined #ruby
alex__c2022 has joined #ruby
h4mz1d has joined #ruby
RORgasm has joined #ruby
senthil has joined #ruby
iocor has joined #ruby
hidensoft has joined #ruby
RORgasm_ has joined #ruby
lopex has joined #ruby
multibot_ has joined #ruby
Squarepy has joined #ruby
<davidcelis> stop installing gems as root
<apeiros_> why? it's not my fault my parents named me root!
<davidcelis> damn hippie parents
<apeiros_> sudo mv davidcelis root
<davidcelis> :(
artOfWar has joined #ruby
sdeobald has joined #ruby
Squarepy has joined #ruby
Dr4g has joined #ruby
Oddnoun has joined #ruby
QKO_ has joined #ruby
parus has joined #ruby
symb0l has joined #ruby
choffstein has joined #ruby
x1337807x has joined #ruby
gianlucadv has joined #ruby
symb0l has joined #ruby
AxonetBE has joined #ruby
iocor has joined #ruby
kesor has joined #ruby
<kesor> is there any use for object identity in ruby? for example with string objects that have the same value?
x1337807x has joined #ruby
jrist has joined #ruby
c0rn has joined #ruby
yoklov has joined #ruby
<heftig> kesor: object identity?
n1x has joined #ruby
<kesor> > String.new('x').object_id
<kesor> => 2239448060
<kesor> > String.new('x').object_id
<kesor> => 2239426400
<multibot_> Not in scope: `String.new'Not in scope: `object_id'
nonotza has joined #ruby
<multibot_> Not in scope: `String.new'Not in scope: `object_id'
arturaz has joined #ruby
Morkel has joined #ruby
<arturaz> % puts "Hello".center(80)
<multibot_> Hello
centipedefarmer has joined #ruby
<arturaz> woot :)
ringotwo has joined #ruby
<heftig> % RUBY_VERSION
<multibot_> 1.9.3
<arturaz> %JRUBY_VERSION
<arturaz> % JRUBY_VERSION
<multibot_> 1.7.0.dev
<arturaz> :P
<apeiros_> String.new('x') is an extraordinarily copious way to say 'x'
<heftig> arturaz: at least it's running in 1.9 mode
<apeiros_> and yes, of course there's moments when object identity is useful. not that I had some at hand right now.
<heftig> arturaz: i take it it's jruby for the sandboxing?
<arturaz> no idea, i'm not the developer. However it runs more than ruby though :)
<arturaz> @help
<multibot_> (!) scala (!reset|type|scalex), (%) ruby (%reset), (,) clojure, (>>) haskell, (^) python, (&) javascript, (##) groovy, (<prefix>paste url), lambdabot relay (true), url: https://github.com/lopex/multibot
triptec has joined #ruby
<apeiros_> heftig: does it have measures against making it spam the channel?
<kesor> ^ str() is str()
<multibot_> True
<kesor> % String.new.eql? String.new
<multibot_> true
<kesor> % String.new.equal? String.new
<multibot_> false
<heftig> ruby strings are mutable and not interned
<kesor> any special reason why?
<heftig> % :foo.equal? :foo
<multibot_> true
<arturaz> ! List("I", "bet", "no-one", "knows", "scala", "here").mkString(" ")
<multibot_> String = I bet no-one knows scala here
<kesor> because we have symbols?
virunga has joined #ruby
<lopex> ! Category[({type L[A, B] = Kleisli[Option, A, B]})#L].compose(Kleisli((_: Int) + 1 some), Kleisli((_: Int) * 2 some))(2)
<multibot_> Option[Int] = Some(5)
<arturaz> lopex, you do not count :D
<lopex> couldnt resist
<arturaz> and because of you people now think that scala is for robots
<arturaz> be ashamed.
<lopex> ! List(1,2,3) map (1+)
<multibot_> List[Int] = List(2, 3, 4)
<arturaz> levelup!
<arturaz> ;D
<lopex> sometimes it's even easier
dr_bob has joined #ruby
<chovy> somebody want to take a stab at refactoring this? http://refactormycode.com/codes/2023-refactor-permutation-to-be-recursive
hidensoft has quit ["Leaving"]
havenn has joined #ruby
<csavola> homework?
artm has joined #ruby
lukevisinoni has joined #ruby
orospakr has joined #ruby
<heftig> chovy: list.repeated_permutation(count).each do |word|
<heftig> well, not strictly
<heftig> it'd be an array of chars and not a word
<heftig> but correcting that should be trivial.
sekretskwerl has joined #ruby
<sekretskwerl> is there a socket.io library for Ruby?
<sekretskwerl> gem, rather
<heftig> what's socket.io?
<sekretskwerl> its a socket io library that has several types of sockets that it abstracts
<heftig> ruby has 'socket'
<sekretskwerl> yes.
symb0l has joined #ruby
<sekretskwerl> i want to use socket.io with EventMachine. I found a socket.io library on github, cloned it and did 'rake gem' but, it had abunch of bugs and wouldn't compile.
timonv has joined #ruby
<sekretskwerl> I need a working socket.io implementation (perhaps in Cramp? The documentation for Cramp is really lacking)
<sekretskwerl> although, the git repo was supposed to be a Cramp plugin
<sekretskwerl> otherwise, I will get stuck with NodeJS for my project.
<heftig> didn't eventmachine already have its own evented socket implementations?
<sekretskwerl> socket.io is not just a socket
sam113101 has joined #ruby
mcwise has joined #ruby
tatsuya_o has joined #ruby
maahes has joined #ruby
<sekretskwerl> no one know of a gem?
<sekretskwerl> perhaps I can use Juggernaut-ruby
<heftig> em-websockets?
<sekretskwerl> no
<sekretskwerl> em-websockets is only websockets, it doesn't abstract other types of sockets with it.
* apeiros_ soon got a buzzword bingo
jbw has joined #ruby
ed_hz_ has joined #ruby
<sekretskwerl> apeiros_: abstract and socket are buzzwords?
_bart has joined #ruby
<arturaz> sekretskwerl, I highly recomment celluloid-io
<arturaz> recommend :)
<arturaz> threaded+evented io, mix as you like
S1kx has joined #ruby
S1kx has joined #ruby
davidpk has joined #ruby
<arturaz> i've recently switched to it from EM
<arturaz> and it's a breeze.
<arturaz> i'm loving it
<sekretskwerl> arturaz: does it do web and flash sockets?
thone has joined #ruby
oposomme has joined #ruby
<arturaz> sekretskwerl, we're using it for flash sockets
<arturaz> flash sockets are just regular tcp sockets
<arturaz> as probably websockets are
<arturaz> haven't used it for those though
<sekretskwerl> my project is taking an application that used to be a telnet application, and turning it more modern with a jquery client and using web/flash sockets.
<sekretskwerl> arturaz: websockets do inherit from tcp sockets, but there's an extra layer to them. i'm not sure on the details of implementing them from a tcp socket.
<sekretskwerl> i'm mostly trying to avoid having to do the project in nodejs
<sekretskwerl> the server, at least.
<sekretskwerl> with Juggernaut-ruby gem I could use Rails to talk to NodeJS server
Faris has joined #ruby
* apeiros_ gets the impression people think that the 'web' part of 'websocket' is layer 4…
<arturaz> sekretskwerl, well, one thing that you can avoid with celluloid is unholy mess of the callbacks :)
perlsyntax has joined #ruby
iocor has joined #ruby
pygmael has joined #ruby
jonteru has joined #ruby
ilyam has joined #ruby
superguenter has joined #ruby
shruggar has joined #ruby
schovi has joined #ruby
tommyvyo has joined #ruby
qwerxy has joined #ruby
mengu has joined #ruby
<shadoi> sekretskwerl: http://cramp.in/
<sekretskwerl> shadoi: I haven't been able to figure out how to do socket.io implementation with Cramp?
ph^ has joined #ruby
<shadoi> You'd need to follow something like the Celluloid::IO implementation
<shadoi> sekretskwerl: but, really you don't want to be polling on a websocket
Faris has joined #ruby
macmartine has joined #ruby
<sekretskwerl> shadoi: negative. i want a pub/sub method
<shadoi> sekretskwerl: that is a layer above the socket handling code.
CombatWombat has joined #ruby
<shadoi> sekretskwerl: is there a problem with using it?
<sekretskwerl> shadoi: Cramp?
<shadoi> yes
<sekretskwerl> no, I was reading over Cramp docs quite a bit, trying to figure out if it would work.
<sekretskwerl> my attraction to socket.io over WebSocket is that not everything supports WebSocket
<sekretskwerl> and socket.io takes care of being like "oh, lets use a flash socket" or one of the other types for you
nerdy has joined #ruby
<sekretskwerl> so i'm basically just trying to find a method of attack that requires the least bit of setup/prep/reinvention
yawniek_ has joined #ruby
<shadoi> sekretskwerl: it's just syntactic sugar to make them behave the same. You would need to add support for different socket types to something like Celluloid::IO to get equivalent abstractions in Ruby.
<shadoi> sekretskwerl: but seriously, fuck Flash. :)
<sekretskwerl> shadoi: i'm just not familiar enough with their implementations to do that.
<sekretskwerl> lol
<sekretskwerl> well, Flash is supported by like...everything.
<sekretskwerl> WebSocket isn't
<shadoi> Node has done more work to make this simpler (sometimes with devastating side-effects).
sam113101 has joined #ruby
<shadoi> But if you want easy, Node.js is probably easier for a websocket/flash socket abstraction.
<arturaz> sekretskwerl, i can give you the code for flash server on celluloid :)
<shadoi> sekretskwerl: https://github.com/dkastner/socket.io-ruby see this?
<sekretskwerl> shadoi: did you look at the git code I linked? that is called 'socketio', but I'm not sure what its doing precisely.
<shadoi> it probably uses that plugin
maahes has joined #ruby
<shadoi> looks like a compat layer for socket.io on the client
<sekretskwerl> im thinking of just creating a fibered, evented WebSocket server
<sekretskwerl> and saying "use a modern browser"
<sekretskwerl> which IE9 apparently isn't :P
<shadoi> sekretskwerl: Cramp is a evented websocket server that uses fibers.
<shadoi> don't reinvent it :)
<shadoi> If anything, add features to celluloid.
<sekretskwerl> shadoi: yeah, so, I guess if I just bite the bullet and use WebSocket-only, I'll just run with Cramp.
<sekretskwerl> shadoi: WebSockets are the future anyway, wouldn't you say
<sekretskwerl> for things that need a full socket, anyhow
<shadoi> yeah, now that they actually finished the protocol
<sekretskwerl> oh they did?
<sekretskwerl> sweet, i thought it was still in flux and that was another thing that was bothering me.
Zolrath has joined #ruby
jrist has joined #ruby
<shadoi> ok, "finished" being a very flexible term in the case of the w3c :)
<sekretskwerl> lol
srnty has joined #ruby
<sekretskwerl> "finished" like wireless N was for 10000 years?
<shadoi> yeah
<shadoi> there are at least revisioned documents for the protocol now.
<sekretskwerl> "You can very easily fallback to flash sockets if the browser doesn’t have WebSockets support. Check out the web-socket-js library by Hiroshi Ichikawa, which does exactly that. Cramp will “just work” with the web-socket-js library."
ctwiz has joined #ruby
<sekretskwerl> so all I have to do is throw the files in the server's directory and Cramp will use it if needed?
mxweas_ has joined #ruby
Eiam has joined #ruby
froy has joined #ruby
<shadoi> try it and see
trivol has joined #ruby
<Tomasso> how do you change the key from a key,value pair from a Hash?
gogiel has joined #ruby
superguenter1 has joined #ruby
<shadoi> Tomasso: you create a new one and delete the old one.
nfluxx has joined #ruby
JwbF75ug has joined #ruby
<Tomasso> mm shadoi , by iterating on each pair?
<shadoi> if that's what you need to do…
<shadoi> hash[:new_key] = hash.delete(old_key)
<shadoi> if you just need a one-off
<shadoi> (delete returns the value)
mmokrysz has joined #ruby
<Tomasso> got it, thanks xD
_2easy has joined #ruby
mmokrysz has quit [#ruby]
<arturaz> % a = {:foo => :bar}; a[:baz] = a.delete(:foo)
<multibot_> bar
<arturaz> % a = {:foo => :bar}; a[:baz] = a.delete(:foo); a
<multibot_> {:baz=>:bar}
<arturaz> i <3 multi_io
<arturaz> i <3 multibot_
<arturaz> err
<arturaz> ;D
<methoddk> anyone good with CSS animations? I tried asking in #css and #jquery (related to both) but no one would answer
flakrat has joined #ruby
sbanwart has joined #ruby
simpleharmonicmo has joined #ruby
markb has joined #ruby
Faris has joined #ruby
maahes has joined #ruby
n1x has joined #ruby
ephemerian has joined #ruby
<robacarp> methoddk: what sort of animation are you trying to accoumplish?
<pgpkeys> just asking if someone is good with something would probably be why. ask specific, informative, concise, and on-topic would probably help :)
<methoddk> a simple fade out
<methoddk> I fade an element in after an AJAX request for it
<methoddk> and then fade it out on a click
<methoddk> the fade outs don't work in chrome or ff
snip_it has joined #ruby
<methoddk> but are flawless in Safari
<shadoi> methoddk: use a library that hides cross-browser bullshit.
<methoddk> like what?
zakwilson has joined #ruby
<robacarp> well, you can post the code if you want, but if you're doing the animation with javascript I don't really want to look at it.
Guest__ has joined #ruby
<methoddk> robacarp the animations are done in CSS, I use JS to change the classes of the element
<methoddk> to trigger the animation
adeponte has joined #ruby
<shadoi> methoddk: there are thousands, this isn't really a #ruby question though :)
<robacarp> check out methoddk: http://css3.bradshawenterprises.com/all/
CheeToS has joined #ruby
Kyle__ has quit [#ruby]
cmarques has joined #ruby
<methoddk> I know… no one will help me anywhere else
thomd has joined #ruby
<robacarp> methoddk: so, post teh code, I'll look at it.
rrecio has joined #ruby
<robacarp> shadoi: thats not a css animation.
srnty has joined #ruby
<shadoi> you can see how he solved all the cross-browser bullshit in there.
<shadoi> it's non-trivial
Faris has joined #ruby
nect has joined #ruby
Guest38111 has joined #ruby
Guest38111 has joined #ruby
<robacarp> that is an excellent demo, a bit lacking in actually useful effects though
<nect> I have an encoded char "*" which converts to ascii \\052. How do I convert \\052 back to a star?
<shadoi> robacarp: ? did you see the github readme?
<robacarp> shadoi: nope.
<shadoi> nect: "\052".chr
<nect> any way to do it on a whole string?
<nect> I have a "\052.example.com"
<nect> I want to convert it back to "*.example.com"
<shadoi> nect: each_char
wyhaines has joined #ruby
maahes has joined #ruby
<shadoi> ah, well will you always know what the string starts with?
keymone_ has joined #ruby
<shadoi> "\052.http://example.com/".split('.').first.chr
<shadoi> depends what you need though
<nect> "\052.example.com".each_char.collect { |c| c }.join("")
<methoddk> shadoi thats what I'm using
<nect> something prettier than that? :)
<shadoi> nect: require 'uri'; URI.parse("\052.http://example.com/")
<nect> brilliant, thx
<shadoi> stupid IRC client keeps inserting http://
<shadoi> heh
<shadoi> methoddk: welcome to the bleeding edge… :)
lunchdump has joined #ruby
arvidkahl_ has joined #ruby
<artm> I'm not sure how to formulate my question, but there it is: http://codepad.org/CUkeNNcQ
gregorg_taf has joined #ruby
<shadoi> artm: create a log class method that returns a logger object, and then use the normal log levels like "info", "error", "debug", etc.
wyhaines has joined #ruby
<artm> shadoi: if it returns a logger object I won't be able to chain image operations
<shadoi> artm: why not?
<shadoi> they're just method calls, logging has nothing to do with it.
<artm> I have functions like: { return input_image.lighter().threshold(...).enhance_contrast().sobel().gauss() }
<artm> I want to insert logging between operations
iamjarvo has joined #ruby
<artm> input_image.log().lighter().log().threshold(...).log().enhance_contrast().log().sobel().log().gauss()
<artm> image operations return new images
<artm> if log() returns a logger i can't call lighter() on it, can I?
choffstein has joined #ruby
<shadoi> artm: that's kind of an insane way to do that, just put a log message in each method.
<shadoi> input_image has a log entry, lighter has a log entry, etc.
Gekz has joined #ruby
Gekz has joined #ruby
<artm> right. that's possible.
<shadoi> artm: I reinitialize logger everytime in that example, you'd probably want to pass that around as a constant or something.
<artm> i'm still to stuck to how I imagined it should have looked, trying to imagine it your way
<shadoi> artm: that way you can set it to log extra info when $DEBUG is set and none of your usage changes
<shadoi> input_image.lighter.theshold(…)
<shadoi> should never change based on what logging info you want to see
skrewler has joined #ruby
<artm> only problem is how to come up with filenames then
<artm> because I save images you see
i8igmac has joined #ruby
<shadoi> that should be a separate method
<shadoi> save_file or something
<artm> yeah, i have save file
<shadoi> yeah, just don't do that as part of logging, that's weird.
<artm> why?
<shadoi> logging may need to report errors in the save method.
<artm> no, my logging is to see what is happening to image as it is processed
<artm> I log an html and images
<artm> html refers to those images
<shadoi> Sure, but I'm saying you should make logging a generic thing, and use it to report not only information about the task your doing, but also about the state of your program.
<artm> I don't need that
<shadoi> yet.
<shadoi> you will.
superguenter has joined #ruby
gmarcilhacy has joined #ruby
ipoval has joined #ruby
<gmarcilhacy> Hi!
<artm> yeah, but then I'll use some existing logging library for that sort of logging
<shadoi> you can always make a "save_and_log" method that does both things, I'm just saying build it so that you don't reinvent the wheel just to add sparkling rims.
<shadoi> that sort of usage change will be a big pain in the ass down the road.
<gmarcilhacy> I am running tests through a rake tasks, and I want to stop the task if one test fails.
Faris has joined #ruby
<gmarcilhacy> Should I override "puts" and see if it contains the work "error"?
looopy has joined #ruby
liluo has joined #ruby
<robacarp> gmarcilhacy: this sounds like a bad idea.
nobitanobi has joined #ruby
oposomme has joined #ruby
<gmarcilhacy> What can I do then?
oposomme has joined #ruby
<robacarp> why do you want to prevent the rest of the tests from running?
<artm> shadoi: if I save_and_log() inside the individual operations I'm still left with the problem that I don't know what to call the image. hmm... may be I should just name them with timestamps or something like that...
<gmarcilhacy> I first want to run my tests, and if everything passes, deploy to production (heroku)
<robacarp> oh I see.
thoradam has joined #ruby
Aaton has joined #ruby
<gmarcilhacy> any idea? :D
<robacarp> well, I would probably try and check the exit status of the test suite
<artm> robacarp: if it fails rake won't continue, no?
<robacarp> hopefully they're returning some nonzero value when tests fail, but idk.
<robacarp> artm: yea, I'd hope so.
<gmarcilhacy> if the rake task fails yes, but not if the test fails
<artm> gmarcilhacy: which testing framework you use?
<gmarcilhacy> test unit
Aaton has joined #ruby
<artm> and if test fails it doesn't return error code?
tomku has joined #ruby
Faris has joined #ruby
<gmarcilhacy> no
<shadoi> artm: you can use the object hash as a filename, or generate random filenames with timestamps… lots of solutions to that.
Mcilvena has joined #ruby
<artm> shadoi: problem is the image library is not mine, but the image algorithms (the "something_complicated" methods from my paste) are. so it's still easier for me to insert logging there.
madhatter has joined #ruby
<shadoi> artm: override the method, use your own that does your logging.
<shadoi> call super to execute the original method.
<artm> right.
hadees has joined #ruby
havenn has joined #ruby
danielvdotcom has joined #ruby
albemuth has joined #ruby
<artm> and to make all images use the same logger i need to make it global or something
<shadoi> just use a class constant
<artm> like Image::Logger ?
<shadoi> MyClass::LOGGER = Logger.new("#{self.class.name}-logger")
<shadoi> sure
<artm> right.
<shadoi> or part of a bigger system, move it up the hierarchy
<artm> the system isn't much bigger
<klip> artm: btw, you can also try to use AOP and overwrite send method to "inject" all methods by adding there a logging functionality :) something like this http://uberpwn.wordpress.com/2011/03/14/ruby-aop-in-12-lines-of-code/ :)
<shadoi> only don't do that. :)
<artm> what "AOP" stands for?
<klip> aspect oriented programming :)
<artm> pff... what is "aspect oriented programming" then?
<artm> oh what, google
<shadoi> aka Mind-fuck programming.
<klip> it's hardcore if you do it yourself :) but there are some libs for that :)
<klip> not sure how uptodate they are
<artm> no, I think I'm already overcomplicating this project
<klip> :)
artOfWar has joined #ruby
<shadoi> It'd be fine if it were builtin and idiomatic, as it is, it's extremely confusing to look at code like that when you're trying to figure out what a program does.
<artm> all I want is to see what's going on as image gets processed
MasterIdler has joined #ruby
<shadoi> artm: the mixin I sent you is mostly a standard ruby way of doing this.
<artm> except for save image part and there we go again :)
<shadoi> no it's still the same
bwlang has joined #ruby
<shadoi> like I said, split logging from file saving and you're good to go.
<artm> may be I should just take existing logging library and mix "save image" into it :)
noname has joined #ruby
<shadoi> artm: the end result is almost identical to what I gave you, just add another method called "save_and_log", etc.
<artm> but I don't want to split. I want to see images in context. what were operations and their paramters. what were analysis results
<artm> hmm
<artm> the save_image() should log what it saved
<shadoi> yes
<shadoi> exacrtly
<artm> then the image name will appear in context
<artm> yeah!
<artm> thanks
<artm> you see, I was just still inside my box
<shadoi> yeah it's hard to step back
<artm> thank you for getting me out
<shadoi> I usually just think "If I wanted to use this in more than 1 place, how would I do it?"
<shadoi> forces you to not tightly-couple behaviors
<artm> I'm afraid to think that too early, we have tiny budgets :)
<shadoi> It saves you a TON of time later on.
<shadoi> trust me.
<shadoi> That's money.
<artm> ok, now that i'm convinced i can do with a normal logging library, any suggestions? personal favorites? :)
greywolf` has joined #ruby
<shadoi> I just use logger
<shadoi> (like I did in that mixin)
artOfWar has joined #ruby
<artm> ah, 'logger' is in standard library?
<shadoi> yes
* artm smacks himself on a head with a thick manual
sbanwart has joined #ruby
trkemist has joined #ruby
<trkemist> I have a question
<trkemist> what is the best way to learn ruby and rails for someone who has been on the technology side of it for most of his career?
<shadoi> artm: now you can add as much debugging as you like using: log.debug, and you will only see it if you set the logger.level to 0
<shadoi> trkemist: technology side of it?
Mcilvena has quit [#ruby]
<shadoi> trkemist: you mean non-technical? or what
Mcilvena has joined #ruby
<trkemist> No i mean systems admin/networking engineering/network architecture
<trkemist> not a developer
<artm> it like IT
<trkemist> Oh yeah IT
<trkemist> sorry.. I didn't realize i put it in lowercase
<artm> my method (for ruby) is each time I think perl or awk or bash, I figure out how they do it in ruby.
SolarisBoy has joined #ruby
<shadoi> trkemist: personally I'd recommend learning ruby first, and then moving on to rails.
<daed> rails sort of requires ruby knowledge :P
<artm> "Are you a Ruby on Rails programmer who's ashamed that you don't really know Ruby?" :)
Pacra has joined #ruby
trkemist has joined #ruby
<trkemist> Omg. I can't believe it, If you answered the last thing I have is from 19:44... :/
<trkemist> Is there a logbot I can see the responses?
<trkemist> i lost connection 5 minutes ago :/
<shadoi> shadoi> trkemist: http://ruby.learncodethehardway.org/ 4:46
<shadoi> shadoi> trkemist: http://tryruby.org/levels/1/challenges/0 4:47
<i8igmac> s.scan(/#{names.each}/)
triscuit has joined #ruby
<i8igmac> can i put a list of names inside this scan
Mcilvena has quit [#ruby]
triscuit has quit [#ruby]
<shadoi> i8igmac: no, but you could make a proc that does that and call it for each iteration in an each
<i8igmac> for i in names
<dn2k> maybe names.join('|') ?
iocor has joined #ruby
<shadoi> names.map {|n| n =~ /#{pattern}/}
drake10 has joined #ruby
Ontolog has joined #ruby
deryl has joined #ruby
lukevisinoni has joined #ruby
Sailias has joined #ruby
deadly_hcs has joined #ruby
cha1tanya has joined #ruby
nonotza has joined #ruby
Nisstyre has joined #ruby
<shadoi> i8igmac: I suppose you actually want the inverse of that
Aaton has joined #ruby