fflush changed the topic of #ruby to: Ruby 1.9.3-p194: http://ruby-lang.org || Paste > 3 lines of text on pastebin.com
_whitelogger has joined #ruby
grillo has joined #ruby
perryh has joined #ruby
<Phlogistique>
havenn: I don't get this guy's problem
<havenn>
Phlogistique: His questionable ethics!
Apocalypse has joined #ruby
<Phlogistique>
he's basically saying "OMG IO::Popen runs a SHELL when I ask it to!!!"
gmci has quit [Quit: Computer has gone to sleep.]
<Phlogistique>
and then I can't kill it in a completely roundabout and wrong way! ZOMG!
schwap has joined #ruby
_whitelogger has joined #ruby
<Phlogistique>
havenn: now Open3.capture2 indeed does exactly what I want
<Phlogistique>
(its name is terrible though)
jimeh has quit [Ping timeout: 246 seconds]
stephenjudkins has quit [Quit: stephenjudkins]
u_u has quit [Ping timeout: 248 seconds]
manizzle has quit [Ping timeout: 252 seconds]
nobitanobi has quit [Read error: Connection reset by peer]
brianpWins has joined #ruby
beakerman has joined #ruby
nobitanobi has joined #ruby
sepp2k has quit [Remote host closed the connection]
qwerxy has quit [Quit: offski]
baroquebobcat has joined #ruby
mparodi has quit [Quit: Leaving]
nobitanobi has quit [Read error: Connection reset by peer]
nobitanobi has joined #ruby
bluOxigen_ has joined #ruby
maletor has quit [Quit: Computer has gone to sleep.]
bluOxigen has quit [Ping timeout: 268 seconds]
RegEchse has quit [Quit: <3 WeeChat (v0.3.9-dev)]
iamjarvo has quit [Quit: Computer has gone to sleep.]
beakerman has quit [Ping timeout: 276 seconds]
Zespre has quit [Remote host closed the connection]
blahnick2 has joined #ruby
havenn has quit [Remote host closed the connection]
bintut has quit [Quit: Leaving]
beakerman has joined #ruby
poga has joined #ruby
RudyValencia- has joined #ruby
RudyValencia has joined #ruby
RudyValencia- has quit [Read error: Connection reset by peer]
u_u has joined #ruby
jimeh has joined #ruby
manizzle has joined #ruby
blahnick2 has quit [Ping timeout: 244 seconds]
niklasb has quit [Ping timeout: 272 seconds]
beakerman has quit [Ping timeout: 276 seconds]
velikasha1 has joined #ruby
velikasha1 has left #ruby [#ruby]
manizzle has quit [Ping timeout: 248 seconds]
beakerman has joined #ruby
yasushi has joined #ruby
TorpedoSkyline has quit [Quit: Computer has gone to sleep.]
poga has quit [Remote host closed the connection]
TorpedoSkyline has joined #ruby
yasushi has quit [Remote host closed the connection]
mfridh has quit [Ping timeout: 268 seconds]
bluOxigen_ has quit [Ping timeout: 248 seconds]
yasushi has joined #ruby
beakerma_ has joined #ruby
dev_ryan70 has quit [Remote host closed the connection]
beakerman has quit [Ping timeout: 276 seconds]
allyraza has joined #ruby
yasushi has quit [Ping timeout: 240 seconds]
butblack has joined #ruby
brianpWins has quit [Quit: brianpWins]
brianpWins has joined #ruby
baroquebobcat has quit [Quit: baroquebobcat]
jwang has quit [Quit: Leaving]
beakerma_ has quit [Read error: Connection reset by peer]
beakerman has joined #ruby
cakehero has quit [Quit: Computer has gone to sleep.]
zelo has quit [Ping timeout: 245 seconds]
guns has quit [Quit: guns]
ysyk has joined #ruby
VegetableSpoon has quit [Remote host closed the connection]
LiquidInsect has quit [Ping timeout: 252 seconds]
LiquidInsect has joined #ruby
manizzle has joined #ruby
richo has left #ruby [#ruby]
manizzle has quit [Read error: Connection reset by peer]
IrishGringo has quit [Ping timeout: 244 seconds]
cakehero has joined #ruby
baphled has quit [Ping timeout: 245 seconds]
banisterfiend has quit [Ping timeout: 245 seconds]
manizzle has joined #ruby
mirTapir has quit [Ping timeout: 272 seconds]
mirTapir has joined #ruby
cakehero has quit [Client Quit]
gmci has joined #ruby
banisterfiend has joined #ruby
havenn has joined #ruby
darren has quit [Remote host closed the connection]
Spooner has quit [Ping timeout: 240 seconds]
darren has joined #ruby
u_u has quit [Ping timeout: 248 seconds]
DanBoy has joined #ruby
pingfloyd has joined #ruby
dev_ryan70 has joined #ruby
mucker has quit [Remote host closed the connection]
Hanmac1 has joined #ruby
nobitanobi has quit [Read error: Connection reset by peer]
savage- has joined #ruby
nobitanobi has joined #ruby
dev_ryan70 has quit [Ping timeout: 276 seconds]
ipoval has joined #ruby
Hanmac has quit [Ping timeout: 252 seconds]
<Paradox>
im having some problems with rails and sass. I have a folder of sass partials, starting with underscores as the names, but sprockets is rendering them to css
sgronblom has joined #ruby
<Paradox>
any simple way to suppress this?
nobitanobi has quit [Read error: Connection reset by peer]
jonathanwallace has quit [Read error: Connection reset by peer]
JarJar has quit [Quit: This computer has gone to sleep]
insecurlex has quit [Remote host closed the connection]
IrishGringo has joined #ruby
justsee|away is now known as justsee
scientes has quit [Ping timeout: 272 seconds]
<sazboom>
exit
sazboom has quit [Quit: EPIC5-1.1.4[1667] - amnesiac : I really dispise you internet know-it-alls]
jimeh2 has joined #ruby
iamjarvo has joined #ruby
jimeh has quit [Ping timeout: 240 seconds]
kyktommy has joined #ruby
u_u has joined #ruby
cakehero has quit [Quit: Computer has gone to sleep.]
chessguy_ has quit [Remote host closed the connection]
nedbat has quit [Ping timeout: 244 seconds]
beneggett has joined #ruby
stephenjudkins has joined #ruby
r0bby_ has joined #ruby
justsee is now known as justsee|away
gregfu has quit [Quit: gregfu]
r0bby_ is now known as robbyoconnor
r0bby has quit [Ping timeout: 244 seconds]
gregfu has joined #ruby
sgronblom has quit [Quit: leaving]
Targen has quit [Ping timeout: 248 seconds]
Targen_ has joined #ruby
Eplemosen has quit [Quit: Leaving]
Araxia has quit [Quit: Araxia]
gregfu has quit [Client Quit]
pu22l3r has joined #ruby
vitor-br has joined #ruby
sazboom has joined #ruby
adelcampo has quit [Quit: Leaving...]
havenn has joined #ruby
r0bby has joined #ruby
patient has quit [Quit: R-R-R-RAGEQUIT!]
jonathanwallace has quit [Remote host closed the connection]
robbyoconnor has quit [Ping timeout: 265 seconds]
bluenemo has quit [Remote host closed the connection]
jasonLas has joined #ruby
digitalcakestudi has joined #ruby
r0bby_ has joined #ruby
dev_ryan70 has joined #ruby
eataix has joined #ruby
techsurvivor has joined #ruby
nari has joined #ruby
beneggett has quit [Quit: Computer has gone to sleep.]
soooga has joined #ruby
r0bby has quit [Ping timeout: 276 seconds]
jarred has quit [Quit: jarred]
ysyk has quit [Ping timeout: 252 seconds]
mahmoudimus has quit [Quit: Computer has gone to sleep.]
dev_ryan70 has quit [Ping timeout: 276 seconds]
pingfloyd has joined #ruby
jasonLas has quit [Ping timeout: 276 seconds]
gmci has quit [Quit: Computer has gone to sleep.]
emmanuelux has quit [Ping timeout: 268 seconds]
iamjarvo has quit [Quit: Computer has gone to sleep.]
r0bby_ is now known as robbyoconnor
leoncamel has joined #ruby
perryh is now known as perryh_away
Mokiwai has joined #ruby
kyktommy has quit [Quit: kyktommy]
n_blownapart has joined #ruby
waxjar has quit [Ping timeout: 252 seconds]
waxjar has joined #ruby
ipoval has quit [Quit: ipoval]
<n_blownapart>
very basic noob question, if you have time. I had a hard time with this operator even before I forgot ruby. basically, this means either an empty array or the instance variable referring to an array, right? Thanks: = []
<n_blownapart>
@stack || ^^
<n_blownapart>
correction @stack || = []
Markvilla1 has quit [Quit: Leaving.]
<heftig>
||= is one operator
<n_blownapart>
heftig: oh yeah, so no space right?
<heftig>
yes
<heftig>
a ||= b is basically a shortcut for a || (a = b)
<heftig>
that is, if a is nil or false, assign b to a
<heftig>
reading unset instance variables returns nil, so @stack ||= [] would make @stack an empty array if it's unset
<n_blownapart>
so heftig ... hold on one sec..
<n_blownapart>
so technically the unset instance var. is false? heftig
<heftig>
is nil
TorpedoSkyline has quit [Quit: ["Textual IRC Client: www.textualapp.com"]]
havenn has quit [Remote host closed the connection]
Mokiwai has left #ruby ["Ik ga weg"]
freeayu has joined #ruby
<n_blownapart>
heftig: so in your example, if a is false or nil, you assign b to a. what does assigning b to a do...ie what is then the value of b?
<n_blownapart>
heftig: logically why does b "cover" for a?
<heftig>
b doesn't change
<heftig>
a changes to the value of b
ysyk has joined #ruby
ysyk has quit [Max SendQ exceeded]
centipedefarmer has joined #ruby
<n_blownapart>
heftig: sorry, is that just a rule, because b is on the right of the operator or something?
<heftig>
you do know what a = b does, right?
<butblack>
is there a way to convert a model datetime in symbol format to a date? for example I have a date_end column which has a symbol :date_end I would like to make it just a date :date_end.to_date doesn't work… suggestions?
<heftig>
butblack: symbols and dates are apples and oranges
<heftig>
converting between them is nonsense
ysyk has joined #ruby
<n_blownapart>
heftig: well, one thing is that b would then refer to the same obj. as a does
ysyk has quit [Max SendQ exceeded]
<davidcelis>
omg
<butblack>
heftig: what would you suggest?
<n_blownapart>
sorry
<heftig>
butblack: i can barely make sense of your question
<n_blownapart>
heftig: I understand a = b in the context of object reference. is that what you are asking me?
maletor has joined #ruby
<heftig>
n_blownapart: i'm using a and b just as placeholders for whatever variables or expressions you want
<heftig>
(obviously, a variable must be to the left of an assignment)
<butblack>
heftig: ok, let's try this… I have a variable that equals this @brooms.group_by(&:date_end) .. :date_end is a datetime, however I need to group it by date, how could I do that?
digitalcakestudi has quit [Ping timeout: 272 seconds]
<butblack>
heftig: great, thanks
drago757 has joined #ruby
ysyk has joined #ruby
ysyk has quit [Max SendQ exceeded]
yoklov has quit [Quit: computer sleeping]
Dreamer3 has quit [Ping timeout: 240 seconds]
liluo has joined #ruby
<n_blownapart>
heftig: this is what my book says: array || = [] is shorthand for: if array has a boolean value of true (its neither false nor nil) then don't do anything; but if it doesn't, initialize it to a new array. So if its true, that means the array already has contents, right?
<heftig>
no
<heftig>
it just means the variable "array" is not false or nil
<heftig>
and, of course, a filled array is true as well
<heftig>
0 is true, too :p
<n_blownapart>
so if its empty, its fine. but in the case @stack || = [] , how could @stack, which is just a instance var. within a method definition, be false then?
stephenjudkins has quit [Quit: stephenjudkins]
stephenjudkins has joined #ruby
Dreamer3 has joined #ruby
<heftig>
n_blownapart: nil is falsey as well
<heftig>
and instance variables that were never written have the content nil
<heftig>
just try it in irb
<heftig>
>> @foo
<al2o3cr>
(NilClass) nil
<heftig>
>> @stack
<al2o3cr>
(NilClass) nil
<heftig>
>> @stack ||= []; @stack
<al2o3cr>
(Array) []
<heftig>
>> @stack ||= []; @stack << 3; @stack
<al2o3cr>
(Array) [3]
pu22l3r has quit [Remote host closed the connection]
<heftig>
>> @stack = 0; @stack ||= []; @stack
<al2o3cr>
(Fixnum) 0
<heftig>
>> @stack = flase; @stack ||= []; @stack
<al2o3cr>
exit status: 1
<al2o3cr>
stderr was too long, I PMed it to you
<heftig>
>> @stack = false; @stack ||= []; @stack
<al2o3cr>
(Array) []
<n_blownapart>
heftig: ok thank you....got my work cut out for me.
scriabin has joined #ruby
<banisterfiend>
>> BEGIN { $a = callcc { |cc| $a = cc } }; END { $a.call }
<al2o3cr>
stderr was too long, I PMed it to you
<al2o3cr>
exit status: 1
otters has quit [Quit: WeeChat 0.3.8]
otters has joined #ruby
justsee|away is now known as justsee
<savage->
>> Process.pid
<al2o3cr>
(Fixnum) 5913
savage- has quit [Remote host closed the connection]
havenn has joined #ruby
<n_blownapart>
al2o3cr: sorry, were you answering heftig's irb examples earlier?
<heftig>
n_blownapart: it's a bot
<n_blownapart>
heftig: no shit?
<heftig>
just send message starting with >> to the channel, and it will try to run it in ruby
freeayu__ has joined #ruby
<n_blownapart>
heftig: that is cool thanks.
<heftig>
and give you the value of the whole thing as an answer
<heftig>
>> 2 + 2
<al2o3cr>
(Fixnum) 4
<n_blownapart>
heftig: that is excellent
dev_ryan70 has joined #ruby
liluo has quit [Remote host closed the connection]
<banisterfiend>
n_blownapart: haha u really thought al2o3cr was just some dude voluntarily executing all our code and telling us teh result? :P
<n_blownapart>
banisterfiend: I'm a babe in the woods but I enjoy this stuff a lot
freeayu has quit [Ping timeout: 260 seconds]
<banisterfiend>
:))
<n_blownapart>
I thought some dude was eager to answer heftig 's stuff
MonsterWithin has joined #ruby
freeayu__ has quit [Ping timeout: 272 seconds]
dev_ryan70 has quit [Ping timeout: 276 seconds]
<n_blownapart>
heftig: banisterfiend why did heftig put @stack after the semiColon in this example: @stack ||= []; @stack ?
<heftig>
technically not needed
<heftig>
i just wanted to emphasize that the answer of al2o3cr is the value of @stack
twock has quit [Ping timeout: 268 seconds]
<n_blownapart>
ok thanks heftig
Synthead has quit [Quit: sqooq]
jonathanwallace has joined #ruby
nwest has quit [Quit: Computer has gone to sleep.]
<jrajav>
al2o3cr will print out the result of putting the entire line in eval(), which itself returns the result of the last statement
yoklov has joined #ruby
gmci has joined #ruby
<banisterfiend>
>> Enumerator.new { |y| y << "jrajav".chars.shuffle.join }.next
<al2o3cr>
stderr was too long, I PMed it to you
<al2o3cr>
exit status: 1
<heftig>
it's not specific to eval. if you have a list of expressions separated by ; or linebreaks, the value of the whole list is the value of the last expression
<banisterfiend>
>> Enumerator.new { |y| y << "jrajav".chars.to_a.shuffle.join }.next
<al2o3cr>
(String) "raajvj"
freeayu__ has joined #ruby
<banisterfiend>
>> Enumerator.new { |y| y << "jrajav".chars.to_a.shuffle.join }.next.next.next.next.next.next
<jrajav>
allyraza: I guess that's between you and the web service :P
<jrajav>
allyraza: Do you mean how do you CHECK for error?
<heftig>
jrajav: were you the one who runs the bot?
<allyraza>
jrajav: yes
<jrajav>
heftig: Yes
<allyraza>
what is the best practice
<heftig>
I think I could do File.unlink "/bot.rb"
dev_ryan70 has quit [Remote host closed the connection]
<heftig>
>> File.unlink "/omg"
<al2o3cr>
(Fixnum) 1
<heftig>
>> File.read "/foo"
<jrajav>
allyraza: You're being spectacularly vague, but if you're referring to a REST HTTP web service, it should be returning the appropraite HTTP status code on an error
<al2o3cr>
stderr:
<al2o3cr>
from -e:1:in `<main>'
<al2o3cr>
-e:1:in `inspect': failed to allocate memory (NoMemoryError)
<n_blownapart>
hi .. why is this said in such a round-a-bout way? : "an object, upon being sent a message, looks for and finds (or fails to find) a method to execute whose name matches the message.
<jumpingcloud>
Would someone mind tearing me apart and telling me why my code sucks before I submit it? I'm trying to get an internship =)
<jrajav>
n_blownapart: I'm confused. Are you asking why people write poorly?
<jrajav>
I'm afraid that's an intractable question
ipoval has quit [Quit: ipoval]
jarred has quit [Quit: jarred]
justsee|away is now known as justsee
dev_ryan70 has quit [Ping timeout: 276 seconds]
<n_blownapart>
jrajav: well, I did my best to find a good book: well-grounded rubyist. I like the book and the author has been using this type of description re: method calls.
<n_blownapart>
I like the book *but the author... ^
scientes has joined #ruby
<jrajav>
I've never read that book, but it sounds like you're having a little trouble with it
<banisterfiend>
jumpingcloud: jesus
<jrajav>
I'd suggest diversifying your portfolio :P
<banisterfiend>
jumpingcloud: it doesnt look like ruby code at all
<banisterfiend>
jumpingcloud: that's my first reaction :)
<jumpingcloud>
banisterfiend: yes yes give me more!! =)
<banisterfiend>
jumpingcloud: i would use case/when rather than if/elsif
<jumpingcloud>
yeah, i was thinking that.
<banisterfiend>
jumpingcloud: also, use 2 space indent
<banisterfiend>
jumpingcloud: also consider raising an exceptoin rather than just 'puts something is wrong'
ananthakumaran has joined #ruby
<banisterfiend>
im not 100% on your code, but error conditions are often better managed with exceptions
<jumpingcloud>
Your right, I was actually thinking of making that a setup_rovers method, but... I'm surprised i actually finished it in the first place =D
digitalcakestudi has quit [Ping timeout: 244 seconds]
r0bby_ has joined #ruby
r0bby_ is now known as robbyoconnor
richardcreme has quit [Ping timeout: 244 seconds]
scientes has quit [Ping timeout: 252 seconds]
r0bby has quit [Ping timeout: 276 seconds]
<banisterfiend>
jumpingcloud: cool
<banisterfiend>
jumpingcloud: 1. get it working 2. refactor :)
<banisterfiend>
jumpingcloud: are you using git?
Juul has quit [Ping timeout: 246 seconds]
<jumpingcloud>
banisterfiend: i am using git
<banisterfiend>
jumpingcloud: cool, then you can refactor without worrying about messing it up
<jumpingcloud>
banisterfiend: it works though, did you try it?
<banisterfiend>
jumpingcloud: nope
<jumpingcloud>
okay, cool, yeah it works. you scared me ;)
<banisterfiend>
i was just commenting on the code style
<jumpingcloud>
I'll try to refactor. I'm new so we'll see.
<banisterfiend>
jumpingcloud: you want to aim for this: DRY and small methods
<jumpingcloud>
i changed the indent ;)
<jumpingcloud>
banisterfiend: awesome thanks for your help, I really appreciate it.
MarGarina has joined #ruby
Banistergalaxy has joined #ruby
banisterfiend has quit [Ping timeout: 276 seconds]
mockra has joined #ruby
lusory has quit [Read error: Connection reset by peer]
mockra has quit [Ping timeout: 240 seconds]
darren has quit [Remote host closed the connection]
n_blownapart has quit [Remote host closed the connection]
jarred has joined #ruby
Banistergalaxy has quit [Ping timeout: 252 seconds]
mockra has quit [Remote host closed the connection]
waxjar has quit [Ping timeout: 240 seconds]
Targen_ is now known as Targen
dev_ryan70 has joined #ruby
scientes has quit [Ping timeout: 272 seconds]
<karneisada>
I'm new to ruby
<karneisada>
I did not expect this many people in the IRC chat
iori has joined #ruby
freeayu3 has quit [Read error: Connection reset by peer]
moshee has quit [Ping timeout: 248 seconds]
dev_ryan70 has quit [Ping timeout: 276 seconds]
gmci has quit [Quit: Computer has gone to sleep.]
moshee has joined #ruby
moshee has quit [Changing host]
moshee has joined #ruby
freeayu has joined #ruby
nari has quit [Ping timeout: 244 seconds]
<davidcelis>
why
<Axsuul>
Is there proper way to extend class methods from a module still to define a ClassMethods module within and then def self.included(base); base.extend(ClassMethods); end ?
yasushi has quit [Remote host closed the connection]
yasushi has joined #ruby
mfridh has joined #ruby
yasushi has quit [Ping timeout: 240 seconds]
MonsterWithin has quit [Ping timeout: 260 seconds]
zelo has joined #ruby
gmci has quit [Quit: Computer has gone to sleep.]
haxrbyte has joined #ruby
krai has quit [Ping timeout: 245 seconds]
opus has quit [Quit:]
krai has joined #ruby
dev_ryan70 has joined #ruby
s1n4 has quit [Quit: peace out]
MonsterWithin has joined #ruby
k_89 has joined #ruby
dev_ryan70 has quit [Ping timeout: 260 seconds]
specialGuest has joined #ruby
specialGuest has quit [Changing host]
specialGuest has joined #ruby
d3vic3 has quit [Quit: leaving]
qwerxy has quit [Quit: offski]
yxhuvud has quit [Ping timeout: 246 seconds]
Targen has quit [Ping timeout: 268 seconds]
Spaceghostc2c has quit [Remote host closed the connection]
MetaCosm has quit [Remote host closed the connection]
SeanTAllen has quit [Read error: Connection reset by peer]
moeSeth has quit [Remote host closed the connection]
_marvin has quit [Remote host closed the connection]
relix has quit [Remote host closed the connection]
anildigital_work has quit [Remote host closed the connection]
[diecast] has quit [Remote host closed the connection]
Dr4g has quit [Remote host closed the connection]
kaichanvong has quit [Remote host closed the connection]
cool has quit [Remote host closed the connection]
denysonique has quit [Remote host closed the connection]
lectrick has quit [Remote host closed the connection]
dotemacs has quit [Remote host closed the connection]
octarine has quit [Remote host closed the connection]
randym has quit [Remote host closed the connection]
aquaranto has quit [Remote host closed the connection]
franckverrot has quit [Remote host closed the connection]
notbrent has quit [Write error: Connection reset by peer]
patricksroberts has quit [Remote host closed the connection]
MoMo has quit [Read error: Connection reset by peer]
philcrissman has quit [Remote host closed the connection]
pvh has quit [Remote host closed the connection]
mroth has quit [Remote host closed the connection]
NimeshNeema has quit [Remote host closed the connection]
ladder4 has quit [Remote host closed the connection]
fcoury has quit [Remote host closed the connection]
orend has quit [Remote host closed the connection]
dnyy_ has quit [Remote host closed the connection]
kapowaz has quit [Remote host closed the connection]
fowl has joined #ruby
kirun has joined #ruby
vagab0nd has quit [Quit: leaving]
Targen has joined #ruby
Spaceghostc2c has joined #ruby
JarJar has joined #ruby
[diecast] has joined #ruby
<Inoperable>
chars.sort_by { |key, value| value }
<Inoperable>
the second value argument
<Inoperable>
?
<apeiros_>
what about it?
<Inoperable>
i don't get it
octarine has joined #ruby
<apeiros_>
sort_by is based on #each, #each yields(key, value)
<Inoperable>
ok
<apeiros_>
and you return a value from sort_by, by which you want to sort (hence the name). since you want to sort by value, you return the value
mroth has joined #ruby
<Inoperable>
ohh ok
<Inoperable>
apeiros_: so every method in ruby inherits from some parent method?
<apeiros_>
no
<apeiros_>
but many methods for collections are implemented in the Enumerable module
<apeiros_>
and that only needs the #each method to work
<fowl>
each yields [key, value]
<apeiros_>
fowl: yeah, correct. it yields an array, not two distinct values.
<apeiros_>
(and do |key, value| gets that array auto-splatted)
<Inoperable>
auto-splatted?
<apeiros_>
fowl: your turn to explain, that was the reason I didn't mention that detail :-p
aquaranto has joined #ruby
cousine has joined #ruby
aez|zzz has quit [Ping timeout: 240 seconds]
<Inoperable>
hehe
MetaCosm has joined #ruby
monkegjinni has quit [Remote host closed the connection]
<Inoperable>
can google it, thanks for dropping the bone
karneisada has quit [Ping timeout: 245 seconds]
burgestrand has quit [Quit: Leaving.]
anildigital_work has joined #ruby
randym has joined #ruby
<fowl>
apeiros_: i dont understand why its auto-splatted, it doesnt make much sense when you can also do |(a, b)| to expand an array if needed
Russell^^ has joined #ruby
<fowl>
Inoperable: i guess its comparable to doing a = [1, 2] which is fine, you'll get [1, 2], but if you throw another var in there like a, b = [1, 2] then a is 1 and b is 2
dnyy_ has joined #ruby
<Inoperable>
fowl: didnt knew the a,b = [1, 2] expression is even possible
aezop has joined #ruby
<Inoperable>
but i started like 12h ago
<Inoperable>
so there is a lot i dont know
Divinite has joined #ruby
monkegjinni has joined #ruby
<Inoperable>
but im already falling in love
monkegjinni has quit [Remote host closed the connection]
insecurlex has joined #ruby
blacktulip has joined #ruby
Dr4g has joined #ruby
moeSeth has joined #ruby
MoMo has joined #ruby
lectrick has joined #ruby
pvh has joined #ruby
<Divinite>
Inoperable: With ruby.
MonsterWithin has quit [Ping timeout: 245 seconds]
<Inoperable>
Divinite: yeah
<Divinite>
Awh, that's so sweet. How old is she?
<Inoperable>
Divinite: 13 hehe
MonsterWithin has joined #ruby
<Inoperable>
Divinite: but she looks like 17
k_89 has quit [Ping timeout: 272 seconds]
Criztian has quit [Remote host closed the connection]
<Divinite>
Inoperable: Fair enough.
philcrissman has joined #ruby
heftig has quit [Ping timeout: 240 seconds]
Hanmac has joined #ruby
notbrent has joined #ruby
franckverrot has joined #ruby
relix has joined #ruby
jimeh2 has quit [Ping timeout: 252 seconds]
Divinite has quit [Remote host closed the connection]
Markvilla has joined #ruby
jimeh2 has joined #ruby
krai has quit [Ping timeout: 248 seconds]
<shevy>
I still dont get it
<shevy>
array.each {|(a, b)|}
<shevy>
why are the () used there again?
gmci has joined #ruby
<shevy>
it's harder and harder for my brain to learn anything new
<fowl>
shevy: a, (b, c) = [1, [2, 3]]
<Hanmac>
shevy its needed when you has hash.each_with_index{|(k,v),idx| ... } or something similar
myth17 has joined #ruby
savage- has joined #ruby
carloshh has joined #ruby
myth17 has quit [Changing host]
myth17 has joined #ruby
qko has quit [Read error: Connection reset by peer]
kapowaz has joined #ruby
qko has joined #ruby
<Inoperable>
is there a built-in method to get the word count from a string?
<otters>
shevy: 5 AM
Morkel has quit [Quit: Morkel]
<apeiros_>
what's a word? :)
<shevy>
Inoperable you can write such a method
<apeiros_>
str.scan(/\b.{3,}\b/).length # a possible way
<envygeeks>
can anyone explain this? https://gist.github.com/3331803 << that hash was created by a simple replace of the hash with a symbolized hash
<atmosx>
I was looking at 'pragmatic books' today, metaprogramming apparently made a book of its own
<Gurpartap>
shevy: "kinda" inactive
<atmosx>
well git has a book also, which makes no sense to me but okay
<shevy>
vectorshelve, my largest 3 projects are not on rubygems yet though :(
<vectorshelve>
shevy: nice collection of gems ;)
<shevy>
yeah, I started with small gems, and slowly will work my way up to my main projects
<shevy>
vectorshelve, I hated gems ~2 years ago
<shevy>
takes some time to get rid of the hate
<shevy>
atmosx, metaprogramming... I hate metaprogramming. It always confuses me
<Gurpartap>
barrier
<Gurpartap>
barrier
<envygeeks>
you would still hate rubygems if you looked at their source
<shevy>
overcome
<shevy>
barrier
<shevy>
envygeeks hehehehe
ly_gs has quit [Remote host closed the connection]
uris has joined #ruby
<vectorshelve>
shevy: Gurpartap I want to pass a string to a method which would be a keyword for search in a site and I want to fetch the search results as array of strings. which is the best way to go abt it ? I thought if I use nokogiri it will have some element of UI html parsing which will make the whole thing inconsistent
<shevy>
I should collect this epic quote :)
<Gurpartap>
envygeeks++
<shevy>
vectorshelve, ok so you have a method, and give input to this method via a string, which is your keyword
<vectorshelve>
shevy: yes
<shevy>
vectorshelve, what is "search result"... array? string?
<shevy>
vectorshelve, you could try via .scan
<shevy>
no idea about nokogiri, perhaps it has something convenient
<vectorshelve>
shevy: suppose I pass "google" to the method.. it will search for google in a site and fetch the results as array
<shevy>
ah ok
<atmosx>
vectorshelve: entire website?
<shevy>
so you have one huge string
ly_gs has joined #ruby
<shevy>
the entire website == your huge string
m_3 has quit [Quit: leaving]
nari_ has quit [Ping timeout: 248 seconds]
<atmosx>
vectorshelve: like scrapping or just the 1st page/result
<envygeeks>
since Google semantically labels their results you could just do a root xpath search vectorshelve
<atmosx>
vectorshelve: if you need entire website you might wanna check out 'anemone'
<atmosx>
xpath with google will work but then you depend on google alone...
cousine_ has joined #ruby
<Gurpartap>
envygeeks: "simple replace of the hash with a symbolized hash" is there a gist for that?
<vectorshelve>
atmosx: envygeeks shevy I am planning to make a gem so this string that I pass will go search it on a site and fetch the results.. this is the use case
<Gurpartap>
of how you did that
<vectorshelve>
atmosx: 1st page result
<shevy>
vectorshelve yes, I would just download the page locally via ruby into a string, then use .scan on it
MonsterWithin has quit [Ping timeout: 244 seconds]
<Gurpartap>
vectorshelve: sorry, nokogiri/xpath noob here
<vectorshelve>
Gurpartap: ok
<atmosx>
vectorshelve: I don't clearly understand the use and how the results will be displayed in a human-readable-way on cli
<shevy>
vectorshelve, well first write the script, then make it a gem
<vectorshelve>
shevy: yes
<atmosx>
vectorshelve: hmm, I'm planning to write a similar script for my 'moralytics' tool, but I'll use online dictionaries, not google
<vectorshelve>
shevy: so what would be the best way to do it ?
andrewhl has joined #ruby
<atmosx>
vectorshelve: dictionaries have a standard 'search url' like http://blah.bluh<keyword>=?bogus_search=id
<vectorshelve>
atmosx: I wont use google.. may be some site for similar purpose.. but will that be a forgery over the contents of the site ? #SOPA #PIPA :)
cousine has quit [Ping timeout: 240 seconds]
<shevy>
vectorshelve openuri
specialGuest has quit [Ping timeout: 260 seconds]
<vectorshelve>
atmosx: ok so given my use case.. what do you suggest would be the best way of implementing it ?
ly_gs has quit [Remote host closed the connection]
<shevy>
envygeeks, never heard of faraday or EM-BOOBS
<vectorshelve>
shevy: getting a good idea.. thanks
<Gurpartap>
LOL
<vectorshelve>
envygeeks: why sad smiley ?
<shevy>
vectorshelve, always try to think in terms of "what your object can do"
<shevy>
and objects love methods
<shevy>
cat.meow
<vectorshelve>
shevy: :)
<shevy>
cat.run_to :seattle
<vectorshelve>
shevy: ruby.code :)
<envygeeks>
shevy: async http requests, so you don't block like you do with open-uri, I guess for a linear script like his it doesn't matter but meh
<shevy>
vectorshelve, there is a .code method for Coderay
<shevy>
it is nice, Coderay
<vectorshelve>
shevy: :)
<atmosx>
vectorshelve: here is a script I wrote some time ago, which among other things uses nokogiri to grep content from blogs http://codepad.org/WKiGXN0B
<Gurpartap>
EM EVERYTHING
<shevy>
I use it to colourize ruby code on the commandline
<atmosx>
vectorshelve: you might an idea, however there are plenty of gems that you can use… I'd go for a list of online dictionaries with standard page structure and use x.path per page to gather the results I want.
<shevy>
first one should be this:
<shevy>
each(&:update)
<shevy>
each {|x| x.update }
<shevy>
you see?
<shevy>
(I think)
<Gurpartap>
yeah that
<shevy>
the second one .... hmmm
<Gurpartap>
it's the same
<shevy>
I think you pass a proc to this method
<shevy>
oh ok
<Gurpartap>
except it passes a block too
<shevy>
Gurpartap is expert vectorshelve, learn from him :)
<Gurpartap>
lol
freeayu has quit [Read error: Connection reset by peer]
<vectorshelve>
shevy: yes I know.. the indian ruby hero :) Gurpartap
<shevy>
hehe
<vectorshelve>
atmosx: nice
<shevy>
how's the work in the computer area in india? noone uses ruby right?
<vectorshelve>
shevy: second method ? Gurpartap &block ?
<envygeeks>
isn't PHP the biggest language there? That company that makes PHP based support software just banked millions and built a new office in one of the most expensive offices there
<atmosx>
I hate PHP too, but since I don't make money out of code I don't a shit about it anyway
<vectorshelve>
atmosx: thanks mate
<atmosx>
vectorshelve: ;-)
<vectorshelve>
atmosx: will try to use that site
<shevy>
atmosx hehe
<vectorshelve>
shevy: India is catching up on ruby on rails.. me too :P
<atmosx>
yeah, didn't check out the code, if you can scrap the synonyms using xpath (nokogiri) it would be veeeery easy to get the synomycs
<atmosx>
vectorshelve: you're from india?
<vectorshelve>
atmosx: what if the site updates html ;D
<vectorshelve>
atmosx: yes
<shevy>
vectorshelve I always found it hard to get into ruby on rails myself
<atmosx>
vectorshelve: I don't know, you will worked it out alone :-P
<vectorshelve>
shevy: sorry ruby.. forgot I am not supposed to name rails here :D
<shevy>
it would be easier if one could learn individual ror components
<vectorshelve>
shevy: I work in it.. but sadly I hate it at times.. I want to work on something stand alone... system programming sought of stuff
<envygeeks>
well figured out my problem, it's because Hashie is a piece of shit
* atmosx
is listening to Franz Ferdinand - This Boy, from the album You Could Have It So Much Better [2:21 mins] [192 kbps MPEG audio file] [3.28 MB] [played missing value times]
<xorox90>
are there any one who have complain about ruby's encoding?
<vectorshelve>
Gurpartap: sought of but not completely
<Gurpartap>
vectorshelve: your earlier code didnt actually make sense. so i tried to infer what you're aiming for
arturaz has joined #ruby
nedbat has quit [Disconnected by services]
<vectorshelve>
Gurpartap: yes I got it now.. thanks :)
nedbat_ has joined #ruby
blacktulip has quit [Remote host closed the connection]
<Gurpartap>
vectorshelve: &:foo has nothing to do with &block
<vectorshelve>
Gurpartap: hmmm
<shevy>
xorox90, yeah. The Encoding addition was the biggest piece of crap in Ruby's history. But it's futile to complain about it, it'll stay.
justsee is now known as justsee|away
<matled>
shevy: the default values just suck, otherwise it's fine
<Gurpartap>
encodings are like timezones
nedbat_ is now known as nedbat
freeayu has joined #ruby
<xorox90>
I got it shevy thx..
<shevy>
matled code that worked perfectly well in 1.8.x no longer worked in 1.9.x. for those who use UTF it's not a problem, but I wanna stay in ISO*. For me, I solve it by using # Encoding: ASCII-8BIT in every .rb file, so it is ok nowadays. but it still annoys me
ph^ has quit [Remote host closed the connection]
beneggett has quit [Quit: Computer has gone to sleep.]
Eldariof-ru has quit [Ping timeout: 244 seconds]
Eldariof59-ru has joined #ruby
<matled>
shevy: exactly, they should have just used binary as default and all scripts would be compatible
<matled>
it's so annoying to get shell scripts right if the locale indicates utf-8
<shevy>
yeah
<matled>
pathnames/environment variables/arguments may all contain characters not valid in utf-8 encoding
Eldariof27-ru has joined #ruby
iori has joined #ruby
envygeeks has left #ruby [#ruby]
<xorox90>
what kind of ruby ide do you prefer? I use ruby mine but there big problem.. if I click some empty space in ruby mine, it dosen't stick to properly.. I'm sorry for my bad english...
bier has quit [Read error: Connection reset by peer]
nedbat has joined #ruby
bier has joined #ruby
xorox90 has quit [Remote host closed the connection]
qwerxy has joined #ruby
pen has joined #ruby
heftig has quit [Ping timeout: 240 seconds]
kaen has joined #ruby
cousine has joined #ruby
k_89 has joined #ruby
Husel has quit [Quit: Page closed]
Russell^^ has quit [Quit: Russell^^]
moshee has quit [Ping timeout: 244 seconds]
moshee has joined #ruby
moshee has joined #ruby
moshee has quit [Changing host]
quest88 has joined #ruby
mockra has quit [Remote host closed the connection]
nateberkopec has joined #ruby
jorum has quit [Quit: Leaving...]
cousine has quit [Remote host closed the connection]
d3vic3 has joined #ruby
cousine has joined #ruby
otters has quit [Quit: WeeChat 0.3.8]
tk_ has joined #ruby
sazboom has joined #ruby
shevy has quit [Ping timeout: 252 seconds]
fayimora has joined #ruby
<k_89>
just curious ... but are any of you guys using for something not even remotely related to web dev?
<banseljaj>
k_89: rephrase the question please?
fowlzzzzzzzzzzzz is now known as fowl
darren has joined #ruby
<k_89>
banseljaj, i'm curious about fields where ruby is used which are not related to web-dev
<banseljaj>
k_89: Ah. There I can't help you much. Although I *am* trying to developa desktop application for personal use. If only I can make stupid gtk work
<fowl>
k_89: ruby is a scripting language, rails is not ruby. whoever is spreading these nefarious lies will pay for it in the afterlife.
<k_89>
fowl, i 'despise' rails
<fowl>
same here
<banseljaj>
fowl: sinatra? merb?
<banseljaj>
cucumber?
<banseljaj>
rspec?
<banseljaj>
PUPPET!
<banseljaj>
how the fuck could i forget puppet.
<fowl>
banseljaj: whats your point? just naming things?
<vectorshelve>
how can I highlight code in README.rd file in github
<banseljaj>
k_89: look up puppet. an enterprise level solution for setting up OSs the correct way.
<k_89>
checking it out already :P
<banseljaj>
fowl: meant to ask, do you also hate sinatra/merb?
<banseljaj>
and the other two were for k_89. Cucumber and rspec are not exclusively related to web dev
<ddv>
Not sure why it would matter if someone hates something
xorox90 has joined #ruby
<k_89>
the debates though are fun to watch
<fowl>
banseljaj: sinatra is alright but if i really need to host a website it will be for some debugging/controlling/reporting or something mundane like that and id rather use webrick
<banseljaj>
<ddv> Not sure why it would matter if someone hates something -- +1
<k_89>
i use php
<k_89>
:P
<k_89>
now hate me
<banseljaj>
k_89: I hate you.
<k_89>
haha
* banseljaj
is secretly a WP dev.
<banseljaj>
sometimes*
<ddv>
Whatever pays the bills
<banseljaj>
fowl: Ah. I understand. wasn't meaning to debate. just wanted to know. :)
<banseljaj>
ddv: Indeed
Asher has joined #ruby
<banseljaj>
Guys, ruby-libnotify is not installing. I have no idea why. Stupid gem. :(
<Gurpartap>
karma
<banseljaj>
Also, is ruby-gtk2 abandoned?
<banseljaj>
Gurpartap: how? o.O
<Gurpartap>
you're a php developer secretly
<fowl>
banseljaj: i think its called ruby-gnome2 or something like that
<Gurpartap>
your karma doesn't let you install the ruby-libnotify gem now
shevy has joined #ruby
<banseljaj>
Gurpartap: Are you saying that karma didn't know about it before? :P
havenn has quit [Remote host closed the connection]
<k_89>
Gurpartap, any chance you from delhi ?
<banseljaj>
fowl: No gem named like that. and the library itself is not available either. their deb repo gives 404
<Gurpartap>
k_89: Nop. No chance.
<k_89>
heh
<fowl>
banseljaj: what is a deb repo
<banseljaj>
fowl: debian repository.
<banseljaj>
Gurpartap: any certainty?
<fowl>
banseljaj: please tell me you arent installing gems through that..
qwerxy has quit [Quit: offski]
<banseljaj>
fowl: No, I'm not. I am also, not on debian. I'm on ubuntu.
<k_89>
ubuntu = debian
<k_89>
built on debian
<Gurpartap>
banseljaj: karma is a seed, not god.
<Gurpartap>
or God
<Gurpartap>
or demigod
<fowl>
lol .. why did you bring up debian then if it doesnt apply to you? (even though it does)
<k_89>
i dont think there is anything like karma ... its all random ..
<banseljaj>
k_89: Indeed. Except Ubuntu is fast forward from debian. debian still has 2 year old packages in its repo.
<k_89>
or rather chaotic
<k_89>
banseljaj, yeah true
<banseljaj>
fowl: I was just commenting about how ruby-gnome2 has disappeared mostly
<Gurpartap>
no one's debating about karma's existence :)
<Gurpartap>
it's common sense, whether or not you call it karma :)
qwerxy has joined #ruby
<banseljaj>
No gem named ruby-gnome2. It was apparently superseded by the gtk2 gem.
<fowl>
banseljaj: http://rubygems.org/gems/gtk2 refers to itself as ruby-gnome2 project, last updated july this year, so yes still maintained..
<Gurpartap>
you reap what you sow (could or could not be in the karma syllabus, k_89)
<Gurpartap>
(in simpler words, you don't get random fruits if you sow a mango seed)
<Gurpartap>
peace.
chichou has joined #ruby
<banseljaj>
<Gurpartap> (in simpler words, you don't get random fruits if you sow a mango seed) -- If you could, that would be awesome. :D
<k_89>
Gurpartap, many times things are 'sown' around by so many others .. its chaotic ... true what you do has some effect on what becomes of you .. but you cant be sure of that
vectorshelve has quit [Quit: Page closed]
<banseljaj>
fowl: well, installing gtk2, I still can't install libnotify because apparently "ERROR: no gtk2.rb found, please install Ruby/Gtk2"
<Gurpartap>
k_89: no way of tracking which seed resulting in which fruit != saying fruits and seeds are unrelated, to escape the difficulty of imagining a simple phenomenon :)
sazboom has quit [Quit: EPIC5-1.1.4[1667] - amnesiac : The fatter they are, the fatter they fall]
<k_89>
Gurpartap, thats why i am using the word chaotic .. not random ... there's a difference between the two, big difference ;)
<Gurpartap>
k_89: shunning university syllabus in 10th class takes us no where.
Zespre has joined #ruby
<banseljaj>
k_89: Randomly Chaotic? :D
qwerxy has quit [Client Quit]
<Gurpartap>
k_89: <k_89> "i dont think there is anything like karma"
<shevy>
foobar.rb:3:in `require': no such file to load -- sinatra (LoadError)
<shevy>
however
<shevy>
if I do
<shevy>
require 'sinatra'
<shevy>
it works
<shevy>
HMMMMM.
<banseljaj>
shevy: require '#{x}'?
<Gurpartap>
shevy: x = timeout; require x => true
<Gurpartap>
banseljaj: that's no different than just x, since it's already a string
<k_89>
shevy, create a Gemfile
<shevy>
what
<k_89>
yes
<banseljaj>
Gurpartap: I know. But I am kinda superstitious about it.
<shevy>
x = timeout does not work for me
<k_89>
shevy, create a Gemfile with gem 'sinatra' in it
<Gurpartap>
shevy: quote (sorry)
<Gurpartap>
quotes
<shevy>
yeah
<shevy>
with quotes it works
<Gurpartap>
shevy: do as k_89 wants you to
<Gurpartap>
:P
<shevy>
why do I have to create a gemfile
<k_89>
i dunno really ..
<Gurpartap>
shevy: sinatra error is probably because sinatra isn't around
<Gurpartap>
there's no fault with require method
<shevy>
require 'sinatra' works
<k_89>
yeah it'd in your script
spg has joined #ruby
<Gurpartap>
shevy: try passing 'timeout' ?
<banseljaj>
shevy: why are you doing this anyways?
jorum has joined #ruby
<fowl>
banseljaj: what are you talking about? it says you need ruby/gtk2 so install gtk2
<banseljaj>
shevy: try string interpolation once.
okapi has joined #ruby
<shevy>
banseljaj to require ruby libraries via $stdin.gets
<k_89>
it all started when i gave up rails and tried playing with sinatra .. i made a Rakefile to setup migrations and no gem would be required properly
<fowl>
banseljaj: i just installed libnotify and gtk2 and both compiled without issue..
sysrmr has quit [Quit: Konversation terminated!]
<banseljaj>
fowl: I did install gtk2. It was the first thing i did. But it still won't compie.
<k_89>
shevy, then i created a gemfile .. and stuff worked
<banseljaj>
fowl: you did?
<shevy>
I just noticed something
<shevy>
when I input:
<shevy>
pp
<k_89>
basically the path where gems are installed isn't included into $PATHS in ruby
<shevy>
it works
<shevy>
yeah.... hmmmmmm
<fowl>
banseljaj: you keep saying things like "wont compile"
<shevy>
now I see what you mean k_89
<shevy>
damn :(
<fowl>
banseljaj: does gems say "sorry i dont feel like compiling :(" or does it give an error or what
<fowl>
segfault? anything more than "wont compile"
<banseljaj>
fowl: well, installing gtk2, I still can't install libnotify because apparently "ERROR: no gtk2.rb found, please install Ruby/Gtk2"
<banseljaj>
I have gtk2 installed.
spg has left #ruby [#ruby]
<fowl>
banseljaj: nvm, figure it out yourself
<banseljaj>
even then I have the above error.
<k_89>
shevy, if by any chance you find out why this shit happens .. please share :P
<banseljaj>
fowl: the above error keeps popping up.
<Gurpartap>
k_89: we thought you knew the solution.
<Gurpartap>
that you proposed :p
<fowl>
banseljaj: do `ruby -e "require 'gtk2'"
<shevy>
k_89 I think you are right ... there seems to be different load paths or something used
<banseljaj>
fowl: did you install ruby-libnotify or libnotify?
<k_89>
Gurpartap, i knew what worked .. i wasn't lying when i said i use php :P
<fowl>
banseljaj: i told you earlier Do Not Install Gems Through Your Package Manager
azm has joined #ruby
<banseljaj>
fowl: I am *not*. there is a GEM named ruby-libnotify.
<Aenigma>
i have a directory of 88,000 files or so. (they're jpeg images downloaded from a live camerea). i wanted to deduplicate it using ruby so i made it populate a hash keyed with md5 checksums with values being the file paths. i ran out of ram doing this. i'm not sure why. what's the right way to do this?
<apeiros_>
after all, an md5 is 16bytes, lets assume your average file path is 112bytes then that's 128bytes per file. 88k*128B =~ 11MB
<jrajav>
>> 88000 * 128 / 1024
<al2o3cr>
(Fixnum) 11000
<jrajav>
;)
<fowl>
>> 88000 * 128.0 / 1024
<al2o3cr>
(Float) 11000.0
<apeiros_>
>> require 'units'
<al2o3cr>
stderr was too long, I PMed it to you
<al2o3cr>
exit status: 1
khakimov has quit [Quit: Computer has gone to sleep.]
DarthGandalf has joined #ruby
Criztian has joined #ruby
indian has joined #ruby
<atmosx>
hello
adelcampo has joined #ruby
<Aenigma>
apeiros_: blahh. how do i fix memory leaks? the only thing that would leak enough would be the actual files and i opened those using File.open block
<apeiros_>
Aenigma: feel free to share the code ;-)
ly_gs has joined #ruby
<apeiros_>
other than that, in the older days I used bleakhouse. don't know if it's been updated for 1.9, though
<apeiros_>
on osx, you might be able to use dprobes
<atmosx>
begin / rescue/ <bold>ensure</bold> File.close ?
workmad3 has quit [Ping timeout: 272 seconds]
<apeiros_>
atmosx: File.open with a block does that better.
maletor has quit [Quit: Computer has gone to sleep.]
<atmosx>
apeiros_: okay
baphled has joined #ruby
ianbrandt has joined #ruby
maletor has joined #ruby
yakko has joined #ruby
mockra has joined #ruby
baphled has quit [Client Quit]
baphled has joined #ruby
<jrajav>
Forgive me if I'm derping
<jrajav>
But isn't 88k * 128b actually 11k MB?
<jrajav>
i.e. ~ 11 GB?
omry has joined #ruby
dangsos has joined #ruby
eph3meral has left #ruby ["Leaving"]
<dangsos>
anyone have any experience with the refinery cms gem?
<fowl>
Aenigma: why are you using File.open to md5? you can Digest::MD5.file()
<jrajav>
There's still the problem of storing the hash
<jrajav>
Wait. I *am* derping
<jrajav>
Don't mind me
baphled has quit [Client Quit]
baphled has joined #ruby
cakehero has quit [Quit: Computer has gone to sleep.]
lkba has joined #ruby
mockra has quit [Ping timeout: 244 seconds]
mengu has joined #ruby
mrdodo has joined #ruby
yakko has quit [Quit: No Ping reply in 180 seconds.]
specialGuest has quit [Ping timeout: 268 seconds]
yakko has joined #ruby
dangsos has quit [Quit: Page closed]
mrdodo has quit [Ping timeout: 248 seconds]
fayimora has quit [Quit: Busy…..zzzzz]
brianpWins has joined #ruby
atmosx has quit [Ping timeout: 244 seconds]
ly_gs has quit [Remote host closed the connection]
timonv has joined #ruby
alexwh has joined #ruby
butblack has quit [Quit: butblack]
macer_ has joined #ruby
macer_ is now known as macer1
<macer1>
hey
<macer1>
anyone here is using bindata?
yakko_ has joined #ruby
h8R has joined #ruby
yakko has quit [Ping timeout: 260 seconds]
Guest11049 is now known as rippa
lledet has joined #ruby
<lledet>
anyone know of a good json-rpc client gem?
<Aenigma>
fowl: blah. why are the ruby-docs for md5 stuff so crappy? i don't Digest::MD5 even documented at all
<apeiros_>
fowl: actually MD5.file just opens the file too :) but I'd use that one too. depending on how Aenigma did it, that shouldn't be the problem, though.
Quadrant has joined #ruby
snearch has quit [Quit: Verlassend]
snearch has joined #ruby
atmosx has quit [Ping timeout: 252 seconds]
<fowl>
apeiros_: but it opens in binary and reads it in parts and all that which you probably wouldnt do if you just used File.open()
<apeiros_>
fowl: as I said - depending on how he did it. we don't know.
<jrajav>
I magically forgot about kilobytes as a concept
<jrajav>
It was pretty trippy
snearch has quit [Client Quit]
axl_ has quit [Ping timeout: 248 seconds]
<jrajav>
I think tomorrow I'll forget about the number 36
<joekarma>
probably a terrible way to do it... but I suppose you could try s.to_f.to_s == s or s.to_d.to_s == s
cj3kim has joined #ruby
cj3kim has joined #ruby
cj3kim has quit [Changing host]
<joekarma>
er to_i
<joekarma>
not to_d
robbyoconnor has joined #ruby
<Mon_Ouie>
to_int is when the object actually can be treated as an integer. It works on numerics, but not on a string.
<R40UL>
to_d is double right?
<Mon_Ouie>
See #to_i
syamajala has joined #ruby
<joekarma>
R40UL: to_d is not a method, that was a mistake on my part
Guest94817 has quit [Quit: Leaving to Quit]
r0bby_ has quit [Ping timeout: 248 seconds]
<Mon_Ouie>
joekarma: In that case, you might as well check if % 1.0 == 0
<Hanmac>
R4OUL: to_int: treat as integer (only for Numeric childs): to_i: "convert" to integer : to_d: "convert" to bigdecimal
linoj has quit [Quit: linoj]
hkhalid has joined #ruby
<hkhalid>
hi
<Mon_Ouie>
Also notice the convention in Ruby is to use snake_case over camelCase for variable and method names
<R40UL>
oh
<R40UL>
thanks !
<R40UL>
will change it, i'm used to php u know ;p
cantonic has quit [Read error: Connection reset by peer]
waxjar has quit [Ping timeout: 276 seconds]
cantonic has joined #ruby
<joekarma>
the question is, is "3e6" numeric?
<Hanmac>
yeah we notic the smell on php on your body
<joekarma>
it certainly is if you key it into a repl without quotes
<R40UL>
Hanmac I'm currently converting, so sorry :<
cantonic has quit [Client Quit]
<RubyPanther>
R40UL: if (Integer(val) rescue nil) ...
<Hanmac>
>> "3e4".to_f
<al2o3cr>
(Float) 30000.0
<RubyPanther>
or (Float(val) rescue nil) if you want 1.0 or 3e6 to pass
cantonic has joined #ruby
rippa has quit [Ping timeout: 256 seconds]
<otters>
>> Float("foo")
<al2o3cr>
exit status: 1
<al2o3cr>
stderr was too long, I PMed it to you
<RubyPanther>
That is why it is (Float("foo") rescue nil) :)
burgestrand has quit [Quit: Leaving.]
<otters>
so they say
* Hanmac
not like rescue nil ... because it rescue EVERYthing ...
<joekarma>
def is_numeric(s) Float(s) rescue nil or Integer(val) rescue nil end
<joekarma>
I like it
<RubyPanther>
Hanmac: that is a different issue, this is the statement postfix form it rescues everything always and nil is just the return value, you can also say rescue false
<joekarma>
not much can go wrong in that single statement
<otters>
yeah, so like, in what case will Float(...) throw an error that you aren't expecting
<RubyPanther>
add a couple parents are you're golden
<RubyPanther>
parens
<Hanmac>
RubyPanther my problem is that it even rescue "fatal" wich is bad imo
nobitanobi has quit [Read error: Connection reset by peer]
havenn has joined #ruby
waxjar has joined #ruby
<otters>
how can float parsing throw a fatal error
<joekarma>
"<input type crash>"
<RubyPanther>
it isn't going to rescue anything other than the call to Float()
<Hanmac>
the fatal could come somewhere from the inside of ruby
hkhalid has quit [Quit: Leaving]
yakko has joined #ruby
<apeiros_>
otters: it won't. that doesn't mean nothing else can while that code is being executed.
<otters>
oh
<joekarma>
can it really rescue code from a different thread though?
<apeiros_>
Hanmac: inline rescue uses StandardError - are you sure it'd rescue fatal?
awarner has quit [Remote host closed the connection]
<Hanmac>
>> fatal rescue nil
<al2o3cr>
(NilClass) nil
<Mon_Ouie>
NameError: undefined local variable or method `fatal' for main:Object
<joekarma>
anyhow, I suppose if you're really paranoid you could wrap all that in a begin end and rescue ArgumentError explicitly.. but that kind of seems like Javaification to me
waxjar has quit [Ping timeout: 245 seconds]
Chryson has quit [Quit: Leaving]
moshee has quit [Ping timeout: 265 seconds]
<apeiros_>
Hanmac: there's no fatal method…
moshee has joined #ruby
moshee has joined #ruby
moshee has quit [Changing host]
<apeiros_>
and NameError < StandardError
<joekarma>
>> abort rescue 3
<al2o3cr>
exit status: 1
<joekarma>
>> (quit) ; lisp style
<al2o3cr>
exit status: 1
<al2o3cr>
stderr was too long, I PMed it to you
<atmosx>
I'd like to scan for twitter username. I came up with this: if word.scan(/^@\w+/) but the regexp for some reason doesn't work
<atmosx>
rubular shows it as if it's correct
waxjar has joined #ruby
<atmosx>
but no matter what 'word' is, it gets accepted
timonv has joined #ruby
<Mon_Ouie>
accepted?
<apeiros_>
atmosx: dude, you're on irc long enough to know that "doesn't work" is a horrible problem description
croz has joined #ruby
croz has quit [Max SendQ exceeded]
baroquebobcat has quit [Quit: baroquebobcat]
<atmosx>
apeiros_: true, sorry I'm tired
<Mon_Ouie>
String#scan return an Array, not a boolean
croz has joined #ruby
croz has quit [Max SendQ exceeded]
<joekarma>
probably because you're trying to scan for usernames that appear only at the beggining of a string
<joekarma>
you might be looking for \b
<apeiros_>
joekarma: @ is not a word boundary
<joekarma>
s/beggining/beginning/
croz has joined #ruby
<joekarma>
apeiros_: good point
<atmosx>
apeiros_: I'm just trying to grab whatever word begins with '@' here. But it accepts strings that start without '@'.
croz has quit [Max SendQ exceeded]
<apeiros_>
and I doubt he'd want foo@bar to match…
croz has joined #ruby
croz has quit [Max SendQ exceeded]
<Mon_Ouie>
It sounds to me like you want =~
<atmosx>
=~ hmm
croz has joined #ruby
croz has quit [Max SendQ exceeded]
<Mon_Ouie>
If you use scan(…) in a condition, it will always be true, because it will always be an array
Morkel has quit [Quit: Morkel]
croz has joined #ruby
croz has quit [Max SendQ exceeded]
<joekarma>
atmosx: you could split on whitespace first then use select
<Hanmac>
hm there is an rb_fatal method but i think its hidden from the plain side
croz has joined #ruby
croz has quit [Max SendQ exceeded]
nat2610 has joined #ruby
<atmosx>
Mon_Ouie: aha, didn't knew
<joekarma>
>> "the words in this @paragraph".split(/\s+/).select { |w| w[0] == ?@ }
<al2o3cr>
(Array) ["@paragraph"]
<Mon_Ouie>
Since he named his variable word, I guess he already split the text somehow
croz has joined #ruby
croz has quit [Max SendQ exceeded]
blah123 has joined #ruby
croz has joined #ruby
croz has quit [Max SendQ exceeded]
fantazo has quit [Remote host closed the connection]
croz has joined #ruby
croz has quit [Max SendQ exceeded]
<joekarma>
Mon_Ouie: yes, his problem was probably just the use of scan
<joekarma>
as you mentioned
perryh is now known as perryh_away
croz has joined #ruby
croz has quit [Max SendQ exceeded]
blah123 has quit [Client Quit]
<atmosx>
Mon_Ouie: thanks a lot, works and it's easy to read using =~
croz has joined #ruby
croz has quit [Max SendQ exceeded]
blah123 has joined #ruby
croz has joined #ruby
croz has quit [Max SendQ exceeded]
croz has joined #ruby
croz has quit [Max SendQ exceeded]
croz has joined #ruby
resure has quit [Remote host closed the connection]
<joekarma>
probably a missing param in a url or something. probably
<apeiros_>
so, still him
waxjar has quit [Ping timeout: 240 seconds]
<atmosx>
good night all
<atmosx>
I'm off to bed
Spooner_ has joined #ruby
<maletor>
weird
sazboom has joined #ruby
<maletor>
getting rid of all options and body => makes it work. upgrading from 18 to 19 broke this.
alanp has quit [Ping timeout: 245 seconds]
balki_ has quit [Ping timeout: 245 seconds]
cj3kim has quit [Quit: This computer has gone to sleep]
* joekarma
is betting a little experimentation will show that getting rid of *one* of the options will fix this
blah123 has joined #ruby
<maletor>
nope
<vandemar>
maletor: after the } on :query => {... } try .reject{|k,v| $stderr.puts "#{k.to_s} is null"; v==nil}
<apeiros_>
"is null" - awesome :)
Spooner has quit [Ping timeout: 244 seconds]
<apeiros_>
java coder? :D
waxjar has joined #ruby
mmokrysz has joined #ruby
* apeiros_
has a friend who still calls the NoMethodError a NullPointerException
mmokrysz has left #ruby [#ruby]
banseljaj is now known as imami|afk
<R40UL>
but really, ruby is like so much faster in compiling then java
<vandemar>
apeiros_: no. why?
cj3kim has joined #ruby
<joekarma>
most languages call it null.. just lisp and ruby are the outliers
<Hanmac>
maletor: "== nil" is bad ... use ".nil?"
MarGarina has quit [Ping timeout: 246 seconds]
dekronin1 has joined #ruby
<vandemar>
maletor: also try putting something in the body
<maletor>
so what is the value of the key is nil? ?no_value=&value=asdf
<bperry>
or "if not var" :)
<maletor>
is valid
<maletor>
but not for ruby?
jimeh3 has joined #ruby
leoncame` has joined #ruby
<R40UL>
if !var
<R40UL>
?
<apeiros_>
joekarma: yeah, but IME, java coders suffer the most long term damage :-p
<apeiros_>
vandemar: btw., #{} calls to_s already. no need to do it yourself.
<vandemar>
maletor: what does that have to do with ruby? it's the gem/library that might not be filtering out nils, that's the point of trying to diagnose it that way
gentz has joined #ruby
<patient>
can someone point me to a project with nice rspec tests i can inspire myself on?
<joekarma>
R40UL: that's actually subtly different - rather than testing for nil, that's testing for truthiness
richardcreme has quit [Read error: Connection reset by peer]
<vandemar>
maletor: so there are a ton of nils ?
richardcreme has joined #ruby
Spooner_ is now known as Spooner
<joekarma>
vandemar: I use JavaScript a lot so am probably liable to make the same mistake
<joekarma>
don't feel bad
<joekarma>
we are legion
<maletor>
best way to get rid of the nils?
<vandemar>
joekarma: my first language was C. for quite a while, so...
Fretta has joined #ruby
jonnn has joined #ruby
<maletor>
This has gotta be a bug in URI. Queries cannot exist with nil values?
<vandemar>
maletor: what I wrote with the adjustments recommended. .reject{|k,v| $stederr.puts "#{k} is nil"; v.nil?} after the } for :query => { ... } and then add something trivial to :body in case the gem/library is trying to take the first element of that hash (nil) and call each_byte on it
<vandemar>
maletor: without the stdederr typo
<Hanmac>
vandemar information: like in C in ruby exist one thing that cant be compared with "==" ... its the special float NaN
<apeiros_>
Float::NAN == 1 # => false
<apeiros_>
or you mean which is != itself?
<yakko>
[facebook question] hey, what's the easiest way to put the posts of a FB PAGE into a website?
<jrajav>
In such a tiny file, it isn't really needed, but it's considered best practice in C to declare all your functions at the top of the file
pingfloyd has quit [Quit: pingfloyd]
<Paradox>
header files!
<therealfakemoot>
jrajav: I guess I just wasn't sure how the two statements weren't redundant.
<therealfakemoot>
Well, I'm still not sure
<jrajav>
Partly as self-documenting code and partly so that you can call a function from another function that's defined earlier
<therealfakemoot>
Should it mirror the function signature?
<jrajav>
They aren't redundant -- they're doing two different things. A function declaration provides the prototype of a function, giving its name, return type, and arguments -- all the information needed to call it
<therealfakemoot>
The example is sparse.
<jrajav>
The function definition gives the implementation
<jrajav>
And yes, a function declaration and definition have to match
<therealfakemoot>
Sorry, I've never written serious C before
<therealfakemoot>
Or dealt with Ruby in my entire life
<jrajav>
So why are you trying to create a Ruby extension in C?
[Neurotic] has joined #ruby
<therealfakemoot>
jrajav: Part of a larger project for which I will be paid handsomely.
insecurlex has quit [Remote host closed the connection]
<therealfakemoot>
I'm not writing the C
pingfloyd has joined #ruby
<therealfakemoot>
I'm just trying to wrap it with the Ruby C extension wrappers
joekarma has quit [Quit: joekarma]
gqlewis has joined #ruby
joekarma has joined #ruby
pskosinski has quit [Ping timeout: 276 seconds]
jonathanwallace has joined #ruby
havenn has joined #ruby
pskosinski has joined #ruby
RegEchse has quit [Quit: <3 WeeChat (v0.3.9-dev)]
jjang has joined #ruby
daniel_hinojosa has joined #ruby
cj3kim has quit [Quit: This computer has gone to sleep]
pskosinski has quit [Quit: I've got a feeling there's a fish in the floor; I'd better squish it or he'll swim out the door; Sometimes they take me for a walk in the sun; I see my fish and I have to run]
chichou has joined #ruby
bbloom has quit [Ping timeout: 268 seconds]
locriani has quit [Remote host closed the connection]
Eplemosen has quit [Quit: NOPE]
Chryson has joined #ruby
Eplemosen has joined #ruby
savage- has joined #ruby
MarioEIU has joined #ruby
adeponte has joined #ruby
maletor has joined #ruby
havenn has quit [Remote host closed the connection]
bluOxigen has quit [Ping timeout: 252 seconds]
havenn has joined #ruby
havenn has quit [Remote host closed the connection]