Topic for #ruby is now Ruby programming language || ruby-lang.org || RUBY SUMMER OF CODE! rubysoc.org/ || Paste >3 lines of text in http://pastie.org || Para a nossa audiencia em portugues http://ruby-br.org/
<steampunkey> i keep getting "<gem_name> requires Ruby version >= 1.9.2". what might be the problem, if ruby --version is 1.9.3..
glosoli has joined #ruby
amesha has joined #ruby
michaelh_ has joined #ruby
eywu has joined #ruby
EvanR has joined #ruby
<steampunkey> anyone?
interlocutor has joined #ruby
<iamjarvo> steampunkey: is a specific gem?
<steampunkey> iamjarvo: linecache19
burns180 has joined #ruby
destructure has joined #ruby
d2dchat has joined #ruby
<d2dchat> Any ideas why I'm having issues trying to run mysqlimport through ruby's system method?
<d2dchat> When I copy the exact command output
<d2dchat> and run the command in my console, it works.
twqla has joined #ruby
PhilK has joined #ruby
mikepack has joined #ruby
bosox20051 has joined #ruby
johndbritton has joined #ruby
<jellosea> what does if something.nil? ….. end
<jellosea> whats the ? for
<jellosea> i'm sure this is basic but i don't know how to search this in google
<steampunkey> iamjarvo: nvm, thx
albemuth has joined #ruby
nsadmin has joined #ruby
interlocutor has quit [#ruby]
<nsadmin> Hi... is 1.9 stable? and the gems?
<ekaleidox> yes
<nsadmin> cool, thanks
jlogsdon has joined #ruby
orospakr has joined #ruby
<heftig> jellosea: part of the method name
<heftig> methods ending in ? are supposed to be predicates
bwlang has joined #ruby
Norrin has joined #ruby
<steampunkey> nsadmin: http://pastebin.com/Hja3FaGX
thone has joined #ruby
tomzx has joined #ruby
tommyvyo_ has joined #ruby
timonv has joined #ruby
burns180_ has joined #ruby
Teomari has joined #ruby
wmoxam has joined #ruby
akem has joined #ruby
axl_ has joined #ruby
philcrissman has joined #ruby
timonv has joined #ruby
davidcelis has joined #ruby
dbgster has joined #ruby
ZachBeta has joined #ruby
eywu has joined #ruby
<steampunkey> can someone please help me with this: http://pastebin.com/DyWhiUhk ? I'm trying to rake db:migrate
tatsuya_o has joined #ruby
Avanine has joined #ruby
eywu1 has joined #ruby
froy has joined #ruby
twock has joined #ruby
btanaka has joined #ruby
gen0cide_ has joined #ruby
ZachBeta has joined #ruby
hasrb has joined #ruby
dzhulk has joined #ruby
igotnolegs has joined #ruby
<steampunkey> help meeee please :-(
* Avanine helps steampunkey
* steampunkey receives no help
<Avanine> lol
<Avanine> what do you need?
<Avanine> i must have joined after you originally asked your question.
<steampunkey> Avanine: oh, ok. I'm trying to rake db:migrate, but it keeps spitting this out: http://pastebin.com/DyWhiUhk
<Avanine> what does it spit out when you --trace?
timonv has joined #ruby
<steampunkey> sec
<fowl> Can't explain all the feelings that you're making me feel. My heart's in overdrive and you're behind the steering wheel
<steampunkey> Avanine: this: http://pastebin.com/7cCKPzVa
<steampunkey> fowl: sorry, still a guy.
carlyle has joined #ruby
rohit has joined #ruby
<Avanine> steampunkey: this looks like the same problem you're hitting: http://stackoverflow.com/questions/8378277/cannot-use-ruby-debug19-with-1-9-3-p0
<steampunkey> Avanine: everything does, none of it worked yet. let me check that link out though
chimkan has joined #ruby
burns180 has joined #ruby
<steampunkey> Avanine: i've installed those packages but the message persists. Not from the source though, and I hope I won't need to
<Avanine> :\ that sucks.
<Avanine> what are you requiring here: /home/me/dev/ruby/saas/homework2/hw2_rottenpotatoes/config/application.rb:13
<steampunkey> yep
akem has joined #ruby
cableray has joined #ruby
<steampunkey> Avanine: Didn't write it, but the line is: Bundler.require *Rails.groups(:assets => %w(development test))
akem has joined #ruby
<steampunkey> darnit.
QaDeS_ has joined #ruby
sbanwart has joined #ruby
havenn has joined #ruby
cmasseraf has joined #ruby
shtirlic has joined #ruby
io_syl_ has joined #ruby
ed_hz__ has joined #ruby
mfridh_ has joined #ruby
banisterfiend has joined #ruby
__main__ has joined #ruby
phantasm66 has joined #ruby
akem has joined #ruby
pdtpatr1ck_ has joined #ruby
brian- has joined #ruby
Kiall has joined #ruby
albemuth has joined #ruby
crankycoder has joined #ruby
liluo has joined #ruby
timonv has joined #ruby
readyforcaca has joined #ruby
<readyforcaca> hey guys i really gotta know something
<readyforcaca> it's been giving me the jeepers creepers for the past two weeks'
<readyforcaca> and google has done nothing for me.. absolutely nothing
amesha has joined #ruby
<readyforcaca> what is a better efficiently more user friendly.. more turnover friendly and overall better framework:
<readyforcaca> yii for php
<readyforcaca> or rail for uby
<readyforcaca> ?
<readyforcaca> i am hiring two guys to develop a website like odesk.com
<readyforcaca> simlar to elance.com
<readyforcaca> and want to know which framework i should select
davidcelis has joined #ruby
burns180_ has joined #ruby
<readyforcaca> Rubites - does anyone know answer to above
<readyforcaca> i would be heavily indebted to you if you know
<davidcelis> ?
<fowl> readyforcaca: im available for a focus group if it can be done through emails also i'll accept no less than 100$USD for my time thank you
<readyforcaca> fowl: sure you can join my focus group
<readyforcaca> i charge $101/hr for it
<readyforcaca> let's do it
<readyforcaca> !
godfrey999 has joined #ruby
Avanine has joined #ruby
fenec2 has joined #ruby
<fenec2> hello
<readyforcaca> what' sup fenec2
<readyforcaca> hey fenec do you prefer ruby on rails or yii?
<fenec2> ROR
<fenec2> no hesitation
<fenec2> :)
<Pheen> readyforcaca: If after two weeks you haven't been able to find anything that says definitively which framework will be better then it seams pretty clear both could solve your problem. It will simply come down to the preference of the developer.
ryannielson has joined #ruby
<fenec2> guys am trying to create a class to display the cartesian product
<fenec2> but am having some issues
shtirlic_ has joined #ruby
<fenec2> here is my code
<fenec2> thanks for helping me
maletor has joined #ruby
<fenec2> why initialize is not returning an array
<fenec2> ?
<fowl> fenec2: initialize returns the object you made
<fenec2> yes
<fenec2> i dont want that
<fowl> then you want it to run when it's created and set the results to a variable so you can get them
<fenec2> what if i want new to return an array
<fowl> well fenec2 you dont really need a whole class for what you're doing
<fenec2> its part ofthe requirement for my homework
<fowl> the cartesianProduct() method that is, you could just have it as an outside method or define it as a class method
nari has joined #ruby
<fenec2> can you show me please
readyforcaca has quit [#ruby]
ryannielson has joined #ruby
<fenec2> i dont see how defining it as a class method would help me to return an array when i instantiate the object
<fowl> oh 1 sec
<fenec2> i need to pass a rspec test
<fenec2> this wouldnt work
<fenec2> i need to make this call c = CartesianProduct.new([:a,:b], [4,5])
<fowl> SomeClass.new is always gong to be an instance of SomeClass (unless you do some super crazy stuff that i wont go into)
<fowl> you would use SomeClass.new(args).calculate if you just want the results
<fowl> or whatever api you're being forced into
<fowl> now, to be honest, this is way more taxing that i thought it would be, so i bid you all in #ruby a fair good night
fowl has quit ["Leaving"]
jphpsf has joined #ruby
<fenec2> thank you for trying
<fenec2> anyone else
<fenec2> ?
<fenec2> heeelp
amesha has joined #ruby
<steampunkey> fenec2: you didn't pay attention to the yield lecture
<fenec2> saas class
<banisterfiend> steampunkey: what's a yield lecture
<fenec2> ahhaha
kpshek has joined #ruby
<fenec2> please tell me what i am missing
<steampunkey> banisterfiend: if you've noticed a sudden inflow to this channel, it's because we're all taking the free online class that teaches (among other things) Ruby
<fenec2> its an awesome class
<banisterfiend> steampunkey: link to the class?
<steampunkey> steampunkey: https://www.coursera.org/saas/
sacarlson has joined #ruby
<fenec2> steampunkey, what am i missing?
<fenec2> i dont see why i cant just return an array
<steampunkey> fenec2: you can
<ryannielson> I know you can open up classes and add methods to them, if there any way to do the same with modules? I tried to add something to enumerable and it didn't work
<cout> ryannielson: define "didn't work"
<steampunkey> ryannielson: i tried for homework2, part 1, and it works. just do the usual
<ryannielson> cout: opened up the module, and added the method. Then I did Enumerable.methods, the new method wasn't in the list.
<fenec2> steampunkey, so why it is not working for me?where would you use a yield
krz has joined #ruby
cloke_ has joined #ruby
<banisterfiend> ryannielson: try Enumerable.instance_methods
<banisterfiend> ryannielson: you're confusing class methods and instance methods :)
<cout> yep
mfridh_ has joined #ruby
<ryannielson> banisterfiend: Haha, it is in instance methods. So methods just returns class methods then. Gotcha. So now if I include Enumerable that method will be good to use.
<ryannielson> Thanks guys!
<steampunkey> fenec2: not sure. i keep putting it into irb, and it keeps printing contents of the CWD o.O
<fenec2> yeah :(
<banisterfiend> ryannielson: if u wnat to show off to your lecturers use pry instead of irb, http://pry.github.com
<ryannielson> banisterfiend: Fancy!
<steampunkey> fenec2: actually, I see
h4mz1d has joined #ruby
<fenec2> yess
<fenec2> what it is?
<steampunkey> fenec2: ehm nvm
<fenec2> oh
<fenec2> LOL
akem has joined #ruby
akem has joined #ruby
burns180 has joined #ruby
<steampunkey> fenec2: that is some weird stuff going on there
linoj_ has joined #ruby
<steampunkey> you must have some special char somewhere, i keep getting the contents of my dir listed
<steampunkey> fenec2: oh, the tab. o.O
<steampunkey> sec, lemme try replacing it
<fenec2> i think def inialize(a,b)
<fenec2> should be
<fenec2> def initialize(a,b)
<fenec2> fuck my life
<fenec2> so stupid
<fenec2> now i just need to implement each method
<fenec2> and use yield
<fenec2> yaaaay
<steampunkey> fenec2: yeah, i noticed that
<steampunkey> was about to tell you, but i don't see why it complains about the nr. of args
<steampunkey> (i got the error now)
looopy has joined #ruby
<fenec2> thank you for your help
<steampunkey> fenec2: oh yeah, and scratch that about returning the whole array being an option XD
<steampunkey> fenec2: i kinda think i did more harm than good here ;-D
<fenec2> you gave me motivation
<steampunkey> heh. fair enough.
<fenec2> initialize will return the object itsef
<steampunkey> fenec2: are you doing it on a VM?
<fenec2> is there a way to make it return some thing else
<fenec2> nn
<fenec2> on my ubuntu
<fenec2> i use RVM
jrgifford_ has joined #ruby
<fenec2> so i have everything i need and separate all the class gems and rubies
<steampunkey> i'm using debian, can't get the tools to run (for the part after the one you're doing now)
<fenec2> i will let you know when i get there
<steampunkey> fenec2: why do you want to return something else?
MrGando has joined #ruby
<fenec2> just curious
<steampunkey> you need <Class>.new to get you the instance of <Class>
<steampunkey> maybe it can be overriden, i don't know
<steampunkey> would be useful for a singleton perhaps
<fenec2> yeah
wallerdev has joined #ruby
macmartine has joined #ruby
<fenec2> let say you want to do something like , ListTimezones.new
<fenec2> just an idea
<steampunkey> btw. i took this class only because i wanted to learn ruby. I dislike S aaS (as a concept)
<fenec2> ???
<fenec2> are you serious
<steampunkey> yep
<fenec2> are you a professional developer?
<steampunkey> yep
<fenec2> very intresting
<banisterfiend> steampunkey: what language do you use currently?
<steampunkey> banisterfiend: depends. what for?
<fenec2> perl and ruby
akem has joined #ruby
ascarter has joined #ruby
<fenec2> most of what i do is in ROR
<steampunkey> for scripting on the shell I use bash, on the desktop I use Python, and on the web I use PHP
<banisterfiend> steampunkey: which are your primary development languages then
<steampunkey> C and Bash
<fenec2> its very handy for prototyping and to make changes very fast
<steampunkey> with the emphasis on C
<steampunkey> but so far i'm liking what I'm seing in Ruby
<fenec2> you bet
<steampunkey> and I have only mixed feelings about Python
pastjean has joined #ruby
<banisterfiend> steampunkey: what aspects of ruby appeal to u
<steampunkey> banisterfiend: a very-dynamic object model ;-)
<banisterfiend> steampunkey: in particular? :)
<steampunkey> did i mention I mostly work in C? ;-)
jrgifford has joined #ruby
<banisterfiend> steampunkey: what about in comparison to python though?
shadoi has joined #ruby
axl_ has joined #ruby
<steampunkey> banisterfiend: actually, the thing I may like even more is its -in my opinion- better combination of multiple paradigms compared to Python. I know Scheme as well, so all that stuff stuff isn't new to me, but Ruby - not being functional - is much easier.
<banisterfiend> ok
<steampunkey> Python's just really weird. I can't put my finger on it, but Ruby makes it easier.
<cout> both ruby and python have some peculiar idiosyncracies
pencilcheck has joined #ruby
<steampunkey> i'm not a fan of gems, but considering I hate Python's import etc, I probably will become a fan
<steampunkey> banisterfiend: *maybe* "everything is an object" (although not true for methods). In Python, I usually ended up writing procedural code, and in Ruby, objects are natural (or rather, native)
havenn has joined #ruby
<heftig> you can get method objects, though
sdwrage has joined #ruby
amesha has joined #ruby
<steampunkey> heftig: what do you mean
<heftig> obj.method(:foo)
<cout> steampunkey: control structures in ruby are not objects either
<banisterfiend> that's an object wrapper for a method though, methods themselves aren't objects
<heftig> %w{foo bar baz}.each(&method(:puts))
kah has joined #ruby
<cout> e.g. if/else/while/until
pu22l3r has joined #ruby
<steampunkey> banisterfiend: and finally, if i haven't started boring you already, i like my strings mutable (maybe i'm weird?).
<banisterfiend> steampunkey: do you know about symbols yet?
pu22l3r has joined #ruby
<banisterfiend> ugh http://imgur.com/VsNGI
<steampunkey> cout: well, those aren't types, they're structures
<heftig> banisterfiend: yum
<steampunkey> banisterfiend: must be industrial-grade XD
<banisterfiend> heftig: i guess it wont look out of place next to saur kraut
jergason has joined #ruby
Karmaon_ has joined #ruby
<heftig> sauerkraut is horrible
<steampunkey> cout: umm, not structs like abstract types, syntactic elements... umm.. you know.
phantomfakeBNC has joined #ruby
<heftig> banisterfiend: why buy that honey, then?
<steampunkey> banisterfiend: symbols?
<heftig> steampunkey: :symbol
NotMyself has joined #ruby
<steampunkey> oh, they're like... immutable strings? XD
<banisterfiend> heftig: i guess some deluded hippie might feel esp close to nature when they eat it, putting little bits of bees antenna and wing on your morning toast
<banisterfiend> their*
<heftig> the stuff is probably way more expensive, even though it's simpler to produce
<steampunkey> banisterfiend: i don't have a problem with a bee part per se, my problem is a feeling that all those things written on the top boil to: unsanitary (and generally unprocessed due to lazyness and lack of care).
<fayimora> NO rubyconf london :( ?
<steampunkey> *down
<heftig> steampunkey: i agree with that
<steampunkey> i was sure your conferences were called rubycon
cha1tanya has joined #ruby
<steampunkey> anyway, cya
cloke has joined #ruby
CheeToS has joined #ruby
sroy2_ has joined #ruby
dv310p3r has joined #ruby
burns180_ has joined #ruby
phantomfakeBNC has joined #ruby
jesly has joined #ruby
mikepack has joined #ruby
bkirz has joined #ruby
choffstein has joined #ruby
shadoi has joined #ruby
rexbutler has joined #ruby
philcrissman has joined #ruby
dzhulk has joined #ruby
marcuspat has joined #ruby
thecreators has joined #ruby
stringoO has joined #ruby
startling has joined #ruby
amesha has joined #ruby
axl_ has joined #ruby
skrewler_ has joined #ruby
banisterfiend has joined #ruby
pdtpatr1ck_ has joined #ruby
looopy has joined #ruby
startling has quit [#ruby]
burns180 has joined #ruby
MrGando has joined #ruby
mztriz has joined #ruby
linoj_ has joined #ruby
mxweas has joined #ruby
radic_ has joined #ruby
macmartine has joined #ruby
skipper has joined #ruby
hasrb has joined #ruby
Karmaon has joined #ruby
xnm has joined #ruby
adeponte has joined #ruby
wroathe has joined #ruby
wilmoore has joined #ruby
pdtpatr1ck has joined #ruby
nfluxx has joined #ruby
jcromartie has joined #ruby
<wroathe> So I'm trying to do some tdd and test for a race condition that I'm not entirely sure exists. We use delayed jobs to queue multiple workers that send 250 emails each...
<wroathe> There's a separate record in the database that gets updated whenever a worker completes and keeps track of how many workers have completed
<wroathe> and once the workers_completed > num_workers_to_complete it sets the is_pending field to false and the sent_on field to the current time
<wroathe> But every once in a while the is_pending field and the sent_on field don't get updated and the workers_completed field is missing a worker.
amesha has joined #ruby
<wroathe> And I suspect that it's because two workers are running at the same time
<wroathe> To prove that though I'd like to implement a test that forces the race condition around the logic I'm working with.
adamkittelson has joined #ruby
banisterfiend has joined #ruby
travisjeffery has joined #ruby
Drewch has joined #ruby
vraa has joined #ruby
ed_hz_ has joined #ruby
rohit has joined #ruby
kevinbond has joined #ruby
machine1 has joined #ruby
munx has joined #ruby
wmoxam_ has joined #ruby
voodoofish430 has joined #ruby
MrCheetoDust has joined #ruby
colinwd has joined #ruby
rushed has joined #ruby
burns180_ has joined #ruby
ZachBeta has joined #ruby
nobitanobi has joined #ruby
ericmuyser has joined #ruby
friskd has joined #ruby
stephenjudkins has joined #ruby
fungoat has joined #ruby
Karmaon has joined #ruby
colinwd has joined #ruby
amesha has joined #ruby
nobitanobi has joined #ruby
adeponte has joined #ruby
timonv has joined #ruby
Fretta has joined #ruby
snearch has joined #ruby
Targen has joined #ruby
srp_ has joined #ruby
Avanine has joined #ruby
adeponte has joined #ruby
blueadept has joined #ruby
KaiSforza has joined #ruby
cloke has joined #ruby
chimkan___ has joined #ruby
cloke has joined #ruby
j3r0m3 has joined #ruby
wookiehangover has joined #ruby
cloke has joined #ruby
nfluxx has joined #ruby
nobitanobi has joined #ruby
nobitanobi has joined #ruby
tangledhelix has joined #ruby
ringotwo has joined #ruby
amesha has joined #ruby
sizz has joined #ruby
burns180 has joined #ruby
manizzle has joined #ruby
_adeponte has joined #ruby
ins0mniac|2 has joined #ruby
cloke has joined #ruby
_adeponte has joined #ruby
ins0mniac|2 has quit [#ruby]
ryanf has joined #ruby
danishkhan has joined #ruby
skrewler has joined #ruby
lewis1711 has joined #ruby
<lewis1711> "return sprintf('%s: {...}', self.class.name)" what does the ... do?
ElderFain has joined #ruby
<heftig> lewis1711: nothing
blueadept` has joined #ruby
io_syl has joined #ruby
macmartine has joined #ruby
<shadoi> lewis1711: it's purely a string.
PaciFisT has joined #ruby
<lewis1711> I see. I just fail to understand the method I guess
amesha has joined #ruby
<lewis1711> I don't know why Set inspects in such an ugly way, where as Vector is so nice. so I am doing that thing you're not supposed to do.. monkey patching, is it?
<shadoi> sprintf is a old-timer, you can see how it works in detail by reading: man sprintf
<shadoi> it's just a way to print out formatted strings
dzhulk has joined #ruby
<lewis1711> so it works the same as the C one? ah, good then
<shadoi> yes
banjara has joined #ruby
burns180_ has joined #ruby
<lewis1711> out of curiosity, why does Set print like "<#Set: {...}>", as opposed to Vector which prints "Vector[...]" ? If anyone has a good reason. can't see one
<shadoi> different authors? :)
dominikh has joined #ruby
sarmiena_ has joined #ruby
<shadoi> who makes .new private anyway? ugh.
<lewis1711> where?
<lewis1711> oh, in Vector?
<lewis1711> yeah Set definitely wins on the constructor front
<shadoi> everything in matrix
amesha has joined #ruby
<shadoi> bizarre.
<lewis1711> [...].to_set is also nice
<lewis1711> but it's printing is hideous especially if you do powersets
csprite has joined #ruby
<shadoi> Mixin your own inspect/to_s if it bugs you that much. :)
<lewis1711> I did
<shadoi> I think all Enumerables look like that.
<shadoi> err, nevermind
<shadoi> lol
<lewis1711> one of them does.. apart from Set I mean. can't remember what though
<shadoi> I just didn't see it overriding to_s/inspect in the docs
amesha has joined #ruby
burns180 has joined #ruby
machine1 has joined #ruby
gokul has joined #ruby
iband has joined #ruby
caiges has joined #ruby
cloudgeek has joined #ruby
<cloudgeek> i8igmac: hey ! where are you
<shevy> in the cellar, fixing the holes
wallerdev has joined #ruby
bkirz has joined #ruby
greenarrow has joined #ruby
amesha has joined #ruby
x0F__ has joined #ruby
Drake_mac has joined #ruby
cha1tanya has joined #ruby
nobitanobi has joined #ruby
Morkel has joined #ruby
badabim has joined #ruby
ninegrid has joined #ruby
nobitanobi has joined #ruby
bkirz has joined #ruby
bkirz has joined #ruby
burns180_ has joined #ruby
burns180_ has joined #ruby
robbyoconnor has joined #ruby
m0rt3st has joined #ruby
<m0rt3st> when you have a class and it's initialize with (*names) - what is the * represents? thanks
ozzloy has joined #ruby
ozzloy has joined #ruby
stephenjudkins has joined #ruby
nemesit has joined #ruby
rippa has joined #ruby
amesha has joined #ruby
nobitanobi has joined #ruby
<m0rt3st> when you have a class and it's initialize with (*names) - what is the * for ?
<wallerdev> it means you can do Apple.new(1, 2, 3) and the names will be = [1, 2, 3]
<wallerdev> basically varargs
<m0rt3st> ha, interesting; thanks!
<wallerdev> np
dhruvasagar has joined #ruby
t0mmyvyo has joined #ruby
TaTonka has joined #ruby
manizzle has joined #ruby
JJasonClark_ has joined #ruby
<JJasonClark_> anyone know a gem to do email newsletters? something to store the emails addys, do email confirmations, sends emails possible using a job system.
<wallerdev> im not sure that makes much sense JJasonClark_
ceej has joined #ruby
albemuth has joined #ruby
<wallerdev> gems are usually libraries, not entire web serversand mail clients
<wallerdev> and databases?
<wallerdev> haha
<JJasonClark_> wallerdev: opps, didn't describe it well enough. looking for something to collect and confirm email addresses. And a method to iterate over the email addy lists and send the same message to
nachtwandler has joined #ruby
<JJasonClark_> maybe not a single gem?
<wallerdev> right but don't you need a web server for people to do email confirmations?
<wallerdev> and you're asking for a way to store emails, which means you'd need some sort of database
<JJasonClark_> wallerdev: sure. I'm using the rails framework, so rake middle ware or rails gem would work
burns180 has joined #ruby
<JJasonClark_> should I have asked on a more rails centric room? is it #rails?
<wallerdev> #rubyonrails
<JJasonClark_> ok
<wallerdev> I'm not aware of any gems for it, i'd probably just create an emails table and go from there, doesn't seem too hard
adurity has joined #ruby
<wallerdev> and rails has built in support for sending emails I'm pretty sure
friskd has joined #ruby
<JJasonClark_> wallerdev: I agree, but I figured I would look to make sure someone hadn't already made a gem for it. Would rather right a 1 liner than a whole system for doing this.
<JJasonClark_> wallerdev: less code to maintain too
<JJasonClark_> wallerdev: btw, I asked on the rails channel. thanks
<wallerdev> np
<wallerdev> your question makes more sense as a rails question
<wallerdev> might have a generator or something that can set that stuff up for ya
<JJasonClark_> wallerdev: I'm hoping so. seems like a common problem. Although, as you say, it's not difficult to implement.
<JJasonClark_> wallerdev: hope just not to trivial that no one has made a gem for it yet
max_ has joined #ruby
pen has joined #ruby
TaTonka has joined #ruby
amesha has joined #ruby
Karmaon has joined #ruby
yxhuvud has joined #ruby
ed_hz_ has joined #ruby
<Quadlex> I'm trying to figure out the best way to deal with a Soap web service from within a web app
<Quadlex> Currently I've got a gem that wraps operations with authentication, but it feels like the wrong thig to do
KaiSforza has quit [#ruby]
<banisterfiend> cout: u here?
Morkel has joined #ruby
ezkl has joined #ruby
zakwilson_ has joined #ruby
c0rn has joined #ruby
tonini has joined #ruby
amesha has joined #ruby
mafolz has joined #ruby
jarjar_prime has joined #ruby
Gesh has joined #ruby
apok has joined #ruby
mafolz has joined #ruby
johndbritton has joined #ruby
CheeToS has joined #ruby
bkirz has joined #ruby
Nss has joined #ruby
burns180 has joined #ruby
burns180 has joined #ruby
trivol has joined #ruby
friskd has joined #ruby
godfrey999_ has joined #ruby
zommi has joined #ruby
armyriad has joined #ruby
ph^ has joined #ruby
SPYGAME has joined #ruby
banjara has quit [#ruby]
trivol_ has joined #ruby
nixmaniack has joined #ruby
crankyco_ has joined #ruby
eldariof has joined #ruby
colinwd has joined #ruby
InBar has joined #ruby
Gesh has joined #ruby
sgmac has joined #ruby
sgmac has quit [#ruby]
ephemerian has joined #ruby
nemesit has joined #ruby
friskd has joined #ruby
amesha has joined #ruby
LMolr has joined #ruby
tewecske has joined #ruby
sjang1 has joined #ruby
AxonetBE has joined #ruby
Avanine has joined #ruby
bkirz has joined #ruby
bier has joined #ruby
tvw has joined #ruby
IPGlider has joined #ruby
mklappstuhl has joined #ruby
<mklappstuhl> hey
dzhulk has joined #ruby
cyri_ has joined #ruby
<mklappstuhl> I need to concat a long string from multiple vars with long names I dont want to have a endlessly long line of code but I also dont want to have newlines in the concatted string
burns180_ has joined #ruby
wilmoore has joined #ruby
Spockz has joined #ruby
srji has joined #ruby
ringotwo has joined #ruby
shruggar has joined #ruby
twqla has joined #ruby
nemesit has joined #ruby
<Avanine> mklappstuhl: why not just strip out the newlines at the end with a gsub?
alup has joined #ruby
adurity has joined #ruby
amesha has joined #ruby
<mklappstuhl> Avanine: I know I could do that but isnt there some extra method for that casE?
<Avanine> if they're in an array, you can .join them.
somazero has joined #ruby
KJF has joined #ruby
<Avanine> you could also escape the newline.
<Avanine> mklappstuhl: http://pastebin.com/w58NHgDf
<Avanine> $ ./test.rb
<Avanine> onetwothreefour
stephenjudkins has joined #ruby
AxonetBE has joined #ruby
friskd has joined #ruby
LMolr has joined #ruby
scalebyte has joined #ruby
<scalebyte> can anyone pls get me the quotes correct : "<a href =\"#"class ="abcd">+</a><label class="c">#{key}</label>".html_safe
<banisterfiend> scalebyte: use %q{} instead
<scalebyte> banisterfiend: hw wud it be like then ?
<banisterfiend> scalebyte: lyk dis if u cry everytim
<scalebyte> banisterfiend: %q{"<a href ="#"class ="abcd">+</a><label class="c">#{key}</label>"}.html_safe ?
ukwiz has joined #ruby
<banisterfiend> scalebyte: lyk dis if u cry everytim!
<banisterfiend> scalebyte: hw wud u get 2 c a besfren if u hv to b gon sum wir b4 noon lols
<scalebyte> banisterfiend: i didnt get u just help me pls :'(
Kevin- has joined #ruby
KJF has joined #ruby
simao has joined #ruby
tobyo has joined #ruby
crankycoder has joined #ruby
amesha has joined #ruby
mdw has joined #ruby
yann_ck has joined #ruby
RVS has joined #ruby
eignerchris has joined #ruby
DuoSRX has joined #ruby
pu22l3r has joined #ruby
stephenjudkins has joined #ruby
<m0rt3st> exit
<m0rt3st> exit
<RVS> Hello, can anybody help me? I need the same functionality in 2 Ruby apps (based on Sinatra). I can create a gem of course, but i need to share yml files (localization). How can I read this files from one gem from the apps?
francisfish has joined #ruby
burns180 has joined #ruby
sleetdrop has joined #ruby
flippingbits has joined #ruby
srp_ has joined #ruby
blacktulip has joined #ruby
Zolrath has joined #ruby
sarmiena_ has quit [#ruby]
Talvino has joined #ruby
thecreators has joined #ruby
fixl has joined #ruby
<Tasser> why can't ruby compile with more than one thread :-(
keymone has joined #ruby
amesha has joined #ruby
nesoi has joined #ruby
rohit has joined #ruby
<nesoi> hi, I don't know ruby and am trying to use a library someone made. It is taking some data and putting it in a structure which can be accessed by varname.response_type.first.fieldname.subfiieldname
<nesoi> if I want to find out how many entries have been returned, can I do something like varname.response_type.length or some other method which will show me?
xiangel has joined #ruby
<nesoi> it says I can use has or method notation
<nesoi> hash
<rohit> nesoi: Try .count
<nesoi> thanks
<nesoi> seems to have worked!
<nesoi> I downloaded aptana studio for windows development in ruby, but it seems to be very cumbersome, or perhaps I haven't got it set up properly. Any suggestions for something else to use?
tatsuya_o has joined #ruby
xMKx has joined #ruby
srp_ has joined #ruby
seoaqua has joined #ruby
burns180_ has joined #ruby
jeffmess has joined #ruby
Spockz has joined #ruby
canton7 has joined #ruby
<Tasser> nesoi, linux
<canton7> nesoi, netbeans (with the relevant plugin which needs a bit of searching for) worked really well for me for ages. I've now discovered sublime text 2, which also does a fantastic job
A124 has joined #ruby
ccapndave has joined #ruby
<nesoi> canton7, why do you like sublime text 2 more than netbeans?
odinswand has joined #ruby
Muz has joined #ruby
nkts has joined #ruby
<canton7> nesoi, I can't really describe it.. It just makes coding a lot more pleasant. I suggest you give it a shot -- the free version only has a very occasional nag screen
workmad3 has joined #ruby
berserkr has joined #ruby
<nesoi> their site sounds very stern about paying... "must be paid for"... "no educational discounts"... etc.
sacarlson has joined #ruby
somazero has joined #ruby
<canton7> are you on http://www.sublimetext.com/2 ?
<nesoi> yeah
amesha has joined #ruby
<canton7> cool. there's an occsional nag screen on save, but i've been using the free version for ages now.
<canton7> Also, if you feel the editor lacking in an area, look at the available packages. The selection is pretty impressive
<nesoi> I didn't notice packages
QaDeS has joined #ruby
<nesoi> ah okay, thanks
stefanp has joined #ruby
<stefanp> Hi, I'm trying to use nailgun with rvm on os x and have problems with using interactive programs (irb etc). Is this a known issue/any tips? Thanks!
<rippa> use supernailgun
<stefanp> uh thanks
<nesoi> canton7, how do you run something from sublime, or do you just save it and use the command line?
<stefanp> very funny
<canton7> nesoi, ctrl-B, or tools -> build
<nesoi> ah okay, build = run in this case.
<nesoi> thanks
pen has joined #ruby
<A124> rippa: Thanks for link xD .. I got that urge to play it again xD
akem has joined #ruby
akem has joined #ruby
IPGlider has joined #ruby
rly has joined #ruby
<rly> How do I remove a 'gem'?
<nesoi> if I get some object back from a library method, is there a way to enumerate its instance names?
<ddv> rly: come on first google or read gems help
<nesoi> (I hope I have the terminology right)
<ddv> rly: gem uninstall
<nesoi> in other words, can I get a listing of all its instance variable names, and maybe all its methods?
<rly> ddv: gem --help | grep uninstall => nothing
<rly> ddv: please try again
<ddv> rly: gem help uninstall
barraponto has joined #ruby
<rly> Brilliant!
fr0gprince_mac has joined #ruby
<ddv> You could have easily found that with Google.
<nesoi> rly
<rly> There is a widely used convention on Unix, it's called providing a --help command that works.
<barraponto> what does ** mean in Dir['lib/**/*.rb'] (as seen in http://docs.rubygems.org/read/chapter/20#files ) ?
<rly> You can say whatever you want, but it just stinks.
<ddv> rly: There is also a widely used convention that you first Google before asking questions
<rly> ddv: no, I just bother whoever creates garbage until they fix it.
<rly> ddv: if it is not in the --help synopsis, it doesn't exist.
<rly> So, I will say it one more time.
<nesoi> how about my questions?
<rly> FIX YOUR SOFTWARE, TYVM.
<nesoi> if I get some object back from a library method, is there a way to enumerate its instance variable names, and methods?
<ddv> rly: gem help commands, you just need to READ
<nesoi> rly: post a bug report
<rly> nesoi: I just did.
<rly> ddv: yeah, excellent another indirection.
<ddv> nesoi: duh it's pebkac
<nesoi> pebkac???
<rly> problem exists between keyboard and chair.
<nesoi> rly: gem help commands does list uninstall
<nesoi> anyway
<ddv> rly: also you that stupid that maybe maybe when there is a install command there is probably a uninstall command also, just because it's not in the first screen bullshit, gem help commands
<rly> nesoi: yes, but I cannot be bothered to do that.
<ddv> nesoi: I already told him that
<rly> ddv: perhaps other software calls it 'remove'.
<nesoi> rly is a troll and should be banned for that "can't be bothered" statement
<rly> ddv: so, perhaps not.
<ddv> rly: gem help commands
<ddv> rly: it's in the help
<rly> ddv: uhm, do you think I am stupid?
<ddv> you are just trolling
<ddv> rly: yes
<rly> ddv: you told me 3 times already.
<ddv> rly: you don't seem to get it
<nesoi> ok, so my naieve question: if I get some object that has a bunch of data which can be accessed by .fieldname, how do I get a list of all .fieldnames in that object?
<rly> ddv: you seem to lack communication skills then.
<ddv> rly: /ignore
<ddv> :)
<rly> :)
<nesoi> some people like to argue apparently.
<rly> I think I should just make an effort to actively replace all ruby based software from my system.
<rly> I don't even know why I have it installed.
adambeynon has joined #ruby
<barraponto> what's the difference between gem.files = %x[git ls-files].split("\n") and s.files = `git ls-files`.split("\n") ?
<rly> I will give you another free piece of advice.
<rly> If a package has an incorrect description, DO NOT INSTALL IT.
<rly> Just reply "Dear developer, you suck.".
<rly> Then I won't be bothered with yet more crap about it.
<rly> If you remove this gems, one or more dependencies will not be met.
<rly> Hilarious.
<rly> Would you please tell me which ones?
<rly> It only lists one.
<rly> Is it one or 'more'?
<rly> Or do I get to find out in a few months when I use some program which happened to depend on it?
<rly> Has anyone every used this crap before?
crumbs has joined #ruby
rly has quit ["WeeChat 0.3.6-dev"]
burns180 has joined #ruby
vasanth has joined #ruby
trivol has joined #ruby
cloke has joined #ruby
nixmaniack has joined #ruby
jlebrech has joined #ruby
<nesoi> which version of ruby should I use, 1.8.n or 1.9.n?
<rippa> 1.9.3
cloke has joined #ruby
vasanth has quit [#ruby]
KL-7 has joined #ruby
cloke has joined #ruby
IPGlider has joined #ruby
amesha has joined #ruby
bluenemo has joined #ruby
csherin has joined #ruby
pen has joined #ruby
fayimora has joined #ruby
srp_ has joined #ruby
TaTonka has joined #ruby
kedare has joined #ruby
amesha has joined #ruby
mengu has joined #ruby
burns180 has joined #ruby
pu22l3r has joined #ruby
shruggar1 has joined #ruby
eldariof has joined #ruby
<barraponto> what is the difference between %q{something} and "something" (in a gemspec file?)
rohit has joined #ruby
<rippa> barraponto: %q is like single quotes
<barraponto> rippa: which means it's faster than double quotes?
<rippa> no
<rippa> it means it doesn't do interpolation
<rippa> and has less escape sequences
<barraponto> rippa: can i just use single quotes?
iamjarvo has joined #ruby
<A124> (Aready on #ruby-lang) What whould you advise as a storage for tens of thousands small (~5kB) images? Most files will remain untouched.
shruggar has joined #ruby
cha1tanya has joined #ruby
<rippa> barraponto: yes
<barraponto> rippa: thanks :)
jeffmess has joined #ruby
nikhil_ has joined #ruby
Vendethiel has joined #ruby
arussel has joined #ruby
<arussel> I'm using the pg module, when doning conn.exec("select * from bar").each {}, did we fetch everything from the db or are we using a cursor ?
KarlFreeman has joined #ruby
andyl has joined #ruby
amesha has joined #ruby
MrGando has joined #ruby
glosoli has joined #ruby
mrake has joined #ruby
<arussel> is there a way to get a cursor to be able to walk big tables ?
beoran4 has joined #ruby
<beoran4> kknow my ruby, but now I'lm learning python for using blender (3d modelling). There's a few surprising things in python compared to Ruby I'd say.
<beoran4> In ruby methods are not objects, and they are not functions either. In python, functions are objects, but there are no reeal methods, just bound functions.
iocor has joined #ruby
<beoran4> And you have function decorators which are in fact fyufnctions which modify function obbjects themselves. It's a whole different approach to metaprogramming.
K3ler has joined #ruby
<beoran4> oh, and the else clause on loops suprised me too
<beoran4> (in python)
y3llow_ has joined #ruby
<beoran4> and the with expression. I'm glad we can pas blocks so easily in Ruby, so we don't need such a special case experssion as with.
fayimora has joined #ruby
emocakes has joined #ruby
burns180_ has joined #ruby
Elfix has joined #ruby
waxjar has joined #ruby
chased has quit ["Leaving"]
davidpk has joined #ruby
pen has joined #ruby
BrianE|mobile has joined #ruby
pangur has joined #ruby
zommi has joined #ruby
<pangur> http://fpaste.org/omHE/ works for me to the extent that I can print out one Patron's name via lines 40-41. How can I get all my names to appear on screen? What I am wondering is whether I am creating a new Patron every time or simply overwriting one or whatever?
* pangur looks a little confuzzled
darthdeus has joined #ruby
<darthdeus> hey guys, is there any way that I can just stub the first call of a method in rspec? I have SecureRandom.urlsafe_base64 generating some kind of unique token, and I want to be able to stub the first call so that it returns an already existing token, to see if it actually gets called the second time
Prezioso has joined #ruby
<Tasser> darthdeus, dependids on your mocking framework
<nesoi> I installed ruby 1.9.3 on my mac using rvm, but ruby -v still shows the 1.8.7 the mac came with. How do I fix that?
<darthdeus> Tasser: mocking framework is rspec's mocking framework
<darthdeus> I guess I should probably ask this in #rspec instead
<pangur> Should the line "patrons.each do |n| " only print out the attributes of one patron or should it print out the attributes of all patrons?
<pangur> nesoi, have you tried rvm use 1.9.3
<Tasser> pangur, it shouldn't print anything
ikaros has joined #ruby
tk__ has joined #ruby
<nesoi> pangur, yes, but do I have to do that in every new shell, or put it in .profile? What about if I want to use an IDE and it uses ruby to run my code?
<pangur> Ok, then. When I do the next line, "return n.surname", should it return all surnames?
<Tasser> return doesn't do what you think
<Tasser> except you think it does return the first element
LMolr has joined #ruby
<pangur> It certain returns the first line in my array of names
<pangur> certainly
<pangur> Whether it should or not is a different matter
<Tasser> so what's your question?
<pangur> I had been hoping that it would return all my names :)
<pangur> I have 61 names in my csv file.
<pangur> It only seems to return the first of these
<pangur> no seems about it.
<pangur> It only returns the first
<Tasser> yeah, because that's what you tell it to do
<Tasser> patrons.map(&:name)
<pangur> Is that what I need instead of patrons.each do |n| ?
arussel has quit ["ERC Version 5.3 (IRC client for Emacs)"]
jeffmess has joined #ruby
interlocutor has joined #ruby
zaydana has joined #ruby
<pangur> Have I failed to read all my names from the csv file into my array or have I failed to read the array out to the screen?
<Tasser> pangur, patrons.each do |patron| puts patron end
<Tasser> ... does something different
somazero has joined #ruby
nanderoo has joined #ruby
barraponto has quit [#ruby]
<pangur> #<struct Patron surname="Forbes", forename="Emma", age="7", pup=" X\n", sci=n
<pangur> il>
<Tasser> what do you want to get?
Cheshire has joined #ruby
<pangur> That only appeared in my console. Bytesize error in my browser. I just want Name Surname - Age in my browser.
Cheshire has quit [#ruby]
<pangur> The fact that I am now getting all my names in the console indicates to me that I am getting my names out of the csv file. However, getting the names from the Patron instance to the screen is what is eluding me.
<pangur> So, I feel that I have made progress.
apeiros_ has joined #ruby
Beoran_ has joined #ruby
<AxonetBE> I have this scenario : I use an api to get some pickup point from a delivery company, and to list these points I do result[0][:address], result[1][:address] but I want to make something like points.each do |point|; point.address; end . Is this possible?
<cout> I am now
<cout> banisterfiend: I am now
<apeiros_> of course
<apeiros_> AxonetBE: use e.g. a Struct
<apeiros_> or a proper class
<AxonetBE> apeiros_: but the api is sending me a nested hash with the points, so I have to convert this then to a struct?
QaDeS has joined #ruby
glosoli has quit [#ruby]
<apeiros_> AxonetBE: obviously…
<AxonetBE> apeiros_: Ok never used structs but I will take a loot at it
akemrir has joined #ruby
amesha has joined #ruby
mezzagis has joined #ruby
TaTonka has joined #ruby
SolarisBoy has joined #ruby
fivetwentysix has joined #ruby
fermion has joined #ruby
pu22l3r_ has joined #ruby
burns180 has joined #ruby
urbino has joined #ruby
<fivetwentysix> Anyone know how to fix this vim highlighting issue: http://dl.dropbox.com/u/29559855/Screen%20Shot%202012-03-08%20at%208.43.02%20PM.png
amoxibos has joined #ruby
Mac has joined #ruby
sgmac has joined #ruby
sgmac has quit [#ruby]
<AxonetBE> apeiros_: For example I get back this hash : https://gist.github.com/2000901
peterhellberg has joined #ruby
<shevy> the french secret service!
adambeynon has joined #ruby
Sailias has joined #ruby
<AxonetBE> shevy: you wish :)
`brendan has joined #ruby
cloke has joined #ruby
looopy has joined #ruby
<apeiros_> AxonetBE: yes, map the data
tandy80 has joined #ruby
<apeiros_> and a Struct may very much be what you want
<apeiros_> also, french keys? eeeew, bad api, bad… :)
emocakes has joined #ruby
Cheshire has joined #ruby
stephenjudkins has joined #ruby
banisterfiend has joined #ruby
MrGando has joined #ruby
KL-7 has joined #ruby
MrGando has joined #ruby
wenbert has joined #ruby
iocor_ has joined #ruby
<pangur> apeiros_: I am still struggling with this https://gist.github.com/2000891 is my code and https://gist.github.com/2000903 is what appears on my screen.
<pangur> the latter is what appears in my browser rather than my console.
kf8a has joined #ruby
Cheshire has quit [#ruby]
amesha has joined #ruby
burns180_ has joined #ruby
<apeiros_> pangur: the most relevant part is probably "You're seeing this error because you have enabled the show_exceptions setting. "
<apeiros_> you seem to have truncated a bit…
<apeiros_> as that the bit I pasted tells me that you've had an exception, and what exception should be in your browser too, but I don't see it in the paste…
<pangur> oh, the backtrace?
DuoSRX has joined #ruby
<apeiros_> that'd be part of it
<apeiros_> more importantly the actual exception
<pangur> ok, I have clicked on it to expand it.
<apeiros_> line 3 & 4 tell you what is wrong and where
<apeiros_> pangur: have you read what your `get '/' do … end` should return?
<apeiros_> you probably should read the sinatra tutorial and see, what you're expected to return, and then actually do that…
<pangur> I get a list of names in the console, as I would expect.
ethd has joined #ruby
* pangur is off to do the net.tuts sinatra tutorial
<apeiros_> pangur: look, sinatra renders to the browser what you return in the `get '/' do … end`
<apeiros_> and you don't return anything it can handle
<pangur> I have created a views/index.erb
<apeiros_> the return value btw. is the array of Patron's
<pangur> so, I should return patrons
* pangur ponders
<apeiros_> nooo
<apeiros_> you should return a string
pen has joined #ruby
<pangur> oh
jeffmess has joined #ruby
<apeiros_> sinatra being based on rack, I'd assume you could also return an array of the form: [status_code, headers, body]
LMolr has joined #ruby
<apeiros_> where status_code is an integer, e.g. 200 for OK. headers is a hash, e.g. {:content_type => "text/plain"}, and body is an Array of strings, e.g. ["Hello World"]
<apeiros_> (or anything that responds to .each and yields strings)
DrShoggoth has joined #ruby
mezzagis has joined #ruby
<pangur> Ok, thanks, apeiros_. That seems somewhat out of my reach for the time being. I need to learn a bit more before I can progress with this.
lateau has joined #ruby
A_D has joined #ruby
tatsuya__ has joined #ruby
burns180 has joined #ruby
<A_D> Hi there!
<A_D> I'm writing a native extension to ruby
<A_D> and I'm wondering if with rb_define_singleton_method can I extend ruby String class
<Tasser> why not?
tayy has joined #ruby
<shevy> I guess so
<shevy> x = "foo"
<A_D> 'twas I'm trying to
<shevy> def x.bla
<shevy> hmm wait
<shevy> with singleton, you extend only the object, dont you?
<shevy> not the rest of the class
<A_D> I think that would work too
<A_D> rb_cString = rb_define_class("String");
amesha has joined #ruby
Scorchin has joined #ruby
<shevy> and where is rb_define_singleton_method?
<A_D> guess `ts on ruby.h
tuxaddicted has joined #ruby
bwlang has joined #ruby
ikaros_ has joined #ruby
fearoffish has joined #ruby
scalebyte has joined #ruby
bosborne has joined #ruby
<cout> ts :(
<cout> I miss him
td123 has joined #ruby
<shevy> ts?
Scorchin has quit [#ruby]
<shevy> scalebyte you need to unban yourself from #rubyonrais
<shevy> +l
<cout> shevy: guy decoux
<shevy> ah
LMolr has joined #ruby
lorandi has joined #ruby
<A_D> or.. maybe is better in this way:?
<A_D> rb_define_class("String", VALUE); kinda lost here..
emocakes has joined #ruby
bwlang has joined #ruby
<scalebyte> shevy: hw can I get unbanned ?
<scalebyte> shevy: that radar has blocked my ip
<shevy> scalebyte no idea, I am sure they have a policy
<scalebyte> shevy: can u help me with that q ?
<beoran4> you have to get in contact with a channel operator, I guess
<lateau> A_D: it seems rb_define_class returns String class simply.
<scalebyte> question*
K3ler has joined #ruby
<A_D> let me see
<shevy> scalebyte I dont know rails, so how I should be able to help you? if you have a specific RUBY question I can try to help, but this convoluted layer of complexity that is rails is just line noise to my poor helpless innocent little eyes
dql has joined #ruby
<scalebyte> shevy: but again hash is in ruby only...
<shevy> I see lots of railsism there
<shevy> { :cat => "nice", :dog => "bad" }
<shevy> that's a hash
<cout> I was recently accepted for a job doing rails dev
<shevy> now if the question is "how to get the value of dog, the answer is easy
<cout> also if anyone has seen my soul lying around somewhere, I'm trying to remember what I did with it
<shevy> hash[:dog]
choffstein has joined #ruby
<shevy> cout as long as you get rich with it :D
<cout> shevy: it will get me some good references for med school
philcrissman has joined #ruby
ascarter has joined #ruby
neurodrone has joined #ruby
neurodrone has joined #ruby
<emocakes> naw, you got banned scalebyte? I wonder why?
joast has joined #ruby
wyhaines has joined #ruby
<scalebyte> how to loop thorugh arrays ?
<lateau> A_D: initializing funcs would be good examples. look around object.c:Init_Object(). pure ruby & native-c share almost same ways to implements or extends class.
<beoran4> with array.each{ |element| }
<scalebyte> beoran4: yes thanks
<scalebyte> beoran4: its array.each do{ |element| } i guess
<A_D> lateau: and If I did this?
<A_D> VALUE rb_cString = rb_define_class("String", rb_cObject);
<A_D> rb_define_singleton_method(rb_cString, "my_string_test", my_string_test, 0);
geekbri has joined #ruby
Cancel has joined #ruby
<Tasser> scalebyte, nope, it's not
dv310p3r has joined #ruby
<scalebyte> Tasser: but it works for me array.each do |x| puts x end
<Tasser> yes, that one does
<apeiros_> he meant do{ - it's either do or {, not both
bwlang_ has joined #ruby
zommi has joined #ruby
flippingbits has joined #ruby
<shevy> scalebyte why do you use invalid ruby syntax
<scalebyte> shevy: hw come ? it worked for me in the console
<scalebyte> shevy: was that wrong ?
<shevy> then you should use what works in the console also in #ruby
amesha has joined #ruby
cha1tanya has joined #ruby
burns180_ has joined #ruby
<scalebyte> amesha: Hai
Gesh has joined #ruby
theRoUS has joined #ruby
marcuspat has joined #ruby
timonv has joined #ruby
<A_D> Just GOT IT
<A_D> rb_define_method(rb_cString, "my_string_test", my_string_test, 0);
<A_D> that was my mistake
<lateau> A_D: good :)
ryannielson has joined #ruby
akem has joined #ruby
EvanR has joined #ruby
<lateau> A_D: void rb_define_method(VALUE klass, const char *name, VALUE(*func)(), int argc)
pen has joined #ruby
fayimora has joined #ruby
Jackneill has joined #ruby
bglusman has joined #ruby
lorandi has joined #ruby
hydrozen has joined #ruby
cantbecool has joined #ruby
carlyle has joined #ruby
cantbecool has quit [#ruby]
bwlang_ has joined #ruby
robbyoconnor has joined #ruby
dql has joined #ruby
ELICO has joined #ruby
<ELICO> hello i want to thread a command 20 times how can i do it?
albemuth has joined #ruby
davorb_ has joined #ruby
<Tasser> ELICO, you don't. GIL fucky up threads
<ELICO> what?
zaydana_ has joined #ruby
<apeiros_> ELICO: threads = Array.new(20) { Thread.new do yourstuff end }
<apeiros_> and Tasser means that due to the GIL in MRI/KRI, you'll not get true concurrency.
<cout> that's new to me
jgarvey has joined #ruby
<ELICO> thanls apeiros
<cout> I didn't know Array.new could take a block
Indian has joined #ruby
Sailias has joined #ruby
<cout> I probably would have used a Range and #collect
drknus has joined #ruby
Redjack1964 has joined #ruby
axl_ has joined #ruby
* apeiros_ prefers map over collect
<ELICO> i tried but no good... it will not do what i want
kpshek has joined #ruby
<apeiros_> shorter and somehow maps syntactically better to the way I think
amesha has joined #ruby
<apeiros_> s/syntactically/semantically/
<cout> apeiros_: I usually do to, but in this case #collect seemed like it fit
jeffmess has joined #ruby
Squarepy has joined #ruby
<apeiros_> ELICO: it does what you say you'd want
<ELICO> i will pastebin what id did
<apeiros_> if what you say differs from what you want, maybe fix what you say? :-p
Squarepy has joined #ruby
cloudgeek has joined #ruby
KarlFreeman has joined #ruby
<ELICO> i'm not good at programming so...http://pastebin.com/f21Ck2Dh
<ELICO> maybe i dont understand the concepts and how it works
<apeiros_> if you're not good at programming, you should stay the heck away from concurrency
<apeiros_> you WILL screw up
<apeiros_> even experienced programmers do
EvanR has joined #ruby
<ELICO> well i am trying.. the machine wont die from it
<cloudgeek> is possible to have 2 http request at same time
<apeiros_> ELICO: the main thread doesn't wait for other threads to finish
<cloudgeek> one is get and other is post
urbino has quit ["Leaving"]
<apeiros_> ELICO: so when the main thread ends, ruby exits and doesn't bother to finish the still running threads
<apeiros_> you'll have to join them: threads.each(&:join)
<EvanR> apeiros_: especially experienced do
<ELICO> so how i do it?
<EvanR> (stay away from concurrency)
<apeiros_> cloudgeek: even though you didn't say whether you meant send or receive - yes, it is possible.
<EvanR> especially pthreads-like shit
<ELICO> well maybe you can help me wither yes. i want to send mass mail to my server
<apeiros_> ELICO: I already told you
<apeiros_> I told you what happens (which you should have told me), why it happens and what to do against. just read what I wrote.
<Tasser> apeiros_, the java guys got a nice little utility package for that where you won't screw up in simple cases ;-)
<ELICO> i tried but i didn't understood sorry
NotMyself has joined #ruby
<apeiros_> Tasser: the problem is, that if you don't understand the underlying issues, you'll screw up eventually, no matter how much the tools simplify it :-/
<apeiros_> but of course, having powerful tools at hand is a nice thing :)
bwlang_ has joined #ruby
<EvanR> powerful tools put holes in the wall
coreydaley has joined #ruby
<EvanR> or your feet
<EvanR> you want good tools
phantasm66 has joined #ruby
<cloudgeek> apeiros_: okay then what should need to there ,BOTH HTTP resuest
<cloudgeek> The two requests MUST correspond to the SAME controller action
<cloudgeek> or not?
<apeiros_> cloudgeek: Errno::ENOCONTEXT
<apeiros_> I wonder how you expect anybody to actually answer your question. you are aware that you're in #ruby, and not in #whateverthingyouuse, yes?
virunga has joined #ruby
virunga_ has joined #ruby
<ELICO> anyway thanks
<cloudgeek> apeiros_: okay thnaks
apok has joined #ruby
tomzx has joined #ruby
ezkl has joined #ruby
LBRapid has joined #ruby
phantasm66 has joined #ruby
bpgoldsb has joined #ruby
fayimora has joined #ruby
internet_user has joined #ruby
ezkl has joined #ruby
chson has joined #ruby
Drake_mac has joined #ruby
ph^ has joined #ruby
iocor has joined #ruby
burns180 has joined #ruby
burns180 has joined #ruby
bbttxu_ has joined #ruby
blischalk has joined #ruby
snip_it has joined #ruby
friskd has joined #ruby
wmoxam has joined #ruby
<cloudgeek> what a.foo means ?
Helius has joined #ruby
bitrot has joined #ruby
stefanp has joined #ruby
stefanp has joined #ruby
Drake_mac has joined #ruby
johndbritton has joined #ruby
bbttxu_ has joined #ruby
vipaca has joined #ruby
Redjack1964 has joined #ruby
vipaca has joined #ruby
bwlang_ has joined #ruby
n1x has joined #ruby
PaciFisT has joined #ruby
amesha has joined #ruby
oliwer has joined #ruby
macmartine has joined #ruby
oliwer has quit ["kthxbye"]
codezombie has joined #ruby
drake has joined #ruby
Drake_mac has joined #ruby
Drake_mac has quit [#ruby]
MrCheetoDust has joined #ruby
cmasseraf has joined #ruby
bwlang_ has joined #ruby
cantbecool has joined #ruby
Vendethiel has joined #ruby
kevinbond has joined #ruby
cantbecool has quit [#ruby]
tatsuya_o has joined #ruby
akem has joined #ruby
dhruvasagar has joined #ruby
rb2k has joined #ruby
<rb2k> anybody got an idea how I can get the text of an element in capybara WITHOUT getting the text of the children too
rickmasta has joined #ruby
<pen> hey
<pen> how do I extend existing class in ruby?
<pen> for example
<pen> I subclass Queue
<pen> and I think I overrite << by defineing a method called def add(obj) end
<pen> and I call super(obj)
<pen> but I am getting errors :(
KL-7 has joined #ruby
Phrogz has joined #ruby
<pen> deryldoucette: how about modify existing methods?
<pen> deryldoucette: can I do that? also is << really << so I can just type def << end ??
alex__c2022 has joined #ruby
<deryldoucette> that i am not sure of
<deryldoucette> (your last)
<pen> deryldoucette: oh, but I can modify existing methods by calling super right?
<deryldoucette> yes, within the method
<deryldoucette> super means 'use what the parent class has'
<deryldoucette> basically
amesha has joined #ruby
<deryldoucette> the one thing I'm iffy on is if that would be better read as saying return *control* to the parent class
graybeard has joined #ruby
<graybeard> join #rubyonrails
fbernier has joined #ruby
j3r0m3 has joined #ruby
Drewch has joined #ruby
bwlang_ has joined #ruby
mikewintermute has joined #ruby
KL-7 has joined #ruby
burns180_ has joined #ruby
<JonnieCache> super just calls the implementation of the same method from the parent
<JonnieCache> its different if you use it in a module but dont worry about that
<JonnieCache> it is "passing control" to the parent class in a sense, but not really, being as youre in a subclass so you share the parent class's stuff anyway
<JonnieCache> its a matter of interpretation, "control" doesnt have a formal meaning here
vienneau has joined #ruby
vienneau has quit [#ruby]
caiges has joined #ruby
Vert has joined #ruby
neurodrone has joined #ruby
ckrailo has joined #ruby
bwlang_ has joined #ruby
neurodrone has joined #ruby
ethd has joined #ruby
amesha has joined #ruby
ckrailo has joined #ruby
mikepack has joined #ruby
nvez has joined #ruby
nvez has joined #ruby
<deryldoucette> JonnieCache: thank you for the clarification
kidoz has joined #ruby
Targen has joined #ruby
iamjarvo has joined #ruby
nonotza has joined #ruby
ckrailo has joined #ruby
emmanuelux has joined #ruby
io_syl has joined #ruby
munx_ has joined #ruby
nanderoo has quit [#ruby]
lateau has quit [#ruby]
chaitanya_ has joined #ruby
amesha has joined #ruby
dbgster has joined #ruby
vipaca has joined #ruby
vipaca has joined #ruby
lorandi has joined #ruby
nanderoo has joined #ruby
timonv has joined #ruby
bwlang_ has joined #ruby
CheeToS has joined #ruby
nachtwandler has joined #ruby
baroquebobcat has joined #ruby
tayy has joined #ruby
snip_it has joined #ruby
MasterIdler_ has joined #ruby
lkba has joined #ruby
KL-7 has joined #ruby
wyhaines has joined #ruby
v0yager has joined #ruby
cloke has joined #ruby
ephemerian has joined #ruby
Azure has joined #ruby
seejohnrun has joined #ruby
robcthegeek has joined #ruby
amesha has joined #ruby
seejohnrun has quit [#ruby]
vipaca has joined #ruby
vipaca has joined #ruby
burns180 has joined #ruby
bwlang_ has joined #ruby
burns180 has joined #ruby
crankycoder has joined #ruby
ceej has joined #ruby
<scalebyte> how can I keep entering hash into an array ? i did this for the first value
<scalebyte> user.profile.detail[:prior_experience][:data] = Hash["TCS" => "Trainee"]
apeiros_ has joined #ruby
arkx has joined #ruby
<pen> what's wrong?
<pen> why can't I call super anymore?
<cout> pen: use super() instead of super
<cout> one of ruby's warts, IMO
<scalebyte> how can I keep entering hash into an array ? i did this for the first value
<scalebyte> user.profile.detail[:prior_experience][:data] = Hash["TCS" => "Trainee"] works
<scalebyte> but user.profile.detail[:prior_experience][:data] Hash["TCS" => "Trainee"]
<deryldoucette> i find that suprising that you *have* to use the ()
<scalebyte> but user.profile.detail[:prior_experience][:data] << Hash["TCS" => "Trainee"] after that doenst work
amesha has joined #ruby
<Companion> [companion@cube pcaprub]$ type rvm | head -1
<Companion> rvm is hashed (/usr/local/rvm/bin/rvm)
<Companion> bah
<apeiros_> scalebyte: Hash["TCS" => "Trainee"] is a relatively bad way to say {"TCS" => "Trainee"}
<cout> deryldoucette: what's surprising is that with and without (), super has different semantics
<scalebyte> apeiros_: ok thanks leme check if that works
<apeiros_> cout: don't forget &nil
<deryldoucette> #rvm and make sure that you are A) part of the rvm group, then log out then back in and B) that your distrib is loading /etc/rvmrc and /etc/profile.d/rvm.sh
choffstein has joined #ruby
<deryldoucette> Companion that was for you
<Companion> ty
<deryldoucette> but lets move the rvm stuff over to the right chan
<deryldoucette> not a problem.
<scalebyte> apeiros_: that works but hw to add second hash into the array ?
<scalebyte> apeiros_: thats my problem
<apeiros_> scalebyte: you assigned a hash to …[:data], not an array
<deryldoucette> cout: see? love hanging here cause i learn new shit every damned day hehe
<apeiros_> so there's no array to add a second hash
<scalebyte> apeiros_: so how to have an array of hashes ?
arkx has joined #ruby
<Companion> deryldoucette, dint work :(
<cout> apeiros_: oh, I didn't realize you needed it
<deryldoucette> Companion: ok come to #rvm so we're not flooding #ruby
<scalebyte> apeiros_: https://gist.github.com/2001976 pls help me out
<cout> someone needs to invent a language that doesn't have any warts
<apeiros_> cout: yeah, took me good half an hour to figure that out… :)
<Companion> oh damn thought I was in #rvm
<deryldoucette> nope
<cout> and then NEVER add any features to it, to make sure it stays that way
<apeiros_> scalebyte: [] is an empty array
<deryldoucette> ping me when you're there. i have part join quit turned off
<apeiros_> scalebyte: [1,2,3] is an array with the elements 1, 2 and 3. [{:a => 1}, {:a => 2}] is an array with two hashes in it
<scalebyte> apeiros_: I want it to be array of hashes.. so that I can add hahses into array also how can I add hashes into array ?
<apeiros_> scalebyte: you can use << or push to add further elements to an array.
<apeiros_> hth
<apeiros_> (push and << don't care what the elements are, whether they be hashes or numbers is irrelevant to them)
<scalebyte> apeiros_: << isnt working since u said [:data] is an hash
<apeiros_> scalebyte: yeeees, that's why you should assign an array to it
<scalebyte> apeiros_: can u get it correct here ? https://gist.github.com/2001976
<scalebyte> apeiros_: here is where I am defining... and I want data to be array of hashes
<Tasser> IRC. Getting done work for you ™... NOT
<apeiros_> scalebyte: I told you all you need in order to fix it yourself
tshirtman has joined #ruby
<jlebrech> i'd love a linux distro that replaces all config files with yaml
<scalebyte> apeiros_: ok
<pen> cout: so how does super works? if I inherit the class and I want to override and extend some super class's method how do I do super method?
JStoker_ has joined #ruby
burns180_ has joined #ruby
<tshirtman> how do i create a list from an iterator? i have that loop that yield stuff, and i like it that way, but i need a list on the other side, any nice way to get all elements in a list?
blischalk has joined #ruby
<Tasser> jlebrech, and parse them back to the original format?...
<tshirtman> patch all the programs! :D
<pen> cout: say if I inherit Queue and I want to extend << method, I will call super << obj within the method to retain it's behavior right?
wilmoore has joined #ruby
isaacsanders has joined #ruby
<isaacsanders> hey
<jlebrech> Tasser: possible, it would probably have to parse rather than native suport as you'd have to recode all the unix utils
<isaacsanders> I am trying to dynamically define a method
<isaacsanders> how can I do that in 1.9.3
amesha has joined #ruby
<isaacsanders> ?
<Tasser> jlebrech, have fun with your own personal hell ^^
<Tasser> isaacsanders, no different than in other ruby versions
<jlebrech> Tasser :P
hadees has joined #ruby
<isaacsanders> define_method is not in 1.9.3
<Tasser> wtf?
<Tasser> sure it is
<isaacsanders> nope
<Tasser> huhm
<alex__c2022> anyone have a link to a good example to how to encrypt some data using openssl?
<Tasser> isaacsanders, main is less magic
<isaacsanders> ?
<isaacsanders> ok
<isaacsanders> your right
<Tasser> *you're right
<tshirtman> nobody have a nice idiom to create a list from an iterrator?
<isaacsanders> sorry
<isaacsanders> map?
d2dchat has joined #ruby
<Tasser> tshirtman, ^
<tshirtman> oh, good idea
<isaacsanders> thanks folks
<isaacsanders> this is fun being in here.
<Tasser> isaacsanders, http://sprunge.us/UKeU
<isaacsanders> i might stay
<Tasser> it is defined, but not public
<isaacsanders> That is weird
<isaacsanders> oh well
<Tasser> nah, not really
<isaacsanders> my specs are green
waxjar has joined #ruby
<isaacsanders> yah
<isaacsanders> i understand it
<tshirtman> hmm, nope, still complain as "no block given"
<isaacsanders> oh well
<Tasser> tshirtman, ohhh, try #to_a
<pen> is Array thread safe? I was using Queue but I can't access the last element so I want to switch to Array
jankly has joined #ruby
<pen> but I wonder if array is thread safe
<Tasser> pen, jruby?
<pen> MRI
<Tasser> so why use threads?
<pen> what do you mean
<Tasser> it's single-core anyway
<pen> so is it thread safe?
<pen> just a question
flak has joined #ruby
alx- has joined #ruby
<Tasser> I'd say so - but just know you won't get any speed if your Threads wait for CPU - if they wait for external resources, it's fine. Otherwise you're wasting your time
<pen> I have some objects and I just want to make sure they don't have race condition
<pen> that's it
catphish has joined #ruby
<pen> threads
<catphish> is there anything in ruby to manipulate HTTP GET query strings
<catphish> specifically i want to be able to add auth_token=nnnnn to a given request string
<pen> if I have to have the same code for multiple method (like <<, push, etc) how do I do that?
<Tasser> catphish, depends how you send the get requests
n3m has joined #ruby
<Tasser> pen, alias
<pen> is it possible to do something like def <<, push() end
Tearan has joined #ruby
<catphish> Tasser: how so?
QaDeS has joined #ruby
<catphish> right now i go Net::HTTP::Get.new(path)
<pen> Tasser: hmm, looking at it nw
<pen> now
<Tasser> pen, alias :<< :push
<pen> Tasser: cool
blischalk_ has joined #ruby
mensvaga has joined #ruby
<Tasser> catphish, curb simplifies that stuff
<Tasser> I wouldn't use net/http
<catphish> so `path` needs to be modified from '/test?id=1' to '/test?id=1&auth_code=nnnnn'
<Tasser> ... it's just not resilient
<pen> Tasser: where do I put that?
<Tasser> pen, somewhere
<catphish> Tasser: really? always worked well for me
<catphish> apart from the timeout issue
amesha has joined #ruby
<mensvaga> Let's just say I have a program that reads in a string, and what string method I want to call on it, like: hello upcase
munx has joined #ruby
<mensvaga> How do I specify what methods on the string class can be called?
<mensvaga> I want to restrict what methods can be called
<mensvaga> I'm trying to use a dispatch hash
<robacarp> mensvaga: make an array of the allowables and call .include? on it
timonv has joined #ruby
<mensvaga> but: string_object = String.new; string_dispatch = { 'to_s' => string_object.method( :to_s) } doesn't work
daniel_hinojosa has joined #ruby
voodoofish430 has joined #ruby
<mensvaga> It would be cool if I could call: String.'method_name' (where method_name is a string itself)
<mensvaga> is there a way to do that?
blueadept has joined #ruby
linoj_ has joined #ruby
<linoj_> hi, is there a way in ruby to say a specific method is private rather than grouping them in a private "section"
<Tasser> linoj_, private :method_name
<Tasser> but I haven't seen uses of private that often
<Tasser> and 666 users again :-)
<robacarp> mensvaga: you're overcomplicating this
adambeynon has joined #ruby
<mensvaga> OK. Please explain or point to documentation.
bwlang_ has joined #ruby
eywu has joined #ruby
<robacarp> string_object.send(method) if string_object.responds_to?(method)
<Tasser> and allowed_methods.include?(method)
<robacarp> if you want to filter the methods first, do somethin like this:
<robacarp> ['upcase','downcase'].include?(method)
<robacarp> yea, what Tasser said
<robacarp> man the join/quit spam in this channel is awful
<mensvaga> robacarp: what client are you using?
fgro has joined #ruby
<deryldoucette> if using irssi, /ignore #ruby +PART +JOIN +QUIT
<robacarp> mensvaga: for ruby?
<robacarp> oh, yea, I just did that :)
<mensvaga> robacarp: no, if you're using pidgin, you can load the "hide extraneous quits" plugin
<mensvaga> but yeah, what he said.
savage- has joined #ruby
<deryldoucette> can add the -network freenode portion as weill if you're like me and on multiple networks but the same chan name
<mensvaga> When using string_object.send(method), how do I pass parameters to it
<mensvaga> ?
<mensvaga> Now I probably should just read the documentation ;)
jgrevich has joined #ruby
<fgro> noob question. i have a set of variables, say a,b,c. What i want is: result = (first variable that is not nil from the set in left to right order)
rippa has joined #ruby
<robacarp> yes...you should... :)
<mensvaga> Is there a way I can do: String.send(method)("Some string")
<mensvaga> ?
<fgro> wasn't there something like |==
dvsuresh has joined #ruby
<mensvaga> ah, send(method, arg1, arg2)
<robacarp> fgro: result ||= a || b || c
<robacarp> mensvaga: yep
marcuspat has joined #ruby
<fgro> robacarp: nice!
sacarlson has joined #ruby
norex has joined #ruby
<robacarp> fgro: that wont do anything if result is already defined though...
<Mon_Ouie> It should be result = a || b || c
drake_ has joined #ruby
<robacarp> ^^
fmcgeough has joined #ruby
<fgro> robacarp: yep. but it helps in my case, result is not defined
<Mon_Ouie> Also don't confuse defined and nil/false
<fgro> where in the ruby api can I find ||= ? couldn\t find it here: http://www.ruby-doc.org/core-1.9.3/
headius has joined #ruby
<fgro> Mon_Ouie: yes, in my case result is nil.
<pen> does ruby have md5?
<Mon_Ouie> It's not a method call
<Mon_Ouie> It's a shortcut for something like a || (a = b) IIRC
<Mon_Ouie> and || isn't a method either (it's just a logical or)
<mensvaga> if I have: columns = ['a','b','c']; values = [1,2,3];
<rippa> columns.zip values
<td123> pen: require 'digest/md5'
<mensvaga> is there a way for me to assign those to an associative array in one line that results in: hash = { 'a'=>1, '
<rippa> Hash[columns.zip values]
<mensvaga> 'b'=>2, c=>'c']
<mensvaga> zip?
<fgro> Mon_Ouie: ok, well where can I find more info on this in the ruby doc? operators?
<rippa> mensvaga: yes
<mensvaga> okie dokie.
<mensvaga> thanks
<rippa> [a,b].zip [1,2] #=> [[a,1],[b,2]]
<pen> td123: ok thanks, but somehow it is not showing up in official ruby doc
drake_ has quit ["Linkinus - http://linkinus.com"]
<td123> ya I couldn't find it either in the docs, not sure what's going on
<mensvaga> rippa: I don't think zip is what I want
<rippa> why?
t0mmyvyo has joined #ruby
SegFaultAX|work has joined #ruby
<mensvaga> i want: hash = { 'a' => 1, 'b' => 2, 'c' => 3}
bwlang_ has joined #ruby
drake10 has joined #ruby
<rippa> yep
<rippa> that does what you want
<rippa> [22:13:34] <rippa> Hash[columns.zip values]
<mensvaga> Ah, I get it now
<mensvaga> I think
<mensvaga> Hash[columns.zip values] doesn't appear to work either.
<mensvaga> I will work with a short example and get back to you.
Spockz has joined #ruby
<mensvaga> pastebin?
<mensvaga> .pastebin
<mensvaga> !pastebin
<mensvaga> ?pastebin
* mensvaga I got nothin.
maletor has joined #ruby
ed_hz_ has joined #ruby
drake10 has quit ["Linkinus - http://linkinus.com"]
flippingbits has joined #ruby
<pen> what's the proper way to do OS detection?
<pen> are there library functions for this>
<pen> ?
amesha has joined #ruby
ringotwo has joined #ruby
burns180 has joined #ruby
colinwd has joined #ruby
<mensvaga> rippa: ^^
yann_ck has joined #ruby
<rippa> mensvaga: works here
<mensvaga> what version of ruby?
<mensvaga> ruby 1.8.6 (2010-02-05 patchlevel 399) [i386-linux]
j3r0m3 has joined #ruby
<rippa> 1.9.3 p125
<mensvaga> f7u12
<mensvaga> any way to do it in 1.8.6?
<mensvaga> or do I just have to foreach through them?
badabim has joined #ruby
<rippa> what exactly doesn't work?
<dbgster> trying to load a yaml file, what's wrong here? http://pastebin.com/8LgBk4X4
<rippa> mensvaga: Hash[*columns.zip(values).flatten]
<rippa> try that
<mensvaga> that appears to work.
friskd has joined #ruby
vipaca has joined #ruby
vipaca has joined #ruby
<mensvaga> {"a"=>1, "b"=>2, "c"=>3}
<mensvaga> THanks!!! 11 one
<apeiros_> mensvaga: beware, you should only use that if you don't have nested data
<mensvaga> Understood.
<apeiros_> else use h={};columns.zip(values) { |k,v| h[k] = v};h
<mensvaga> that's probably the better way to do it for the version of ruby I'm on, right?
<apeiros_> only if you've got nested data
<apeiros_> otherwise rippa's version is fine
<mensvaga> sure, but if somebody looks at my code and says "I can haz assign multiple values to associative array" it may screw them up.
enherit has joined #ruby
<rippa> or use
<rippa> flatten(1)
<rippa> if it works on 1.8
<apeiros_> doesn't
<rippa> that would only flatten one time
<rippa> oh well
<apeiros_> only as of 1.8.7
<rippa> 1.8 sucks
<apeiros_> but as of 1.8.7, you can just do Hash[cols.zip(vals)] too
sgmac has joined #ruby
mikepack has joined #ruby
<mensvaga> I'm surprised such functionality wasn't in an earlier version.
<apeiros_> you're not the only one
<apeiros_> even in 1.9, there's tons of functionality I'd expect in core or at least stdlib
<Eiam> I need to perform the following tasks.. 1) Check and see if a file exists in /var/log and if it doesn't, create it. 2) copy files into /Library/LaunchDaemons/ 3) unload a plist from launchctl 4) load a plist into launchctl . are these things Rake is capable of doing without shelling out into sh like x{} or sh mv blah
<Eiam> i was reading last night and it looked like possibly FileUtils would do some of it
<Tasser> apeiros_, real OO isn't possible if you can't patch core classes freely...
<Eiam> or is rake not really the tool I'm after?
<Tasser> Eiam, if ruby can do it, rake can do it.
<Tasser> but beware of rake options, they're ugly as shit
<dbgster> hi guys, so any tips? http://pastebin.com/8LgBk4X4 just a friggin yaml file I can't get right!
<apeiros_> dbgster: your indentation is wrong
kenperkins has joined #ruby
<apeiros_> you want line 2-5 indented by 2 spaces
<Tasser> dbgster, seems recursive
bwlang has joined #ruby
<apeiros_> dbgster: also, there's YAML.load_file
<apeiros_> no need to read the file yourself
apok has joined #ruby
<Eiam> Tasser: well I know ruby could do it, my question was doing it without shelling out via x{} or sh
<Eiam> and if i was using the right tool for the job
<apeiros_> also, I think you can just write `development: *defaults`
<apeiros_> instead of the << construct
<dbgster> ok i'll try that thanks.
<mensvaga> holy crap
<apeiros_> you've got holy crap?
<apeiros_> you must not let the pope know!
<mensvaga> does that mean if I have a hash = { 'a' => '1', 'b' => '2', 'c' => 3'}, I can't just say:
<dbgster> apeiros_: yes that worked! thanks a bundle.
<mensvaga> columns = ['a','c']; puts hash[columns].join(' ');
<mensvaga> ?!
<apeiros_> mensvaga: of course not
<apeiros_> you could have a key ['a', 'c']
<apeiros_> you want Hash#values_at
<apeiros_> plus splat
<Eiam> wait why would you want a spalt there
<mensvaga> This old ass version of ruby is really getting in the way of me having a good opinion of it.
<Eiam> hash.values_at[*cols]
<mensvaga> okie dokie
<apeiros_> Eiam: um, no, you want (), not [] there
<apeiros_> [] is a method
<Eiam> sorry
<Eiam> let me finish my coffee
<Eiam> ill stop commenting until its down
<Eiam> =)
<apeiros_> mensvaga: that doesn't change in newer rubies, and if you think about it, it makes a lot of sense.
tayy has joined #ruby
<mensvaga> It probably does.
<Eiam> still don't understand the splat but, ill apply my small mind to it when im more alert
<rippa> alias [] to values_at
<rippa> problem solved
<apeiros_> mensvaga: hash = {['a','c'] => 1, 'a' => 2, 'b' => 3}; hash[['a', 'c']] # <-- what do you expect here?
<mensvaga> I should have told you I'm learning Ruby from a Perl background :)
tex3l has joined #ruby
danishkhan has joined #ruby
<apeiros_> rippa: you mean: problem substituted by a fucking turd of bigger problems?
<mensvaga> apeiros_: I expect that a reference to the array ['a','c'] is an invalid key to that hash
<mensvaga> or a non-existing key
<Eiam> mensvaga: really? that'd be a bummer
<mensvaga> though you could use a memory address as a key to an associative array.
i8igmac has joined #ruby
<mensvaga> but that's the "other" language speaking.
<apeiros_> mensvaga: hu? that doesn't even make sense…
amesha has joined #ruby
<apeiros_> ah, I put b somewhere where it should have been c
<Eiam> mensvaga: FYI it works fine
<apeiros_> mensvaga: hash = {['a','c'] => 1, 'a' => 2, 'c' => 3}; hash[['a', 'c']] # <-- what do you expect here?
<apeiros_> now
<mensvaga> oh, wait. You did create a key called ['a','b']
<Eiam> 1
<apeiros_> mensvaga: as per your previous statement, you'd expect [2, 3] as result
<mensvaga> those are two different addresses
wyhaines has joined #ruby
Pheen has joined #ruby
<apeiros_> mensvaga: but that'd make it impossible to retrieve the value 1
<mensvaga> OK, now I'm talking out of my ass. I don't know what's going on.
catphish has quit ["Leaving"]
<apeiros_> since its key *is* ['a', 'b']
<mensvaga> I know this isn't Perl
<mensvaga> Yes, but you're defining a new anonymous array, aren't you?
<apeiros_> yes
<mensvaga> ['a','b'] returns an array
<apeiros_> they're considered to be the same hash key
<mensvaga> and I would expect that: a = ['a','b']; b=['a','b']
<apeiros_> (I think we'll just assume that we both mean ['a', 'c'] when we say ['a', 'b'], aight? :D)
sgmac has quit [#ruby]
<mensvaga> point to different arrays in memory
<apeiros_> mensvaga: they do
<apeiros_> but they are the same key to a hash
<mensvaga> Now that's comedy.
<apeiros_> Hash uses .eql? and .hash
<apeiros_> mensvaga: you'd have lots of fun with string keys otherweise…
<apeiros_> mensvaga: after all, a = "foo"; b = "foo" # two different points in memory too
<mensvaga> Yes, but I wouldn't assume that a hash would automatically dereference something that's passed in
<Eiam> isn't this why we typically use symbols as keys
<apeiros_> mensvaga: that makes no sense either.
<Eiam> to avoid that sort of mental weirdness?
<mensvaga> "Oh! I have an array? Let's see if there are any keys that are arrays. There are! Let me compare the arrays. They're equal?! That means they're the same key!"
<Mon_Ouie> Eiam: No, we use strings and symbols in different cases
<apeiros_> mensvaga: you don't get it
<apeiros_> mensvaga: in Hash, you can use *any* object as key
ggolin has joined #ruby
<mensvaga> I do get it, and I'm not used to it.
<apeiros_> and strings wouldn't work *either* if it wouldn't use that mechanism
<mensvaga> apeiros_: Yes, it makes sense.
<mensvaga> In Perl, a string is considered a scalar data type
<apeiros_> and no, Hash does *not* look whether it has an Array, or any other class (Strings are special cased, but that's another matter)
<Mon_Ouie> Symbols would usually be used for a restricted set of options (like the name of an attribute), and string in other cases (like name of users)
<mensvaga> and hashes only use scalar data types as keys
<mensvaga> they don't use objects and compare keys with some method that determines whether or not they're equal.
<apeiros_> mensvaga: actually it does
axl_ has joined #ruby
<apeiros_> perl just hides it from you
<apeiros_> (ruby actually too, you're just surprised, that it accepts a different set of objects as key)
<mensvaga> apeiros_: As for the Perl thing, I don't believe you. As for Ruby, I believe you :)
<apeiros_> mensvaga: how do you think a hash works?
<mensvaga> And I'm aware this isn't Perl.
<apeiros_> magic & pixie dust?
<mensvaga> apeiros_: If I were to explain it, I don't want to get banned for talking off topic. I can explain Perl hashes _very_ well.
<apeiros_> a hash works by calculating a bucket-index, and then checking each key/value in that bucket for hash-key equality
<apeiros_> perl doesn't do that any differently. that's datastructure 101.
<mensvaga> apeiros_: and in Perl, that index for a hash is always a scalar variable.
<apeiros_> mensvaga: I'm the only active op here, you wouldn't get banned :-p
<Eiam> Mon_Ouie: hmm, maybe I use symbols incorrectly. currently almost all my hashes use symbols as their keys, aside from cases where my keys are dynamically generated, why wouldn't I want to do that?
c0rn has joined #ruby
Cancel has quit [#ruby]
nfluxx has joined #ruby
workmad3 has joined #ruby
burgestrand has joined #ruby
<apeiros_> mensvaga: perl too calculates a hash value for the key, perl too calculates a bucket-index from that hash-value. if you don't believe me, check perl's sources. sadly I don't know perls sources as I do rubys, so I can't point you to the right place.
<Mon_Ouie> Depends on what "all your cases" are
<Mon_Ouie> Generally I tend to think of symbols more like integers, like symbolic constants in C: you use it to name a value, it doesn't matter what it actually is
<mensvaga> apeiros_: WE're talking about 2 different things.
<apeiros_> mensvaga: ruby just opens that up a little, and allows you to provide the hash value for each object and the equality check. that tiny "trick" enables using any object instead of just a select few
<mensvaga> Yes.
<mensvaga> That's exactly what I'm saying.
ed_hz_ has joined #ruby
<mensvaga> I never made any statement contrary to how a hashing algorithm works
<scalebyte> can I have a hash with 3 values ?
<mensvaga> I only stated that Perl uses scalar values for hash keys
<apeiros_> 18:53 mensvaga: they don't use objects and compare keys with some method that determines whether or not they're equal.
<apeiros_> I'd say you did :-p
<Eiam> Mon_Ouie: hm, stuff like {:id => a, :first_name => "john", :last_name =>"doe"}
<mensvaga> apeiros_: strings, integers, floats, etc are not objects
<mensvaga> if they're not objects, they don't have methods
<Eiam> yhm
<mensvaga> (in Perl)
<scalebyte> apeiros_: can I have a hash to store 3 values somehow ? key should be 1 value and values should be two
<apeiros_> ah well… matter of how you look at it, but ok, in perl terminology, they aren't.
<mensvaga> DING.
<mensvaga> apeiros_: how many data types does Perl have?
Richmond has joined #ruby
<Mon_Ouie> That is the kind of thing that is fine, what I'd consider wrong would be using :john instead of "john"
<Eiam> only 1, the confusing type
<mensvaga> (a question for how well you know your Perl ;)
danishkhan has joined #ruby
<Eiam> =)
adamkittelson has joined #ruby
<Eiam> Mon_Ouie: oh, yeah I agree there. that seems weird to me
<apeiros_> mensvaga: been a while, I'm not even sure anymore what is actually considered to be a type in perl
<mensvaga> Most people say 3.
LMolr has joined #ruby
<rippa> apeiros_: I'd expect hash[[a,c]] to return 1
<Eiam> rippa: it does
<scalebyte> there is no data type in perl its all duck typing
MrGando has joined #ruby
<mensvaga> apeiros_: yes. I know lots about Perl.
<apeiros_> rippa: good expectation :-D
<rippa> and hash[a,c] to return [2,3]
<rippa> sp, no problem here
<Eiam> scalar list & hash
conor_ireland has joined #ruby
<Eiam> (I'm assuming are the 3 people would say)
<rippa> just like @values_at works
<rippa> *#
<apeiros_> rippa: yes, that'd be nice. but iirc there was some issue with having it like that… meh, don't remember… but I'd be in favor of it anyway
<Eiam> rippa: it does not, it returns nil
<rippa> Eiam: if it was possible to return several values
<Eiam> it is possible to return several values, return an array
<rippa> though tehre is one problem
<rippa> values_at always returns an array
<apeiros_> mensvaga: which 3 then?
<Mon_Ouie> That would mean it would return an array of elements unless the amount of arguments is 1
<apeiros_> Mon_Ouie: !
<rippa> and that's inconsistent
<apeiros_> right, denormalized return value
<mensvaga> apeiros_: there are 7: scalars, arrays, associative arrays, globs, file handles, directory handles and formats.
davidcelis has joined #ruby
<Eiam> Mon_Ouie: it could just always return an array
<Eiam> even if its one value
<apeiros_> mensvaga: ok, it's *really* been a while…
<mensvaga> Hash keys are always scalar, which can be int, float, string, etc
<Eiam> i mean its a weird case anyway, i don't really mind it existing
<rippa> there's #values_at for that
<mensvaga> No, it's been that way for a while, people just don't know.
<Eiam> it doesn't bother me that i can't do hash[['a','c']]
<apeiros_> mensvaga: so why are handles and formats not scalars?
<rippa> and always having an array for [] would be inconvenient
<mensvaga> apeiros_: they're handled differently as base data types in Perl.
<Mon_Ouie> Eiam: It could, but it would be more confusing, and break pretty much any existing code using hashes
<apeiros_> mensvaga: it's been ~10 years for me, I *had* learnt that stuff, but I doubt I'd have remembered it.
<Eiam> Mon_Ouie: sure. I didn't say I was in favor of it
<Eiam> merely that its possible =)
<mensvaga> I don't know why, but it's probably easy to explain why handles are considered special. Formats though? I know nothing of them.
<apeiros_> mensvaga: mind a query? because now we're really getting OT and the channel isn't empty
<mensvaga> apeiros_: hit me
probst has joined #ruby
Prezioso has joined #ruby
tex3l has quit [#ruby]
Araxia has joined #ruby
flippingbits has joined #ruby
danishkhan has joined #ruby
Avanine has joined #ruby
DuoSRX has joined #ruby
eldariof has joined #ruby
shadoi has joined #ruby
burns180_ has joined #ruby
matthewC has joined #ruby
timonv has joined #ruby
bwlang has joined #ruby
babinho has joined #ruby
amesha has joined #ruby
seanstickle has joined #ruby
emocakes has joined #ruby
asobrasil has joined #ruby
john_smith has joined #ruby
cpruitt has joined #ruby
mengu has joined #ruby
yann_ck has joined #ruby
pdtpatr1ck has joined #ruby
<cpruitt> Can anyone point me in the right direction here. My google searches don't seem to be giving me what I'm looking for. I have a very simple .rb file. When it runs I want to start a longer process (another .rb file) in another process and immediately return. The longer process can continue in the background (I don't need to know if it successfully completes or not) but I want to return control to the terminal by ending the first .rb script. Is that possible
logic has joined #ruby
<cpruitt> back ticks & kernel.system don't seem to do what I am looking for
<Phrogz> cpruitt: Threads.
isaacsanders has joined #ruby
<Phrogz> cpruitt: Wait...you want the first process to end completely and leave the other running? Not threads :)
t0oL has joined #ruby
<Phrogz> cpruitt: What OS(es)?
<cpruitt> Phrogz: Maybe I'm not using them correctly. I tried Thread.new { `./send_last_commit_mail` }
<cpruitt> OS X
j3r0m3 has joined #ruby
<cpruitt> just my box, it's not going to be shared
<Phrogz> cpruitt: `ruby other_file.rb &`
<Phrogz> The ampersand is the key.
macmartine has joined #ruby
techhelp has joined #ruby
Uni has joined #ruby
apok has joined #ruby
<cpruitt> Phrogz: Hmm… OK I just tried that and the execution of the other_file.rb is not output to terminal, but first_file.rb blocks until other_file completes.
<Phrogz> That does not make sense to me, but I'll need to test it before telling you that you're wrong :)
<cpruitt> lol I'd love to be wrong.
<cpruitt> I could be goofing something up
techhelp has quit [#ruby]
pazustep has joined #ruby
Spockz` has joined #ruby
<Phrogz> Nope, I'm wrong. I'm not sure why that doesn't work, but it doesn't.
davidpk has joined #ruby
<Phrogz> Proof of my wrongness: http://pastie.org/3550153
<cpruitt> Hmmm...
ringotwo has joined #ruby
<burgestrand> banisterfiend: yo! you around?
ikaros has joined #ruby
<Phrogz> So, it seems that if you start another process the master Ruby process is not allowed to finish until that other process terminates.
<cpruitt> spawn("./send_last_commit_mail")
<cpruitt> that maybe look right?
<cpruitt> seems to work
<cpruitt> oh wait...
<cpruitt> no, the first file never returns...
wyhaines_ has joined #ruby
logic has joined #ruby
logic has joined #ruby
wyhaine__ has joined #ruby
t0oL has quit [#ruby]
Dave123-work has joined #ruby
<isaacsanders> hey
<isaacsanders> nvm
<cpruitt> there we go. Awesome, thanks.
JonnieCache has joined #ruby
<cpruitt> coulda sworn I'd tried that but I guess not or I did it wrong
Dave123-work has quit [#ruby]
Dave123-work has joined #ruby
Morkel has joined #ruby
twqla has joined #ruby
<Phrogz> cpruitt: http://pastie.org/3550181
<Phrogz> Proof that it works. :)
\logic has joined #ruby
\logic has joined #ruby
<Phrogz> Thanks for teaching me something :)
zulax has joined #ruby
danishkhan has joined #ruby
<cpruitt> Yeah it's working for me. Now I just need to figure out why it won't work as a git hook… Thanks for the tiip
<Avanine> that is really neat.
Quirrell has joined #ruby
danishkh_ has joined #ruby
mensvaga has quit [#ruby]
<pen> looks like if I initiate a thread in a class instance I can't access the class instance variable from the thread
<pen> is there to get it?
Prezioso has joined #ruby
wallerdev has joined #ruby
Seisatsu has joined #ruby
flippingbits has joined #ruby
amesha has joined #ruby
<apeiros_> pen: threads and variable scope are orthogonal
ascarter has joined #ruby
<apeiros_> threads are about execution, not about access. same rule applies to code there as in any other block.
<Phrogz> pen: Pastie your code?
LMolr has joined #ruby
vmatiyko has joined #ruby
<pen> Phrogz: ok, hold on
hadees has joined #ruby
cbuxton has joined #ruby
john has joined #ruby
youdonotexist has joined #ruby
<pen> just updated again
<pen> refresh
<pen> so the thread should call but it is not
<pen> if you puts in timeout? it doesn't print anything
burns180 has joined #ruby
<apeiros_> pen: your thread crashes probably
<pen> apeiros_: why?
<apeiros_> put `Thread.abort_on_exception = true` on top of your code
<burgestrand> Thread.abort_on_exception = true
<burgestrand> ^ holy grail of working with threads
<burgestrand> >.>
greenarrow has joined #ruby
<apeiros_> because `self.push obj` almost certainly crashes
<Phrogz> pen: http://pastie.org/3550271 After I fixed your code to actually run and then join the thread, I get the error that "update" is not defined (which it isn't).
<apeiros_> unless… oh my, are you srsly patching Queue from stdlib?
<Phrogz> pen: This shows that the thread correctly calls the timeout? and notify methods.
<apeiros_> DO NOT DO THAT
<pen> apeiros_: why not?
coreydaley has joined #ruby
<apeiros_> because you *will* fuck up
<pen> Phrogz: that's a typo sorry, it should be notify_observers
<apeiros_> create your own class and inherit from Queue, use that
<pen> apeiros_: I am only extending
<Phrogz> pen: If I change the implementation of `notify` to `p @timeout; exit` it works, showing 3
<pen> apeiros_: oh, in my code i'm inheriting
<pen> apeiros_: just in this snippet I didn't inherit :P
<apeiros_> pen: no, for starters, you override initialize
<pen> Phrogz: interesting
<apeiros_> and you most certainly do NOT correctly initialize it
<pen> apeiros_: oh and I forgot to put super
<pen> super()
<apeiros_> super will not help
<apeiros_> you killed the original initialize
<Phrogz> pen: apeiros might give you better help instead of insults if instead of showing what you've done you describe what you are trying to accomplish.
<apeiros_> super will invoke Object#initialize. that's pointless.
<Phrogz> apeiros_: He said that he normally inherits it, so presumably "Queue" is actually "MyQueue < Queue" in his real code.
Ch4rAss has joined #ruby
<pen> Phrogz: well, I was testing this concept, my code is essentially the same
ascarter has joined #ruby
<apeiros_> Phrogz: yeah, showing a broken example == epitome of stupid
amesha has joined #ruby
<Phrogz> Gentle, buddy.
<apeiros_> raaaah!
<apeiros_> :-p
<Phrogz> nerdrage!
<apeiros_> *trollface*
<pen> Phrogz: well then you think the thread can't do function call?
<Phrogz> pen: No, it all worked for me.
<shevy> "<apeiros_> you killed the original initialize" <-- makes me sad :(
mdw has joined #ruby
<shevy> why do you kill things man
<pen> Phrogz: you mean without any change? (besides those typo and error I had)
<Ch4rAss> I have file in bin/ and I would like to require there another file which is in lib/. What is the good way to do that?
Drewch has joined #ruby
n3m has joined #ruby
<Phrogz> shevy: Everything must die, and some things should be killed sooner rather than later.
<Phrogz> It's for the good of the species and ecosystem..
bwlang_ has joined #ruby
hasrb has joined #ruby
<pen> shevy: 'extending not kill' :)
<pen> Phrogz: anyway, I will try again
Keva161 has joined #ruby
<dbgster> is it possible to write code that it looks up hash keys with either symbol or string?
<dbgster> my yaml file is by strings, when I use hashes it uses symbols
MrGando has joined #ruby
<apeiros_> dbgster: yes. take a look at activesupport's HashWithIndifferentAccess
<apeiros_> alterantively, normalize your input
<Phrogz> dbgster: Or...yeah, that. ^^
<apeiros_> (IMO to be preferred)
<dbgster> IMO?
<apeiros_> pen: kill, not extending
<apeiros_> pen: extending means you can reach the original by super. you can't.
<apeiros_> ergo, kill.
<dbgster> oh, like call to_symbol on it?
stephenjudkins has joined #ruby
<apeiros_> dbgster: to_sym, yes
<apeiros_> though I'd probably go the other way, if you don't control the input
<pen> apeiros_: extending doesn't mean that I have to have access to original super :)
<dbgster> no wait that won'g work, oh meaning on the inputted hash keys.
<apeiros_> (symbols from an open source are a memory leak and therefore an attack vector)
<apeiros_> pen: you fail at ruby terminology then
<apeiros_> pen: what you do is called monkey-patch
<apeiros_> class Foo < Bar is called inheritance
<apeiros_> Foo.extend Bar is called extending
<apeiros_> and yes, it matters. at least if you want to be understood.
ilyam has joined #ruby
senj has joined #ruby
c0rn has joined #ruby
iocor has joined #ruby
ringotwo has joined #ruby
vmatiyko has quit [#ruby]
ringotwo_ has joined #ruby
virunga has joined #ruby
timonv has joined #ruby
ascarter has joined #ruby
amesha has joined #ruby
libertyp1ime has joined #ruby
trivol has joined #ruby
fungoat has joined #ruby
amesha has joined #ruby
justinmcp has joined #ruby
wallerdev has joined #ruby
c0rn has joined #ruby
tshirtman has quit [#ruby]
gen0cide_ has joined #ruby
KL-7 has joined #ruby
burns180_ has joined #ruby
<msch> hey, anyone knows what the name of _why's webpage proxy that allowed users to annotate web pages was?
johndbritton has joined #ruby
theRoUS has joined #ruby
<Phrogz> msch: hoodwinkd?
<msch> Phrogz: yep! thanks!
bakineggs has joined #ruby
burns180 has joined #ruby
kpshek has joined #ruby
<dbgster> ruby sure makes thngs faster to develop, but it isn't' as easy as it looks :)
darthdeus has joined #ruby
<Eiam> i need some sensible irb settings
<Eiam> i go crazy when it echos the output of a statement when its huge, but then hate it when it stops doing it for 1-2 line responses.. plus auto complete and other thingies
Caius has joined #ruby
Spockz has joined #ruby
<rippa> try pry
<Eiam> so your suggestion is isntead of use irbrc
<Eiam> just use something other than irb..
<Ch4rAss> I have EM::Connection class in my project and also class ActiveRecord::Base and I would like to have object which inherits from both of them. How to achive that?
yoklov has joined #ruby
jlogsdon has joined #ruby
havenn has joined #ruby
<Eiam> oh, it looks like it has some debug stuff in it though too. well thats nice i keep meaning to go sit down and test that out. right now i debug with pp =(
<shevy> I love pp
<Eiam> i was in a meeting and someone told me about ap
<Eiam> so now im going to have to move to that, because it was pretty awesome
<Eiam> maybe we need 'pap' for pretty awesome print
<shevy> there exists "ap" for awesome print already
<shevy> ah
<shevy> well, and wirble for irb output too. gem install wirble
<shevy> I feel pp works nicely enough most the time anyway
<Eiam> ap was really nice
<Eiam> because i do deal with a lot of complex data structures
io_syl has joined #ruby
Vendethiel has joined #ruby
<Eiam> so the color coding and indenting would be nice. half the time i have to go into textmate and reformat the response to parse it better
<Eiam> parse/consume
mosca_ has joined #ruby
panpainter has joined #ruby
amesha has joined #ruby
bwlang_ has joined #ruby
kirun has joined #ruby
Divinite has joined #ruby
Vert has joined #ruby
amesha has joined #ruby
<RubyPanther> Eiam: the pry author is active in the channel, so it standard for people here to push it. I just use an .irbrc and wirble
<Eiam> well it would be nice to get access to my rails session data
<Eiam> instead of pp it all out and pulling it from rails c
<Eiam> and then bringing it into irb (which is what i do now)
<Eiam> it sounds like i say bindings.pry in my rails code and whenever i load pry, it will hit on that code line like a debugger would
akem has joined #ruby
hooper has joined #ruby
musha68k has joined #ruby
KL-7 has joined #ruby
mikepack has joined #ruby
trivol has joined #ruby
musha68k has joined #ruby
francisfish has joined #ruby
musha68k has joined #ruby
KL-7 has joined #ruby
<Eiam> RubyPanther: https://gist.github.com/893833 seems pretty nice
phantomfakeBNC has joined #ruby
shruggar has joined #ruby
mdw has joined #ruby
Wizecoder has joined #ruby
mdw has joined #ruby
burns180_ has joined #ruby
wilmoore has joined #ruby
<Eiam> holy shit my irb and rails c experience just got AWESOME.
Nss has joined #ruby
theRoUS has joined #ruby
theRoUS has joined #ruby
youdonotexist_ has joined #ruby
mdw_ has joined #ruby
shruggar has joined #ruby
adambeynon has joined #ruby
amesha has joined #ruby
snearch has joined #ruby
cyri_ has joined #ruby
hadees_ has joined #ruby
fr0gprince_mac has joined #ruby
fermion has joined #ruby
shruggar has joined #ruby
<Kyle__> Anyone here ever try using a dictionary with Zlib::Deflate? Did it help? more trouble than it's worth?
emocakes has joined #ruby
bwlang has joined #ruby
davidpk has joined #ruby
caiges has joined #ruby
Sou|cutter has joined #ruby
shruggar has joined #ruby
iMe has joined #ruby
imsplitbit has joined #ruby
jgarvey has joined #ruby
bwlang_ has joined #ruby
Zolrath has joined #ruby
Divinite has joined #ruby
DuoSRX has joined #ruby
youdonotexist has joined #ruby
badabim has joined #ruby
Vert has joined #ruby
odinswand has joined #ruby
Azure|dc has joined #ruby
\logic has joined #ruby
amesha has joined #ruby
bbttxu_ has joined #ruby
<Drewch> anyone know why I can't run rake install without being root?
<Drewch> I always have to do rvmsudo rake install
<Drewch> or else i get: rake aborted! Couldn't install gem, run `gem install /path/goes/here' to get more info
Azure has joined #ruby
<jlebrech> Drewch #rubyonrails
<Kyle__> Drewch: Err, if you run make without being root, you generally get that, because make install generally writes files for the whole system to use. Rake, being ruby's make, is similar.
bwlang_ has joined #ruby
dzhulk has joined #ruby
stringoO has joined #ruby
phantomfakeBNC has joined #ruby
<Drewch> jlebrech: ?? I'm talking about ruby not rubyonrails
iocor has joined #ruby
<jlebrech> ok
<Drewch> Kyle__ I rarely .. in fact I can't even think of a time when I ran make as root
<undersc0re> gems now install to .gems/
<undersc0re> in ruby 1.9.3
<Drewch> I running this: https://github.com/plamoni/SiriProxy
<Drewch> and last week I was able to run rake install
<Drewch> and this week for whatever reason I need to use rvmsudo rake install
<Drewch> so I'm just curious more than anything about what I did
<Drewch> because many of those commands on that page didn't require rvmsudo before, and now they dod =\
MrGando has joined #ruby
pantsman has joined #ruby
pantsman has joined #ruby
burns180_ has joined #ruby
simao has joined #ruby
<Kyle__> Drewch: yes, but make install is different than just running make :) (and ok, now days it's sudo make install)
bakineggs has quit [#ruby]
undersc0re has joined #ruby
iocor has joined #ruby
fbernier has joined #ruby
pantsman has quit ["Leaving"]
ashp has joined #ruby
jellosea_ has joined #ruby
ggolin has joined #ruby
theRoUS has joined #ruby
duard has joined #ruby
duard has quit [#ruby]
bwlang_ has joined #ruby
hubble has joined #ruby
<hubble> yo RUby people
<hubble> Any of you happen to know how I can get an ActionDispatch::Http::UploadedFile into an IO stream object?
<hubble> I want to use this gem to validate an uploaded file: https://github.com/dim/ruby-imagespec/ and it bonks on calling `readbyte` on the UploadedFile
<hubble> i don't /have/ to use this gem but File.open('path/to/file') works perfectly in tests, and now I need to figure out how to translate that when it's an UploadedFile
Drewch has joined #ruby
choffstein has joined #ruby
badabim_ has joined #ruby
somazero has joined #ruby
<hubble> aha, i can call #tempfile on it
<hubble> ; ) nvm!
sullx has joined #ruby
mayfield has joined #ruby
zulax has joined #ruby
<sullx> Hey, I keep getting this error when I am trying to save some data into my mysql db "/.rvm/gems/ruby-1.9.2-p290/gems/ruby-mysql-2.9.4/lib/mysql/charset.rb:264:in `encode': U+2013 from UTF-8 to ISO-8859-1 (Encoding::UndefinedConversionError) " I am on OSX. what can I do to make this conversion save correctly in my DB? Thanks
Gesh has joined #ruby
headius has joined #ruby
nobitanobi has joined #ruby
Divinite has joined #ruby
<sullx> I understand there is some kind of string encoding conversion going on but I am clueless as to how to deal with this error
mlevin has joined #ruby
<Phrogz> sullx: (general advice) Ensure that your Ruby code is in UTF-8, your database is storing in UTF-8 and that your DB adapter is communicating in UTF-8. Done.
jbw_ has joined #ruby
bwlang_ has joined #ruby
`brendan has joined #ruby
<Phrogz> It sounds like your DB is in ISO-8859-1. If you can't fix that, then pre-convert all your strings from UTF-8 to ISO-8859-1 in a lossy fashion before saving.
fermion has joined #ruby
<sullx> Phrogz: thanks for the advice, I will make sure and do this from now on. Assuming the db is in ISO-8859-1 how can I pre-convert all my strings from UTF-8 to ISO-8859-1?
burns180_ has joined #ruby
<Phrogz> sullx: Google about encoding conversion in Ruby 1.9
zul_ has joined #ruby
<shevy> encoding is the eternal suck
tatsuya_o has joined #ruby
drake10 has joined #ruby
drake10 has quit [#ruby]
havenn has joined #ruby
Vert has joined #ruby
systmkor has joined #ruby
<RubyPanther> Encoding used to suck, I thought it is all fixed now?
hubble has quit [#ruby]
<undersc0re> RubyPanther: encoding still sucks
bwlang_ has joined #ruby
madmax_ has joined #ruby
akem has joined #ruby
JivaD has joined #ruby
Bart_ has joined #ruby
JivaD has quit [#ruby]
<sullx> how can I ensure my Ruby code is in UTF-8?
duard has joined #ruby
<sullx> Phrogz: Or anyone else ^
<shevy> sullx your own code? I suppose with your editor
<td123> sullx: you could use "file filename"
<sullx> oh
<shevy> then there is the Encoding part
<shevy> # Encoding: ASCII-8BIT
<shevy> see, I try my best to avoid UTF wherever possible!
<Phrogz> sullx: Put #encoding: UTF-8 at the top of your files (or second line if you have a shebang) and then use a reasonable text editor that honors that claim.
stephenjudkins has joined #ruby
sgmac has joined #ruby
ismell has joined #ruby
<ismell> ello
<sullx> K. Im using TextMate, which I understand to be pretty reasonable. Phrogz your saying if I just put #encoding: UTF-8 the editor will actually ensure the code is in UTF-8?
<nobitanobi> I have an object like this: [{"label" => "mylabel1", "data" => "mydata1"},{"label" => "mylabel2", "data" => "mydata2"}] - And I would like to have two arrays, one of "labels" and the other one of "data". I have done it by doing a .each in the first object and filling two arrays with <<. Is there any rubiest way of doing so?
<Kyle__> sullx: I thought it was with file-save as, but it's been a long time since I've used windows.
<ismell> bundle install --deployment copies all my dependent gems into vendor/bundle, how can I get it so it also copies bundler ? my env doesn't have the bundler gem installed so when my app does require 'bundle/setup' it breaks
<sullx> TextMate is OSX
zulax has joined #ruby
<Kyle__> Wow. I thought OSX stuff used UTF by default. OK. Still, it's probably under file-save as, or possilby under properties.
<nobitanobi> Any ruby advocate here to clean this code I asked?
havenn has joined #ruby
<Phrogz> sullx: Yes, if you tell Ruby that your file is UTF-8 the strings you use inside there (not coming from other sources) will be treated as UTF-8. Try a tmp.rb with just p "80°" and you'll see Ruby barf when it tries to run it.
<Phrogz> "invalid multibyte char (US-ASCII)"
<Phrogz> Then throw the magic #encoding: utf-8 at the top of your file, save, and re run and watch it work.
Seisatsu has joined #ruby
rb2k has joined #ruby
Seisatsu has joined #ruby
rb2k has quit [#ruby]
burns180 has joined #ruby
badabim has joined #ruby
Wizecoder has joined #ruby
badabim has joined #ruby
<shevy> nobitanobi I'd also use .each and then not worry about it anymore
hck89 has joined #ruby
fr0gprince_mac has joined #ruby
bbttxu_ has joined #ruby
<nobitanobi> shevy: ok
<nobitanobi> >)
KL-7 has joined #ruby
dnyy_ has joined #ruby
Radar has quit ["Textual IRC Client: http://www.textualapp.com/"]
zulax has joined #ruby
CacheMoney has joined #ruby
sgmac has quit [#ruby]
bwlang has joined #ruby
cloke_ has joined #ruby
Boohbah has joined #ruby
hck89 has joined #ruby
Uni has joined #ruby
bwlang has joined #ruby
mlevin has joined #ruby
burns180_ has joined #ruby
pu22l3r has joined #ruby
tommyvyo has joined #ruby
pu22l3r has joined #ruby
<nobitanobi> I have an array of hashes and I am doing nectar_spends.sort_by! { |spend| Float(spend.salesSum) } to sort, but is doing it in ascending order. How do I do it in descending?
shintaku has joined #ruby
<nobitanobi> do I need to do a reverse! ?
<banisterfiend> nobitanobi: nectar_spends.sort_by! { |spend| -Float(spend.salesSum) }
sirdeiu has joined #ruby
<shintaku> stupid question. how do i sub ':' for '\:'? I try "foo:bar".sub(":", "\:"), but it shows "foo:bar" if I do "foo:bar".sub(":", "\\:") it shows "foo\\:bar"
<nobitanobi> uh, nice
<cdabba> can someone tell me why these two functions have different results? http://pastebin.com/Z8sVBbKa
emocakes has joined #ruby
<heftig> cdabba: the second one sets p, h and t to the same array
<apeiros_> shintaku: "\\" is a single backslash
<apeiros_> puts "\\" # will print \
<heftig> cdabba: try p,h,t = [],[].[]
<heftig> er
<heftig> cdabba: try p,h,t = [],[],[]
<cdabba> heftig: thanks
<shintaku> what am i missing, then
<shintaku> "foo:bar".sub(":", "\\:").to_s => "foo\\:bar"
<banisterfiend> heftig: sup hefty boy
<shintaku> i know the to_s isn't necessary, but just making sure
<apeiros_> shintaku: again, "\\" means a SINGLE backslash
<apeiros_> shintaku: you're looking at an inspect
<shintaku> oh yeah. i puts and it works
<shintaku> is there a way to do it w/o puts
<apeiros_> oh my
<shintaku> .to_idiot_mode
<shintaku> jk
iocor has joined #ruby
keymone_ has joined #ruby
<apeiros_> I'll never get why people have so much trouble understanding inspect
Squee-D has joined #ruby
<apeiros_> shintaku: s = "\\" # => "\\"; s.size # => 1
<shintaku> :P
<shintaku> i think it's cause we forget
<apeiros_> it's ONE LETTER. it inspect shows you how YOU would have to write it if you'd write it as a ruby literal.
<apeiros_> well, I better don't say what I think why…
<Kyle__> Anyone here ever try using a dictionary with Zlib::Deflate? Did it help? more trouble than it's worth?
n8ji has joined #ruby
chimkan has joined #ruby
<shintaku> thanks, apeiros_
<Boohbah> puts File.readlines('s').select{|m|m=~/#{File.readlines('h')}/}
<Boohbah> how can i make this shorter? :)
<Kyle__> Boohbah: It's fun to golf your code, but if you ever need to read that again, don't make it shorter :)
emocakes has joined #ruby
<apeiros_> Boohbah: see Enumerable#grep
<Boohbah> ok
<apeiros_> also, you seriously reread the file 'h' for every line in file 's'?
ismell has quit [#ruby]
<apeiros_> also, I think it's a condition that can never be met
<apeiros_> you specifically loop through single lines, and you match it against multiple lines…
<Boohbah> also, it has the intended functionality
<Boohbah> also, it is not meant to be practical
<Boohbah> just for fun
banseljaj has joined #ruby
sirdeiu has joined #ruby
<nsadmin> you could read the file into an array (one line per array element)
ceej has joined #ruby
iwaffles has joined #ruby
<iwaffles> on OS X has anyone had the segmentation fault issue with RMagick?
adeponte has joined #ruby
<apeiros_> someone certainly had
<iwaffles> And know the fix?
bwlang_ has joined #ruby
Asebolka has joined #ruby
justicefries has joined #ruby
<justicefries> hi all, I'm trying to run my test suite (on minitest) without using Rake::TestTask. Rake::TestTask is starting way too slowly and I wouldn't mind getting out of that depedency.
<justicefries> anyone have any ideas? I just need to run multiple files
samnang has joined #ruby
workmad3 has joined #ruby
burns180 has joined #ruby
<iwaffles> RMagick.rb:1635: [BUG] Segmentation fault no matter what I do - even followed everything in this: http://stackoverflow.com/questions/2838307/why-is-this-rmagick-call-generating-a-segmentation-fault without any luck. Anyone have any suggestions?
phantomfakeBNC has joined #ruby
systmkor has joined #ruby
cloke has joined #ruby
systmkor has joined #ruby
headius has joined #ruby
TheMoonMaster has joined #ruby
nari has joined #ruby
asobrasil has quit [#ruby]
paissad has joined #ruby
aknagi has joined #ruby
bbttxu has joined #ruby
timonv has joined #ruby
Sailias has joined #ruby
bbttxu has joined #ruby
nonotza_ has joined #ruby
liluo has joined #ruby
<sullx> I have a very large string, and I want to capture the value that follows 'Item #:', and nothing else, how can I do this?
<robacarp> sullx: very large?
tommyvyo has joined #ruby
<workmad3> sullx: regex
<robacarp> regex would porbably the choice
<sullx> yeah, can someone help me out with the regex and would I use a gsub, or scan?
Drewch_ has joined #ruby
<robacarp> steep learning curve, worth it.
Bonkers has joined #ruby
burns180_ has joined #ruby
burns180_ has joined #ruby
<sullx> robacarp: thanks. can anyone help me with this particular regex as I am on a time limit
Helius has joined #ruby
<robacarp> sullx: well, yea, gist your string data
headius has joined #ruby
<sullx> (and please don't tell me to use a parser because I am but I want an additional method to grab the value)
<sullx> :)
<robacarp> why are there literal \n in there
<sullx> robacarp: because thats how the parser (nokogiri) saved it as a string
Drewch has joined #ruby
<robacarp> are you on windows?
<sullx> osx
<robacarp> scraping newegg, eh
senj has joined #ruby
* sullx pat's robacarp on the back for his superior googling talent
<sullx> :)
<sullx> so, about this regex?
JivaD has joined #ruby
<robacarp> holdplz
stephenjudkins has joined #ruby
<sullx> k
<robacarp> I have a hunch that won't actually work thoug
<robacarp> but go for it
sspiff has joined #ruby
Sailias has joined #ruby
<robacarp> now, go use Mechanize to scrape newegg and go learn regex.
<sullx> thank you sir
<canton7> sullx, another possibility: /<b>Item #: <\/b>(\w+)/
Sailias_ has joined #ruby
Avanine has joined #ruby
tolland has quit [#ruby]
gazler has joined #ruby
<banisterfiend> sullx: do you know much about roman history
Karmaon has joined #ruby
<sullx> odd question. but ill bite: a fair amount about their scientific literacy, but other than that not more than the next joe
lewis1711 has quit [#ruby]
<banisterfiend> sullx: just your name reminded me of sulla
<sullx> ah
<sullx> no, relation their sorry :)
mikepack has joined #ruby
john_smith has joined #ruby
zulax has joined #ruby
<robacarp> well!? did it work?!
<robacarp> pins and needles here man!
danryan has joined #ruby
<sullx> robacarp: heh, it worked
<robacarp> phew.
<danryan> Hi folks, I'm trying to create a bit of a DSL to dynamically create methods. Here's the behavior I'd like to achieve: https://gist.github.com/2004181 How do I pass a block to define_method ? This didn't work: https://gist.github.com/2004181/625f9c4b01546b6fbbd16c7e2457de7dff1c3c7f
<sullx> indeed :). data is flowing, analysis is running.
coreydaley has joined #ruby
wilmoore has joined #ruby
<danryan> hum. I think I just got it :D
burns180 has joined #ruby
dv310p3r has joined #ruby
<banisterfiend> danryan: you can pass in &block to define_method
<banisterfiend> define_method(:pig) do |x, &block|
<banisterfiend> block.call
<banisterfiend> end
rtyler has joined #ruby
<Phrogz> ampersands everywhere
<Phrogz> I'm going to make a new company named that. &mpersands &verywhere
<danryan> banisterfiend: This worked for me: https://gist.github.com/2004181
<rtyler> I'm looking for an "infinite mock" for one of my tests, and I feel like there's something in rspec that should already do this such that 'mockedobj.foo.bar.baz' will "just work"
<rtyler> not sure what to search for though :/
<deryldoucette> Phrogz: strt an irc channel for marketing purposes. #how2amp
<Phrogz> danryan: In case that's not a pared-down example of what you're really trying to do with #action, you should know about Object#tap
undersc0re has joined #ruby
<banisterfiend> danryan: that's kind of different :) one defines a method (to be called later presumably) the other just does an instance_eval straight after the block is passed
shevy has joined #ruby
<banisterfiend> shevy: you trolled my friend on reddit
<robacarp> eh? splain!
<danryan> banisterfiend: Ah, hmmm. Not sure I understand the difference. With instance_eval, the block is eval'd right away? defining a method like that does indeed eval the block subsequent times
<rtyler> hahaha
<shevy> banisterfiend it's ok, I forgive him
<robacarp> link?
<rtyler> mystub.stub(:[]).and_return(mystub)
* rtyler facepalms
<shevy> ewww
<shevy> what is :[]
<shevy> that does not look valid
<banisterfiend> danryan: yeah, obviously you define a method for a reason: i.e you can you it by name at any point later u want to use it, and the block is stored as the method body so u dont have to keep passing it
<robacarp> shevy: yea, its valid.
<rtyler> shevy: that's the symbol for a hash or array item accessor
<rtyler> or a funny smiley face
<shevy> oh
<shevy> indeed
<robacarp> you can also do something like 5.send(:+,7).send(:/,2)
<shevy> but can you do anything useful with the :[] at all?
<banisterfiend> danryan: using instance_eval for a start u have to keep passing a block each time u want to use it (unless u save it to an ivar), secondly u dont get a method u can call at different points
<shevy> :+ I saw before