<kiddorails>
lianj: drbrain : Fantastic! Now finally, I understood how it was supposed to work. Thanks a ton.
<kiddorails>
Now, only need to write :audio in file.
nofxx has joined #ruby-lang
sandbags has joined #ruby-lang
nofxx has joined #ruby-lang
JohnBat26 has joined #ruby-lang
<kiddorails>
Will I have to study mp3 structure now to make mp3? :O
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
wsirc_1873311 has joined #ruby-lang
nofxx has joined #ruby-lang
<wsirc_1873311>
Is this the correct way to use methods in case? Should this print 'yay'? http://pastie.org/3737488
<apeiros_>
no
<apeiros_>
case expression when condition --> this will execute condition === expression
<apeiros_>
so in your case, it'll be `(x.type == String) === x`
<apeiros_>
what you probably want is: case x; when String then …
WillMars_ has joined #ruby-lang
<apeiros_>
as that will be `String === x`, and Class#===(other) checks whether other is an instance of the class.
<Mon_Ouie>
And if you only have one condition like that you can just use if x.is_a? String
<apeiros_>
also, type is pretty deprecated
<kiddorails>
drbrain: You there?
nofxx has joined #ruby-lang
Joeysomo_ has joined #ruby-lang
<Mon_Ouie>
That method doesn't even exist here
<rippa>
did it exist?
<apeiros_>
yes
<apeiros_>
it got deprecated in 1.8
<apeiros_>
and removed in 1.9
<lianj>
kiddorails: why not `ffmpeg -i foo.flv foo.mp3` ?
<wsirc_1873311>
Thanks apeiros_. I thought that would compare its value to String rather than its type.
<kiddorails>
lianj: No. No. I don't have to opt that way. :/
<wsirc_1873311>
And I'm using a program that uses Ruby, not Ruby itself. That's why I can use .type
<lianj>
kiddorails: ?
<kiddorails>
lianj: Your program from beginning to end, reads type, tags and body length etc continuously, right? When an mp3 tag is encountered, after reading it's body length, it again iterates to find other tags.
<kiddorails>
lianj: I have to make it in ruby without using ffmpeg or external libraries. Kind of instruction given to me.
<apeiros_>
wsirc_1873311: you mean, you use a program that uses a really old ruby, that's why you can still use .type. use .class instead.
<apeiros_>
better in case they ever move on to a newer ruby
<lianj>
kiddorails: ah ok. yes, the tags are chunks, there are many audio tags
<kiddorails>
after searching for mp3 tag initially, if it again finds mp3 tag.
<lianj>
kiddorails: well, if you take my code, so much for the 'i have to' ;)
<kiddorails>
lianj: All credits to you. :) :)
<kiddorails>
Hey. I'm beginner. That's how I'll learn, alright. ;) I never saw this efficient usee of unpacking.
<kiddorails>
use*
<kiddorails>
mp3 mp3 mp3! HOW
<lianj>
there are no mp3 tags. its an audio tag, you have to look if the codec is mp3 (soundFormat == 2)
<lianj>
if so, you maybe can join these bodies all together, and put a mp3 header in front
<wsirc_1873311>
apeiros_:, I will.
nofxx has joined #ruby-lang
publicvoid has joined #ruby-lang
yxhuvud has joined #ruby-lang
<lianj>
kiddorails: in my local example its 10 (acc codec) and not 2 (mp3) for example
<lianj>
*aac
bjensen has joined #ruby-lang
bjensen has joined #ruby-lang
<kiddorails>
so, adding a mp3 (2) header in front of a file and then streaming entire :audio in it, will manage to make it mp3?
<kiddorails>
lianj: audio_channels, audio_bits etc are first initialized inside the until loop. No way they can decide the value for test.mp3 which is being passed in very beginning. o.O
<Defusal_>
what would be the best way to round these kind of numbers to a readable float when displaying very short amounts of time?
<Defusal_>
while #round(5) would work for the first example, the second would return -3.394e-06
<apeiros_>
"%3.3g" % float
<Defusal_>
ah i guess i can use string format
<apeiros_>
round gives numbers, it's not meant for representations. strings are representations. to render a number to string, you have to_s and the printf-alikes
<Defusal_>
apeiros_, not sure what g is, but that wont work for such small numbers
<Defusal_>
%f works ok though
<apeiros_>
you don't know what it is, yet you know it doesn't work… you're still having the same issue as last time…
<apeiros_>
maybe you should specify your requirements for "work"
<apeiros_>
because this is both, readable & precise
<Defusal_>
i said a readable float
<apeiros_>
yes. this is a float.
<Defusal_>
as in natural
<Defusal_>
or whatever the correct terminology is
<apeiros_>
then you can't have precision.
<Defusal_>
i assumed you would understand from be trying to round to 5 decimal points
<apeiros_>
don't assume. specify.
<Defusal_>
if i wanted precision, i wound not be trying to round it in the first place
MDmalLION has joined #ruby-lang
<apeiros_>
but yes, if you don't want scientific notation, use %.5f"
pbjorklund has joined #ruby-lang
<Defusal_>
i could just display it as it is
<Defusal_>
as i said, %f works
<apeiros_>
Defusal_: you don't understand. if you use .5f, you're settling for a maximal precision of 5 digits. scientific notation has a much higher precision with the same amount of characters.
<Defusal_>
apeiros_, i understand perfectly, i have been using string format since C
<apeiros_>
…
nofxx has joined #ruby-lang
<Defusal_>
but it still goes to negative, which im not sure how to correct
<Defusal_>
but i guess its fine
<apeiros_>
what's there to correct?
<apeiros_>
if you have a negative number you have a negative number…
<apeiros_>
if you expect only positive numbers, then maybe your methodology to get the number in the first place is broken
<apeiros_>
(the one you pasted above sure is…)
<Defusal_>
ok nevermind, i must just be testing with a too small float
<Defusal_>
time wouldn't actually be split that finely
<apeiros_>
sign and small-ness are quite a different thing
<apeiros_>
a number doesn't become negative from being too small…
<Defusal_>
it does the way i was testing, clearly
<apeiros_>
oh…my… god…
<apeiros_>
your method to get to the number is broken. clearly.
<apeiros_>
as is your understanding of math.
<Defusal_>
ok, let me clarify myself
<Defusal_>
i created a negative number by testing incorrectly, it should work fine with actual amounts of time
kiddorails has joined #ruby-lang
z3r00ld has joined #ruby-lang
nofxx has joined #ruby-lang
kiddorails has joined #ruby-lang
batmanian has joined #ruby-lang
fragmachine has joined #ruby-lang
woollyams has joined #ruby-lang
<fragmachine>
Is there a way to return an element from an array only if it contains all the digits in the search term? Eg array.return {|el| 'el includes 1 and 2 and 3 and 4'}
<fragmachine>
=> [1423, 1234, 4231] etc etc
<fragmachine>
I always use include? but it's no good for this
ridders24 has joined #ruby-lang
<ridders24>
hey guys
<ridders24>
what grep expression could I use to find patterns like these: 6486-12-SR-1-1, XYZ-11, FD-01, and LKRL-100-1
<apeiros_>
*
havenn has joined #ruby-lang
<rolfb>
apeiros_: having a nice day?
<rolfb>
:)
<apeiros_>
I'm having a day full of people who fail to express what they want…
<apeiros_>
what about you, rolfb?
<bnagy>
rise above it, man, embrace MINASWAN
<rolfb>
i'm mildy amused by you having a day full of people who fail to express what they want
<rolfb>
:)
Guest18275 has joined #ruby-lang
<bnagy>
ridders24: /[A-Z0-9-]+/ ? :>
d3vic3 has joined #ruby-lang
<rolfb>
apeiros_: but it's really nice of you to help them regardless
<apeiros_>
rolfb: now you make me feel bad :)
<rolfb>
how so?
<rolfb>
that's not my intent
<rolfb>
:)
<bnagy>
fragmachine: only way I can think of offhand is to treat the number as a string, it's a bit of a weird problem :S
<apeiros_>
well, my last response wasn't meant to help directly (since that's impossible with such a badly phrased question), but to reveal the weakness of the question. then again, I think I was too lazy in its execution…
<apeiros_>
should probably have been:
<apeiros_>
ridders24: /.*/, matches all your patterns. want to amend your question? (e.g. by what it should not match?)
<apeiros_>
ridders24: also, those are regular expressions, not grep expressions.
<fragmachine>
I just found that permutation method as well
<apeiros_>
getting the subset of primes in 1_000..9_999 is a trivial task then
<rippa>
Primes.take_while {|p| p<10000000}
<apeiros_>
so you've reduced your set of possible numbers greatly already
<rippa>
*Prime
<apeiros_>
rippa: back when I did, Prime was too f'ing slow for this.
<apeiros_>
is it now up to the task?
<fragmachine>
it's pretty quick
<apeiros_>
(I used a sieve of erastothenes with some added trickery)
<fragmachine>
Prime has sieve of erastothenes inbuilt
<bnagy>
what trickery can you add?
<apeiros_>
fragmachine: even if it takes only 1ms per number, that's still 10'000s for 1..1_000_000, and usually time required per number grows exponentially
<apeiros_>
bnagy: the trickery was mostly related to limits imposed by ruby
<fragmachine>
apeiros_: true true
<rippa>
1_000_000 takes about a second
<rippa>
10_000_000 is long
<apeiros_>
rippa: ok, that's a shitload faster then back then
nofxx has joined #ruby-lang
<apeiros_>
took seconds for 1000 iirc
<apeiros_>
but maybe prime has a LUT for the first N numbers
<rolfb>
uhm, anyone have the sign out url for project euler?
<rolfb>
it got stuck
<rolfb>
i probably need the edit account url too ... fragmachine?
<rolfb>
apparantly it has a bug if you put an email in as username :)
<rolfb>
renders it unable to send you a mail
<rolfb>
i found the logout link
<rolfb>
but it's not working since my account isn't validated
<rolfb>
good going
<rippa>
apeiros_: looks like it also caches results
<bnagy>
the last bit is kind of easy to brute, but I'm trying to think of something pretty
<erikh>
hrm. you guys want to help me out on how to structure.... structured warnings on ruby?
<erikh>
I'm going to attempt to patch it in
futurechimp has joined #ruby-lang
<erikh>
I was thinking of overloading $-w to accept an array of strings
rushed has quit [#ruby-lang]
<erikh>
and each string would be a warning type or '-warning' for excluding warning types
<erikh>
with a module called Warnings and library called 'warnings' that would drive the editing of that array
takaokouji has joined #ruby-lang
<erikh>
so something like this (sec, gisting)
<apeiros_>
erikh: my suggestion at warnings (probably not feasible/within the range of effort that you want): use the exception system. have 2 toplevel exceptions: Exception and Warning. add a keyword "resume". have the toplevel `rescue Warning => w; $stderr.puts w; resume; end`
<apeiros_>
(resume would go back to the point the exception was raised and continue processing there)
<Mon_Ouie>
It looks like it's just generic code to load it from YAML
<shevy>
cool
<shevy>
this should become a new standard :)
* apeiros_
thinks gemspecs should be split into gembuild & gemspec
<apeiros_>
where gemspec is some static format, e.g. yaml
<apeiros_>
it's bad that you have to run code (which may break) just to retrieve meta-data
Swimming_Bird has joined #ruby-lang
kiddorails has joined #ruby-lang
<apeiros_>
hm, actually… the built gem contains a plain .yaml…
<apeiros_>
why do bundler and other tools use the code gemspec then? o0
<yorickpeterse>
You do realize you still have to run code to use the YAML data right? :)
<apeiros_>
yorickpeterse: not the gemspec code, if that's what you mean
<yorickpeterse>
It was a smart ass reply, you still have to parse the YAML data :)
<yorickpeterse>
So there's no benefit over either one of them
<apeiros_>
you fail
<apeiros_>
of COURSE there's a benefit
<apeiros_>
think again
<yorickpeterse>
Such as?
<apeiros_>
your worst gemspecs assumptions are not part of the yaml file
<apeiros_>
such as git being present etc.
<apeiros_>
you can't require or shell-out in yaml.
<yorickpeterse>
That's not an advantage per se, merely a restriction
<apeiros_>
sometimes I'm rendered speechless…
<yorickpeterse>
Besides, when the format changes people will just come up with clever ways to work around it
<apeiros_>
no, no, I give up. I'm not going to explain such a bloody obvious thing.
<yorickpeterse>
Then don't :)
<yorickpeterse>
Not wanting to depend on Git or w/e is something I can understand and up to a certain point agree with, however merely changing a file format isn't going to fix that
<yorickpeterse>
People will write things to work around those issues (lol m4) and such
<yorickpeterse>
So the statement "X instead of Ruby fixes the issue of Gemspecs depending on Y" is simply invalid
<imperator>
is there any advantage to doing Process.waitpid2(fork{ exec cmd }) over system(cmd) ?
<yorickpeterse>
Not really, they both block
<imperator>
that's what i was thinking
macmartine has joined #ruby-lang
Sailias has joined #ruby-lang
<imperator>
librarian gem does that, probelmatic for windows
<apeiros_>
yorickpeterse: you do realize that yaml is not executable, yes?
<apeiros_>
gah, what am I doing…
<yorickpeterse>
Yes, I do, but like I said people will work around that
<yorickpeterse>
Take for example fictional project A
<yorickpeterse>
This project does not have a gemspec in the repo
<yorickpeterse>
(e.g. Nokogiri)
<yorickpeterse>
In this case it doesn't matter what format it will be in, it has to be generated and thus can still rely on some other obscure tools
<yorickpeterse>
I do however agree that in the event of the gemspec already existing it *would* prevent it from happening
frangiz has joined #ruby-lang
<apeiros_>
yorickpeterse: either you didn't read what I wrote or you misunderstood it completely.
<apeiros_>
open a .gem file (it's just a tar), open the metadata.gz - that one is just a plain yaml.
<yorickpeterse>
I'm well aware of that
<apeiros_>
which is what I was asking for, and now I wonder why tools like bundler rely on the .gemspec (which has lots of potential to fail) instead of relying on that metadata file.
<yorickpeterse>
Like I said I get the reasoning for wanting a different format, it's just not a benefit per se
<apeiros_>
(which either is valid or invalid)
<apeiros_>
if you think of going from executable to plain markup was just a format-change, then you don't get it.
<apeiros_>
I'm wasting my time. I should not.
<yorickpeterse>
Then just ignore me, I'm not forcing you to reply or anything :)
<yorickpeterse>
Saying you don't want to waste time on it only to reply isn't going to really work out :)
mattyoho has joined #ruby-lang
Jake232 has joined #ruby-lang
wallerdev has joined #ruby-lang
seanstickle has joined #ruby-lang
Teddy2steper has joined #ruby-lang
<akahn>
is there an array method for splitting the array into two arrays based on the result of a block?
<apeiros_>
partition
lsegal has joined #ruby-lang
<apeiros_>
@ akahn ^
<akahn>
great, thanks apeiros_
<akahn>
ah, on enumerable, of course. just out of curiosity would there be a way to split it into an arbitrary number of arrays based on the result of a block?
<apeiros_>
chunk
<apeiros_>
there was another one…
<apeiros_>
slice_before
<akahn>
neat! thanks
Indian has joined #ruby-lang
datanoise has joined #ruby-lang
mv has joined #ruby-lang
Radium has joined #ruby-lang
<Guest1583>
Hi all. I have a strange behaviour with rails 3.1/ruby 1.9.3p125 : { 'x' => [1,2,3] }.to_json transforms the array into a hash. the problem does not exist with ruby 1.9.3p0.
<shevy>
I am not sure what you mean with array into a hash
<shevy>
because {} in ruby is a hash, right?
andrewhl has joined #ruby-lang
<Guest1583>
shevy : I get the same output with 1.8;x. But with 1.9.3 I get the following : "{\"x\":{\"1\":null,\"2\":null,\"3\":null}}"
<shevy>
hmm
<Guest1583>
I mean 1.9.3p125
<shevy>
looks funny
<mistym>
Guest1583: Hm, on 1.9.3p125 I'm seeing the correct result. What json library are you using?
<Guest1583>
mistym : json-1.6.6
savage- has joined #ruby-lang
MrPunkin has joined #ruby-lang
<MrPunkin>
Trying to use gsub to escape ! so that it reads \\\! but when using the back reference syntax in the replacement string I can't prefix it with more slashes or else it no longer is a valid backreference
bjensen has joined #ruby-lang
frangiz has joined #ruby-lang
z3r00ld has joined #ruby-lang
<yorickpeterse>
Guest1583: Did you by any change dump the string to the console?
<yorickpeterse>
Because if so, that you're seeing is correct
<Guest1583>
yorick : no, it's the output from rails console. And and the other end, the user brower does not see the incoming JSON as an array.
<yorickpeterse>
Anybody in here used Celluloid? I wonder if it has advantages over EventMachine assuming the applications are written in a similar fashion
Chris__ has joined #ruby-lang
<yorickpeterse>
Guest1583: that's what I meant
<yorickpeterse>
That's correct behavior
<Guest1583>
I just recreated a new rails project, and I get the correct behaviour with an empty Gemfile.
<yorickpeterse>
#to_json() returns a string containing JSON. Due to this string being displayed as double quotes all double quotes in it are escaped
<yorickpeterse>
That way it remains valid Ruby if you want to copy-paste it
<apeiros_>
he's not complaining about that yorickpeterse
<robgleeson|mba>
yorickpeterse: he's getting a totally different data type :p
<Guest1583>
yorick : what I mean as a problem is the { 1:null, 2:null, 3:null} hash instead of [1,2,3]
<yorickpeterse>
woops
<yorickpeterse>
Hm, that is odd indeed
<apeiros_>
buggy to_json
<yorickpeterse>
Does it work in vanilla Ruby?
<Guest1583>
It works as expected with a new Rails project. so it's indeed related to an additional gem.
mrsolo has joined #ruby-lang
Hydrogen has joined #ruby-lang
<yorickpeterse>
What does `1.to_json` result in?
butchanton has joined #ruby-lang
frangiz_ has joined #ruby-lang
<Guest1583>
1.to_json => "1"
<Guest1583>
[1,2,3].to_json => "[1,2,3]"
<yorickpeterse>
dafuq
<Guest1583>
I'll review all the additional JSON-related gems the project uses. Thanks all for your help, it pointed me in the right direction :)
<Guest1583>
take care.
<yorickpeterse>
good luck
Teddy2steper has joined #ruby-lang
H2H has joined #ruby-lang
msisk_ has joined #ruby-lang
z3r00ld has quit [#ruby-lang]
curtism has joined #ruby-lang
curtism has joined #ruby-lang
Hydrogen has joined #ruby-lang
Radium has joined #ruby-lang
MDmalLION has joined #ruby-lang
krz has joined #ruby-lang
RORgasm has joined #ruby-lang
kyrylo has joined #ruby-lang
kyrylo has joined #ruby-lang
rippa has joined #ruby-lang
MrPunkin has quit [#ruby-lang]
hagabaka has joined #ruby-lang
hagabaka has joined #ruby-lang
kiddorails has joined #ruby-lang
m3nd3s has joined #ruby-lang
wdperson has joined #ruby-lang
geekfactor has joined #ruby-lang
geekfactor has joined #ruby-lang
Radium_ has joined #ruby-lang
savage-_ has joined #ruby-lang
slaytanic has joined #ruby-lang
benanne has joined #ruby-lang
nofxx has joined #ruby-lang
t_ has joined #ruby-lang
headius has joined #ruby-lang
nofxx has joined #ruby-lang
Nisstyre has joined #ruby-lang
curtism has quit ["Live Long and Prosper"]
nofxx has joined #ruby-lang
gnufied1 has joined #ruby-lang
Sailias has joined #ruby-lang
RORgasm has joined #ruby-lang
gregf has joined #ruby-lang
jasmim has joined #ruby-lang
jasmim has quit [#ruby-lang]
jtoy has joined #ruby-lang
bglusman has joined #ruby-lang
mssola has joined #ruby-lang
achiu has joined #ruby-lang
JohnBat26 has joined #ruby-lang
senj has joined #ruby-lang
justinxr_ has joined #ruby-lang
Axsuul has joined #ruby-lang
crudson has joined #ruby-lang
Karmaon has joined #ruby-lang
acuozzo has joined #ruby-lang
colinta has joined #ruby-lang
<colinta>
is there a way to convert a proc into a (named) method?
<colinta>
e.g. m = lambda {|x| puts x } ; self.bind(m, 'othername') ; self.othername "hi!" # => puts "hi!"
chessguy has joined #ruby-lang
headius has joined #ruby-lang
Karmaon has joined #ruby-lang
Clordio has joined #ruby-lang
slaytanic has joined #ruby-lang
<apeiros_>
colinta: see define_method and define_singleton_method
<colinta>
looking at those now... not clear that I can assign a block (e.g. define_method :othername, m)
<colinta>
doesn't "just work" in irb, working in the top-level space, and
<colinta>
class Object ; define_method :othername, m ; end
<TTilus>
colinta: its define_method :othername, &m
<colinta>
NameError: undefined local variable or method `dict' for Object:Class
<colinta>
'dict' is 'othername' in my example here
<colinta>
NameError: undefined local variable or method `othername' for Object:Class # i mean
gorsuch has joined #ruby-lang
<TTilus>
colinta: you need to tell define_method that m is the block param, thats what the & is for
nofxxx has joined #ruby-lang
fgomez has joined #ruby-lang
heftig has joined #ruby-lang
Boohbah has joined #ruby-lang
Weems has joined #ruby-lang
Weems has joined #ruby-lang
thrcka has joined #ruby-lang
achiu has joined #ruby-lang
deception_ has joined #ruby-lang
bjensen has joined #ruby-lang
heftig has joined #ruby-lang
Beryllium has joined #ruby-lang
deception_ has quit [#ruby-lang]
rolfb has joined #ruby-lang
divoxx has joined #ruby-lang
jstemmer has joined #ruby-lang
slyphon has joined #ruby-lang
msisk has joined #ruby-lang
Karmaon has joined #ruby-lang
postmodern has joined #ruby-lang
CoverSlide has joined #ruby-lang
<owen1>
how to find the location of my gem? i can't figure out how to remove a gem...
<owen1>
nevermind. fount it
<owen1>
found
andrewhl has joined #ruby-lang
<drbrain>
gem uninstall
<drbrain>
?
<shevy>
owen1 look at directories like /usr/lib/ruby/gems/1.8/cache/ etc...
voker57 has joined #ruby-lang
<lianj>
gem which rack
flgr has joined #ruby-lang
kiddorails has quit [#ruby-lang]
colinta has joined #ruby-lang
divoxx_ has joined #ruby-lang
<shevy>
gem this rack
divoxx has joined #ruby-lang
Skif has joined #ruby-lang
bglusman has joined #ruby-lang
tonesfrommars has joined #ruby-lang
outoftime has joined #ruby-lang
morozovm has joined #ruby-lang
morozovm has quit [#ruby-lang]
jtoy has joined #ruby-lang
nif has joined #ruby-lang
colinta has quit [#ruby-lang]
Brainix has joined #ruby-lang
shachaf has joined #ruby-lang
rushanuk has joined #ruby-lang
<ironcamel>
is there a way to gem install a certain version of a module?
<cschneid>
"ABCDEF" => "AB BC DE F" is there an easy way to do that transform, .scan(/../).join(" ") almost works
<cschneid>
but drops the last value, since it doesn't match ..
<apeiros_>
ironcamel: you can't install modules, you can only install gems with gem
<ironcamel>
nevermind, i figured it out
<apeiros_>
and yes, see gem help install
<apeiros_>
ok
<apeiros_>
cschneid: gsub
<ironcamel>
pretty straightforward
<apeiros_>
gsub(/..(?=.)/, '\0 ')
<cschneid>
zero width lookaheads?
<cschneid>
tricky
<cschneid>
:)
<cschneid>
thanks
<Brainix>
Hi, guys. I'm new to Ruby. When is it appropriate to use a class, and when is it appropriate to bundle a collection of methods in a module (or in nested modules)?
<canton7>
is i just me, or do neither cschneid's or apeiros_'s methods produce the output which cschneid said he's expecting?
<cschneid>
canton7: because I typoed my original
<cschneid>
I just want spaces in between each 2 chars
<canton7>
ah, type in the expected, of course
<cschneid>
:)
<canton7>
"AB
* apeiros_
became a master of expectation decryption on irc
<cschneid>
hah, and it's friday afternoon, when I become an expert in typos
<apeiros_>
but this one I actually simply missed :)
<canton7>
* "ABCDEFG".scan(/..?/).join(' ') or "ABCDEFG".gsub(/..?/, '\0 ') both work for me
<apeiros_>
gsub is one less method call!!!!!!1!1!
<cschneid>
canton7: your gsub one leaves a floating space at the end
<cschneid>
and my real problem has 4 per grouping, not 2. So the scan one with the ? operator is harder
<canton7>
true, that. Also, .scan.join is quicker :P
<canton7>
not by that much
<apeiros_>
cschneid: well, just make the scan with {1,4}
<apeiros_>
instead of ?
<apeiros_>
quantifiers ftw!
<cschneid>
hmm, I tried that first time, and it didn't work. Presumably because I screwed up
<canton7>
that, or /..?.?.?/ :P
<canton7>
^^ messy
<apeiros_>
…eeew
<cschneid>
"ABCDEFG".scan(/.{1,4}/).join(' ')
<cschneid>
=> "ABCD EFG"
<cschneid>
worked fine. I swear that's what I had originally
<apeiros_>
heisenbug
<apeiros_>
you looked to close at it!
<apeiros_>
wait, or was that the schroedenbug? I think so…
<cschneid>
dunno, but after squishing, the bug's velocity is 0
<canton7>
heisenbugs are the ones that disappear the second you try and analyse them
<apeiros_>
or only occur when you look for them
<apeiros_>
cschneid: right, AND you know the bugs position!
<apeiros_>
you solved heisenbergs problem!
* canton7
spent 2 weeks finding a race condition in a comms protocol between two micros
<canton7>
precisely because of that damn bug type
<apeiros_>
your debugging caused different timing, causing the bug to disappear, I assume?
gregf has joined #ruby-lang
<canton7>
precisely
nif has joined #ruby-lang
slyphon has joined #ruby-lang
FiXato has joined #ruby-lang
nif has joined #ruby-lang
Rich_Morin_ has joined #ruby-lang
thone_ has joined #ruby-lang
nif_ has joined #ruby-lang
<Rich_Morin_>
I'd like some help with an SSL error Mechanize is giving me - http://pastie.org/3741003
<matled>
ruby -rrubygems -e 'exit 0' should always work if rubygems is installed
<ironcamel>
that's the one i need to check
<ironcamel>
matled: yeah, that worked
<ironcamel>
for rubygems
<matled>
depending on your ruby version you might have to setup your environment so that rubygems is actually required before you try to require your gem
<lianj>
gem list | grep torpedo; is slow but works
<ironcamel>
lianj: thanks
<ironcamel>
that works
<matled>
lianj: and error prone
<ironcamel>
matled: what is a better way?
<lianj>
matled: not more than -rfoo
<matled>
lianj: well, I'll name a gem nuclear_torpedo
<lianj>
then do something like grep "^name (" then
<ironcamel>
matled: the problem is that -rtorpedo doesn't work for this gem
<matled>
ironcamel: the script trying to use the gem will have problems too in this case
<matled>
you could try -rrubygems -rtorpedo
<lianj>
matled: gem names not always equel their require name
rue has joined #ruby-lang
rdavila has joined #ruby-lang
<matled>
lianj: but typically you know the name to require
mistym has joined #ruby-lang
<drbrain>
Rich_Morin_: can you give me the host you're connecting to?
<drbrain>
the one that had the issue, I'd like to fix the problem properly
<Rich_Morin_>
Cool. I'll keep my hacked-up version available in case you need any more traces, etc.
<Rich_Morin_>
Feel free to email me at rdm@cfcl.com
<drbrain>
Rich_Morin_: the easy way to log in mechanize is @agent.log = Logger.new $stderr
enebo has joined #ruby-lang
butchanton has joined #ruby-lang
rking has joined #ruby-lang
kiesia has joined #ruby-lang
mistym has joined #ruby-lang
RORgasm has joined #ruby-lang
fgomez has joined #ruby-lang
Karmaon has joined #ruby-lang
sheela1 has joined #ruby-lang
headius has joined #ruby-lang
countskm has joined #ruby-lang
fgomez has joined #ruby-lang
<countskm>
just curious about naming conventions for class inheritance - I have a Host and then I have a LinuxHost - does that sound right to Append the Subtype to the beginning?
<countskm>
LinuxHost < Host
<countskm>
i guess whats bugging me is in an ls the related classes are not ordered - probably thinking about this too much :-)