banisterfiend has quit [Remote host closed the connection]
banisterfiend has joined #ruby-lang
hahuang65_ has joined #ruby-lang
chessguy has joined #ruby-lang
andrewhl has joined #ruby-lang
tallship has quit [Quit: Too Hip gotta go]
banisterfiend has quit [Ping timeout: 244 seconds]
havenn has quit [Remote host closed the connection]
havenn has joined #ruby-lang
havenn has quit [Read error: Connection reset by peer]
ivanoats has joined #ruby-lang
havenn has joined #ruby-lang
robbyoconnor has quit [Read error: Connection reset by peer]
g0bl1n has quit [Quit: g0bl1n]
havenn has quit [Ping timeout: 260 seconds]
kingCrawlerx has quit [Quit: Computer has gone to sleep]
ivanoats has quit [Remote host closed the connection]
ivanoats has joined #ruby-lang
methym has joined #ruby-lang
slyphon has joined #ruby-lang
Bosox20051 has joined #ruby-lang
bfreeman has quit [Quit: bfreeman]
andrewhl has quit [Remote host closed the connection]
Bosox20051 has quit [Remote host closed the connection]
robbyoconnor has joined #ruby-lang
cdt has joined #ruby-lang
lcdhoffman has joined #ruby-lang
corsican has quit [Quit: leaving]
headius has quit [Quit: headius]
lcdhoffman_ has joined #ruby-lang
corsican has joined #ruby-lang
Z33K|Lux has joined #ruby-lang
t44393 has quit [Remote host closed the connection]
t970 has joined #ruby-lang
cdt has quit [Quit: Ex-Chat]
chessguy has quit [Remote host closed the connection]
lcdhoffman has quit [Ping timeout: 260 seconds]
brianpWins has joined #ruby-lang
macmartine has joined #ruby-lang
Bosox20051 has joined #ruby-lang
chessguy has joined #ruby-lang
mrsolo has quit [Quit: Leaving]
ivanoats has quit [Remote host closed the connection]
ryez has quit [Quit: Page closed]
lcdhoffman_ has quit [Quit: lcdhoffman_]
ivanoats has joined #ruby-lang
ivanoats has joined #ruby-lang
ivanoats has quit [Changing host]
ivanoats has quit [Remote host closed the connection]
ivanoats has joined #ruby-lang
ivanoats has joined #ruby-lang
ivanoats has quit [Changing host]
lcdhoffman has joined #ruby-lang
nazty has joined #ruby-lang
ivanoats has quit [Remote host closed the connection]
nazty has quit [Client Quit]
laszlokorte has quit [Quit: laszlokorte]
milesforrest has left #ruby-lang [#ruby-lang]
chessguy has quit [Remote host closed the connection]
lcdhoffman has quit [Quit: lcdhoffman]
tenderlove has quit [Remote host closed the connection]
Weems has joined #ruby-lang
Weems has joined #ruby-lang
Weems has quit [Changing host]
chessguy has joined #ruby-lang
hahuang65_ has quit [Quit: Computer has gone to sleep.]
chendo_ has quit [Ping timeout: 265 seconds]
chendo_ has joined #ruby-lang
chimkan has joined #ruby-lang
savage-_ has quit [Ping timeout: 265 seconds]
banisterfiend has joined #ruby-lang
savage- has joined #ruby-lang
lcdhoffman has joined #ruby-lang
chendo_ has quit [Ping timeout: 240 seconds]
lcdhoffman has quit [Read error: Connection reset by peer]
lcdhoffman has joined #ruby-lang
savage- has quit [Remote host closed the connection]
chendo_ has joined #ruby-lang
wallerdev has quit [Quit: wallerdev]
wallerdev has joined #ruby-lang
havenn has joined #ruby-lang
bryancp has quit [Remote host closed the connection]
chendo_ has quit [Ping timeout: 240 seconds]
t970 has quit [Remote host closed the connection]
t30325 has joined #ruby-lang
seanstickle has joined #ruby-lang
havenn has quit [Ping timeout: 272 seconds]
<rhizmoe>
i have a couple of classes, each having identical argument checkers in their initialize methods. these checkers are basically if/else loops for TypeError and ArgumentError purposes, and assignment happens within them. is it a decent idea to do something like @foo = check_qty(qty) from a library if the method might bug out in a raise-y way?
chendo_ has joined #ruby-lang
<rhizmoe>
alternatively, is it a bad idea to have lots of logic in the initialize method?
jxie has quit [Quit: leaving]
<steveklabnik>
your name makes me twitch, i can't read it without seeing 'rhizome' ;)
<steveklabnik>
too much deleuze
alvaro_o has quit [Quit: Ex-Chat]
jxie has joined #ruby-lang
mwjcomputing has joined #ruby-lang
<steveklabnik>
to answer your question.... generally, code that checks types of things is bad
dmwuw has quit [Ping timeout: 276 seconds]
chendo_ has quit [Ping timeout: 240 seconds]
bfreeman has joined #ruby-lang
krz has quit [Quit: krz]
chendo has joined #ruby-lang
<rhizmoe>
steveklabnik: it used to be rhizome back in my efnet days, but...it's a long story
woollyams has quit [Quit: Computer has gone to sleep.]
<rhizmoe>
it does derive from deleuze, tho!
Jay_Levitt has quit [Quit: Jay_Levitt]
<rhizmoe>
can you tell me more about not typechecking in code? is it best just to: def initialize(foo,bar,baz); @foo = foo; @bar = bar; @baz = baz; end # and be done with it?
<erikh>
type checking your ivars makes debugging a whole lot easier when you've got a method using the wrong type later
<erikh>
whether it's with the standard isa/=== stuff or respond_to
kvirani has quit [Remote host closed the connection]
<rhizmoe>
this is a coding test, so i want to be as idiomatic as possible i think
<seanstickle>
Didn't you hear? Zed Shaw said that idioms are bad now.
Marc3000 has quit [Ping timeout: 244 seconds]
<erikh>
I'm not sure where idioms take precedence over simple logic, but I've no energy to argue this.
<rhizmoe>
well, by idiomatic i mean standard, simple.
<rhizmoe>
not writing java in ruby, stuff like that.
<banisterfiend>
rhizmoe: i think at the least people use respond_to? rather than is_a?. But a lot of people dont bother with that either and see it as the responsibility of the caller to pass the correct things
<zzak>
finished xmlrpc/server, only parser is left. up to 43.8% doc coverage now
<zzak>
the webrick and mobruby servers could probably go haha
<zzak>
theres a cgi based one too
Marc3000 has joined #ruby-lang
<drbrain>
wow, nice!
<rhizmoe>
lianj: ah, the perlish way :)
<rhizmoe>
banisterfiend: yeah, normally i would do it that way, but this is to impress people
<rhizmoe>
sadly, perhaps.
tenderlo_ has joined #ruby-lang
tenderlo_ has quit [Remote host closed the connection]
tenderlove has quit [Ping timeout: 246 seconds]
Bosox20051 has quit [Quit: Leaving]
mwjcomputing has quit [Quit: Leaving]
<steveklabnik>
rhizmoe: cool :)
<steveklabnik>
rhizmoe: yes, basically what everyone else says. don't ever is_a?, if you must, respond_to?
<steveklabnik>
books that quote deleuze, marx, and the http rfc in the same chapter? i fell in love
<seanstickle>
steveklabnik: ordered
<seanstickle>
steveklabnik: shoulda put your affiliate code in
<steveklabnik>
seanstickle: :) oh well
<steveklabnik>
i do have one
<steveklabnik>
it bought me my copies of Capital II and III :)
<seanstickle>
Close textual readings of code are Very Interesting to me.
jkprg has joined #ruby-lang
desmondmonster has quit [Quit: desmondmonster]
methym has quit [Quit: methym]
banisterfiend has quit [Remote host closed the connection]
<steveklabnik>
this is more a continuation of foucault -> deleuze -> galloway
banisterfiend has joined #ruby-lang
<steveklabnik>
are you aware of the whole Critical Code Studies stuff?
<seanstickle>
I am. Much of what I have read of it is quite terrible.
<steveklabnik>
yeah :/
<steveklabnik>
it doesnt live up to what i'd hoped. they are at least trying
<steveklabnik>
many of them just don't have enough code history
<steveklabnik>
coding
<seanstickle>
English professors swapping out literary terms for things they heard in some programming meetup.
<seanstickle>
Depressing.
<seanstickle>
The one that put me over the edge was an analysis of how a computer virus recapitulates phallocentric patriarchalism.
<seanstickle>
At that point, I was done.
<steveklabnik>
anyway, protocol isn't a close textual reading of code, it's creating 'protocol' as a term to succeed foucault's discipline and deleeuze + guattari's control socieiteis
<steveklabnik>
ha!
banisterfiend has quit [Read error: Connection reset by peer]
dmwuw_ has joined #ruby-lang
<seanstickle>
Have you read Galloway's "The Exploit" ?
<seanstickle>
Considering picking that up as well.
banisterfiend has joined #ruby-lang
brianpWins has quit [Quit: brianpWins]
<steveklabnik>
yes, it is also interesting. it's a sequel of sorts
<steveklabnik>
basically, the exploit is how to get past protocl
<steveklabnik>
he doesn't have answers, just questions
neocoin has joined #ruby-lang
imajes has quit [Excess Flood]
<seanstickle>
I am fine with questions. My education was all about questions, and not so much about answers.
<seanstickle>
I far prefer good questions to bad Critical Code Studies
imajes has joined #ruby-lang
banisterfiend` has joined #ruby-lang
dmwuw has quit [Ping timeout: 240 seconds]
dmwuw_ has quit [Read error: Operation timed out]
chimkan has quit [Quit: chimkan]
mistym has joined #ruby-lang
<steveklabnik>
:)
mephux has quit [Quit: w0ots...]
Musfuut has quit [Ping timeout: 250 seconds]
banisterfiend has quit [Ping timeout: 245 seconds]
mephux has joined #ruby-lang
Musfuut has joined #ruby-lang
Musfuut is now known as Guest78690
kingCrawlerx has quit [Quit: Computer has gone to sleep]
Aphelion has joined #ruby-lang
ttilley has quit [Read error: Connection reset by peer]
t82885 has quit [Remote host closed the connection]
t1053 has joined #ruby-lang
havenn has quit [Remote host closed the connection]
woollyams has joined #ruby-lang
<arooni-mobile>
hi folks. looking to parse out user IDs from a raw HTML response of a user results page.... would you folks recommend nokogiri for this use case? or just simple regexes.
<seanstickle>
Well, except regex is fine sometimes.
ryanf has joined #ruby-lang
<seanstickle>
arooni-mobile: if you don't know which to use, use Nokogiri
<seanstickle>
arooni-mobile: is the best answer
<steveklabnik>
just always use nokogiri
<steveklabnik>
and then you wont have problems
<arooni-mobile>
seanstickle, whats the advantage of nokogiri over regular regexs?
<arooni-mobile>
or shold i read nokogiri docs to find out why
<arooni-mobile>
:P
<seanstickle>
arooni-mobile: not having to fiddle around with regexes, primarily
<steveklabnik>
it is impossible to parse xml/html with regular expressions
<arooni-mobile>
gotcha
headius has quit [Quit: headius]
<seanstickle>
steveklabnik: no one uses POSIX regexes anymore anyways
<steveklabnik>
and it's not as if nokogiri is hard to use
<hagebake>
what do your html and your user IDs look like?
<arooni-mobile>
well i can throw nokogiri at it and see what that yields
<seanstickle>
steveklabnik: extended regel support can parse fine
<arooni-mobile>
one sec i'll get you an example
<steveklabnik>
sure, i mean regular langauges.
<steveklabnik>
i know that many regex implementations aren't regular langauges
<steveklabnik>
but seriously: just fucking use nokogiri
<steveklabnik>
and then everything is roses
<seanstickle>
steveklabnik: ++
<steveklabnik>
or, fiddle around with regexes
<steveklabnik>
forever
<steveklabnik>
and have it break randomly sometimes
<steveklabnik>
i say this as someone who is getting a perl tattoo soon.
<arooni-mobile>
ok ill check out nokogiri
<arooni-mobile>
thanks for recommendations folks
<seanstickle>
steveklabnik: get a tattoo using lambda calculus
<steveklabnik>
:)
<seanstickle>
Or pi calculus
<seanstickle>
Even more trendy/cool
lcdhoffman has joined #ruby-lang
cid404 has quit [Ping timeout: 252 seconds]
<arooni-mobile>
why would you have a method like: def ClassName::instance; @@instance; end;
dmwuw has joined #ruby-lang
<arooni-mobile>
to set a class var @@instance ?
<steveklabnik>
sounds like someone's trying to make a singleton
redgetan has joined #ruby-lang
macmartine has joined #ruby-lang
headius has joined #ruby-lang
havenn has joined #ruby-lang
headius has quit [Client Quit]
arooni-mobile has quit [Ping timeout: 260 seconds]
Kichael has joined #ruby-lang
dmwuw has quit [Ping timeout: 245 seconds]
dmwuw has joined #ruby-lang
t1053 has quit [Remote host closed the connection]
t17892 has joined #ruby-lang
havenn has quit [Ping timeout: 240 seconds]
igotnolegs has joined #ruby-lang
macmartine has quit [Quit: Computer has gone to sleep.]
woollyams has quit [Quit: Computer has gone to sleep.]
arooni-mobile has joined #ruby-lang
Marc3000 has quit [Quit: Leaving.]
Marc3000 has joined #ruby-lang
seanstickle has quit [Quit: seanstickle]
havenn has joined #ruby-lang
macmartine has joined #ruby-lang
woollyams has joined #ruby-lang
arooni-mobile has quit [Quit: Leaving]
arooni-mobile has joined #ruby-lang
macmartine has quit [Read error: Connection reset by peer]
d3vic3 has quit [Read error: Operation timed out]
<arooni-mobile>
steveklabnik, earlier i asked a question about def ClassName::instance; @@instance; end; .... you're saying this is a way of creating the singleton pattern?
chimkan_ has joined #ruby-lang
d3vic3 has joined #ruby-lang
lcdhoffman has quit [Quit: lcdhoffman]
gmci has quit [Quit: Computer has gone to sleep.]
redgetan has left #ruby-lang ["Leaving"]
<rhizmoe>
is there a way to get the index of an array element use in an inject/reduce block?
<rhizmoe>
*used
gmci has joined #ruby-lang
t17892 has quit [Remote host closed the connection]
t40002 has joined #ruby-lang
<bnagy>
you can ref the array from inside the block and call index, but it's not reliable
<bnagy>
I would each_with_index.inject {|memo,(elem,idx)| ...
<arooni-mobile>
im thinking iits easiest to write a regex to match "profile.html?id=BUPA40U&"
fgomez has joined #ruby-lang
burgestrand has joined #ruby-lang
<bnagy>
... and we come in where exactly?
<arooni-mobile>
just asking if that approach is better than using nokogiri
s1n4 has joined #ruby-lang
<arooni-mobile>
i think it is; i can write a regex faster than learning xpath queries
<bnagy>
regexps are never better than using nokogiri
<bnagy>
but if you're just going to come back every hour until someone tells you something different, then
<bnagy>
yes, use regexps
<arooni-mobile>
haha
banisterfiend has quit [Read error: Connection reset by peer]
burgestrand has quit [Ping timeout: 244 seconds]
kain has quit [Ping timeout: 244 seconds]
ryanf has quit [Ping timeout: 240 seconds]
banisterfiend has joined #ruby-lang
burgestrand has joined #ruby-lang
gmci has quit [Quit: Computer has gone to sleep.]
<arooni-mobile>
ok i wrote the regex that extracts the profile id: /\/profile.html\?id=([A-Z\d]*)/ .... but now i'm curious how can i tell ruby to return all matches.... not just the first one it finds?
gmci has joined #ruby-lang
<bnagy>
ok well your regex is wrong for a start
<arooni-mobile>
well it gets the first profile id with $1
<bnagy>
HS0U6J0
<bnagy>
oh \d sry :) wait ...implicit anchor?
<bnagy>
ew
<arooni-mobile>
better to exclude stuff instead?
<bnagy>
why not use result_item? ANyway whatever
<arooni-mobile>
something like /\/profile.html\?id=([^&]*)/
<bnagy>
augh
brianpWins has joined #ruby-lang
chendo_ has quit [Ping timeout: 240 seconds]
<arooni-mobile>
you hate that one too?
<bnagy>
/result_item-(.*)\\/
<bnagy>
I hate all use of regexps, it's a horrible approach
<bnagy>
anyway the method you want is String#scan
<arooni-mobile>
im open to different ideas; but why is using a regex so much worse than nokogiri
<bnagy>
clearly you're not
macmartine has joined #ruby-lang
<bnagy>
cause two people already explained that to you
<arooni-mobile>
well isnt xpath a different way of regexing
<arooni-mobile>
but with the document instead of literal strings
Tearan has quit [Quit: Sleepy Badger....]
<bnagy>
just use a regexp
chendo_ has joined #ruby-lang
<bnagy>
junk.scan(/result_item(.*)\\/).flatten
<bnagy>
missed a dash
chimkan_ has quit [Quit: chimkan_]
yxhuvud has joined #ruby-lang
<arooni-mobile>
ok that seems to work at least for now
<arooni-mobile>
maybe its not ideal
lsegal has quit [Quit: Quit: Quit: Quit: Stack Overflow.]
tonni has quit [Remote host closed the connection]
chendo_ has quit [Ping timeout: 252 seconds]
zmack has joined #ruby-lang
andrewhl has quit [Remote host closed the connection]
cid404 has joined #ruby-lang
chimkan has joined #ruby-lang
<arooni-mobile>
thanks for your help bnagy
zmack has quit [Remote host closed the connection]
|Vargas| has joined #ruby-lang
woollyams has quit [Quit: Computer has gone to sleep.]
t43522 has quit [Remote host closed the connection]
t62225 has joined #ruby-lang
rubylion has joined #ruby-lang
hahuang65 has quit [Remote host closed the connection]
s0ra_h is now known as sora_h
rubylion has quit [Client Quit]
rubylion has joined #ruby-lang
dhruvasagar has joined #ruby-lang
rubylion has quit [Read error: Connection reset by peer]
bytephilia has joined #ruby-lang
rubarlion has joined #ruby-lang
sora_h is now known as s0ra_h
rubarlion has quit [Read error: Connection reset by peer]
rubarlion has joined #ruby-lang
s0ra_h is now known as sora_h
<rubarlion>
can I match/scan an array, against another array, which is a hashvalue?
cantonic has joined #ruby-lang
<judofyr>
rubarlion: example?
woollyams has joined #ruby-lang
cantonic has left #ruby-lang [#ruby-lang]
fayimora has quit [Quit: Be back in a gifii]
jbsan has quit [Quit: jbsan]
wallerdev has quit [Quit: wallerdev]
runeb has quit [Remote host closed the connection]
laszlokorte has joined #ruby-lang
toretore has joined #ruby-lang
rubarlion has quit [Read error: Connection reset by peer]
runeb has joined #ruby-lang
rubarlion has joined #ruby-lang
cantonic has joined #ruby-lang
rubarlion has quit [Read error: Connection reset by peer]
rubarlion has joined #ruby-lang
<certainty>
are there any plans to put something like array/list comprehensions into the language?
vesan has quit [Ping timeout: 260 seconds]
<banisterfiend>
certainty: not afaik, but we'll have lazy enumerables in 2.0
<certainty>
banisterfiend: yeah i've seen this. That's a great thing. But comprehensions would be cool to as they allow for concise defintions of datasets
Criztian has joined #ruby-lang
cantonic has quit [Quit: cantonic]
<banisterfiend>
certainty: hmm, any comprehesions apart from teh very simple ones look messy are hard to understand IMO
<banisterfiend>
and*
<judofyr>
certainty: I feel list comprehensions are backwards
<banisterfiend>
certainty: can u show an example
<certainty>
banisterfiend: take a look at random haskell code that builds up lists using comprehensions
<banisterfiend>
certainty: can u show (im not familiar with haskell :P)
woollyams has quit [Quit: Computer has gone to sleep.]
<whitequark>
certainty: I don't see how something like [func(x) for x in y if x > 10] is better than y.select { |x| x > 10 }.map { |x| func(x) }
rubarlion has quit [Read error: Connection reset by peer]
<certainty>
banisterfiend: dunno the usual suspects like emulative zip and such [ (a,b) | a <- some_list, b <- some_other_list ]
<certainty>
emulating
rubarlion has joined #ruby-lang
<banisterfiend>
certainty: hmm, is there anything we can't do neatly and cleanly with the current ruby constructs though?
<certainty>
it's the syntax that is appealing. You see what you draw where from and you see what you do with it.
<banisterfiend>
cos that 'zip' one is trivial too
vesan has joined #ruby-lang
<certainty>
banisterfiend: you certainly can do it with ruby. I currently don't have a particular example. I was just asking out of curiousity
<banisterfiend>
oh ok
<banisterfiend>
certainty: there was a cute reddit post the other day, some guy had built support for it into ruby
<banisterfiend>
using lots of weird hacks
<certainty>
the weired hacks part iss scaring me ;)
chessguy has quit [Remote host closed the connection]
rubarlion has quit [Read error: Connection reset by peer]
dhruvasagar has quit [Ping timeout: 260 seconds]
<certainty>
but as i read you guys generally wouldn't welcome comprehensions?
vesan has quit [Ping timeout: 260 seconds]
rubarlion has joined #ruby-lang
<banisterfiend>
certainty: i'll need to see some sexier exmaples to be convinced, im not that familiar with them really
sweetdownfall has joined #ruby-lang
<certainty>
banisterfiend: i suppose there aren't that much killer examples. It's just a denser way to express things
sora_h is now known as s0ra_h
sweetdownfall has left #ruby-lang [#ruby-lang]
s0ra_h is now known as sora_h
<judofyr>
certainty: I just don't see the point of more syntax when blocks solves the same problem
cantonic has joined #ruby-lang
jbsan has joined #ruby-lang
rubarlion has quit [Read error: Connection reset by peer]
jbsan has quit [Client Quit]
rubarlion has joined #ruby-lang
vesan has joined #ruby-lang
x0F has quit [Disconnected by services]
x0F_ has joined #ruby-lang
x0F_ is now known as x0F
<certainty>
judofyr: you're probably right. They don't add much more. The only thing probably being that the composition part is decoupled from the generation part
<rubarlion>
can I scan/match for an array, which is the value of a hash, which is of an array of hashes?
<judofyr>
rubarlion: first of all, the local variables don't make any difference: [{ apple: ["red", "round", "crisp], banana: ["yellow", "curved"] }, { carrot: ["orange", "crisp", "long"], celery: ["green", "long"] }]
lcdhoffman has quit [Quit: lcdhoffman]
<rubarlion>
I don't understand
<judofyr>
rubarlion: that's the same structure
<judofyr>
there's no difference between them
<rubarlion>
oh
banisterfiend has quit [Read error: Connection reset by peer]
rubarlion has quit [Read error: Connection reset by peer]
rubarlion has joined #ruby-lang
banisterfiend has joined #ruby-lang
jxie has quit [Quit: leaving]
rubarlion has quit [Read error: Connection reset by peer]
rubarlion has joined #ruby-lang
kain has joined #ruby-lang
rubarlion has quit [Ping timeout: 260 seconds]
rubarlion has joined #ruby-lang
rubarlion has quit [Client Quit]
rohit has joined #ruby-lang
sporkmonger has joined #ruby-lang
dejongge has joined #ruby-lang
kain has quit [Quit: exit]
kain has joined #ruby-lang
dan|el has joined #ruby-lang
JoshWines has quit [Quit: Leaving]
m3nd3s has joined #ruby-lang
rohit has quit [Quit: Leaving]
kaiwren has quit [Quit: kaiwren]
justinmcp has joined #ruby-lang
diegoviola has joined #ruby-lang
chimkan has joined #ruby-lang
Hakon has joined #ruby-lang
jbsan has joined #ruby-lang
desmondmonster has joined #ruby-lang
workmad3 has quit [Ping timeout: 265 seconds]
titaniumNoob has joined #ruby-lang
Glass_saga has joined #ruby-lang
banisterfiend has quit [Read error: Connection reset by peer]
banisterfiend has joined #ruby-lang
desmondmonster has quit [Quit: desmondmonster]
bryancp has joined #ruby-lang
th3xer0 has joined #ruby-lang
t2978 has quit [Remote host closed the connection]
t95104 has joined #ruby-lang
justinmcp has quit [Remote host closed the connection]
th3xer0 has left #ruby-lang [#ruby-lang]
woollyams has quit [Quit: Computer has gone to sleep.]
woollyams has joined #ruby-lang
chimkan has quit [Quit: chimkan]
|Vargas| has quit [Quit: ...]
th3xer0 has joined #ruby-lang
woollyams has quit [Client Quit]
banisterfiend has quit [Read error: Connection reset by peer]
erichmenge has joined #ruby-lang
banisterfiend has joined #ruby-lang
justinmcp has joined #ruby-lang
mistym has joined #ruby-lang
mistym has joined #ruby-lang
mistym has quit [Changing host]
Strangebrew has joined #ruby-lang
fgomez has quit [Ping timeout: 272 seconds]
Strangebrew has left #ruby-lang ["Leaving"]
laszlokorte_ has joined #ruby-lang
Axsuul has quit [Ping timeout: 252 seconds]
Leeky is now known as Leeky_afk
laszlokorte has quit [Ping timeout: 260 seconds]
hakunin has quit [Remote host closed the connection]
s1n4 has quit [Quit: Lost terminal]
m3nd3s_ has joined #ruby-lang
cantonic has joined #ruby-lang
m3nd3s has quit [Ping timeout: 246 seconds]
workmad3 has joined #ruby-lang
mistym has quit [Remote host closed the connection]
jkprg has joined #ruby-lang
t95104 has quit [Remote host closed the connection]
t81208 has joined #ruby-lang
bryancp has quit [Remote host closed the connection]
justinmcp has quit [Remote host closed the connection]
<andrewvos>
Submodules in Git are shit right?
<totallymike>
Why say that?
<andrewvos>
Well, I've heard they are.
<andrewvos>
So, I decided to ask the question among people that I respect.
* totallymike
isn't that guy ;)
<totallymike>
I don't see what's wrong with them, but I haven't used them for very complex things.
m3nd3s_ has quit []
m3nd3s has joined #ruby-lang
yats has quit [Read error: Connection reset by peer]
<bnagy>
andrewvos: I looked at em, and read some stuff, and came to the same conclusion as you
<bnagy>
fwiw
mistym has joined #ruby-lang
mistym has joined #ruby-lang
mistym has quit [Changing host]
<bnagy>
I'm just breaking stuff into separate repos, and if I need to control a ton at once I'll use forest or whatever it's called
rohit has joined #ruby-lang
kaiwren has joined #ruby-lang
naquad has quit [Ping timeout: 265 seconds]
<bnagy>
but I'm definitely not a git expert
Leeky_afk is now known as Leeky
<andrewvos>
bnagy: Thanks :)
bryancp has joined #ruby-lang
t81208 has quit [Remote host closed the connection]
brunocoelho has joined #ruby-lang
t62352 has joined #ruby-lang
banisterfiend has quit [Read error: Connection reset by peer]
<totallymike>
Pretty much the only thing I've used submodules for is managing vim plugins that have github repos in my dotfiles repo
<totallymike>
come to think of it I haven't updated them in ages
banisterfiend has joined #ruby-lang
naz has quit [Ping timeout: 252 seconds]
yats has joined #ruby-lang
naquad has joined #ruby-lang
bjensen has quit [Quit: bjensen]
bytephilia has quit [Remote host closed the connection]
<drbrain>
Defusal: do you have any jobs that add jobs?
<drbrain>
Defusal: can you show the whole backtrace?
tenderlove has joined #ruby-lang
<Defusal>
drbrain, it has a threaded and EM based scheduler
EvilJStoker is now known as Guest85819
EzeQL is now known as Guest59132
totallymike is now known as Guest75945
tubbo is now known as Guest82894
denysonique is now known as Guest68848
ged is now known as Guest92060
dhruvasagar is now known as Guest79461
<Defusal>
im using the EM one
havenn has joined #ruby-lang
<Defusal>
the above backtrace is everything until it reaches my code
t1806 has quit [Remote host closed the connection]
<richardjortega>
anyone know a good method for removing substrings from beginning and end of a string, if you know the substring at the beginning and end
andrewhl_ has quit [Remote host closed the connection]
<richardjortega>
of a string
<drbrain>
Defusal: when you're adding the job (the deadlock point) the mutex was previously locked
<Defusal>
in a single threaded application..
Dwarf has left #ruby-lang [#ruby-lang]
<Defusal>
sounds like the EM scheduler in that gem still uses threads
Dwarf has joined #ruby-lang
<drbrain>
so either something in your backtrace will show why that could be
<Defusal>
which is terrible if that is the case
<Defusal>
ohhh
benanne has quit [Read error: Connection reset by peer]
<Dwarf>
Hello, could anyone assist me on something?
<drbrain>
ooh, I crashe Safari!
<Defusal>
it must be related to signals
<Defusal>
im going to paste you the full backtrace
<drbrain>
… or there's something extra weird going on
<Dwarf>
I am quite new to ruby but I was wondering how I would skip the first x number of words in a string?
<lianj>
Defusal: do you want to run the jobs in a thread or in em's mainloop thread?
dfr|mac has quit [Remote host closed the connection]
<drbrain>
Dwarf: I would convert a String into an Array first
<Dwarf>
I have that already
banisterfiend has quit [Read error: Connection reset by peer]
<pabloh>
anybody with experience modifying an excel or ods file from ruby code?
<Dwarf>
So that is the easiest way of doing things?
<drbrain>
Dwarf: I think so
<drbrain>
Dwarf: there are ways to do it with String#sub, though
banisterfiend has joined #ruby-lang
<Dwarf>
Mmm
<richardjortega>
Mon_Ouie: then i could just do string.[1..-1] to take out leading slash
<Dwarf>
I'll look into both of them
<rue>
If it’s an actual URI, then using URI is a great idea
dous has quit [Ping timeout: 246 seconds]
<lianj>
Mon_Ouie: oh, youre right, misread his question :|
Dwarf has quit [Changing host]
Dwarf has joined #ruby-lang
<richardjortega>
thank you lianj and Mon_Ouie
benanne has joined #ruby-lang
<richardjortega>
to take out the leading slash, is best recommended just to use string[1..-1] ?
<Mon_Ouie>
That's fine
dan|el has joined #ruby-lang
DEac- has quit [Ping timeout: 240 seconds]
<richardjortega>
thanks
<Dwarf>
drbrain, just a quick question, if I do variable.sub!(/[something]/, '*'), it will work on variable itself?
dabradley has quit [Ping timeout: 246 seconds]
<drbrain>
yes it will
<Dwarf>
Sweet
<Dwarf>
Starting to like ruby
DEac- has joined #ruby-lang
imajes has quit [Excess Flood]
<Defusal>
drbrain, lets hope that solves it
<Defusal>
thank you very much for your left
<Mon_Ouie>
It's important to note it actually works on the object that variable refers too; therefore, if another object has a reference to it, it will be changed too.
<Defusal>
help*
<Mon_Ouie>
For example: a = variable; variable.sub!(…); puts a
<drbrain>
Defusal: I *think* that should do it… there might be a more elegant way for EM to handle the signals, though
dabradley has joined #ruby-lang
<Defusal>
drbrain, if you ever come across one, please let me know :)
<Defusal>
i just need a reliable way to detect CLD
imajes has joined #ruby-lang
<drbrain>
Defusal: I don't know anything about EM, I'm just guessing :/
<Defusal>
drbrain, there is some other API that i think can work on linux
Guest59132 has quit [Quit: Saliendo]
<Defusal>
but its more complicated, and CLD appeared to work fine before
dan|el has quit [Ping timeout: 264 seconds]
qwerxy has joined #ruby-lang
banisterfiend has quit [Read error: Connection reset by peer]
<Defusal>
now for the fun part
<Defusal>
finding every zombie processes pid that escaped when their manager died
qwerxy has quit [Client Quit]
banisterfiend has joined #ruby-lang
havenn has quit [Remote host closed the connection]
<mistym>
Is raising Errno::ENOENT portable?
Asher1 has quit [Quit: Leaving.]
<lianj>
Defusal: how do you start those processes?
Asher has joined #ruby-lang
woollyams has joined #ruby-lang
<Defusal>
lianj, i fork, do other stuff and then usually exec
andrewhl has joined #ruby-lang
<Defusal>
and i create pipes for stdin/out/err if needed
t59678 has quit [Remote host closed the connection]
t67068 has joined #ruby-lang
<lianj>
tried EM.popen ?
<Dwarf>
Oh boy here we go
<Dwarf>
main.rb:135: undefined method `join!' for ["#dwarf", "hello", "world"]:Array (NoMethodError)
<matti>
join!
<matti>
?
<Dwarf>
texttosay = $output.drop(5)
<Dwarf>
texttosay.join!(' ')
<Dwarf>
Yush
<Dwarf>
oh
<rue>
Dwarf: You can’t mutate to join…
<Dwarf>
Out of all the possible functions
<Dwarf>
I see
<lianj>
from array to string requires two !
<matti>
lianj: ']
<Dwarf>
Well, I'll be off facedesking
<Dwarf>
thanks
<Defusal>
lianj, don't even go there, i have tried every possible EM implementation of spawning, they all have edge cases and other issues
<Defusal>
i wrote my own spawning implementation for EM from scratch for that very reason
<lianj>
Defusal: hehe ok, maybe i recall talking to you about it.. for myself i was always fine with EM.popen
* lianj
shuts up
<Defusal>
also, as i said, i do other stuff
<Defusal>
this is not a very trivial system
<lianj>
care to show your spawning code? curious
Leeky_afk is now known as Leeky
<Defusal>
lianj, i could paste it for you, though it is not complete. there are still a few things i need to do
<Defusal>
i am just far too thinly spread at the moment and have an insane amount of far more important things to work on
<lianj>
sure, nevermind. i will ping you at another point :)
<Defusal>
lianj, it's ok, i'll paste it for you
sockmonk has quit [Ping timeout: 246 seconds]
sailias has quit [Quit: Leaving.]
<Defusal>
lianj, it is a module for my own modular platform, so it would need some changes to get working alone, and you'll just have to deal with some messy comments and debug stuff
mistym has quit [Remote host closed the connection]
laszlokorte has joined #ruby-lang
dan|el has joined #ruby-lang
banisterfiend has quit [Read error: Connection reset by peer]
havenn_ has quit [Remote host closed the connection]
anannie has joined #ruby-lang
banisterfiend has joined #ruby-lang
reactormonk has joined #ruby-lang
Guest75945 has quit [Ping timeout: 246 seconds]
dfr|mac has joined #ruby-lang
dan|el has quit [Ping timeout: 245 seconds]
dfr|mac has quit [Remote host closed the connection]
jackhammer2022 has joined #ruby-lang
<anannie>
I noticed something interesting, if I do print '\n%s' % var then the newline is inserted but the new line charecter is printed on the previous line. This does not change for STDOUT.puts or puts. However if I put it in double quotes then the escape characters work properly and nothing gets printed. I'm wondering why this is so
<drbrain>
anannie: in '' strings, \ only escapes \ and '
<drbrain>
in "" strings \n turns into the newline character
<anannie>
drbrain: Why is that so?
<anannie>
drbrain: Why the difference in the way the two are treated?
<drbrain>
for your convenience
<anannie>
drbrain: ?
<anannie>
Can you please give me an example where this might be useful?
<drbrain>
if you want to print \ followed by n to your terminal then '\n' may be easier to write than "\\n"
<drbrain>
also, interpolation doesn't happen in '' strings, so you could do something like: eval '#{foo}', binding
<anannie>
interpolation means substitution of the %s by the variable? Sorry I'm new to all of this
<drbrain>
anannie: also, puts automatically adds a newline to the end of strings if one isn't there, but print does not
<drbrain>
anannie: interpolation like "\n#{var}"
<drbrain>
that's the same as "\n" + var.to_s or "\n%s" % var
<anannie>
or "\n", var?
<drbrain>
interpolation can happen outside of just printing
<anannie>
I like how the language has so many different ways of doing the same thing, was this intended or is it an accident?
<drbrain>
so you can have something like output << "\n#{var}", but not output << "\n", var
<drbrain>
it is intentional
<drbrain>
I use all these different ways of combining strings in different parts of my programs
<drbrain>
it depends on which one fits
<drbrain>
I use % mostly to do formatting of numbers
<anannie>
"""so you can have something like output << "\n#{var}", but not output << "\n", var""" I didn't understand this bit
<drbrain>
anannie: try this in irb: var = "hello"; output = ""; output << "\n", var
<anannie>
I'll try it out in irb
<drbrain>
you can replace ; with your enter key
<drbrain>
compare it to output << "\n#{var}"
yxhvuud has quit [Ping timeout: 245 seconds]
<anannie>
hrm it's giving me an error.
<drbrain>
yes
<drbrain>
but for print it's fine
<anannie>
does << do assignment?
<drbrain>
no, it usually appends the thing on the right to the thing on the left
<anannie>
Ah I see it appends the thing
<drbrain>
a << b call the method #<< on a
<anannie>
this is quite need
<anannie>
* neat
<anannie>
and needed
<drbrain>
if the thing on the left is an Array you can use #push to append multiple items at the same time
bryancp has quit [Remote host closed the connection]
<threedaymonk>
you can also do output << "\n" << var
<anannie>
so it's basically array1.push array2?
<drbrain>
array.push item1, item2
<drbrain>
use #concat when you have two arrays
<anannie>
This is really cool. I thought logically you would have to loop it and then assign things one by one as you do in C++
<drbrain>
anannie: do you know about ri?
<anannie>
array1.concat array2? I can see that it stores the array within the array as an element, which is quite sweet if you think about it... turtles all the way down...
<anannie>
drbrain: Yes
<drbrain>
you can learn about the methods with `ri Array.concat` or `ri Array.push`
<anannie>
I'm reading it up simultaneously... There's also an online version of the documentation which is a bit more neat
UCSB-mrodrigues has joined #ruby-lang
<drbrain>
yes
dejongge has quit [Quit: Leaving.]
<threedaymonk>
drbrain: I don't recall ever seeing Array#concat in the wild, as opposed to just +=
mrodrigues has joined #ruby-lang
<anannie>
One thing I never understood though is how you go from writing statements like these to actually building something that does some X hopefully useful thing. It seems suspiciously like sorcery.
<steveklabnik>
:)
<drbrain>
threedaymonk: I think it was added late in ruby 1.8
<drbrain>
anannie: it felt like that to me when I started!
dfr|mac has joined #ruby-lang
<drbrain>
anannie: you pick something you want to do, then figure out what one part should do, then figure out what a part of *that* would do and so-on until you have something you know how to do
<drbrain>
… and you can't worry about making mistakes
<anannie>
drbrain: What happened to change that?
<drbrain>
mistakes are fun because you learned something new
<drbrain>
I made lots of mistakes and lots of correct choices, so now the path is more obvious
solars has quit [Ping timeout: 246 seconds]
t73559 has quit [Remote host closed the connection]
<anannie>
I worry a lot about making mistakes, they frighten me, which is interesting/
t37927 has joined #ruby-lang
<drbrain>
the typical downside to programming mistakes is that you wasted some time
<anannie>
drbrain: Is it better to do array1 << item1 << item2 or array1.push (item1, item2)
<anannie>
?
<drbrain>
I use push
<anannie>
may I ask why?
<anannie>
(it's neater I guess)
<drbrain>
it looks nicer
<threedaymonk>
it's probably clearer and more explicit
Hakon has quit [Quit: Leaving...]
<anannie>
okay. thank you for helping me out drbrain and threedaymonk... I'll get back to the exercises
<threedaymonk>
anannie: it's important to type push(item1, item2) not push (item1, item2) - i.e. no space between method and arguments
<tsou>
I'm reading the pickaxe chapter on metaprogramming.. and I'm trying to understand how this works: https://gist.github.com/3430114
<erikh>
I like push because it communicates more than an operator
<threedaymonk>
anannie: unless you are using no parentheses at all, in which case array1.push item1, item2 is correct
<anannie>
threedaymonk: Ah that's a bad habit of mine. I like things spaced out. Doesn't ruby delete whitespace?
<tsou>
so, if I get it right, no matter which class has the "add_mouth" line inside of it, all of the objects of all of the classes under Parent will have this method..
voker57 has quit [Read error: Connection reset by peer]
<threedaymonk>
anannie: when it comes to method arguments, it's a bit demanding - it has to be to avoid ambiguities in the language syntax
workmad3 has quit [Ping timeout: 265 seconds]
dfr|mac has quit [Remote host closed the connection]
<anannie>
threedaymonk: That makes sense
<tsou>
question is, why add_mouth behaves this way, and how define_method "knows better"..
<erikh>
tsou: it's important to understand the context of where the method is called
<tsou>
erikh: indeed; this is what i'm trying to understand.. ;)
<erikh>
but yes, to answer your question, inheritance provides the methods from Parent to its inheriting children
<erikh>
sure
<erikh>
so, sec
<tsou>
the way it is presented in the pickaxe books, it gives one the impression that in the code I posted, add_mouth should only be available to Child instances..
<drbrain>
Defusal: lock recursion through same path through the signal handler? or a different path?
dhruvasagar has joined #ruby-lang
<Defusal>
from <internal:prelude>:8:in `synchronize'
<Defusal>
from /usr/local/lib/ruby/1.9.1/thread.rb:157:in `push'
<Defusal>
from /home/admin/process_manager/lib/modules/base.rb:37:in `block (2 levels) in signal'
<Defusal>
sorry for spam :/
<rhizmoe>
looks like fun
<Defusal>
drbrain: mod.signal_queue << sig
<Defusal>
signal_queue is Queue.new
<drbrain>
Defusal: try just Array
<Defusal>
so much for a queue being safe
<Defusal>
you really think that'll work when a queue doesnt?
<drbrain>
Defusal: Queue is multi-thread safe, but not lock-recursion safe
<Defusal>
heh, ok
ryez has joined #ruby-lang
<Defusal>
well good news is, most of my services are either down or empty due to them having been down and/or out of date for so long
<drbrain>
Defusal: it won't recursively lock… and since you're on CRuby it doesn't need locking
<Defusal>
so soon there won't be any users to boot off until tomorrow
cantonic has quit [Quit: cantonic]
outoftime has quit [Quit: Leaving]
drupin has left #ruby-lang ["Leaving"]
<Defusal>
drbrain, seem much better, when processing tons of queued stuff being send from another process, it reached the open file limit without recursive locking
<Defusal>
sent*
<drbrain>
cool
brianpWins has quit [Quit: brianpWins]
<Defusal>
drbrain, thanks for the help, this has not been the best day