<zenspider>
jaimef: lemme know if that doesn't make sense
Mithos^ [Mithos^!~Mithos@client-81-105-211-213.mcr-bng-011.adsl.virginmedia.net] has joined #ruby-lang
workmad3 [workmad3!~workmad3@cpc1-bagu10-2-0-cust81.1-3.cable.virginmedia.com] has joined #ruby-lang
<zenspider>
JosephRuby: ok. I added a comment pointing out that it can be made 80% faster very easily... but I'm not going to just give you the code... you'll learn more if you work through it
<zenspider>
too bad I didn't make the comment on stack overflow... I could be earning ... points... or something
<infid>
you know what the say... the larger the stackoverflow pointage, the larger the loser
<zenspider>
hah
<zenspider>
I had a running bet with someone in here that I wouldn't use stackoverflow over the next year. I don't remember who it was with or what the wager was for but I want to collect :P
<infid>
I give it a hard time but I do like the site overall
<zenspider>
I think it is yahoo answers for code
<samuelkadolph>
Nah, they suggest you add sources to Yahoo! Answers
<infid>
I remember when answering questions on IRC felt competitive. Whoa man, SO takes that to a new annoyance. You spend time answering a question and by the time you hit submit 5 people have beat you to it, and because they answered first the question asker ends up accepting their answer and rarely returning to see yours
<jaimef>
zenspider: it does, never used optional params before. thanks
<infid>
IRC is different. You answer a question and the question asker /quit's before you hit Enter
<zenspider>
jaimef: awesome
hangingclowns [hangingclowns!~Adium@58.247.100.206] has joined #ruby-lang
<infid>
Nah, it's way better than any type of Yahoo! Answers. Those are always the worst answers. At least on SO you're bound to get at least one intelligent answer.
<infid>
Everyone at my work who has said that SO sucks, I catch using it at least once a day as I walk by their desk. It's like Hanson when they first came out. Everyone said they sucked, yet listened to them secretly.
<shevy>
infid well that is just because some people don't know how to work IRC
<shevy>
or they are impatient
<shevy>
but the key to IRC is to idle to power
<zenspider>
idle to power? hah
jmontross [jmontross!~Adium@static-96-236-65-137.snfcca.dsl-w.verizon.net] has joined #ruby-lang
<infid>
IRC feels more social than any new trend such as Facebook, Stackoverflow or Google+
<hangingclowns>
anyone know why I can't seem run spec tests for a gem?
<hangingclowns>
it keeps not picking up a constant
<hangingclowns>
I'm using autload for require statements
<confounds>
hangingclowns is anything ever truly constant?
jasmin [jasmin!~jasmin@178.239.26.139] has joined #ruby-lang
<infid>
not even constants are constants once the program exists :(
<hangingclowns>
haha
<confounds>
exactly
<hangingclowns>
actually, I'm trying to include a module in a class
<hangingclowns>
but it can't seem to pick up on it?
<hangingclowns>
I have one file where everything is loaded from autoload :Class, 'path'
<infid>
the term "volatile memory" feels redundant
havenn [havenn!~skipper@pool-72-67-31-69.lsanca.fios.verizon.net] has joined #ruby-lang
<samuelkadolph>
Sure but no one says that
<samuelkadolph>
There is volatile variables.
<hangingclowns>
ahh, anyways, I figured it out
<zenspider>
why are you using autoload at all?
<hangingclowns>
I included all files, when I should just include one
<hangingclowns>
why?
<hangingclowns>
is it a bad idea?
<zenspider>
is it a good idea?
<hangingclowns>
I'm using a gem
<hangingclowns>
i'm building a gem and I have like, so far, over 60 classes
<hangingclowns>
but I wnat to be able to use any class if I want to
<hangingclowns>
so why load every class into memory if say I only want to use 1 or 2?
srbartlett [srbartlett!~srbartlet@202.146.7.239] has joined #ruby-lang
<infid>
sounds more like the Mother Load then a Gem
<zenspider>
hangingclowns: who said you had to load every class?
kain [kain!~kain@151.64.233.57] has joined #ruby-lang
<hangingclowns>
so then what do you recommend?
<samuelkadolph>
Don't do anything
<zenspider>
not doing autoloads
<samuelkadolph>
Any code that needs your class has to require i
<samuelkadolph>
it*
<hangingclowns>
so i'd have to require my users to load every piece that they want to use?
<hangingclowns>
sounds like a hassle for them
<zenspider>
wtf are you writing that needs 60 classes anyhow?
<hangingclowns>
data migration and configuration
<hangingclowns>
for an erp sytem
<shevy>
infid well, I'll never use facebook or google+, I don't see the point in providing more and more data to companies myself when it's already horrible enough as is. but stackoverflow is not so bad
<zenspider>
then they're enterprisey lemmings and expect to be inconvenienced
<infid>
are you writing a Gem or Mr Holland's Opus
<hangingclowns>
if it can play music, then maybe I can retire early :)
<zenspider>
I don't see a problem in having to require what you actually use.
<shevy>
hehe
<infid>
shevy: I don't blame you
<shevy>
define "early" ;D
<zenspider>
makes code more clear imhfo
<hangingclowns>
yeah, it can...
<hangingclowns>
but what it comes down to...
<hangingclowns>
this system is so massive and code changes everyday
<hangingclowns>
i just starting writing tests
<infid>
shevy: I love how all companies these days have tricked everyone into giving them their private information by making it seem cool or convenient
* zenspider
sighs
<shevy>
infid convenience is a powerful thing
<hangingclowns>
not to mention I'm the only ruby guy here, everyone else is munching on the Python juice
<hangingclowns>
oh yeah, was also wondering...
<infid>
shevy: it's hard to balance things. Obviously I'm not going to give up my cellphone or gmail and go live in the woods
<jaimef>
so I have output that uses \n\n to split records. trying to identify just those records containing a filter. however foo.split("\n\n").each {|a| puts "yes" if a.match(/bar/) } is not working
<hangingclowns>
anyone know if it's best to go straight from CSV to XML, or should I load things into a database, too?
<shevy>
hangingclowns beat them with beautiful poems as code!
<hangingclowns>
shevy: I do, everyday
<infid>
we may fear corporations knowing too much about us but the government already does
<zenspider>
is 'of' a keyword/builtin/whatever in zsh or any other shell you guys know of?
<hangingclowns>
I convinced them to use Rake to run tasks rather than doing everything by hand
xjiujiu [xjiujiu!~quassel@218.77.14.195] has joined #ruby-lang
<zenspider>
hangingclowns: "best" is a red herring
<hangingclowns>
red herring?
<hangingclowns>
Files: 68
<hangingclowns>
Modules: 11 ( 0 undocumented)
<hangingclowns>
Classes: 67 ( 0 undocumented)
<hangingclowns>
Constants: 45 ( 0 undocumented)
<hangingclowns>
Methods: 253 ( 0 u
<hangingclowns>
massive gem, right?
<infid>
hangingclowns: why go from CSV to XML? Why not start with XML since it can do things that CSV can't? What are you trying to accomplish?
<hangingclowns>
I sure hope it can play me beautiful music?
<shevy>
ewww moving to XML
<shevy>
today is a sad day
<hangingclowns>
I've got CSV files that come from a customer, and I wnat ot load them into CSV to load into a system
<infid>
hangingclowns: if you can 'start' with a database, then allow it to export to csv, xml, etc if needed
<zenspider>
meh. 253 methods is not that much overall. and yes, "best" is a red herring.
<infid>
hangingclowns: I'd load them into a database then, straight
<zenspider>
esp with such a poorly worded question.
<shevy>
oh cool... now I should count how many methods my projects have
<hangingclowns>
yeah, but I saw Mongodb, and I was impressed...
<hangingclowns>
I wnated to use it
<infid>
hangingclowns: there are ETL tools that can do stuff like that i'm sure, if you don't want to do it yourself
<hangingclowns>
I'm used to relational databases, not used to using this "document"-style loading
<hangingclowns>
what's ETL?
<infid>
extract/transform/load (iirc)
<hangingclowns>
never heard of that
<infid>
lots of businesses get csv files to digest and process everyday, it's a long solved problem
<hangingclowns>
yeah it is
<hangingclowns>
but I think there's not quite an easy way around this part
<hangingclowns>
plus, it's not for certain if the data will be even ready by the time it gets to me
<hangingclowns>
i've got a pretty good system down
twittard [twittard!~twittard@wc.lax.truecarcorp.com] has joined #ruby-lang
<infid>
I wouldn't conver them to XML. If you need to process them and discard them, then do so. Preferably by storing the csv in a decent looking data structure
<hangingclowns>
i make a model for every database table I've run into so far
<hangingclowns>
not much I can do
<hangingclowns>
I need them in XML
<hangingclowns>
cause sometimes I need to reference them later on
<hangingclowns>
and we need to save them in a file for use later
<hangingclowns>
trust me, there's no way around this
<infid>
I don't trust you :p
<hangingclowns>
haha
<hangingclowns>
okay, here's what's up
<hangingclowns>
i take some customer data, and convert it into XML
<hangingclowns>
XML that's readable by OpenERP
<hangingclowns>
I take all of their XML, make it into a module
<hangingclowns>
so the customer is buying a module from us
<hangingclowns>
and all they do it drop it into their system, and turn on the module
<hangingclowns>
the system loads their data in and BAM
<hangingclowns>
everyone is happy
<hangingclowns>
the system is ready and configured for their use
<hangingclowns>
say that their system blows up
<hangingclowns>
no big deal
<infid>
referecing them and "needing" them for later use is a good need for a real database, not xml files. And that way you can run sql on it, generate xml, csv or whatever files you may need in the future
<hangingclowns>
they just drop the DB and reload the module
savage- [savage-!~savage-@209.118.197.220] has joined #ruby-lang
<infid>
so i would go csv -> rdbms (or even nosql if sufficient) -> xml
<hangingclowns>
mmm
<hangingclowns>
its' been crossing my mind
<hangingclowns>
right now I have a steady system of a builder that corresponds to a model, and a model
<hangingclowns>
a builder is responsibile for building an array of models
<hangingclowns>
the builder reads in a CSV file, and according to the headings at the top, makes the models
<hangingclowns>
well, model
neoesque [neoesque!~neoesque@210.59.147.232] has joined #ruby-lang
<hangingclowns>
and then, after that, the builder is only responsible for startign the XML buildling process
<hangingclowns>
it just passes the Nokogiri::XML::Builder object to the model
<hangingclowns>
and the model just adds itself to it
<hangingclowns>
so everyting is done in memory, for now
<infid>
what if in a month you need it to do something besides xml, and to convert all past records to a new format
wyhaines [wyhaines!~wyhaines@65.39.118.15] has joined #ruby-lang
<bougyman>
you don't raelly have to choose between rdbms and nosql for xml, per se.
<bougyman>
postgres has an 'xml' data type
<bougyman>
understands xpath, can even index by it.
<infid>
mysql has a csv table too
<hangingclowns>
actually, we do use postgres for the Openerp
<hangingclowns>
i haven't looked much into postgres
<bougyman>
hangingclowns: um.
<bougyman>
then why not just dump as data you can COPY in to postgres?
<bougyman>
COPY is by far the fastest, most efficient way to get data in to postgres.
<hangingclowns>
yeah, but if the data is not ready by the time it gets to me, still gotta play with it
<bougyman>
i thought you had a module on their system?
<infid>
Agreed. If you're fortunate enough to already have postgres available, then by all means use the beautiful thing :)
<bougyman>
maybe I misread,.
<hangingclowns>
no
<hangingclowns>
the idea is that we MAKE the module
<hangingclowns>
and they buy the module from us
<infid>
turnkey
<bougyman>
and what does the module do?
<hangingclowns>
the module just consists of their company data and anything else that we add to it
<hangingclowns>
cause every business has different processes
<bougyman>
yes, we call this ETL on our team
<hangingclowns>
so we need to add that into the system, whether we do that with XML or python code
<bougyman>
extract, transform, load.
<hangingclowns>
yeah, exactly
<bougyman>
there are a TON of commercial ETL products, and quite a few open source ones.
<hangingclowns>
if we need to edit the database, then we have to use python, if we just load in data, we use CSV or XML
<infid>
Pentaho is a decent ETL one
<bougyman>
Pentaho is quite comprehensive.
<infid>
might be overkill
<infid>
but it allows you to just do the simple thing you want, and do more later if needed
<bougyman>
i find generic business object software like that generally includes way more than any one process needs.
<bougyman>
cause it has to be the everytransformer.
robglees_ [robglees_!~rob@85-91-26-142.ptr.magnet.ie] has joined #ruby-lang
<bougyman>
we just wrote a generic one internally and use that as the base for every new client-data ETL
<hangingclowns>
right now, this system is going pretty well so far
voker57 [voker57!~voker57@kvirc/developer/Voker57] has joined #ruby-lang
<hangingclowns>
it's better than the old system, I think
<bougyman>
so each client has their own classes on top of our base classes that does their funky-specific tranformations.
<hangingclowns>
yeah
<hangingclowns>
i have something like taht
<hangingclowns>
I have a basic Base class that just loads all attributes into an attributes hash
<hangingclowns>
everything else builds on that
<bougyman>
ours writes everything into postgres.
<hangingclowns>
like relationships
<bougyman>
cerates the tables, models, etc.
<bougyman>
reads a csv header or what-not for field/atribute names, but allows remapping, of course.
<hangingclowns>
but, can you imagine the hassle of giving someone a DB and telling them to load it into their postgres?
<bougyman>
hangingclowns: i thought your module would handle the transformation into what you hold vs what they desire as output.
<bougyman>
anv the other way around for export.
<hangingclowns>
well the idea is that many times, we get some messed up shit
<bougyman>
no idea, that's your ship.
<hangingclowns>
like some crazy excel charts and stuff
<bougyman>
yes, client-supplied data generally sucks.
<hangingclowns>
have to sift through all that crap
<bougyman>
no.
<bougyman>
you read all the cood and have the bad go to a manual-bullshit bucket.
<bougyman>
you should only have to touch the exceptions.
<hangingclowns>
anyways, like I said, so far its' going well and it doesnt' take me long to make up a class in it
<bougyman>
the ones I hate the most are the old unix exports.
<bougyman>
no sane separator, multi-line records with arbitrary fields.
<hangingclowns>
i'm lucky if they ever heard of Linux over here
<bougyman>
that's when, unfortunately, I resort to regex (and thusly, luck).
<bougyman>
oh none of the people who have those are unix people.
<bougyman>
they have some old FACS or PICK box in the back office that spits this junk out.
<bougyman>
er s/FACS/MUMPS/
<hangingclowns>
yeah, sounds like you have more fun at work than I do
<zenspider>
old unix...
<zenspider>
heh
<bougyman>
i wrote the core of what we use, i don't touch it much anymore, though.
<hangingclowns>
that's the plan!
<bougyman>
we have a great gal in india who programs most of our etl now.
<hangingclowns>
write once, don't touch again
<hangingclowns>
except maintenance
<bougyman>
we push the data into postgres... then into PICK from postgres.
<bougyman>
this industry runs almost completely on PICK and MUMPS.
<hangingclowns>
so it's a bad idea to go from CSV to straight XML?
<bougyman>
i don't see any value in it.
<bougyman>
csv is less filesystem space for the same amount of data.
febits[0] [febits[0]!~tony@203.118.14.113] has joined #ruby-lang
febits[0] [febits[0]!~tony@unaffiliated/bits58] has joined #ruby-lang
<bougyman>
you already restrict yourself in csv so that xml can add no value to the data richness.
<hangingclowns>
ahh
<hangingclowns>
got ya
<hangingclowns>
yeah, but not much data richness I think
<bougyman>
if your initial export were XML i'd say not to bother going to CSV, as well.
<bougyman>
it's your boat, you gotta decide how to sail her.
<hangingclowns>
haha
<hangingclowns>
yeah, it is, but I gotta ask which way has the best wind, right?
<hangingclowns>
but in the end, it's my baby
<bougyman>
i'd say: take any junk they want to throw at you in.
<bougyman>
and you have to offer what, about 4 kinds of exports?
<bougyman>
what you do internally is 100% your choice.
<hangingclowns>
only has 2, right now
<hangingclowns>
only will be two as far as I can see
<hangingclowns>
system only allows CSV or XML
<bougyman>
you can't really tell them how to give you the data, not if your "value-add" is to make their job easier. some of these companies we've worked with take 4 weeks to get a new report programmed to do something as simple as produce a TSV (tab-separated) or fixed-length export.
<hangingclowns>
and XML is much easier to link with other data files
dv310p3r [dv310p3r!~dv310p3r@c-98-203-41-91.hsd1.fl.comcast.net] has joined #ruby-lang
X99 [X99!~quassel@218.77.14.195] has joined #ruby-lang
savage-_ [savage-_!~savage-@209.118.197.220] has joined #ruby-lang
savage-_ [savage-_!~savage-@209.118.197.220] has joined #ruby-lang
heppy_ [heppy_!~heppy@fw.baysidebusinessplaza.com] has joined #ruby-lang
jmontross [jmontross!~Adium@static-96-236-65-137.snfcca.dsl-w.verizon.net] has joined #ruby-lang
savage- [savage-!~savage-@209.118.197.220] has joined #ruby-lang
hangingclowns [hangingclowns!~Adium@58.247.100.206] has quit [#ruby-lang]
robgleeson [robgleeson!~rob@subtle/contributor/robgleeson] has joined #ruby-lang
febits[0] [febits[0]!~tony@unaffiliated/bits58] has joined #ruby-lang
amh345 [amh345!~amh345@unaffiliated/amh345] has joined #ruby-lang
<amh345>
this started as a rails question. but i believe it's more ruby so i shall ask here :) var.model.map(&:table).map(&:col1).include?(true) >> will return true/false. what do i need to do in ruby to get the entire result and not just a true/false? i need to get the value from another col if include is true.
SuperTa__ [SuperTa__!~supertaz_@c-24-130-115-179.hsd1.ca.comcast.net] has joined #ruby-lang
<zenspider>
don't do the include?(true) ?
<zenspider>
I can't/won't guess at what col1 does...
<amh345>
if i dont include?(true) i get the entire result from the map(&:col)
<amh345>
which could contain many records in a hash
<zenspider>
you just said you wanted the entire resul
<zenspider>
t
<amh345>
i just need the one result (if there is one) with all it's details. just just a single col
<amh345>
not* just a single col
<amh345>
i've been at this for hours
<zenspider>
then... you prolly want to replace .include?(true) with find { |x| x.include? true }
<zenspider>
but again... you're not asking very well
<mephux>
yea, I just read the question and have no idea what you mean by `entire result`
<amh345>
i need to find a col with the value of true. but the table has many cols. so when i find the true result. i need to get other details from it. now it's sounding more like a rails question.
<br1an>
zenspider: you on android, ios or other? i put colloquy on iphone but not liking it
<br1an>
might just try irccloud on the phone actually now i think of it
<br1an>
(oh, forgot you might be on a notebook)
<lianj>
oh wait, maybe just check is the string is odd? and add a '0' then?
<br1an>
lianj: i dont understand link
Gushings [Gushings!~Adium@c-98-216-169-197.hsd1.ct.comcast.net] has joined #ruby-lang
<br1an>
oh, wait, maybe i do
lsegal [lsegal!jinx@modemcable249.109-177-173.mc.videotron.ca] has joined #ruby-lang
<br1an>
you want to right justify the formatted text in console? or...?
<lianj>
no, just the correct hex output of that huge int
<ryanf>
zenspider just hates fun
<ryanf>
I think ampex is cute, not sure if I'd use it in production (and get fired by zenspider) thoug
<ryanf>
*though
<br1an>
lianj: correct how? whats there is incorrect? what does rjust mean if not right justify?
<br1an>
ryanf: hmm, maybe it'd be a good thing just to have in irb or console for doing quick stuff...
<ryanf>
yeah I think that's a great use case for stuff like that
<lianj>
["100"].pack("H*") != ["0100"].pack("H*")
<banistergalaxy_>
you could play edge games with it, have the screen open on the ampex source when zenspider is in the room but closing it before he passes by your desk, and eeach time you keep it open for a little bit longer, increasing the chance he'll see it. Eventually it becomes a kind of perversion, and you actually want to get caught until one day you turn towards him with the source on your screen and eyes shining saying 'fire me, zen
<banistergalaxy_>
spider, fire me'
Marco [Marco!~marco@c-98-254-52-240.hsd1.fl.comcast.net] has joined #ruby-lang
<br1an>
lianj: right, 0100 is octal i think, right?
<lianj>
br1an: i want the last line's result, just not with reverse.pack.reverse.unpack madness. no 01 00 would be hex
<br1an>
oh, maybe in JS it's octal
<lianj>
trolling?
<br1an>
not trying to, but maybe i'm confused :-)
<lianj>
heh ok
<br1an>
if you type 0100 into irb, it interprets it as 64
<br1an>
that's octal 100, no?
<lianj>
its a string at my example
<lianj>
br1an: and yes, [0b0100, 0o0100, 0x0100]
<lianj>
but that not my problem there
<br1an>
nod, sorry, i got confused, trying to figure out if i can help constructively now :-)
<br1an>
probably not but willing to try :-)
<lianj>
haha ya, thanks
<lianj>
now the link is up in the backlog, and chances lower someone looks at it xD
<lianj>
zenspider: any hints? :>
<br1an>
apologies :-)
arthurlockhart [arthurlockhart!~bobes@60-242-128-8.static.tpgi.com.au] has joined #ruby-lang
<lianj>
no need to, its fine
<br1an>
i was thinking maybe some way to use marshal as i kind of feel youre doing somethign similar, but maybe not
<br1an>
i'm not totally clear on what youre doing this for :-)
dr0id [dr0id!~andy@unaffiliated/dr0id] has joined #ruby-lang
<lianj>
that why i pasted the example, i want the correct hex representation of that huge integer
<br1an>
but the to_s(16) isnt right because its missing a leading 0?
<lianj>
str.rjust doesnt work because the length of those ints is not fixed.
<lianj>
br1an: right
<lianj>
reverse.pack.reverse.unpack feels mad. the .odd? solution might work to but i'm hoping someone pulls out another fine solution
SuperTa__ [SuperTa__!~supertaz_@vpn.lax.truecarcorp.com] has joined #ruby-lang
gnufied [gnufied!~gnufied@122.167.254.70] has joined #ruby-lang
<br1an>
yeah, i was thinking i.length.even? ? i : "0"+i
<br1an>
seems less ugly/crazy anyway, and probably more efficient :-)
imperator [imperator!~Daniel@63-225-247-192.hlrn.qwest.net] has joined #ruby-lang
<lianj>
specs all pass. yea i will go with that, for now
brianpWins [brianpWins!~brianpWin@hlfxns0169w-142068026252.dhcp-dynamic.FibreOp.ns.bellaliant.net] has joined #ruby-lang
x0F_ [x0F_!~x0F@unaffiliated/x0f] has joined #ruby-lang
bobess_log_bot [bobess_log_bot!~cinch@60-242-128-8.static.tpgi.com.au] has joined #ruby-lang
headius [headius!~headius@71-210-151-185.mpls.qwest.net] has joined #ruby-lang
arthurlockhart [arthurlockhart!~cinch@60-242-128-8.static.tpgi.com.au] has joined #ruby-lang
rippa [rippa!~splitta@85.158.54.234] has joined #ruby-lang
sh1nji [sh1nji!~sh1nji@c-69-181-222-6.hsd1.ca.comcast.net] has joined #ruby-lang
arthurlockhart [arthurlockhart!~cinch@60-242-128-8.static.tpgi.com.au] has joined #ruby-lang
NinoScript [NinoScript!~Adium@pc-55-124-83-200.cm.vtr.net] has joined #ruby-lang
arthurlockhart [arthurlockhart!~cinch@60-242-128-8.static.tpgi.com.au] has joined #ruby-lang
arooni-mobile [arooni-mobile!~arooni-mo@187.153.70.132] has joined #ruby-lang
igotnolegs [igotnolegs!~igotnoleg@75-162-83-166.slkc.qwest.net] has joined #ruby-lang
csherin [csherin!~csherin@61.17.18.22] has joined #ruby-lang
lsegal` [lsegal`!~jinx@modemcable249.109-177-173.mc.videotron.ca] has joined #ruby-lang
lsegal [lsegal!jinx@modemcable249.109-177-173.mc.videotron.ca] has joined #ruby-lang
NinoScript [NinoScript!~Adium@pc-55-124-83-200.cm.vtr.net] has quit [#ruby-lang]
Nisstyre [Nisstyre!~yours@infocalypse-net.info] has joined #ruby-lang
krz [krz!~foobar@unaffiliated/krz] has joined #ruby-lang
S1kx [S1kx!~S1kx@pdpc/supporter/monthlybyte/s1kx] has joined #ruby-lang
JosephRuby [JosephRuby!~joseph@46.33.34.18] has joined #ruby-lang
sh1nji [sh1nji!~sh1nji@c-69-181-222-6.hsd1.ca.comcast.net] has joined #ruby-lang
<josh9>
i have a route that looks like this - /products/:store where i instantiate a store object. it can be target/cvs/walmart etc.
<josh9>
i can use a case statement to decide which object to create, but that seems a bit ugly.
<josh9>
another option is to use a factory method. something like this:
<josh9>
store_name = params[:store]
csherin [csherin!~csherin@115.111.177.122] has joined #ruby-lang
<josh9>
store = StoreManager.new(store_name).create_store
<josh9>
but all I did here is moved the case statement into the StoreManager's constructor.
<josh9>
any opinions?
<ryanf>
what is your objection to the case statement?
<ryanf>
if you really feel the need to be clever about it, you could do store = Stores.const_get(params[:store]).new
<josh9>
ryanf: i have a case statement, but now it's hidden inside the factory object
<ryanf>
where your stores are Stores::Walmart, Stores::Target, etc
<josh9>
ryanf: what's Stores? the manager Class?
<ryanf>
no it's just a module
<ryanf>
to hold the classes, so that you know const_get isn't going to give you something weird
<josh9>
what's const_get?
<ryanf>
I bet you can figure it out if you apply yourself :)
<josh9>
ryanf: will do. thanks
<ryanf>
hmm actually that still might not be the best idea, I didn't know const_get could get arbitrary top-level objects
<ryanf>
maybe just stick with the case statement
<ryanf>
if you have like module Stores; class Target; end; end and then Stores.const_get('Target'), you'll get Stores::Target back
<ryanf>
but if you do Stores.const_get('Object'), you'll just get Object
<ryanf>
so that's not really ideal
<ryanf>
because then the user could make you instantiate any class
<ryanf>
not that that's necessarily a huge problem, but, you know, not great.
ttilley [ttilley!~ttilley@unaffiliated/lv] has joined #ruby-lang
Marco [Marco!~marco@pat148.vpn.border2-cfw.Dartmouth.EDU] has joined #ruby-lang
spuk [spuk!~spuk@unaffiliated/spuk] has joined #ruby-lang
<josh9>
ryanf: i am looking at the definition of const_get - 'The value of the constant is returned if a definition is found'
<josh9>
so if i pass a class name, it return the value of this class. does that mean it create an instance of that class?
<josh9>
sorry if it's a stupid question.
<josh9>
i'll just try it
<josh9>
works. thanks!
<rippa>
josh9: it returns reference to that class
<josh9>
rippa: got it
wyhaines [wyhaines!~wyhaines@65.39.118.15] has joined #ruby-lang
Marco_ [Marco_!~marco@c-98-254-52-240.hsd1.fl.comcast.net] has joined #ruby-lang
gokulnath [gokulnath!~gokulnath@115.111.177.122] has joined #ruby-lang
sh1nji [sh1nji!~sh1nji@c-69-181-222-6.hsd1.ca.comcast.net] has joined #ruby-lang
<postmodern>
is there a way to hide an instance variable from the default Object#inspect method?
<shyouhei>
postmodern: no. write your own #inspect.
twittard [twittard!~twittard@cpe-76-169-74-39.socal.res.rr.com] has joined #ruby-lang
looopy [looopy!~looopy@pool-141-156-47-198.washdc.btas.verizon.net] has joined #ruby-lang
wyhaines [wyhaines!~wyhaines@65.39.118.15] has joined #ruby-lang
wyhaines [wyhaines!~wyhaines@65.39.118.15] has joined #ruby-lang
levifig [levifig!~levifig@levifig.com] has joined #ruby-lang
<josh9>
i just noticed something interesting with the include method. when i am including a module and i am outside any class or a module it allow me to refer to my classes withouth the <module-name>::
<josh9>
is my observation correct?
confounds [confounds!~confounds@CPE78cd8e667600-CM78cd8e6675fd.cpe.net.cable.rogers.com] has joined #ruby-lang
<rippa>
you are inside the main
amerine [amerine!~mturner@c-24-22-64-72.hsd1.or.comcast.net] has joined #ruby-lang
burgestrand [burgestrand!~burgestra@h-163-174.a155.priv.bahnhof.se] has joined #ruby-lang
<josh9>
rippa: i believe so, since it almost the top of the file and it's not in any scope of module/clesss
<josh9>
class
<rippa>
main is an instance of Object
<rippa>
so you are including into Object
<josh9>
rippa: oh. is it a bad practice?
<rippa>
depends
<rippa>
if it works for you, use it
<josh9>
rippa: i guess i can keep using :: but it gets annoying
<rippa>
you can also do something like
<rippa>
MyClass = MyModule::MyClass
<josh9>
good tip
<rue>
It's less scattershot, so typically better
vesan [vesan!~vesan@maailmanlopun.modeemi.net] has joined #ruby-lang
chris2 [chris2!~chris@vuxu.org] has joined #ruby-lang
<queequeg1>
I'm trying to execute a method that I'm looking up in a hash. : http://pastie.org/3060958
looopy [looopy!~looopy@pool-141-156-47-198.washdc.btas.verizon.net] has joined #ruby-lang
<queequeg1>
is that send bare or do I have to attach it to something? I'm getting a "nil is not a symbol" error.
<ryanf>
that means you tried to get a nonexistent value from the hash
<queequeg1>
hrm, I will puts to see what is getting sent.
<ryanf>
the send doesn't need to be attached to anything because you want to call it on the same object that you'd otherwise be calling the method on
<ryanf>
which in this case is the top-level object
<ryanf>
you could also do method(Conversion_Methods[conversion_method]).call(degrees) fyi, I can't think of an advantage over send though
<ryanf>
and it'll be slower
<rippa>
all put methods in array
<rippa>
*or
<rippa>
*hash
<ryanf>
ah yeah
<rippa>
derp
<ryanf>
you could do ConversionMethods = {:f2c => method(:convert_from_fahrenheit_to_celcius)...}
<ryanf>
and then your original code would work
<queequeg1>
ah
<queequeg1>
let me try that.
<ryanf>
the underscore for uppercase vars isn't normal style btw, that's why I just forgot it :)
<ryanf>
uh by uppercase vars of course I mean constants
<queequeg1>
I was trying to have it be a constant.
<ryanf>
yeah I'm just saying the normal ruby naming convention is ConversionMethods instead of Conversion_Methods
<ryanf>
that's all
<queequeg1>
Ah, right.
<queequeg1>
ooops.
<infid>
next you'll be calling }'s "squigglies" :p
<queequeg1>
Thanks for the help. Nice to see the code do what I wanted it to rather than what I told it to :-)
<rippa>
no, ~ is squigglie
corn_man [corn_man!kvirc@unaffiliated/cornman] has joined #ruby-lang
<ryanf>
what's ~> though
<infid>
squigglie pacman
<rippa>
it's sperm operator
<infid>
haha
<infid>
sperm and eggs > spam and eggs
<robgleeson>
ryanf: the approximate operator, or sperm operator
<robgleeson>
ryanf: has a few names, but approximate operator was suggested as well, since some ppl found sperm operator insulting
mindgame [mindgame!~nfxgosu@c-24-6-170-1.hsd1.ca.comcast.net] has joined #ruby-lang
<ryanf>
I know, I was just seeing if anyone would say spermy
<robgleeson>
oh right sorry, came here late :D
wyhaines [wyhaines!~wyhaines@65.39.118.15] has joined #ruby-lang
heftig [heftig!jan@archlinux/developer/heftig] has joined #ruby-lang
chendo_ [chendo_!~chendo@1.153.172.114] has joined #ruby-lang
livinded [livinded!~lolwut@pool-108-23-242-132.lsanca.fios.verizon.net] has joined #ruby-lang
kitallis [kitallis!~kitallis@122.167.83.22] has joined #ruby-lang
csherin [csherin!~csherin@115.111.177.122] has joined #ruby-lang
nicknovitski [nicknovitski!~nicknovit@208.100.191.222] has joined #ruby-lang
gnufied [gnufied!~gnufied@122.167.254.70] has joined #ruby-lang
looopy_ [looopy_!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby-lang
shevy [shevy!~shevy@88-117-37-92.adsl.highway.telekom.at] has joined #ruby-lang
nicknovitski [nicknovitski!~nicknovit@208.100.191.222] has joined #ruby-lang
wyhaines [wyhaines!~wyhaines@65.39.118.15] has joined #ruby-lang
chendo__ [chendo__!~chendo@120.152.192.231] has joined #ruby-lang
chendo__ [chendo__!~chendo@120.152.192.231] has quit ["Leaving..."]
huugsy [huugsy!~huug@ip-213-49-86-244.dsl.scarlet.be] has joined #ruby-lang
<mindgame>
if I want to match any term of an array, what do I say
<mindgame>
if Array.subset (term); code
<erikh>
look at Enumerable, namely #any? and #include?
srbartlett [srbartlett!~srbartlet@202.161.19.210] has joined #ruby-lang
Defusal [Defusal!DeFi@196-209-51-217.dynamic.isadsl.co.za] has joined #ruby-lang
Defusal [Defusal!DeFi@unaffiliated/ecnerifed] has joined #ruby-lang
frangiz [frangiz!~frangiz@user26.77-105-206.netatonce.net] has joined #ruby-lang
kain_ [kain_!~kain@151.64.211.61] has joined #ruby-lang
headius [headius!~headius@71-210-151-185.mpls.qwest.net] has joined #ruby-lang
Heimidal [Heimidal!~heimidal@c-67-165-197-126.hsd1.co.comcast.net] has joined #ruby-lang
|Vargas| [|Vargas|!~luke@host60-203-dynamic.50-79-r.retail.telecomitalia.it] has joined #ruby-lang
|Vargas| [|Vargas|!~luke@pdpc/supporter/profesional/vargas] has joined #ruby-lang
ryanf [ryanf!~revfitz@adsl-67-119-15-66.dsl.snfc21.pacbell.net] has joined #ruby-lang
Indian [Indian!~Indian@unaffiliated/londonmet050] has joined #ruby-lang
yorickpeterse [yorickpeterse!~yorickpet@pdpc/supporter/professional/yorickpeterse] has joined #ruby-lang
<yorickpeterse>
Morning
RegEchse [RegEchse!regechse@crdl.eu] has joined #ruby-lang
cyri_ [cyri_!~cyri_@236.200.72.86.rev.sfr.net] has joined #ruby-lang
NinoScript [NinoScript!~Adium@pc-55-124-83-200.cm.vtr.net] has joined #ruby-lang
Pip [Pip!~Pip@host-90-156-66-217.spbmts.ru] has joined #ruby-lang
Pip [Pip!~Pip@unaffiliated/pip] has joined #ruby-lang
Banistergalaxy [Banistergalaxy!~AndChat@222.153.223.42] has joined #ruby-lang
<mindgame>
is there a way to remove the has join & quit msgs on mIRC
yxhuvud [yxhuvud!mongo@h-85-57.a212.priv.bahnhof.se] has joined #ruby-lang
snuy [snuy!~Adium@77-21-95-121-dynip.superkabel.de] has joined #ruby-lang
<snuy>
i'm using openssl with ruby and want the server not to ask the client for a client certificate. any suggestions?
kyrylo [kyrylo!~kyrylo@46.118.222.107] has joined #ruby-lang
srbartlett [srbartlett!~srbartlet@202.161.19.210] has joined #ruby-lang
molgrew [molgrew!~bozo20@85.182.139.18] has joined #ruby-lang
Banistergalaxy [Banistergalaxy!~AndChat@222.153.223.41] has joined #ruby-lang
postmodern [postmodern!~postmoder@c-71-237-178-98.hsd1.or.comcast.net] has joined #ruby-lang
Defusal [Defusal!DeFi@dsl-241-19-31.telkomadsl.co.za] has joined #ruby-lang
Defusal [Defusal!DeFi@unaffiliated/ecnerifed] has joined #ruby-lang
corn_man [corn_man!kvirc@unaffiliated/cornman] has joined #ruby-lang
ksinkar [ksinkar!~ksinkar@117.195.103.223] has joined #ruby-lang
DuoSRX [DuoSRX!~user@2a01:e34:edd7:4330:3615:9eff:fe93:de4e] has joined #ruby-lang
chrismcg [chrismcg!~chrismcg@pdpc/supporter/active/chrismcg] has joined #ruby-lang
robgleeson [robgleeson!~rob@subtle/contributor/robgleeson] has joined #ruby-lang
thrcka [thrcka!~thrcka@ip-89-102-34-33.net.upcbroadband.cz] has joined #ruby-lang
<mindgame>
whats the command in irb to get out of line? Ex 12:1";13:1"
sh1nji [sh1nji!~sh1nji@c-69-181-222-6.hsd1.ca.comcast.net] has joined #ruby-lang
headius [headius!~headius@71-210-151-185.mpls.qwest.net] has joined #ruby-lang
Eising [Eising!~allan@0x52b41d06.static.bcbnet.dk] has joined #ruby-lang
datanoise [datanoise!~datanoise@24-145-66-018-dhcp.mia.fl.atlanticbb.net] has joined #ruby-lang
datanoise [datanoise!~datanoise@24-145-66-018-dhcp.mia.fl.atlanticbb.net] has joined #ruby-lang
<rue>
No idea what that means
<rue>
^D will let you discard code if you're in a multiline expression
dr_bob [dr_bob!c100f615@gateway/web/freenode/ip.193.0.246.21] has joined #ruby-lang
perryh [perryh!~root@unaffiliated/perry753] has joined #ruby-lang
ioga_wrk [ioga_wrk!~ioga@92.255.125.251] has joined #ruby-lang
snuy1 [snuy1!~Adium@dhcp13.dcsec.uni-hannover.de] has joined #ruby-lang
workmad3 [workmad3!~workmad3@cpc1-bagu10-2-0-cust81.1-3.cable.virginmedia.com] has joined #ruby-lang
voker57_ [voker57_!~voker57@128.70.38.70] has joined #ruby-lang
burgestrand [burgestrand!~burgestra@h-163-174.a155.priv.bahnhof.se] has joined #ruby-lang
benanne [benanne!~sander@b252h039.ugent.be] has joined #ruby-lang
Natch| [Natch|!~natch@178.73.216.173] has joined #ruby-lang
Weems [Weems!~frodo@unaffiliated/weems] has joined #ruby-lang
Para [Para!~Para@123.98.131.25] has joined #ruby-lang
jensn [jensn!~Jens@90-229-211-15-no150.tbcn.telia.com] has joined #ruby-lang
hibariya [hibariya!~quassel@www9204u.sakura.ne.jp] has joined #ruby-lang
beiter [beiter!~beiter@manz-5f748b70.pool.mediaWays.net] has joined #ruby-lang
snuy [snuy!~Adium@dhcp13.dcsec.uni-hannover.de] has joined #ruby-lang
cleaner72 [cleaner72!c3d41d56@gateway/web/freenode/ip.195.212.29.86] has joined #ruby-lang
snuy1 [snuy1!~Adium@77-21-95-121-dynip.superkabel.de] has joined #ruby-lang
werwolf [werwolf!~llakey@174-127-47-94.static-ip.telepacific.net] has joined #ruby-lang
diegoviola [diegoviola!~viola@host-1-211.b15.cvc.com.py] has joined #ruby-lang
<mindgame>
how do i "escape?" a parenthese used as part of a smiley in a puts statement
<molgrew>
what do you mean?
<injekt>
why do you need to escape a parenthesis in a string?
<mindgame>
puts ":( \n are you sure?"
RomD [RomD!~Roman@nrbg-4d0704ba.pool.mediaWays.net] has joined #ruby-lang
<mindgame>
i get an unexpected ':' error
<injekt>
no
<injekt>
that string is fine
<injekt>
you must be doing something else
<shevy>
hehe
<shevy>
mindgame is doing strange things
<shevy>
hmm
<shevy>
I have 100 lines of ruby code, in one method ... this ruby code generates a shell script... it is currently not a class. Should I move that logic into its own class?
<mindgame>
what is the exit code when stuck in a program
<shevy>
it's the world wide wait after all
<erikh>
the only thing I agree with spolsky on -- the only thing -- is that he believes good code is ugly, because it has actual bugfixes applied to it.
<injekt>
hah
<injekt>
mindgame: what?
<shevy>
mindgame perhaps exit 2? exit 666?
<erikh>
mindgame: if a program is stuck it usually enters an i/o wait or alternatively a zombie state in ps (D or Z)
<erikh>
stuck is the antithesis of exit
<shevy>
hehe
chrismcg_ [chrismcg_!~chrismcg@pdpc/supporter/active/chrismcg] has joined #ruby-lang
<erikh>
man that red bull really worked
<mindgame>
hold up I will show you
<manveru>
erikh: ps on windows?
<erikh>
meh
<manveru>
:)
<erikh>
well there's the task manager, and I think there's a ps-alike (but obviously not the same)
<manveru>
well, given that windows doesn't have fork, i don't think it has zombies...
dejongge [dejongge!~jonke@pD9E0E219.dip0.t-ipconnect.de] has joined #ruby-lang
<outoftime>
rue: I see your point. no, not entirely new. optimizing around that fact would probably involve heavier monkey-patching than I really want to do at this point, though.
<rue>
Hm, that's possible
<rue>
I'd definitely go with just String#<<, #+ and so on for simple cases, maybe even File.join
<outoftime>
rue: absolutely, I'd do that if I were in complete control of this code
<rue>
Might be as much as an OOM difference.
<outoftime>
rue: right now it's spending almost as much time building URIs as it is sending data to them
<outoftime>
rue: and Riak is not known for its write performance
<outoftime>
rue: so an OOM difference seems quite plausible.
Natch| [Natch|!~natch@178.73.216.173] has joined #ruby-lang
Austin__1 [Austin__1!~austin@96.45.197.22] has joined #ruby-lang
* imperator
runs URI.build through ruby-prof
Mchl [Mchl!~Mchl@h1881165560.rev.rootvps.pl] has joined #ruby-lang
<rue>
That's a fairly significant difference, if URI.build is the bottleneck
<rue>
outoftime: ^
<Indian>
any one saw banisted the dude from newzland
<rue>
Yes, banisted dude
<outoftime>
rue: yes it is. I noticed actually that URI::HTTP.new is much more performant than URI::HTTP.build
<injekt>
lol
<outoftime>
rue: looks like the URI::Util::make_components_hash method is quite slow, I guess just trying to deal with all manner of different input types.
<imperator>
rue, true, but presumably there's validation going on :)
<imperator>
how fast is fast enough?
<rue>
I'm assuming this is dire straits as C extensions were brought up and outoftime isn't a complete noob ;)
_rockbot_ [_rockbot_!~rockbot@cpe-069-132-113-012.carolina.res.rr.com] has joined #ruby-lang
<outoftime>
yep -- as I mentioned, a significant proportion of the total time it takes to write a document to Riak is just constructing the URL. That just ain't right.
confounds [confounds!~confounds@CPE78cd8e667600-CM78cd8e6675fd.cpe.net.cable.rogers.com] has joined #ruby-lang
<outoftime>
that said, right now I'm just monkey-patching the low hanging fruit; I'll try and come up with a real patch to the library later that addresses the problem closer to the root. it seems that switching to URI.new removes this particular bottleneck
* imperator
looks at available uri gems
savage- [savage-!~savage-@209.118.197.220] has joined #ruby-lang
<_rockbot_>
best books/tools/sources through which to learn ruby: go!
corecode [corecode!~2@0x2c.org] has joined #ruby-lang
<rue>
imperator: There aren't that many
Natch| [Natch|!~natch@178.73.216.173] has joined #ruby-lang
<imperator>
outoftime, i started with a gem search -r -d uri_
looopy [looopy!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby-lang
<outoftime>
imperator: brilliant! : )
<_rockbot_>
outoftime: I'm a roboticist, know python, matlab, c/c++, etc
<rue>
Mostly the stdlib is enough, plus probably 50% just use string building anyway
<outoftime>
_rockbot_: I'd go with the Pickaxe then.
<injekt>
_rockbot_: if you know those, just pick it up and start
<injekt>
Gah pickaxe :(
<outoftime>
what's wrong with the pickaxe?
<injekt>
dont get me started
<outoftime>
I suppose I won't, then : )
<rue>
The Ruby Programming Language, or I hear Eloquent Ruby is, despite the idiotic name, rather good
andrewhl [andrewhl!~andrew@CPE687f7402a2d8-CM00195ed25a2a.cpe.net.cable.rogers.com] has joined #ruby-lang
<outoftime>
I haven't really opened the Pickaxe since being new to Ruby
<imperator>
_rockbot_, use arduino?
<outoftime>
so maybe it's full of inaccuracies that I just didn't notice at the time
<outoftime>
I do vaguely remember it saying that a for loop is identical to an #each call...
<_rockbot_>
imperator - funny enough, no, actually
<injekt>
outoftime: i learned mostly from the pickaxe too, then read it again once i knew what i was doing and was so glad i didn't take too much from it
<injekt>
it's an awesome reference
<outoftime>
injekt: ten four
* imperator
had the original pickaxe!
<imperator>
<- ruby hipster
<injekt>
I used the ruby way (original) a lot, too
<rue>
corundum: no, books is "The Ruby Programming Language", "Eloquent Ruby", "Programming Ruby 1.9” (‘Pickaxe’) or see http://ruby-doc.org/bookstore/
<corundum>
okies!
havenn [havenn!~skipper@pool-72-67-31-69.lsanca.fios.verizon.net] has joined #ruby-lang
<_rockbot_>
awesome, thanks guys!
laszlokorte [laszlokorte!~laszlokor@d101021.adsl.hansenet.de] has joined #ruby-lang
<rue>
corundum: intermediate books is “Ruby Best Practices", “Design Patterns in Ruby”, “Exceptional Ruby”, “The Ruby Way”, or see http://ruby-doc.org/bookstore/
<corundum>
okay then :)
<injekt>
oh come on rue
<injekt>
who's gonna remember that key
queeway [queeway!~queequeg@c-71-202-152-67.hsd1.ca.comcast.net] has joined #ruby-lang
<rue>
I will
<injekt>
heh
<injekt>
:)
vmatiyko [vmatiyko!~vmatiyko@178.121.247.110] has joined #ruby-lang
<savage->
don't forget Ruby Metaprogramming by Paolo Palotta!
vmatiyko [vmatiyko!~vmatiyko@178.121.247.110] has quit [#ruby-lang]
darkf [darkf!~darkf_dix@unaffiliated/darkf] has joined #ruby-lang
SuperTaz_work [SuperTaz_work!~supertaz_@c-24-130-115-179.hsd1.ca.comcast.net] has joined #ruby-lang
thone [thone!~thone@f052157150.adsl.alicedsl.de] has joined #ruby-lang
mndoci [mndoci!~mndoci@nmd.sbx03393.mercewa.wayport.net] has joined #ruby-lang
igotnolegs [igotnolegs!~igotnoleg@75-162-83-166.slkc.qwest.net] has joined #ruby-lang
yorickpeterse [yorickpeterse!~yorickpet@pdpc/supporter/professional/yorickpeterse] has joined #ruby-lang
workmad3 [workmad3!~workmad3@cpc1-bagu10-2-0-cust81.1-3.cable.virginmedia.com] has joined #ruby-lang
Roujo [Roujo!~Roujo@modemcable186.146-70-69.static.videotron.ca] has joined #ruby-lang
nofxx [nofxx!~nofxx@unaffiliated/nofxx] has joined #ruby-lang
looopy [looopy!~looopy@pool-151-200-13-14.washdc.btas.verizon.net] has joined #ruby-lang
bglusman [bglusman!~bglusman@c-68-80-200-61.hsd1.pa.comcast.net] has joined #ruby-lang
Steppenwolf [Steppenwolf!~maus@213-94-244-61-dynamic.b-ras1.wtd.waterford.eircom.net] has joined #ruby-lang
<outoftime>
shit.
<outoftime>
oops! sorry
<outoftime>
totally did not intend to type that there : 0
sepp2k [sepp2k!~sexy@p5DC91457.dip.t-dialin.net] has joined #ruby-lang
guns [guns!~guns@c-98-228-72-208.hsd1.il.comcast.net] has joined #ruby-lang
ttilley [ttilley!~ttilley@unaffiliated/lv] has joined #ruby-lang
<shevy>
lol
dhruvasagar [dhruvasagar!~dhruvasag@65.98.79.137] has joined #ruby-lang
havenn [havenn!~skipper@pool-108-0-191-210.lsanca.fios.verizon.net] has joined #ruby-lang
looopy [looopy!~looopy@pool-151-200-13-14.washdc.btas.verizon.net] has joined #ruby-lang
sh1nji [sh1nji!~sh1nji@c-69-181-222-6.hsd1.ca.comcast.net] has joined #ruby-lang
Heimidal [Heimidal!~heimidal@factory-smtp.factorylabs.com] has joined #ruby-lang
pigdude [pigdude!~tallen@li61-243.members.linode.com] has joined #ruby-lang
pigdude [pigdude!~tallen@li61-243.members.linode.com] has quit [#ruby-lang]
looopy [looopy!~looopy@pool-151-200-13-14.washdc.btas.verizon.net] has joined #ruby-lang
benanne [benanne!~rijdier@218.188-241-81.adsl-dyn.isp.belgacom.be] has joined #ruby-lang
hagabaka [hagabaka!~hagabaka@unaffiliated/hagabaka] has joined #ruby-lang
diegoviola [diegoviola!~viola@host-1-211.b15.cvc.com.py] has joined #ruby-lang
cyri_ [cyri_!~cyri_@jem75-1-87-88-118-80.dsl.sta.abo.bbox.fr] has joined #ruby-lang
havenn [havenn!~skipper@pool-108-0-191-210.lsanca.fios.verizon.net] has joined #ruby-lang
datanoise [datanoise!~datanoise@24-145-66-018-dhcp.mia.fl.atlanticbb.net] has quit [#ruby-lang]
vmatiyko [vmatiyko!~vmatiyko@178.121.247.110] has joined #ruby-lang
vmatiyko [vmatiyko!~vmatiyko@178.121.247.110] has quit [#ruby-lang]
Pip [Pip!~Pip@unaffiliated/pip] has joined #ruby-lang
AlHafoudh [AlHafoudh!~textual@dsl-static-173.212-5-200.telecom.sk] has joined #ruby-lang
davehimself [davehimself!~davehimse@50.15.1.130] has joined #ruby-lang
SuperTaz_work [SuperTaz_work!~supertaz_@38.99.52.59] has joined #ruby-lang
Pip [Pip!~Pip@unaffiliated/pip] has joined #ruby-lang
io_syl [io_syl!~io_syl@unaffiliated/steph021] has joined #ruby-lang
S2kx [S2kx!~S1kx@ip-95-223-80-198.unitymediagroup.de] has joined #ruby-lang
srbaker [srbaker!~srbaker@184.66.82.213] has joined #ruby-lang
gjastrab [gjastrab!~gjastrab@c-69-250-153-142.hsd1.md.comcast.net] has joined #ruby-lang
gjastrab [gjastrab!~gjastrab@c-69-250-153-142.hsd1.md.comcast.net] has quit [#ruby-lang]
Weems [Weems!~the@68-117-153-32.dhcp.unas.al.charter.com] has joined #ruby-lang
Weems [Weems!~the@unaffiliated/weems] has joined #ruby-lang
io_syl [io_syl!~io_syl@unaffiliated/steph021] has joined #ruby-lang
Jake232 [Jake232!~textual@5e092663.bb.sky.com] has joined #ruby-lang
burgestrand [burgestrand!~burgestra@81-229-85-235-no66.tbcn.telia.com] has joined #ruby-lang
Codif [Codif!~codif@84.120.204.160.dyn.user.ono.com] has joined #ruby-lang
<raggi_>
outoftime: wrt uri.build, just use strings dude
<raggi_>
objectified uris for building is a total waste of time, the commonly used spec is so damn trivial
<outoftime>
raggi_: yeah, agreed -- however I'm monkey-patching a library that expects to be working with URI objects, so I still need to find the least-inefficient way to get those objects
<outoftime>
raggi_: which appears to be URI.new
<raggi_>
oh, i see
<raggi_>
:(
<outoftime>
raggi_: sad indeed. but still, definite performance boost going from URI.merge to URI.new
<raggi_>
erikh started using it for somehting a while back, and it works well for that use case
<raggi_>
i just need to implement a to_s and so on really
<raggi_>
and i guess fix the port/scheme mismatch
<outoftime>
raggi_: nice
<raggi_>
1.8.7+, it wont' work with 1.8.6
nuclearsandwich [nuclearsandwich!~nuclearsa@74-93-3-241-SFBA.hfc.comcastbusiness.net] has joined #ruby-lang
<raggi_>
oh, also, n.b. the examples from rfc2732 have been altered for correctness.
tla [tla!~tla@toelboell-lund.dk] has joined #ruby-lang
<raggi_>
*eyeroll*
heppy [heppy!~heppy@75-101-31-55.dsl.dynamic.sonic.net] has joined #ruby-lang
phlipper [phlipper!~phlipper@208.180.213.144] has joined #ruby-lang
bousquet [bousquet!~bousquet@208.180.213.144] has joined #ruby-lang
Mon_Ouie [Mon_Ouie!~Mon_Ouie@subtle/user/MonOuie] has joined #ruby-lang
Pip_ [Pip_!~Pip@unaffiliated/pip] has joined #ruby-lang
Kanolesic [Kanolesic!~Kanolesic@c-24-218-140-224.hsd1.ma.comcast.net] has joined #ruby-lang
corn_man [corn_man!kvirc@unaffiliated/cornman] has joined #ruby-lang
<josh9>
rue: i really loved 'Design Pattern in Ruby' and now reading 'Eloquent Ruby' by the same guy - Russ Olsen
<josh9>
anyone read 'Exceptional Ruby' and cas share his opinion?
TheMoonMaster [TheMoonMaster!~TMM@reddit/operator/themoonmaster] has joined #ruby-lang
savage-_ [savage-_!~savage-@209.118.197.220] has joined #ruby-lang
savage-_ [savage-_!~savage-@209.118.197.220] has joined #ruby-lang
ttilley [ttilley!~ttilley@c-98-217-122-24.hsd1.ma.comcast.net] has joined #ruby-lang
ttilley [ttilley!~ttilley@unaffiliated/lv] has joined #ruby-lang
havenn [havenn!~skipper@pool-108-0-191-210.lsanca.fios.verizon.net] has joined #ruby-lang
sodani1 [sodani1!~shig@user-387hpcb.cable.mindspring.com] has joined #ruby-lang
sh1nji [sh1nji!~sh1nji@c-69-181-222-6.hsd1.ca.comcast.net] has joined #ruby-lang
wyhaines [wyhaines!~wyhaines@65.39.118.15] has joined #ruby-lang
<whitequark>
anyone knows how to get Haml's AST?
<whitequark>
I don't see a public interface in the gem
Mon_Ouie [Mon_Ouie!~Mon_Ouie@subtle/user/MonOuie] has joined #ruby-lang
havenn [havenn!~skipper@pool-72-67-31-69.lsanca.fios.verizon.net] has joined #ruby-lang
srbartlett [srbartlett!~srbartlet@202.161.19.210] has joined #ruby-lang
Swimming_Bird [Swimming_Bird!~textual@64.70.114.88] has joined #ruby-lang
Natch| [Natch|!~natch@178.73.217.174] has joined #ruby-lang
guns [guns!~guns@c-98-228-72-208.hsd1.il.comcast.net] has joined #ruby-lang
sh1nji [sh1nji!~sh1nji@c-69-181-222-6.hsd1.ca.comcast.net] has joined #ruby-lang
petercooper [petercooper!~petercoop@82.144.254.2] has joined #ruby-lang
srbartlett [srbartlett!~srbartlet@202.161.19.210] has joined #ruby-lang
solars [solars!~solars@mk089144206098.a1.net] has joined #ruby-lang
<JosephRuby>
is there a gem to port 1.9 regex methods to 1.8?
curtism [curtism!~curtis@bas11-montreal02-1128531121.dsl.bell.ca] has joined #ruby-lang
<jensn>
I don't want to sound negative or anything, but not using 1.9 is bad™.
<jensn>
If you need the features of 1.9, you probably want to upgrade for all the other good reasons too.
urbanmonk [urbanmonk!~rom@bas1-toronto08-1279487823.dsl.bell.ca] has joined #ruby-lang
postmodern [postmodern!~postmoder@c-71-237-178-98.hsd1.or.comcast.net] has joined #ruby-lang
<Jake232>
Is there something wrong with the syntax of this wrong.
<Jake232>
rescue Wordpressto::Error => e
<Jake232>
puts e.message
<Jake232>
end
<Jake232>
It doesnt output anything, and I'm pretty sure it should be
<JosephRuby>
jensn: would like to, but i am not project lead
lsegal [lsegal!jinx@modemcable249.109-177-173.mc.videotron.ca] has joined #ruby-lang
<samuelkadolph>
Jake232: That code on its own doesn't do anything.
<Jake232>
samuelkadolph: I know that, but I mean
<Jake232>
If something inside the begin blog, causes that error
<Jake232>
Should that display the message?
<samuelkadolph>
What do you think?
<mindgame>
samuelkadolph: your name reminds me of morpheus
<jensn>
JosephRuby: At some point, some of the new stuff was available in the oniguruma gem. I think you need to install oniguruma first though.
<JosephRuby>
jensn: thanks Ill look that way
<Jake232>
samuelkadolph: I figured it should, and that I was over lookign something
<Jake232>
fixed it now anyway
<jaimef>
this seems too long puts "first: #{list_vdi_for_vm(name).split("\n\n").select{ |l| l.match(": hda") }.to_s.split("\n").select{ |l| l.match("vdi-uuid") }.to_s.split().last}"
walbert1 [walbert1!~walt@h251.129.117.75.dynamic.ip.windstream.net] has quit [#ruby-lang]
<mindgame>
is Rdoc the same as the index in pickaxe
<mindgame>
or a fuller index?
hebz0rl [hebz0rl!~hebz0rl@95.130.165.85] has joined #ruby-lang
<josh9>
anyone is using the jenkins gem? i am not able to install it -
[esn] [[esn]!~esn@cac94-12-88-185-141-50.fbx.proxad.net] has joined #ruby-lang
[esn] [[esn]!~esn@cac94-12-88-185-141-50.fbx.proxad.net] has quit [#ruby-lang]
<zenspider>
josh9: this came up the other day. take it to #rubygems and bug qrush about it
<josh9>
zenspider: will do. thanks
<jaimef>
anything cleaner than v.split("\n").first.to_s.split().last ?
<zenspider>
to_s ?
<zenspider>
why are you calling to_s on a string you just split?
<yorickpeterse>
v.split("\n")[0].split[-1]
<yorickpeterse>
:]
<yorickpeterse>
Never really got the advantage of #first and #last
<zenspider>
that's entirely equivalent and not any cleaner
<yorickpeterse>
It's shorter :)
<zenspider>
so?
<yorickpeterse>
and it doesn't call #to_s on a string
<zenspider>
wow
<zenspider>
jaimef: v[/\w+$/]
<jaimef>
not sure what I am smoking today
<jaimef>
zenspider: thanks. I really have to become more proficient at using regexp
confounds [confounds!~confounds@208.113.46.214] has joined #ruby-lang
<jaimef>
v[/\w+-\w+-\w+-\w+-\w+$/] given it's a uuid
<josh9>
is it possible to run minitest by line number?
<zenspider>
josh9: no, assuming I understand your question
<josh9>
zenspider: in rspec you can say :9 and this line will get run
<zenspider>
jaimef: v[/[\w-]+/] will do too
<cout>
I can't say that question has ever crossed my mind before
<zenspider>
josh9: so use rspec
<zenspider>
minitest won't ever try to meet feature parity with rspec. it's never been a goal
<zenspider>
in fact, I'd say it's an anti-goal
<jaimef>
zenspider: it cuts off on -
<jaimef>
so I get the last oid on the uuid only
<zenspider>
jaimef: look again
<josh9>
zenspider: i love minitest minimalistic approach and speed, so i don't think i'll switch anytime soon
<jaimef>
ahh extras nice
<mindgame>
http://pastie.org/3061802 I get an unexpected end error. Also how are my indentations & organization?
<zenspider>
mindgame: use your text editor's ability to fix indentation. then your missing end should also be obvious
shajith [shajith!~shajith@chat.zende.sk] has joined #ruby-lang
shajith [shajith!~shajith@chat.zende.sk] has joined #ruby-lang
Dreamer3 [Dreamer3!~Dreamer3@74-134-34-116.dhcp.insightbb.com] has joined #ruby-lang
shajith [shajith!~shajith@chat.zende.sk] has joined #ruby-lang
<jaimef>
stack level too deep. Tail recursive optimized my ass
<jaimef>
mksm [mksm!mksm@201.20.236.65.user.ajato.com.br] has joined #ruby-lang
dejongge [dejongge!~jonke@pD9E0C56E.dip0.t-ipconnect.de] has joined #ruby-lang
<zenspider>
ruby doesn't claim to be tail recursive
robbyoconnor [robbyoconnor!~wakawaka@guifications/user/r0bby] has joined #ruby-lang
canton7 [canton7!~canton7@95.150.107.113] has joined #ruby-lang
robbyoconnor [robbyoconnor!~wakawaka@guifications/user/r0bby] has joined #ruby-lang
Axsuul [Axsuul!~Axsuul@75-140-75-52.dhcp.mtpk.ca.charter.com] has joined #ruby-lang
<rue>
Does so too, it says so right there on the box
Pip [Pip!~Pip@unaffiliated/pip] has joined #ruby-lang
Kanolesic [Kanolesic!~Kanolesic@74-93-18-65-NewEngland.hfc.comcastbusiness.net] has joined #ruby-lang
Codif_ [Codif_!~codif@84.120.204.160.dyn.user.ono.com] has joined #ruby-lang
voker57 [voker57!~voker57@128.70.38.70] has joined #ruby-lang
voker57 [voker57!~voker57@kvirc/developer/Voker57] has joined #ruby-lang
wyhaines [wyhaines!~wyhaines@65.39.118.15] has joined #ruby-lang
<rue>
Ruby 98, 16-bit edition
<yorickpeterse>
Now with a free copy of Norton Anti virus
<injekt>
hehe
QaDeS [QaDeS!~mklaus@frbg-5d84f462.pool.mediaWays.net] has joined #ruby-lang
robbyoconnor [robbyoconnor!~wakawaka@guifications/user/r0bby] has joined #ruby-lang
sh1nji [sh1nji!~sh1nji@c-69-181-222-6.hsd1.ca.comcast.net] has joined #ruby-lang
ascarter [ascarter!~ascarter@71-37-51-204.tukw.qwest.net] has joined #ruby-lang
hahuang65 [hahuang65!~hahuang65@108-93-94-165.lightspeed.frokca.sbcglobal.net] has joined #ruby-lang
gloriaC991 [gloriaC991!~jake@c-76-19-66-59.hsd1.ma.comcast.net] has joined #ruby-lang
<gloriaC991>
what's the best-practice way of checking if an object is Hash-like? i don't wanna test if it's actually a hash or not, just if it will behave as expected when i call things like obj[:key]
srbaker [srbaker!~srbaker@184.66.82.213] has joined #ruby-lang
<injekt>
depends how you want it to be implemented
<gloriaC991>
injekt: gotcha
<gloriaC991>
thanks
<gloriaC991>
oh, even better
<gloriaC991>
obj.respond_to? :[]
<injekt>
gloriaC991: expect an Array responds to :[] too, if that's okay then sure
<gloriaC991>
true
<gloriaC991>
i think array also responds to fetch though
<injekt>
yep
<injekt>
back to how you want to use the behaviour, if you're using duck typing, it's usually for that reason
<gloriaC991>
fair enough
<gloriaC991>
thanks
<injekt>
a common one is to check if an object responds to :call, that way you can have a proc, block, or your own custom class with a call method, for example
<injekt>
wow lag
<gloriaC991>
interesting
sodani1 [sodani1!~shig@user-387hpcb.cable.mindspring.com] has quit [#ruby-lang]