bzalasky has quit [Remote host closed the connection]
fosky_ has left #ruby-lang [#ruby-lang]
pskosinski has quit [Quit: pskosinski]
<zzak>
yorickpeterse: congrats
krz has joined #ruby-lang
kgrz has quit [Ping timeout: 255 seconds]
richardjortega has quit [Quit: richardjortega]
ryanf has joined #ruby-lang
erpuds has quit [Quit: erpuds]
KM has joined #ruby-lang
dettoaltrimenti has quit [Ping timeout: 264 seconds]
dettoaltrimenti has joined #ruby-lang
vlad_starkov has joined #ruby-lang
vlad_starkov has quit [Ping timeout: 256 seconds]
breakingthings has quit []
savagecroc has quit [Remote host closed the connection]
asunderland has quit [Ping timeout: 272 seconds]
glebm has quit [Quit: Computer has gone to sleep.]
krohrbaugh has joined #ruby-lang
krohrbaugh has quit [Client Quit]
kain has joined #ruby-lang
asunderland has joined #ruby-lang
jovy88 has quit [Read error: Connection reset by peer]
jovy88 has joined #ruby-lang
idkazuma has quit [Remote host closed the connection]
athaeryn has quit [Remote host closed the connection]
bzalasky has joined #ruby-lang
rippa has joined #ruby-lang
idkazuma has joined #ruby-lang
idkazuma has quit [Remote host closed the connection]
rippa has quit [Ping timeout: 240 seconds]
arubin has joined #ruby-lang
asunderland has quit [Ping timeout: 256 seconds]
woollyams has joined #ruby-lang
Guest99994 has joined #ruby-lang
wallerdev has quit [Quit: wallerdev]
Guest99994 has quit [Killed (idoru (Spam is off topic on freenode.))]
guiambros has quit [Ping timeout: 264 seconds]
guiambros has joined #ruby-lang
Mon_Ouie has joined #ruby-lang
idkazuma has joined #ruby-lang
mistym has quit [Remote host closed the connection]
idkazuma has quit [Ping timeout: 272 seconds]
mistym has joined #ruby-lang
mistym has quit [Changing host]
mistym has joined #ruby-lang
mistym has quit [Remote host closed the connection]
seydar has joined #ruby-lang
<seydar>
i have a question that is unrelated to ruby and technically is homework. i am prepared for your hatemail
<amerine>
seydar: Just ask your questions, friend.
<seydar>
i have a TCP protocol for a server and a client. each transaction contains the user/pass, a session number (the session number is stable, users can have many sessions open), and a sequence number that is increasing
<seydar>
the sequence number is clearly to prevent against replay attacks
<seydar>
but what purpose would a session id serve if you already know the user who's sending it?
<seydar>
like, in any TCP connection
<seydar>
what's the purpose of having a user/pass and a session id?
woollyams has quit [Quit: Computer has gone to sleep.]
vlad_starkov has quit [Ping timeout: 252 seconds]
willw000 has quit [Client Quit]
divout has joined #ruby-lang
bzalasky has quit [Remote host closed the connection]
willw00 has joined #ruby-lang
idkazuma has joined #ruby-lang
bzalasky has joined #ruby-lang
<seydar>
tough crowd, tough crowd
seydar has quit [Quit: leaving]
<willw00>
Hello all, so I have rvm installed, and rvm list shows 1.9.3 as current and default, but ruby -v in terminal shows 1.8.7, how can i actually use 1.9.3?
cordax has joined #ruby-lang
<willw00>
Also, I've just registered, are my messages going through?
symm- has joined #ruby-lang
idkazuma has quit [Remote host closed the connection]
spike|spiegel has quit [Quit: WeeChat 0.4.0]
bothra has quit [Read error: Connection reset by peer]
bothra has joined #ruby-lang
woollyams has joined #ruby-lang
spike|spiegel has joined #ruby-lang
willw00 has quit [Quit: Leaving]
mucker has quit [Quit: leaving]
divout has quit [Remote host closed the connection]
<rue>
Yes
woollyams has quit [Quit: Computer has gone to sleep.]
noop has joined #ruby-lang
blacktulip has joined #ruby-lang
woollyams has joined #ruby-lang
DomKM has quit [Quit: Leaving.]
kgrz has joined #ruby-lang
vlad_starkov has joined #ruby-lang
divout has joined #ruby-lang
oneirophren has joined #ruby-lang
smt has joined #ruby-lang
smt has left #ruby-lang [#ruby-lang]
fsvehla has joined #ruby-lang
vlad_starkov has quit [Ping timeout: 248 seconds]
nXqd has quit [Ping timeout: 264 seconds]
io_syl has quit [Quit: Computer has gone to sleep.]
kgrz has quit [Quit: Computer has gone to sleep.]
krz has quit [Ping timeout: 252 seconds]
Domon has quit [Remote host closed the connection]
nXqd has joined #ruby-lang
Domon has joined #ruby-lang
symm- has quit [Ping timeout: 252 seconds]
nXqd has quit [Remote host closed the connection]
yawniek_ has quit [Quit: WeeChat 0.4.0]
nertzy3 has joined #ruby-lang
nertzy2 has quit [Ping timeout: 252 seconds]
Mon_Ouie has quit [Ping timeout: 272 seconds]
My_Hearing has joined #ruby-lang
rippa has joined #ruby-lang
tomzx_mac has quit [Ping timeout: 258 seconds]
workmad3 has joined #ruby-lang
athaeryn has quit [Remote host closed the connection]
kgrz has joined #ruby-lang
krz has joined #ruby-lang
mucker has joined #ruby-lang
krz has quit [Remote host closed the connection]
krz has joined #ruby-lang
fsvehla has quit [Quit: fsvehla]
workmad3 has quit [Ping timeout: 272 seconds]
glebm has joined #ruby-lang
krz has quit [Client Quit]
JohnBat26 has joined #ruby-lang
krz has joined #ruby-lang
kgrz has quit [Quit: Computer has gone to sleep.]
kgrz has joined #ruby-lang
solars has joined #ruby-lang
rippa has quit [Ping timeout: 240 seconds]
Domon has quit [Remote host closed the connection]
<snafoo>
I've tried grabbing the first element, but that doesn't help either ;;
<drbrain>
and, why don't you use XPath instead of a regular expression?
<snafoo>
src = open(page[0]).read() like that? ;(
<amerine>
↑
<snafoo>
I'm not sure how to go about getting the data I need with xpath T_T Too much of a noob
<manveru>
he can't install nokogiri or hpricot for some reason
alessio_rocco has joined #ruby-lang
glebm has joined #ruby-lang
<amerine>
snafoo: I'm going to hazard a guess that page is an empty array, hence drbrain suggestion of using XPath.
gnufied has quit [Quit: Leaving.]
<drbrain>
snafoo: or use =~ or match instead of scan
<manveru>
just using String#[] would be enough i hope :)
<drbrain>
or ↑
<snafoo>
I have hpricot manveru, I used it somewhat, but then couldn't figure out how to get exactly to the elements I needed, so I just used regex for the rest :(
gnufied has joined #ruby-lang
<snafoo>
Which I know is atrocious :P
joshH3 has quit [Read error: Connection timed out]
rippa has joined #ruby-lang
joshH3 has joined #ruby-lang
Domon has quit [Remote host closed the connection]
joshH3 has quit [Read error: Connection reset by peer]
joshH3 has joined #ruby-lang
joshH3 has quit [Read error: Connection reset by peer]
joshH3 has joined #ruby-lang
noop_ has joined #ruby-lang
noop has quit [Ping timeout: 256 seconds]
fsvehla has quit [Read error: Connection reset by peer]
agarie_ has quit [Remote host closed the connection]
<snafoo>
return the blocks of html, how do i go about getting the URL from that?
Domon has joined #ruby-lang
glebm has joined #ruby-lang
kain_ has joined #ruby-lang
kain has quit [Ping timeout: 245 seconds]
joshH3 has quit [Read error: Connection timed out]
joshH3 has joined #ruby-lang
fsvehla has quit [Read error: Connection reset by peer]
mbj has joined #ruby-lang
skade has quit [Read error: Operation timed out]
vlad_starkov has joined #ruby-lang
fsvehla has joined #ruby-lang
<dr_bob>
Depends on where they sit, snafoo. Could be "//*[@id=\"ctl00_PlaceHolderMain_CommonQuestionsDisplayEditModePanel_Search_lvRegisterRecordsList_ctrl0_IndNameHyperlink\"]//a/@href"
runeb has joined #ruby-lang
<snafoo>
Hrmm, ok thanks dr_bob
<snafoo>
Do you know if it's possible to have wildcards in xpath?
fsvehla has quit [Read error: Connection reset by peer]
<spike|spiegel>
ddfreyne: thanks
<injekt>
yorickpeterse: $LOADED_FEATURES.freeze
<injekt>
yorickpeterse: also yeah push accepts multiple arguments
<injekt>
oh that was ddfreyne
noop_ has joined #ruby-lang
fsvehla has joined #ruby-lang
ammar_ has joined #ruby-lang
ammar_ has left #ruby-lang [#ruby-lang]
mikestok has joined #ruby-lang
glebm has quit [Ping timeout: 256 seconds]
Domon has quit [Remote host closed the connection]
fsvehla has quit [Read error: Connection reset by peer]
ammar_ has joined #ruby-lang
ammar_ has left #ruby-lang [#ruby-lang]
fsvehla has joined #ruby-lang
<dr_bob>
yorickpeterse: why not $:.freeze?
glebm has joined #ruby-lang
barttenbrinke has joined #ruby-lang
barttenbrinke has quit [Remote host closed the connection]
barttenbrinke has joined #ruby-lang
marr has joined #ruby-lang
skade has quit [Read error: Operation timed out]
skade has joined #ruby-lang
<barttenbrinke>
yorickpeterse: I want to get the i into a UTF8 string
<yorickpeterse>
injekt: oh, that could work too
<yorickpeterse>
but I prefer annoying error messages
robbyoconnor has quit [Ping timeout: 252 seconds]
<barttenbrinke>
whitequark .. wow that looks like all kinds of nasty :)
laneoneform has joined #ruby-lang
laneoneform has left #ruby-lang [#ruby-lang]
<barttenbrinke>
The UTF8Sanitizer doesn't decode the %ED to i for me..
justinmcp_ has quit []
francisfish has quit [Remote host closed the connection]
justinmcp has joined #ruby-lang
io_syl has joined #ruby-lang
glebm has quit [Ping timeout: 256 seconds]
<whitequark>
barttenbrinke: well...
<whitequark>
>> 0xED.chr
<yorickpeterse>
whitequark: bot is borken
<yorickpeterse>
charliesome doesn't know how to code, etc
<charliesome>
fark
woollyams has quit [Quit: Computer has gone to sleep.]
<dhruvasagar>
Hi guys, I wrote a simply command line utility in ruby that loops through directories and does some stuff, but when I press ^C during processing, it doesn't stop, it just skips current directory and continues...I want to quit the program if I press ^C
eval-in_ has quit [Remote host closed the connection]
<dhruvasagar>
I am trying to rescue Interrupt, but it is just not doing anything...
<yorickpeterse>
trap 'INT' in particular if I remember the signal name correctly
<whitequark>
dhruvasagar: um, just re-raise Interrupt
<snafoo>
When I do puts item.search("//td/a/@href"), it returns the link text, but not the URL? Why is that?
<whitequark>
rescue Interrupt;
<whitequark>
raise
<barttenbrinke>
whitequark, no, it is í
<whitequark>
barttenbrinke: ok, but not UTF-8 i
<dhruvasagar>
whitequark: it's not even rescueing...I want to 'exit', but it doesn't
<whitequark>
ì
<charliesome>
barttenbrinke: 0xed is í in iso-8859-1
<yorickpeterse>
snafoo: a[@href]
<whitequark>
shit how do I type that
<yorickpeterse>
Though my xpath is rusty
<charliesome>
barttenbrinke: but you're using a 'UTF8Sanitizer'
<dhruvasagar>
yorickpeterse: where should I place Signal.trap(), before , after or duging my processing code ?
<yorickpeterse>
before
<yorickpeterse>
since it's a loop it will otherwise block it
<barttenbrinke>
charliesome I want transform "%ED" into "í"
<barttenbrinke>
In ruby 1.9
<dhruvasagar>
yorickpeterse: how is Signal.trap different from Kernel.trap ?, I tried with trap, but it didn't do anything either. I used >trap('INT') { exit }. but it didn't do anything
<charliesome>
barttenbrinke: why?
<snafoo>
hmmm, yorickpeterse, that return the entire <a> tag :S
<charliesome>
barttenbrinke: is your input guaranteed to be in iso-8859-1?
<yorickpeterse>
dhruvasagar: err, I think they're an alias to be exact
<yorickpeterse>
snafoo: what library are you using, Nokogiri?
<barttenbrinke>
Charliesome: no
idkazuma has quit [Remote host closed the connection]
<charliesome>
barttenbrinke: what encoding is it in?
<snafoo>
hpricot
<yorickpeterse>
heh
<dhruvasagar>
yorickpeterse: ok, is my example trap('INT') not correct then ?
pcboy__ has quit [Ping timeout: 256 seconds]
glebm has joined #ruby-lang
<yorickpeterse>
dhruvasagar: not sure, paste the rest of the code (or what's relevant of it) in a pastebin
<barttenbrinke>
charliesome: It's a user posted URL.. to that means it --should-- be 8859, but that it could be something elese
sush24 has joined #ruby-lang
<charliesome>
barttenbrinke: do you have control over the form the user comes from?
<charliesome>
the checkmark is to force some versions of IE to actually post the form in utf-8
fsvehla has quit [Read error: Connection reset by peer]
marr has quit []
pcboy_ has joined #ruby-lang
vlad_sta_ has quit [Remote host closed the connection]
<dhruvasagar>
yorickpeterse: I tried rescuing as well, it doesn't seem to stop :/
idkazuma has joined #ruby-lang
<TvL2386>
Hi guys, I'm playing with Savon (SOAP library). The wsdl operations show I can call method :get_version, but when I do that, Savon says: /usr/local/rvm/gems/ruby-2.0.0-p0/gems/savon-2.1.0/lib/savon/response.rb:70:in `raise_soap_and_http_errors!': (SOAP-ENV:Client) Unknown method "{urn:iControl}:get_version" (Savon::SOAPFault). I'm connecting to a F5 iControl webservice to manage loadbalancers
<yorickpeterse>
TvL2386: please don't paste errors/code directly in this channel, it's much easier to read when pasted in a pastebin
<yorickpeterse>
e.g. gist.github.com
<barttenbrinke>
charliesome , yeah so they don't ever have to deal with it
<yorickpeterse>
dhruvasagar: hm, then I'm not sure what's going on
fsvehla has joined #ruby-lang
sduckett has joined #ruby-lang
<dhruvasagar>
yorickpeterse: :(, ok thanks for trying
countdigi has joined #ruby-lang
glebm has quit [Ping timeout: 256 seconds]
<TvL2386>
I know it's not very friendly, been messing with this for quite some time now and I'm frustrated...
<TvL2386>
not an excuse though :-)
<yorickpeterse>
it's just an FYI :)
glebm has joined #ruby-lang
<yorickpeterse>
also, a method name with {herp:der}:foo looks a bit weird, even for SOAP
idkazuma has quit [Remote host closed the connection]
<TvL2386>
yorickpeterse, yeah it looks weird to me too. Almost as if I should wrap something on a higher level saying we live in namespace iControl or something... My lack of soap knowledge is biting me here
<TvL2386>
There's this iControl gem (https://github.com/magec/icontrol), but it's 2 years old and is using a very old Savon version... I'm trying to get this into a Rails project which depends on a newer version of Savon... So I cannot use, and don't want to use something that old.
<darix>
whitequark yorickpeterse: with all the tools around parsing ruby and analyzing it. can the libraries be used to determine if there are unused gems listed in a Gemfile?
<whitequark>
darix: no
<whitequark>
well, yes*
<whitequark>
*if your testsuite is good enough, you can remove gems one by one and check if it fails.
<whitequark>
I bet you can trivially write a script to do that.
<TvL2386>
yorickpeterse, found it! For this particular request, I should initialize my Savon client with: ":namespace => 'urn:iControl:LocalLB/Pool',". Now it works
<andrewvos>
Aww man are you using savon?
<andrewvos>
That was rhetorical
<whitequark>
savon is awesome
<andrewvos>
But I feel for you man
<TvL2386>
please please please enlighten me
runeb has quit [Remote host closed the connection]
<whitequark>
it's about as good as you can get if you *have* to use soap
<TvL2386>
I have to use soap
<andrewvos>
Can you quit your job?
<TvL2386>
lol
<TvL2386>
who can't?
<andrewvos>
Well some people are too scared, so a lot of people ;)
<yorickpeterse>
andrewvos: shut it Hamilton
<TvL2386>
as long as a new one pops up fast :)
<yorickpeterse>
darix: in theory, yes
krz has quit [Quit: krz]
<darix>
yorickpeterse: but?
<andrewvos>
yorickpeterse: I think you mean "Hammond"
<TvL2386>
Well, I'm a network engineer, trying to automate an F5 loadbalancer... it uses a SOAP interface
<andrewvos>
A load balancer with a soap interface?
<andrewvos>
For reallio?
<TvL2386>
F5 & Citrix Netscaler both use SOAP
<injekt>
oh mine
<TvL2386>
it's not that weird andrewvos
<injekt>
oh my*
<injekt>
how did I mix up my and mine
<injekt>
that is the question
<andrewvos>
TvL2386: It is to me! I guess you're stuck with savon then
<yorickpeterse>
darix: they don't exist yet
<darix>
injekt: because you can?
<yorickpeterse>
andrewvos: whatever
<injekt>
darix: damn straight!
<andrewvos>
injekt: mein god
<yorickpeterse>
andrewvos: cars are not my interest
<TvL2386>
Well... At least soap is an improvement over the expect scripts used for Cisco in my opinion :)
<TvL2386>
but I'd rather have a REST interface...
<andrewvos>
TvL2386: What problems you having with Savon then?
<snafoo>
Any idea why I get
<snafoo>
realtyscrape.rb:34:in `block in <main>': undefined method `attributes' for nil:N
<snafoo>
ilClass (NoMethodError)
<snafoo>
from puts item.search("//td/a").attributes['href']
<TvL2386>
andrewvos, it's fixed now, it seems I should have used a namespace
<snafoo>
this is so annoying -_--
banister`sleep has quit [Remote host closed the connection]
<TvL2386>
andrewvos, my noobyness on the subject bit me
<andrewvos>
snafoo: What gem are you using?
<injekt>
snafoo: because item.search returned nil?
<snafoo>
hpricot
fsvehla has quit [Read error: Connection reset by peer]
<injekt>
use nokogiri
<andrewvos>
Yeah
<snafoo>
but it most definitly does have a href element
<injekt>
snafoo: but //td/a found nothing, that's the issue
<snafoo>
I can't T_T no admin on this machine and it doesnt have the libs nokogiri needs
<injekt>
in nokogiri that would return a nodeset
<snafoo>
but when i output just puts item.search("//td/a")
<snafoo>
it returns the entire <a> tag, with href elements
<injekt>
maybe because hpricot
tarruda has joined #ruby-lang
<injekt>
snafoo: anyway Elements#attributes makes no sense
<spike|spiegel>
charliesome: thanks for ruby-core:54687 :)
<snafoo>
hmmm
<charliesome>
spike|spiegel: working on a patch right now
<spike|spiegel>
cool
<snafoo>
puts item.at("//td/a")[:href]
divout has quit [Remote host closed the connection]
<snafoo>
still gives me a undefined method error
<snafoo>
:|
<whitequark>
please, stop using hpricot already
<injekt>
snafoo: that's because it's nil
<whitequark>
nokogiri
<snafoo>
i can't install it whitequark :(
<injekt>
the thing is, you can do this fine with hpricot, the problem is at is not finding anything, so it's nil
<injekt>
you'd have the same problem in nokogiri
<spike|spiegel>
snafoo: can't install is not an excuse.. why?
<snafoo>
I don't understand why though, because when i output just the <a> tag it shows the href element in there T_T
<snafoo>
spike|spiegel: Don't have admin, nor the correct libs
wallerdev has joined #ruby-lang
<injekt>
snafoo: so: puts item.at("//td/a")
<injekt>
works?
<snafoo>
sec
<snafoo>
yeah it returns the entire <a> tag
<injekt>
and puts item.at("//td/a")[:href] does what?
woollyams has joined #ruby-lang
<snafoo>
realtyscrape.rb:34:in `block in <main>': undefined method `[]' for nil:NilClass
<snafoo>
(NoMethodError)
<injekt>
lol
<snafoo>
;S
<bougyman>
item.at{"//td/a").class
<injekt>
rogue { !
<bougyman>
what is it?
sduckett has quit [Ping timeout: 246 seconds]
dhruvasa1ar has joined #ruby-lang
idkazuma has joined #ruby-lang
<snafoo>
Hpricot::Elem
<bougyman>
that's nuts.
<snafoo>
is what that returns 0_0
<injekt>
then the world is broken
<yorickpeterse>
isn't hpricot dead anyway?
_Mon_Ouie_ has quit [Ping timeout: 260 seconds]
<spike|spiegel>
llooooooong dead
<bougyman>
he's missing libxslt and doesn't have root, yorickpeterse
<injekt>
not long dead
<snafoo>
bleh
<yorickpeterse>
agh
<yorickpeterse>
* ah
<injekt>
but yeah, definitely nokogiri
glebm has quit [Ping timeout: 252 seconds]
<spike|spiegel>
not maintained for more than 1 year == long dead. no?
<snafoo>
its gonna be a long night..
<bougyman>
no, that could just mean done, spike|spiegel
<injekt>
I thought it had pushes to master less than 6 months ago
_Mon_Ouie_ has joined #ruby-lang
<injekt>
I dunno, I haven't used it for years now
ritek has joined #ruby-lang
dhruvasagar has quit [Ping timeout: 264 seconds]
<spike|spiegel>
bougyman: only very few libs ever get to that stage
<bougyman>
spike|spiegel: agreed
dabradley has quit [Ping timeout: 272 seconds]
alessio_rocco has joined #ruby-lang
<yorickpeterse>
"After years of lack of a proper maintainer for one of why's jewels, it has been decided to finally close the book on hpricot. Most users have migrated to alternatives and there is simply no time or energy to continue with the current codebase."
fsvehla has quit [Read error: Connection reset by peer]
<yorickpeterse>
From the READM
<yorickpeterse>
* README
_Mon_Ouie_ has left #ruby-lang [#ruby-lang]
Mon_Ouie has joined #ruby-lang
fsvehla has joined #ruby-lang
dabradley has joined #ruby-lang
<yorickpeterse>
jesus christ, ActiveRecord's API is so dumb for common stuff
<yorickpeterse>
Herp.where('foo LIKE ?', 'GETOUT')
<yorickpeterse>
arel tiem I suppose
alessio_rocco has quit [Ping timeout: 248 seconds]
wallerdev has quit [Quit: wallerdev]
alessio_rocco has joined #ruby-lang
<yorickpeterse>
also holy shit, Nightwish, I haven't listened to this in years
<yorickpeterse>
So a common thing I do in AR is something like the following: `SomeModel.select(:id).map(&:id)`. The problem is that this creates SomeModel instances only to throw them away again. Is there a more efficient way of doing this?
<gnufied>
(I was kidding!)
Matip has joined #ruby-lang
<Matip>
Hello guys
<yorickpeterse>
(even though each instance only has an id attribute)
<gnufied>
SomeModel.pluck
<injekt>
yorickpeterse: pluck
<gnufied>
yorickpeterse: &
<injekt>
omg
<yorickpeterse>
oh sweet
<yorickpeterse>
ta
<Matip>
is there a bitwise not operator?
<judofyr>
~
<Matip>
like in 0b111100 == ¬0b000011
<Matip>
no, ~ is ones complement, which is not the same
<judofyr>
ah, right
<Matip>
> 0b111100 == ~0b000011
<Matip>
=> false
<Matip>
I can't believe ruby doesn't have a "not" bitwise operator O_O
<Matip>
it's one of the most basic functions when you have to manipulate binary data
<gnufied>
first stackoverflow result will help, but you are right
<gnufied>
we use ruby for Web stuff.
<gnufied>
:-)
<judofyr>
Matip: what about 0b111111 - X?
<judofyr>
err
<judofyr>
xor
<injekt>
zzak: I made it about 2 hours
<Matip>
gnufied, there's no excuse to not have a not operator >_>
<Matip>
ruby is not using "¬" symbol, it could have been the bitwise not!!
<gnufied>
how would I type that?
<gnufied>
I don't think that will fly
<gnufied>
C as well does not have a bitwise NOT operator, IIRC
<gnufied>
having said that, if you feel strongly about it. open a ticket for ruby-core.
<Mon_Ouie>
Then again, Ruby doesn't ≠, ×, or λ either
<Matip>
Mon_Ouie, what do you mean?
<Mon_Ouie>
That Ruby doesn't use any non-ASCII character at all
wesside has joined #ruby-lang
<zzak>
injekt: before buying a cat?
<injekt>
zzak: :D
<ddfreyne>
There's no bitwise operator not in Ruby? Weird, it never occurred to me
<ericwood>
wat r bits?
<ericwood>
r tey like strings?
io_syl has quit [Quit: Computer has gone to sleep.]
<ericwood>
;)
<ericwood>
please don't hurt me
<Matip>
ok, so how are we supposed to implement it?
<yorickpeterse>
ericwood: yeah but they're webscale
<ericwood>
noice
v0yager has quit [Ping timeout: 256 seconds]
thebastl has joined #ruby-lang
fragamus has joined #ruby-lang
v0yager has joined #ruby-lang
runeb has joined #ruby-lang
kgrz has joined #ruby-lang
<Mon_Ouie>
How about judofyr's way? You do need to specify how many bits you want.
thebastl has quit [Remote host closed the connection]
srbaker has quit [Quit: Computer has gone to sleep.]
MartynKeigher has joined #ruby-lang
ikrima has joined #ruby-lang
gnufied has joined #ruby-lang
<wnd>
Obviously I don't understand standard streams well enough to really understand why this works the way it does: https://gist.github.com/wnd/79c9e8b4bb9d4d6482ff . Takes filename as argument, creates/overwrites it. Comment line 13 to see expected behaviour.
malev has joined #ruby-lang
ikrima has quit [Client Quit]
glebm has quit [Ping timeout: 256 seconds]
cod3r has quit [Ping timeout: 246 seconds]
glebm has joined #ruby-lang
rippa has joined #ruby-lang
<wnd>
related to that, tell me it's a bad idea to PTY.spawn(foo){|out, err, pid| Process.kill(pid); Process.wait(pid)} instead of out, err, pid = PTY.spawn(foo) ...
io_syl has joined #ruby-lang
g0bl1n has joined #ruby-lang
barttenbrinke has quit [Remote host closed the connection]
<zzak>
injekt: you use homebrew right?
glebm has quit [Ping timeout: 246 seconds]
kogent has quit [Quit: kogent]
lcdhoffman has quit [Quit: lcdhoffman]
<zzak>
nvm i think i found it
kogent has joined #ruby-lang
<zzak>
i didnt have homebrew bin and sbin in my path :/
glebm has joined #ruby-lang
wesside has quit [Quit: Ice cream truck!]
Axsuul has joined #ruby-lang
vlad_sta_ has joined #ruby-lang
thebastl has joined #ruby-lang
rwk1 has joined #ruby-lang
thebastl has quit [Remote host closed the connection]
vlad_st__ has joined #ruby-lang
thebastl has joined #ruby-lang
vlad_starkov has quit [Read error: No route to host]
asunderland has joined #ruby-lang
glebm has quit [Ping timeout: 264 seconds]
tonni has quit [Remote host closed the connection]
vlad_sta_ has quit [Ping timeout: 264 seconds]
<injekt>
zzak: I do
judofyr has quit [Remote host closed the connection]
<injekt>
hah
<yorickpeterse>
def self.delete_all; raise "Dont use delete_all"; end
<yorickpeterse>
lol
tarruda has quit [Ping timeout: 264 seconds]
<yorickpeterse>
(I found this Gem)
<zzak>
injekt: still not building tho, i get permissions errors too
<zzak>
and openssl and readline errors
cod3r has joined #ruby-lang
glebm has joined #ruby-lang
rwk1 has quit [Ping timeout: 258 seconds]
face has quit [Ping timeout: 240 seconds]
spinky has quit [Ping timeout: 245 seconds]
MaddinXx has joined #ruby-lang
maxmanders has quit [Quit: Computer has gone to sleep.]
<snafoo>
rooar
<snafoo>
does hpricot not support standard xpath or something -_______-
face has joined #ruby-lang
nXqd has quit [Ping timeout: 245 seconds]
runeb has quit [Remote host closed the connection]
nXqd has joined #ruby-lang
thebastl has quit [Remote host closed the connection]
GarethAdams has joined #ruby-lang
Matip has quit [Read error: Connection reset by peer]
benlovell has quit [Ping timeout: 246 seconds]
spinky has joined #ruby-lang
Matip has joined #ruby-lang
glebm has quit [Ping timeout: 240 seconds]
glebm has joined #ruby-lang
toretore is now known as Guest34542
barttenbrinke has joined #ruby-lang
GarethAdams|Work has quit [Ping timeout: 260 seconds]
nXqd has quit [Ping timeout: 264 seconds]
Quatrerwin has quit [Remote host closed the connection]
barttenbrinke has quit [Read error: Connection reset by peer]
willw00 has quit [Remote host closed the connection]
<spike|spiegel>
is he talking to day? uughhh
glebm has quit [Ping timeout: 246 seconds]
spinky has quit [Ping timeout: 245 seconds]
dfdf has quit [Remote host closed the connection]
<ndrst>
haha nice
<ndrst>
anyone of you guys at the eurucamp 2013?
lele has joined #ruby-lang
<andrewvos>
ndrst: stop copying me!
t_ has joined #ruby-lang
workmad3 has quit [Ping timeout: 264 seconds]
<ndrst>
andrewvos: did I?
glebm has joined #ruby-lang
workmad3 has joined #ruby-lang
GarethAdams has quit [Quit: Leaving...]
skade has quit [Quit: Computer has gone to sleep.]
<andrewvos>
Word for word you plagiariser
<ndrst>
I need proof to feel guilty!
<andrewvos>
Read up
<yorickpeterse>
andrewvos: I'm sorry Mr Hammond but your statement does not exactly hold ground
<yorickpeterse>
what proof have you that ndrst should be convicted of plagiarism and scumbaggery?
<ndrst>
I guess just wild shots, cowboy style?
workmad3 has quit [Ping timeout: 248 seconds]
workmad3 has joined #ruby-lang
vlad_st__ has quit [Remote host closed the connection]
glebm has quit [Ping timeout: 256 seconds]
rolfb has joined #ruby-lang
glebm has joined #ruby-lang
marr has joined #ruby-lang
sandbags has joined #ruby-lang
sandbags has joined #ruby-lang
sandbags has quit [Changing host]
joevandyk has joined #ruby-lang
<joevandyk>
d = "04/28/13 11:00pm"; puts DateTime.strptime(d, "%m/%d/%y %h:%M%p") gives me an invalid date error.
<joevandyk>
any ideas?
swav has joined #ruby-lang
<joevandyk>
oh
<joevandyk>
nm
tarruda has quit [Quit: leaving]
robbyoconnor has quit [Ping timeout: 252 seconds]
rwk1 has joined #ruby-lang
benlovell has quit [Ping timeout: 256 seconds]
mbj has quit [Ping timeout: 260 seconds]
<spike|spiegel>
yeah :D get a rubber duck
rwk1 has quit [Ping timeout: 264 seconds]
dhruvasagar has quit [Ping timeout: 264 seconds]
cored has quit [Ping timeout: 256 seconds]
xtristan has joined #ruby-lang
xtristan is now known as Guest45642
Guest45642 has quit [Client Quit]
dhruvasagar has joined #ruby-lang
cored has joined #ruby-lang
cored has quit [Changing host]
cored has joined #ruby-lang
jkline has joined #ruby-lang
<ndrst>
so explain andrewvos!
barttenbrinke has joined #ruby-lang
emacs-usr has quit [Ping timeout: 256 seconds]
<yorickpeterse>
I hereby declare andrewvos a scumbag. Court dismissed
divout has quit [Quit: Leaving.]
glebm has quit [Ping timeout: 260 seconds]
mbj has joined #ruby-lang
glebm has joined #ruby-lang
Karql has quit [Read error: Operation timed out]
ndrst has quit [Read error: Operation timed out]
ndrst has joined #ruby-lang
mucker has quit [Quit: leaving]
Aloysius1 has joined #ruby-lang
<Aloysius1>
Hello! I'm building a server in Ruby to receive a URL-encoded POST and trying to figure out the simplest approach. I know I could use Rails or Sinatra but was wondering if there was anything simpler yet.
tarruda has joined #ruby-lang
<yorickpeterse>
The lowest level you can go (without re-inventing everything) is raw Rack
<Aloysius1>
Thank you. Don't really want "low" so much as "light", if you know what I mean.
<yorickpeterse>
Sinatra is probably your best bet, it's more pleasant to work with than raw Rack
<Aloysius1>
OK. Thank you very much.
<yorickpeterse>
np
adambeynon has joined #ruby-lang
dhruvasagar has quit [Read error: Connection reset by peer]
justinra_ has joined #ruby-lang
xcombelle has quit [Remote host closed the connection]
<injekt>
cored: also you dont need to cast to an integer (really) so something like this would work: (start..finish).each { |x| count += 1 if x.reverse == x }
<cored>
we don't have an equivalent, on Ruby world, right?
<yorickpeterse>
yes we do
<yorickpeterse>
Rubinius
<cored>
ok
<injekt>
yeah runs in about 2 seconds in normal python
erpuds has joined #ruby-lang
<cored>
I'm using Ruby 1.9.3
<cored>
still running
<injekt>
almost hit 3 minutes in Ruby 2.0
<yorickpeterse>
mind you, Ruby isn't really the best language when dealing with calculations like these
<injekt>
something must be wrong though, I wouldn't usually use ruby for this but being this much slower than python? wut
<cored>
yorickpeterse: oh, yes I know this is just an experiment
<cored>
yes
<yorickpeterse>
Probably a bit of a chicken-egg problem: Ruby isn't optimized for it because nobody uses it for it, but nobody uses it for it becaues it isn't optimized
<yorickpeterse>
From now on I'll end every sentence with the word Basecamp.
<cored>
I'm running it with rbx now
<injekt>
cored: you should write actual equivalent code in both languages and then discuss
<cored>
but I just hit ctrl+c with 1.9.3
<injekt>
because that code isn't equivalent
<cored>
hm
beiter has quit [Quit: beiter]
<cored>
I wasn't the one that did the other code
<injekt>
worryingly I can't speed up the ruby one, but I can speed up the python one a lot
<cored>
but yes, you probably right, there is another Python version which is slower than the one I show you
<cored>
you can speed up the Python one
<injekt>
no im saying the python one is even faster than you think
<cored>
more ?
<injekt>
yes
<injekt>
the code is not optimized
intellitech has joined #ruby-lang
intellitech has joined #ruby-lang
intellitech has quit [Changing host]
<cored>
and why is that?
<cored>
oh I see
<injekt>
do you write python?
<cored>
not really
<cored>
I have minial experience with it
intellitech_ has joined #ruby-lang
intellitech_ has joined #ruby-lang
intellitech_ has quit [Changing host]
intellitech has quit [Read error: Connection reset by peer]
intellitech_ is now known as intellitech
vlad_sta_ has quit [Remote host closed the connection]
glebm has quit [Ping timeout: 268 seconds]
vlad_starkov has joined #ruby-lang
yfeldblum has joined #ruby-lang
vlad_sta_ has joined #ruby-lang
glebm has joined #ruby-lang
vlad_starkov has quit [Ping timeout: 245 seconds]
intellitech has quit [Quit: intellitech]
DomKM has joined #ruby-lang
<injekt>
yeah it's certainly not doing the same thing
intellitech has joined #ruby-lang
intellitech has quit [Changing host]
intellitech has joined #ruby-lang
<injekt>
takes 17 seconds in perl
g0bl1n has joined #ruby-lang
kgrz has quit [Quit: Computer has gone to sleep.]
ndrst has quit [Ping timeout: 246 seconds]
ndrst has joined #ruby-lang
<whitequark>
yorickpeterse: ruby isn't optimized for calculations because it's next to impossible to optimize it for calculations
<whitequark>
thing #0 you do if you wanna use your language as a (predictable) calculator: make it statically typed.
<whitequark>
after that it would still be somewhat slow but it can be helped
lcdhoffman has joined #ruby-lang
<injekt>
whitequark: can you see any perf improvements I could make to my code? funnily enough whilst I know ruby will be an order of magnitude slower than most languages, if perl does it in ~17 seconds, I'd expect ruby to do it inl ess than 5 minutes
<chris2>
i read "make is" and was really confused :)
<whitequark>
injekt: repost the link please
<yorickpeterse>
whitequark: that would hold true if it wasn't for Python being a lot faster
<whitequark>
yorickpeterse: hm... I think I have mistaken the context
carloslopes has quit [Remote host closed the connection]
<yorickpeterse>
same holds true there, I believe Python was also faster
thebastl has quit [Remote host closed the connection]
<cored>
injekt: for soem weird reason, your version is still running
<injekt>
whitequark: same code in python supposedly ran in less than 2 seconds (but I dont think it's the same code), same code in perl (i just wrote it) runs in 17 seconds
<injekt>
whitequark: I killed the ruby process at about 5 minutes
<cored>
injekt: if you used the seed file I sent you, then you will notice that all the lines ends with \n
<whitequark>
injekt: input data?
<cored>
does this still applies, (start..finish) without doing the casting to number?
<injekt>
cored: that's fine
<chris2>
but slower
emacs-usr has joined #ruby-lang
<cored>
injekt: with ("1".."2\n")
<chris2>
hmm. maybe not.
<cored>
does that work?
<injekt>
cored: can you post the input file for whitequark
<whitequark>
injekt: and same code in python/perl.
<cored>
injekt: wait
<injekt>
whitequark: the python code isn't the same but I dont want to rewrite it because I cant stand python
<whitequark>
the algorithm in python version is different and performs way less work
<whitequark>
*of course* it's faster
<cored>
what happen with the while hi >= lo
vlad_starkov has joined #ruby-lang
mbj_ has joined #ruby-lang
<injekt>
whitequark: sure but that's still blazing fast
glebm has quit [Read error: Connection reset by peer]
mbj has quit [Ping timeout: 245 seconds]
sepp2k has joined #ruby-lang
vlad_sta_ has quit [Ping timeout: 264 seconds]
<cored>
it took 1 minute and 40 seconds with rbx
mixandgo has quit [Quit: mixandgo]
<whitequark>
injekt: what?
<whitequark>
don't performing work is obviously faster than performing it. the algorithm is vastly different. check by yourself if you don't believe
<whitequark>
oh yes, you'd need to actually read the python source ;)
<injekt>
whitequark: uh..
<injekt>
I read the python source, I'm not disagreeing with you, I'm saying it's fast and that it's still way faster than ruby would be given the same algorithm
glebm has joined #ruby-lang
<bougyman>
hrm.
<whitequark>
injekt: did you actually implement the same algorithm as in python in ruby?
<bougyman>
i know I've done this before, but I'm having a brainfart.
<bougyman>
how to get the owner of a file or directory as username, not uid.
<injekt>
whitequark: nope, that's why I said "it's still way faster than ruby would be" rather than "it's still way faster than ruby is"
<injekt>
it's an assumption, but I'll take my chances on it being fairly accurate
<whitequark>
injekt: then your claim does not have a base
<whitequark>
I see no reason for it to be true
<injekt>
sure it has a base
Mon_Ouie has quit [Read error: Operation timed out]
<injekt>
ruby is slower than python as these kind of things (usually). Again, it's an assumption, that's enough for me. If this was a problem I was trying to solve I would put more time and effort into it
<yorickpeterse>
gimme a few minutes and I'll port the python code 1:1
joshH8 has quit [Read error: Connection reset by peer]
havenwood has quit [Remote host closed the connection]
<yorickpeterse>
tried to keep it as close to the Python pos
blacktulip has quit [Remote host closed the connection]
<yorickpeterse>
output also is the same as far as I can tell
joshH8 has joined #ruby-lang
joshH7 has quit [Ping timeout: 256 seconds]
<whitequark>
diff it!
<injekt>
that doesn't do the same thing as the original ruby one though does it? that was my original question, that the ruby one had the correct results, the python one did something 'different'
maxmanders has quit [Ping timeout: 252 seconds]
<yorickpeterse>
Ruby 2 does it in about the same time
sebasoga has joined #ruby-lang
retro|cz has joined #ruby-lang
<yorickpeterse>
injekt: No idea, but it does do the exact same as the Python code
<injekt>
yorickpeterse: yeah, nice work
glebm has quit [Ping timeout: 248 seconds]
<yorickpeterse>
time to refactor this cunt
<injekt>
I'd like to port the original ruby one 1:1 to python
joshH8 has quit [Read error: Connection reset by peer]
joshH8 has joined #ruby-lang
<injekt>
because if that does the exact same thing as the original ruby one, that shit is f'ing crazy
TheNotary has quit [Remote host closed the connection]
<injekt>
being over 1 minute quicker with like 300% more code more loops and more objects
joshH8 has quit [Read error: Connection reset by peer]
glebm has joined #ruby-lang
joshH8 has joined #ruby-lang
wmoxam has quit [Ping timeout: 268 seconds]
willw00 has quit [Remote host closed the connection]
joshH8 has quit [Read error: Connection reset by peer]
joshH8 has joined #ruby-lang
sebasoga has quit [Remote host closed the connection]
sebasoga has joined #ruby-lang
r0bgleeson has quit [Ping timeout: 252 seconds]
<cored>
I don't see the need for the closet_higher
joshH9 has joined #ruby-lang
joshH9 has quit [Read error: Connection reset by peer]
<whitequark>
injekt: I'm not sure if you're drunk or just trolling us
<yorickpeterse>
the fuck does it even do
joshH9 has joined #ruby-lang
<yorickpeterse>
like, my semi-useless-coding-competition-skills are next to worthless but this is a whole new level
<cored>
yorickpeterse: probably the guy who wrote it, is a genius
<yorickpeterse>
heh, I wonder if I can speed things up by buffering console output
<yorickpeterse>
MICRO OPTIMIZATIONS GO
<manveru>
no :P
<manveru>
there is almost no output anyway
joshH10 has joined #ruby-lang
<yorickpeterse>
hm no, doesn't seem to make a difference other than making Tmux a bit happier
joshH8 has quit [Ping timeout: 256 seconds]
joshH10 has quit [Read error: Connection reset by peer]
sebasoga has quit [Ping timeout: 264 seconds]
joshH10 has joined #ruby-lang
<yorickpeterse>
so in closest_higher there's this:
sebasoga has joined #ruby-lang
<yorickpeterse>
if (target - value) < 0
<yorickpeterse>
isn't that basically the same as `if value > target`?
<yorickpeterse>
hm, lets see
mbj_ has quit [Ping timeout: 264 seconds]
joshH11 has joined #ruby-lang
<manveru>
i'd say so...
ikrima has joined #ruby-lang
joshH9 has quit [Ping timeout: 256 seconds]
<yorickpeterse>
seems to be the case based on the output
<cored>
yorickpeterse: exactly the same
joshH11 has quit [Read error: Connection reset by peer]
<cored>
yorickpeterse: don't know why this guy did all this, really
<manveru>
still no idea what the closests stuff is
<yorickpeterse>
probably not an actual Python programmer
<cored>
yorickpeterse: he works a web dev for a Python firm :-)
<yorickpeterse>
manveru: apparently takes the next closest value...I think
joshH11 has joined #ruby-lang
<cored>
yorickpeterse: and he have like 2 and a half years working there
<yorickpeterse>
cored: then I feel sorry for his co-workers
<cored>
yorickpeterse: :-)
<injekt>
whitequark: :-)
<yorickpeterse>
the day a co-worker of mine writes this is the day I get a donkey hat and make them wear it
<cored>
yorickpeterse: the funny thing about this, is that he implements the fastest implementation for this problem
<yorickpeterse>
pretty sure you can do it faster
<manveru>
i wish i undestood the problem :P
<yorickpeterse>
Removing the need of Arrays/Tuples can save you some time probably, or at least memory
<cored>
yorickpeterse: there are version in PHP/Javascript/Ruby and I think there's one in Java and the guy who is writting this serie of educational thing for a developers group is saying that the Python version is the fastest
<yorickpeterse>
manveru: idea is to turn 10 into 01 and check if it's the same
<yorickpeterse>
so a numeric palindrome
<whitequark>
did he warm up the JVM?
<whitequark>
I'm sure he didn.t
<yorickpeterse>
fuck the JVM, use Go
<whitequark>
yorickpeterse: fuck you.
joshH11 has quit [Read error: Connection reset by peer]
<yorickpeterse>
hahaha
<cored>
whitequark: warn up?
<injekt>
use go ON the JVM!
<yorickpeterse>
or maybe ~Rust
joshH10 has quit [Ping timeout: 256 seconds]
<manveru>
well, i know palindromes, just not why this is all so complicated
<whitequark>
cored: JVM has adaptive optimization
<cored>
whitequark: interesting
<yorickpeterse>
cored: put it this way, looking at the file, what's the idea of it?
<whitequark>
cored: basically it observes how your code runs and then compiles it with that profiling info
<cored>
whitequark: did not know that
<yorickpeterse>
cored: do you just compare the stuff on the same line?
joshH11 has joined #ruby-lang
<whitequark>
cored: so you need to run the loop, like, 20k times and THEN measure the perf
sebasoga has quit [Ping timeout: 252 seconds]
<cored>
yorickpeterse: you mean the problem?
joshH11 has quit [Read error: Connection reset by peer]
<whitequark>
JVM is optimized for very long-running processes... there's a reason it's a server tech
<manveru>
because sun wanted to sell servers?
<cored>
whitequark: interesting
<manveru>
and their plugin never warmed up fast enough :P
joshH11 has joined #ruby-lang
sebasoga has joined #ruby-lang
robbyoconnor has quit [Ping timeout: 245 seconds]
<yorickpeterse>
aha
glebm has quit [Read error: Connection reset by peer]
<yorickpeterse>
So closest_higher finds the next higher value that's the closest to it
<yorickpeterse>
fuck this shit, I'll use a sort for that
<yorickpeterse>
cored: yeah
<whitequark>
surprisingly
<cored>
yorickpeterse: yes, basically
<cored>
yorickpeterse: I don't know how is this implementation better than the one injekt wrote
joshH12 has joined #ruby-lang
<cored>
yorickpeterse: this code looks ugly and my Python is very basic
<injekt>
they are completely different
<cored>
injekt: yours and his?
<injekt>
cored: yes
joshH12 has quit [Read error: Connection reset by peer]
fn_ has joined #ruby-lang
joshH12 has joined #ruby-lang
<yorickpeterse>
hahahaha, my version of closest_higher is so much better
<yorickpeterse>
not sure if it's actually faster though
joshH12 has quit [Read error: Connection reset by peer]
glebm has quit [Read error: Connection reset by peer]
<yorickpeterse>
andrewvos: ta, stealing this
<andrewvos>
zenspider was right, as usual
<zenspider>
blowmage: so I'm learning
<blowmage>
not a ghetto at all!
<andrewvos>
yorickpeterse: What for?
<yorickpeterse>
andrewvos: so I can see much faster it is
<zenspider>
omakase damnit
<zenspider>
or something
<yorickpeterse>
BASECAMP
mistym has quit [Remote host closed the connection]
<zenspider>
so I'm doing the baseline now then I'll get it running against my patches
<zenspider>
I don't think I'm far off from getting a mostly clean run
<andrewvos>
Why are people saying basecamp and talking about rails I feel like i'm taking crazy pills
* yorickpeterse
is writing tests for ffs
<zenspider>
I AM getting crazy errors, like JSON returning different date formats?
<zenspider>
what' sup wit hthat
<yorickpeterse>
andrewvos: Railsconf
<zenspider>
andrewvos: I'm trying to get minitest proven against rails so I can get MT5 out before rails does another RC
<zenspider>
If I can, we can get rails flipped to MT5 before they release
erpuds has quit [Quit: erpuds]
<andrewvos>
Ooh
<blowmage>
yay!
<andrewvos>
zenspider: Nice
<andrewvos>
zenspider: +1
* blowmage
gets emotional thinking about it
<whitequark>
nice indeed
<andrewvos>
Calm down little guy
Asher has quit [Quit: Leaving.]
<yorickpeterse>
palindromes are not inventions, they are extractions
<andrewvos>
yorickpeterse: Are you at railsconf?
<yorickpeterse>
no
<cored>
andrewvos: the only downside is that, is using another loop
<yorickpeterse>
I'm at home on a couch
<zenspider>
blowmage: at this point, with tenderlove in PDX, it is a fairly big if
<cored>
andrewvos: are you sure that's faster ?
ruurd has joined #ruby-lang
<andrewvos>
cored: Nope
glebm has joined #ruby-lang
<andrewvos>
cored: Let's find out...
<cored>
andrewvos: testing it
intellitech_ has joined #ruby-lang
intellitech_ has quit [Changing host]
intellitech_ has joined #ruby-lang
<yorickpeterse>
we should write a C extension for this
<yorickpeterse>
so that it is webscale
<andrewvos>
yorickpeterse: We should write a basecamp extension for this
<yorickpeterse>
using turbolinks
<andrewvos>
yorickpeterse: And the asset pipeline
<zenspider>
is this palindrome thing just in response to that "python is 10x faster" bs from last week?
<yorickpeterse>
DAMN IT
<yorickpeterse>
About to say that
<andrewvos>
yorickpeterse: YOU LOSE
intellitech has quit [Read error: Connection reset by peer]
intellitech_ is now known as intellitech
<yorickpeterse>
zenspider: not sure, we kinda lost track. Somebody here wrote some Ruby version that took ages, I ported some Python code 1:1 that ran in about 2,5s
<zenspider>
so yes. because the original code was horrifically bad
<yorickpeterse>
yup
solars has quit [Ping timeout: 268 seconds]
<cored>
yorickpeterse: did you refactor the Python code or what?
<yorickpeterse>
No, I gave up
<cored>
yorickpeterse: :-)
<yorickpeterse>
because it's massively overkill right from the start
<cored>
zenspider: well that gist also is pretty ugly code
<cored>
:-P
<cored>
andrewvos: ran a little bit faster
<andrewvos>
I thinkt the string approach may be faster :/
<whitequark>
how so
<andrewvos>
Well, from my simple test it seems faster
<yorickpeterse>
zenspider: regarding your suggestion of using the modulo operator, where you said "highest number", do you mean the highest value of the range (to iterate)
<joevandyk>
is there a way to get the location of the file that required the current file? so if file_a.rb requires file_b.rb, can file_b.rb find the location of file_a.rb?
<charliesome>
joevandyk: take a look at caller perhaps
<charliesome>
joevandyk: that sounds like a dodgy thing to do though
srbaker has joined #ruby-lang
rwk1 has joined #ruby-lang
<andrewvos>
zenspider: Nah still slow. Not sure what box you're running this code on, or just trolling me
<andrewvos>
if you're*
<zenspider>
andrewvos: my POINT is that your code is slow.
<andrewvos>
I assumed you were running the same code
Asher has joined #ruby-lang
<zenspider>
I said "moot point because the argorithm is slow", you responded "How so?", so I told you to run on a bigger range
<andrewvos>
Yeah. Should have guessed
<andrewvos>
How did you optimise it?
sailias has quit [Quit: Leaving.]
<zenspider>
the premise is wrong. you're testing every number from 1 to n. generating tons of garbage, and not even skipping things you KNOW can't be palindromes.
<andrewvos>
zenspider: The reason I'm generating the numbers upfront is because I was trying to get some sort of benchmark. But yeah
<andrewvos>
How would you know a number can't be a palindrome?
idkazuma has quit [Remote host closed the connection]
srbaker has quit [Quit: Computer has gone to sleep.]
justinra_ has quit [Remote host closed the connection]
enebo has quit [Quit: enebo]
srbaker has joined #ruby-lang
glebm has quit [Ping timeout: 256 seconds]
maxmanders has joined #ruby-lang
maxmanders has quit [Client Quit]
vlad_starkov has joined #ruby-lang
<zenspider>
andrewvos: you're NOT generating the numbers up front. you're FILTERING the numbers up front
intellitech has quit [Quit: intellitech]
<zenspider>
1.8s to do 0 to 9_999_999_999_999, and most of that is prolly GC for me
zachlatta has quit [Remote host closed the connection]
<zenspider>
ramps up pretty fast
glebm has joined #ruby-lang
dettoaltrimenti has quit [Ping timeout: 272 seconds]
dettoaltrimenti has joined #ruby-lang
<zenspider>
15 seconds to do 0 to 999_999_999_999_999
<charliesome>
zenspider: whats your algorithm
djwonk has joined #ruby-lang
malev has joined #ruby-lang
glebm has quit [Read error: Connection reset by peer]
maxmanders has joined #ruby-lang
maxmanders has quit [Client Quit]
headius has quit [Quit: headius]
vlad_starkov has quit [Ping timeout: 272 seconds]
<zenspider>
charliesome: generate all the palindromes
glebm has joined #ruby-lang
intellitech has joined #ruby-lang
intellitech has quit [Changing host]
intellitech has joined #ruby-lang
postmodern has joined #ruby-lang
idkazuma has joined #ruby-lang
<cored>
zenspider: so you generated all the palindromes and then match it with the one in the list?
erpuds has joined #ruby-lang
<zenspider>
cored: that's the idea. I don't have the list but that part is easy
<cored>
interesting
<zenspider>
what's the biggest number in the list?
glebm has quit [Read error: Connection reset by peer]