ChanServ changed the topic of #ruby-lang to: Ruby 1.9.3-p125: http://ruby-lang.org | Paste >3 lines of text on http://pastie.org or use a gist
burns180_ has joined #ruby-lang
<rhizmoe> is there a way to mark a variable as read-only?
<RegEchse> WillMarshall: i neither get your terminology (kinda weird) nor your question.
<RegEchse> rhizmoe: do you really mean _variable_? That would be what constants are for.
apeiros_ has joined #ruby-lang
Faris2 has joined #ruby-lang
<drbrain> not even constants are read-only in ruby
<RegEchse> drbrain: But that's what they're for. :)
<RegEchse> and he only asked a way for "marking". constants are "marked" as read-only. (what in fact doesn't bother ruby to reassign constants :/)
<injekt> it bothers ruby, ruby shouts at you
<injekt> but then it's all like lol na bro go ahead
<RegEchse> It's a fact i never got to look up: why does ruby have mutable _const_ants? xD
havenn has joined #ruby-lang
<injekt> ruby doesn't 'enforce' anything, it just indicates how you should use something sometimes
<injekt> like ruby doesn't have true private/protected methods, for example
<injekt> but we have the keywords because they're 'supposed' to be private/protected
<robbrit> rhizmoe: put a capital as the first letter of the variable
<injekt> dont just do that, though
io_syl has joined #ruby-lang
<robbrit> rhizmoe: if you put the first letter as a capital then Ruby will warn you when you change it, that's the closest you can get to a "constant" in ruby
<injekt> robbrit: you talk about it like it's not a 'Ruby constant' when you have it capitalized
robbrit has quit [#ruby-lang]
RedNifre has joined #ruby-lang
<RedNifre> Hello!
<RedNifre> I wrote a little class and I'd like to have myobject * 3 do something special (similiar to how "a"*3 results in "aaa"). How do I define how my own object reacts to *?
<injekt> def *(arg)
<RedNifre> I tried, somehow it didn't work. Guess I made a mistake somewhere else.
<RedNifre> brb (debugging)
burns180 has joined #ruby-lang
leonL_ has joined #ruby-lang
twittard has joined #ruby-lang
<RedNifre> "MyObject can't be coerced into Fixnum (TypeError)" what can I do about that? (The object encapsulates a number)
<injekt> can you paste your code?
<RedNifre> ok, one moment...
<rhizmoe> he's gone, but thanks robbrit
<RedNifre> there it is: http://pastebin.com/V1CBk8DP
mikeric has joined #ruby-lang
<RedNifre> I want to use this to represent a distribution of things, but it should also work in equations as a number (having the value of the total)
<injekt> RedNifre: and what's the problem?
<RedNifre> rb:48:in `-': Amount can't be coerced into Fixnum (TypeError)
<RedNifre> from midas.rb:48:in `-'
<RedNifre> hmmm....
thone has joined #ruby-lang
<RedNifre> at that point in the code @total should be somestring.to_i
<RedNifre> So what does it mean that it can't be coerced into fixnum? (I'm very new to ruby)
<injekt> this can't be all of the relevant code. You're trying to coerce your class into a fixnum which I can't see happening in that pastie
<RedNifre> Hm, no, the error is about coercing the number @total into a fixnum I think.
<drbrain> RedNifre: 1 + other_object uses the coerce protocol to convert other_object into a fixnum
<drbrain> so that addition may take place
<RedNifre> The error happens here:
<drbrain> no, it's about coercing Amount into a fixnum, not the value
<RedNifre> def -(number)
<RedNifre> @total - number
<RedNifre> end
<RedNifre> In the code I pasted.
<drbrain> "Amount can't be coerced into Fixnum"
achiu1 has joined #ruby-lang
<injekt> ^
<RedNifre> okay, but why does it happen at that... oh, right!
<RedNifre> number itself can be an Amount-Object...
<injekt> then there's the problem
<RedNifre> So what can I do if I want to write amount1 - amount2 ?
<injekt> @total - number.to_i
<RedNifre> of course! :)
<RedNifre> ...plus a to_i method for Amount that returns @total
<RedNifre> Thank you very much!
<petercooper> yeah, that bit is pretty critical here :)
<RedNifre> Heh, ruby is really nice. In Java it would have ended in Amount.add(Amount.sub(5)) ...
muzone has joined #ruby-lang
<petercooper> Don't worry, after several years of Ruby you might start to think.. hmm, being less implicit and magical and using more method calls is a great idea! And the cycle restarts ;-)
<RedNifre> :D
fayimora has joined #ruby-lang
lchi has joined #ruby-lang
<RedNifre> Hm, what's the best practice for writing +-/* functions? I mean, if you can multiply strings I guess anything goes?
<injekt> I avoid them
<injekt> usually
<injekt> :)
<drbrain> RedNifre: I try to make them consistent
<drbrain> with math
<injekt> ^ the only reason they should ever be used, imo
<drbrain> … so the operations are appropriately commutative, etc.
<drbrain> 0 + item == item, 1 * item == item, etc.
twittard has joined #ruby-lang
burns180_ has joined #ruby-lang
looopy has joined #ruby-lang
<WillMarshall> Silly and simple question
<WillMarshall> When I call Class.new(some_argument)
<WillMarshall> Class will receive initialize with some_argument, yes?
<drbrain> yes
jacktrick has joined #ruby-lang
<WillMarshall> drbrain: Cheers
<WillMarshall> If I'm subclassing and want to call super(), do I need to manually pass through those initializer arguments?
<andrewvos> Don't think so
<WillMarshall> eg class MySubClass < MyClass; def initialize; super; #do stuff; end; end;
<drbrain> WillMarshall: if the superclass needs them, yes
<WillMarshall> Will experiment. Cheers :)
<deryldoucette> petercooper: dude, between you and Gregory, I got tons to learn! I'm not often vocal for people that do awesome things. Let me just say, thanks :)
<petercooper> I saw your tweet, thanks man :)
<drbrain> Object#initialize doesn't do anything, so you don't need to super to it
<deryldoucette> welcome
plusk has joined #ruby-lang
<WillMarshall> drbrain: Cheers :)
QoQOoO has joined #ruby-lang
Banistergalaxy has joined #ruby-lang
Jade has joined #ruby-lang
Jade has joined #ruby-lang
Joeysomo has joined #ruby-lang
Joeysomo has joined #ruby-lang
burns180 has joined #ruby-lang
apeiros has joined #ruby-lang
apeiros_ has joined #ruby-lang
apeiros has joined #ruby-lang
apeiros_ has joined #ruby-lang
apeiros_ has joined #ruby-lang
SkramX has joined #ruby-lang
apeiros_ has joined #ruby-lang
shtirlic has joined #ruby-lang
neoesque has joined #ruby-lang
theconartist has joined #ruby-lang
burns180_ has joined #ruby-lang
RedNifre2 has joined #ruby-lang
chessguy has joined #ruby-lang
apeiros_ has joined #ruby-lang
<WillMarshall> Is there a "not implemented" exception in Ruby?
<drbrain> NotImplementedError
<WillMarshall> Thanks
esad has joined #ruby-lang
<esad> If you're using modules purely as namespace - like for example I want to put all my resque jobs into a module - do you prefer singular or plural?
<esad> Jobs::Crawl or Job::Crawl ? :)
burns180 has joined #ruby-lang
<drbrain> singular
voker57 has joined #ruby-lang
voker57 has joined #ruby-lang
PatrixCR has joined #ruby-lang
leonL has joined #ruby-lang
igotnolegs has joined #ruby-lang
apeiros has joined #ruby-lang
chimkan__ has joined #ruby-lang
nofxx has joined #ruby-lang
acyed has joined #ruby-lang
Sailias has joined #ruby-lang
lchi has joined #ruby-lang
burns180_ has joined #ruby-lang
Phrogz has joined #ruby-lang
heftig has joined #ruby-lang
<WillMarshall> How can I write to a classes @variables from outside that class?
Joeysomo has joined #ruby-lang
<shevy> WillMarshall you must allow an accessor method. use a method
<shevy> def foo(input)
<shevy> @variables = input
<shevy> end
<shevy> or
<shevy> def foo=(input)
<shevy> @variables = input
<shevy> end
<shevy> and then...
<WillMarshall> shevy: Cheers
<shevy> your_object.foo = "some new value"
<shevy> or
<shevy> your_object.foo "some new value"
<shevy> whatever you like more
<lianj> or obj.instance_eval{ @foo = :feels_dirty }
<shevy> usually the latter of has set_foo
<shevy> like
<shevy> your_object.set_foo "some new value"
<shevy> then @foo would be that value
<drbrain> WillMarshall: or you could just use attr_accessor :whatever
<lianj> that too ;)
<shevy> yeah that is shortest
Joeysomo has joined #ruby-lang
<WillMarshall> Chur
rick123 has joined #ruby-lang
<shevy> wat
<shevy> Marrr!!!
<shevy> do we make cat sound now
Natch| has joined #ruby-lang
<rick123> ok, I feel dumb for asking this, but I am doing this so wrong and in such a non-eloquent manner, I figured I'd ask.
<rick123> What's the best way to conditionally remove items from an array based on the items .length?
<petercooper> Array#delete_if is one option
<rick123> ah ok
<shevy> #reject
<rick123> Thank you, that is substantially better.
<petercooper> alternatively, use reject if you don't want to remove items but get a new array with them removed
<shevy> %w( cat dog monkey ).reject {|s| s.size > 4 } # => ["cat", "dog"]
<esad> there's also reject! :)
retro-in-better- has joined #ruby-lang
<lianj> why would someoe dislike delete_if?
<shevy> the _ is hard to make
<petercooper> they do two totally different things
<shevy> imagine if it would have been called
<shevy> deleteif
<lianj> petercooper: different then reject! ? because it replaces the old with the new array?
<shevy> or even
<shevy> delif
<shevy> %w( cat dog monkey ).delif {|s| s.size > 4 }
retro|cz has joined #ruby-lang
<petercooper> lianj: just synonyms in that case
<petercooper> ooh, actually, no not synonyms
<lianj> shevy: works with miniruby :P
<shevy> hmm yeah well perhaps delif is too short
<shevy> imagine if .inject would become .inj
<petercooper> delete_if always returns the array again, reject! does not always
<shevy> this uglifies ruby way too much
<lianj> you opened that door
macmartine has joined #ruby-lang
looopy has joined #ruby-lang
burns180 has joined #ruby-lang
twittard has joined #ruby-lang
PatrixCR has quit [#ruby-lang]
aza_kibo_ has joined #ruby-lang
brownies has joined #ruby-lang
Jay_Levitt has joined #ruby-lang
hahuang65 has joined #ruby-lang
Banistergalaxy has joined #ruby-lang
segy has joined #ruby-lang
segy has joined #ruby-lang
yeltzooo has joined #ruby-lang
<retro|cz> shevy, and .tap would become .tap
ged has joined #ruby-lang
westernanalog has joined #ruby-lang
rohit has joined #ruby-lang
heppy has joined #ruby-lang
srbaker has joined #ruby-lang
robbrit has joined #ruby-lang
<deryldoucette> petercooper: hey I was talking on twitter with mitchellh. Potential article. How to write a C extension for ruby.
<petercooper> It's been done a few times. What's the new take?
esad has quit ["["Textual IRC Client: www.textualapp.com"]"]
rippa has joined #ruby-lang
<petercooper> And TBH, unlike him, I quite like FFI. But I probably haven't gotten far enough to get annoyed with it yet either ;-)
<deryldoucette> nothing. *I* havne't seen any recent articles on how to write one, even one as mitchellh suggested of just doing an echo. I've subscribed to just about eveerything I can think of for ruby stuff, and thats definitely not one that I can honestly say I remember being covered. He mentioned there are a couple out there, but they're all dated.
<deryldoucette> was just thinking to myself "I'd definitely look into something like that"
<petercooper> I had to double check that even worked last week because it got linked on Reddit for some reason
<deryldoucette> hehe
<petercooper> I've definitely seen a fuller one in the last year.. but finding these things..
burns180_ has joined #ruby-lang
<deryldoucette> well i see all the latest and greatest for gems and stuff but thats something thats definitely not given a lot of coverage.
<petercooper> http://rubysource.com/extending-ruby-with-c/ is one that approaches it from the analysis end
gokul has joined #ruby-lang
<deryldoucette> i'll look into those two. thanks
<petercooper> aha.. think I've found it
<petercooper> 12 parter series
<deryldoucette> 12 parter? sheesh! wtf! why haven't i seen that in my google hunts.
<petercooper> That dude should really update them to 1.9 and release them as an e-book or something
<deryldoucette> :)
<deryldoucette> i don't look at anything thats 1.8.x at ALL. I haven't touched 1.8.x in quite some time.
<petercooper> another pretty simple one: http://citizen428.net/blog/2011/06/24/ruby-going-to-c-side/
<rohit> petercooper: That dude indeed should, maybe he can use leanpub
<deryldoucette> christ. only just mentioned it and already I got 4 tabs from you on it. thats crazy! hah!
<rohit> petercooper: Do you have your ruby bookmarks online? Like delicious or something?
<petercooper> being a veracious bookmarker has its benefits
<deryldoucette> hehe i see that! hell *I* can't pull them up that fast and I got TONS of stuff on delicious!
<petercooper> no, I stopped using delicious about a year ago and use a local script system now
<petercooper> all I do to pull those up is: l extension at my terminal and I see all my links that mention extensions.
dr0id has joined #ruby-lang
<petercooper> it works all through a text file I have in my dropbox so I get it on all my machines
<petercooper> only downside, no public sharing.. but I guess I could make the file world readable at some point.
<deryldoucette> hah! cheater
<petercooper> heh, having ruby or rails apps running over dropbox is a major cheat of mine
<petercooper> rather than deploying them to a real server
<deryldoucette> seen a couple articles about static pages on DB, but didn't know you could do a rails app
<deryldoucette> i might try that!
<petercooper> remember rails uses sqlite by default
<petercooper> and being regular files, sqlite databases sync file over dropbox
<rohit> A curated directory of links to good and memorable and worthy links to blogs posts etc
<deryldoucette> i'ma have to try that
<petercooper> That's my other guilty secret, using SQLite almost everywhere
<deryldoucette> i'm a pg boy. sqlite3 always seemed akin to using an access db or something :)
<petercooper> It depends what you're doing. If it's just pretty dumb storage with the barest of SQL needed, it works a treat.
pp01bit has joined #ruby-lang
<deryldoucette> nice
<deryldoucette> ok, bedtime for me. after nidnight
<petercooper> ta ta :)
<deryldoucette> btw, many thanks
<deryldoucette> &
<shevy> nidnight?
lele has joined #ruby-lang
Zolrath has joined #ruby-lang
<rohit> petercooper: Do you think there is any scope for something like this? http://rohitarondekar-postsonrails.heroku.com/topics
tonesfrommars has joined #ruby-lang
<petercooper> Maybe. You'd have to try it :)
<rohit> I gave up on it long back, let the domain expire too
<petercooper> I had a similar thing several years ago, same situation
<petercooper> it's tricky
AndChat- has joined #ruby-lang
<rohit> petercooper: Hmm ok, thanks.
<brownies> the problem with such things is they go out of data very quickly
<brownies> *out of date
<brownies> at which point you basically have a less useful version of ASCIIcasts
burns180 has joined #ruby-lang
<rohit> brownies: Basically requires a lot of work curating. Might as well rely on petercooper's newsletters and use your own bookmarking solution to keep track of things you need :P
<petercooper> This is the thing
<rohit> petercooper: btw you probably get this a lot but your newsletters are super awesome! :)
<petercooper> I'm always looking up stuff I remembered linking in those. And I've had people ask me to look up stuff too.
<petercooper> So I should probably implement a search across the entire archive.
<rohit> petercooper: that would be awesome
<brownies> hm, who is that one guy that has a paid email newsletter for ruby? or maybe rails?
<petercooper> JEG2?
<rohit> There is one more by Gregory Brown
<rohit> I can't remember his twitter handle, for some reason I keep remembering seabiscuit :P
<petercooper> lol
<petercooper> @seacreature
<petercooper> here's his one, btw: http://practicingruby.com/
<rohit> Ah right, that's the one
macmartine has joined #ruby-lang
<brownies> that was the one, thanks petercooper
S0lign0c has joined #ruby-lang
mikeric has joined #ruby-lang
rdeshpande has joined #ruby-lang
znz_jp has joined #ruby-lang
apeiros_ has joined #ruby-lang
rohit has joined #ruby-lang
guns has joined #ruby-lang
achiu1 has joined #ruby-lang
krz has joined #ruby-lang
burns180_ has joined #ruby-lang
cdnz has joined #ruby-lang
looopy has joined #ruby-lang
twelvechairs has joined #ruby-lang
burns180 has joined #ruby-lang
rohit has joined #ruby-lang
JohnBat26 has joined #ruby-lang
achiu1 has joined #ruby-lang
Giddeon has joined #ruby-lang
<erikh> internet!
x0F__ has joined #ruby-lang
<shevy> dodge!
ryanf has joined #ruby-lang
krzyhoo has joined #ruby-lang
<krzyhoo> hey guys, anyone here at this insane hour?
sym- has joined #ruby-lang
<rippa> how is it insane?
jimmy has joined #ruby-lang
burns180_ has joined #ruby-lang
<krzyhoo> well
<krzyhoo> 7 in DE
<krzyhoo> wehere are you at Rippa?
heftig has joined #ruby-lang
Zolrath has joined #ruby-lang
yxhuvud has joined #ruby-lang
burns180 has joined #ruby-lang
twittard has joined #ruby-lang
gokul has joined #ruby-lang
twittard has joined #ruby-lang
amerine has joined #ruby-lang
twittard_ has joined #ruby-lang
<rippa> russia
<tonesfrommars> It's a reasonable hour here in California.
<krzyhoo> so it seems im in the middle
<krzyhoo> but since the sun is already up
<krzyhoo> i can manage
<krzyhoo> ok guys
<krzyhoo> have a question.
|Vargas| has joined #ruby-lang
|Vargas| has joined #ruby-lang
<krzyhoo> I have a yaml configuration file with three levels: the most nested one describes a connection for a particular table,second to last for a db schema and third is a fallback
<krzyhoo> now in order to dynamically select one connection parameter I am using this (and it works):
<krzyhoo> yaml = YAML.load(File.open('connections.yaml'))
<krzyhoo> yaml['p_EMPLOYEE']['g_SAMPLE_SCHEMA']['t_DEPT'], yaml['p_EMPLOYEE']['g_SAMPLE_SCHEMA'], yaml['p_EMPLOYEE']].compact.shift['par_connection_string']
<krzyhoo> (missed '[' in the beginning)
<erikh> can you give us an example yaml document?
<krzyhoo> what i need now is a way to iterate through all three levels in order to use this yaml file as a pattern to create connections
<krzyhoo> sure
burns180 has joined #ruby-lang
<krzyhoo> pastie comming up
<krzyhoo> observe only the first level is filled
<krzyhoo> btw par_connection_string ist not in my paste. it is equal to connect_string
<erikh> so you want a cascade if I understand correctly?
<krzyhoo> yup
<krzyhoo> i want to create all those connections
<krzyhoo> i have a command for it
<krzyhoo> not need to iterate through all the levels
<erikh> yaml[key1].merge(yaml[key1][key2]).merge(yaml[key1][key2][key3])
<krzyhoo> awesome
Randroid has joined #ruby-lang
<erikh> give that a shot and see if it gets you what you want.
<krzyhoo> ok
<krzyhoo> on it :)
<erikh> depending on what matters more, you might need to reverse the order of the merge
<erikh> e.g., starting with key3 and merging down to key1
<krzyhoo> all the connections need to be created
<krzyhoo> as thisdocument is used by both: connection creator
<krzyhoo> and erb template where connections are paremetrises
Randroid has joined #ruby-lang
<erikh> ok; read the docs for Hash#merge, I'm not sure precisely what you're asking at this point.
<erikh> but it's *probably* a part of the solution here.
<krzyhoo> erikh: read that merge thing
<krzyhoo> well it's not quite what i need
<krzyhoo> i will describe my problem in detail
<erikh> if the items in the highest level (root) are fallback and it works up to that
<erikh> you... probably want Hash#merge, you just need to create n objects instead of just 1
<erikh> either way I need to go
<krzyhoo> ok
neoesque has joined #ruby-lang
<erikh> https://gist.github.com/2020108 # holy crap THANK YOU -- ruby users for the advancement of `while`
frangiz has joined #ruby-lang
<rippa> erikh: x/2==(1.0*x)/2 #is this even/odd check?
Jay_Levitt has joined #ruby-lang
sym- has joined #ruby-lang
Zolrath has joined #ruby-lang
burns180_ has joined #ruby-lang
burgestrand has joined #ruby-lang
aza_kibou has joined #ruby-lang
looopy has joined #ruby-lang
<krzyhoo> is there a more sexy way?
<krzyhoo> connections = File.dirname(clp.input_file) + '/' + File.basename(clp.input_file, File.extname(clp.input_file)) + '_connections.yaml'
<krzyhoo> i think i overditi it
<krzyhoo> i mean overdid it
mytrile has joined #ruby-lang
heftig has joined #ruby-lang
dc5ala has joined #ruby-lang
amerine has joined #ruby-lang
rue has joined #ruby-lang
headius has joined #ruby-lang
mikeric has joined #ruby-lang
Avanine has joined #ruby-lang
Mchl has joined #ruby-lang
burns180 has joined #ruby-lang
gianlucadv has joined #ruby-lang
<krzyhoo> dear magicians
<krzyhoo> how gan i move quickly from:
<krzyhoo> to:
<krzyhoo> gan = *can
beiter has joined #ruby-lang
gnufied has joined #ruby-lang
gnufied has joined #ruby-lang
<krzyhoo> so no tips?
A124 has joined #ruby-lang
solars has joined #ruby-lang
burns180_ has joined #ruby-lang
cyri_ has joined #ruby-lang
WillMarshall has joined #ruby-lang
vmoravec has joined #ruby-lang
werwolf has joined #ruby-lang
Stalkr_ has joined #ruby-lang
werwolf has joined #ruby-lang
piglop has joined #ruby-lang
zmack has joined #ruby-lang
d3vic3 has joined #ruby-lang
gray has joined #ruby-lang
Jay_Levitt has joined #ruby-lang
beiter_ has joined #ruby-lang
robbyoconnor has joined #ruby-lang
kaiwren has joined #ruby-lang
burgestrand has joined #ruby-lang
Hakon|mbp has joined #ruby-lang
sdeobald has joined #ruby-lang
burns180 has joined #ruby-lang
pp01bit has joined #ruby-lang
chimkan__ has joined #ruby-lang
d3vic3 has joined #ruby-lang
<_rane> how is it possible that require 'somelib' works in irb but fails in ruby <file> while $: for both environments is identical
canton7 has joined #ruby-lang
Natch| has joined #ruby-lang
rue has joined #ruby-lang
Natch| has joined #ruby-lang
futurechimp has joined #ruby-lang
<gray> shevy: hi
d3vic3 has joined #ruby-lang
gianlucadv has joined #ruby-lang
heftig has joined #ruby-lang
fayimora has joined #ruby-lang
toretore has joined #ruby-lang
<krzyhoo> gan = *can
roadkith has joined #ruby-lang
d3vic3 has joined #ruby-lang
<krzyhoo> anyone here has an idea how to flatten nested hashes?
pw_ has joined #ruby-lang
igaiga has joined #ruby-lang
fayimora has joined #ruby-lang
A124 has joined #ruby-lang
nofxx has joined #ruby-lang
burns180_ has joined #ruby-lang
roadkith has joined #ruby-lang
mikkelb has joined #ruby-lang
mikkelb has quit [#ruby-lang]
sdeobald has joined #ruby-lang
justinmcp has joined #ruby-lang
virunga has joined #ruby-lang
virunga_ has joined #ruby-lang
<andrewvos> krzyhoo: Don't get them nested in the first place *look of disapproval*
tekin has joined #ruby-lang
<krzyhoo> andrewvos: but i need it for a fallback scenario
<andrewvos> krzyhoo: I do not understand.
<krzyhoo> well look at my pastie
<krzyhoo> the follwing is important
<krzyhoo> client might have ca 800 tables
<krzyhoo> they belong to ca 30 groups
<krzyhoo> and thouse 30 groups build one project
<krzyhoo> i need to implement a solution where a connection can be defined wither at table, group or project level
<krzyhoo> where project serves as fallback
<andrewvos> The fuck
<krzyhoo> so i can read it with:
* andrewvos goes back to writing simple code
<krzyhoo> [yaml['p_EMPLOYEE']['g_SAMPLE_SCHEMA']['t_DEPT'], yaml['p_EMPLOYEE']['g_SAMPLE_SCHEMA'], yaml['p_EMPLOYEE']].compact.shift['connection_name']
<andrewvos> krzyhoo: I hope this code isn't being used in any sort of production application :|
<krzyhoo> sort of
<krzyhoo> it is a data anonymisation project
<krzyhoo> but it is simple
<krzyhoo> what you see in my yaml are just parameters for a program that creates a connection
<krzyhoo> since the program can use all of those i had to implement that
<krzyhoo> andrewvos: you with me there buddy?
<krzyhoo> if you ask yourself why the nesting, the answer is, a table with the same name might exist in two groups
<andrewvos> krzyhoo: Break your problems into small pieces and I'll help you. I disagree with that giant config file on a religous level though.
<andrewvos> krzyhoo: Ok well use classes to solve your problem
<andrewvos> krzyhoo: Construct a class relationship from that data
<krzyhoo> andrewvos: a what? where do i read on that?
<andrewvos> Make it so that the next person who uses your code doesn't want to chew their own face off.
tomzx has joined #ruby-lang
<andrewvos> krzyhoo: Basically I mean map that data to some sort of class
<krzyhoo> andrewvos: bummer. i actually thought it is a pretty slick way for a fallback scenario
<andrewvos> An object that contains attribtues. Object.database_name or whatever
<andrewvos> I don't get what you mean by fallback scenario?
<krzyhoo> oh i get it
_ko1 has joined #ruby-lang
<krzyhoo> well..if thetre is no connection defined for a table
<krzyhoo> the fallback scenario is to grab connection details from a group
<krzyhoo> and if no connection of defined for a croup, the fallback is to grab those of a project
<krzyhoo> and the file you have seen serves two purposes
<krzyhoo> the [yaml['p_EMPLOYEE']['g_SAMPLE_SCHEMA']['t_DEPT'], yaml['p_EMPLOYEE']['g_SAMPLE_SCHEMA'], yaml['p_EMPLOYEE']].compact.shift['par_connection_string'] part is in my ERB
<krzyhoo> so that is takes the connection details of the finest granularity (closest to table)
<krzyhoo> same file should serve as input for a program that creates the connection
<krzyhoo> and this is the hard part
<Stereokitsune> it blows my mind out
<andrewvos> Yeah me too man
<krzyhoo> as in order to create all the defined conenctions
<andrewvos> krzyhoo: Too complex. Burn it and make it simple
<krzyhoo> i need to un-nest the hashes
<andrewvos> Take that yaml file out back and shoot it in the head.
<krzyhoo> hmmm
<krzyhoo> that makes me really sad
<krzyhoo> I've seen some pretty fucked up code omn the net
<Stereokitsune> also, is it right to save configurations for the site (like MySQL connection options) in YAML file?
<krzyhoo> very important.
<krzyhoo> this is not Rails app
<andrewvos> Stereokitsune: Well I would just save them in ruby code. Ruby is just as readable as yaml. Otherwise store them somewhere externally. I like how heroku does it.
<krzyhoo> the ERB describes is an XML file
<krzyhoo> for a proprietary application
verto has joined #ruby-lang
<Stereokitsune> andrewvos: I just wanted to make my simple app more useable by others. Or is it a bad habit after attempts to program in PHP?
burns180 has joined #ruby-lang
<krzyhoo> well andrewvos I'll try and go with the Class for ConnectionParams
<andrewvos> Stereokitsune: Don't think ahead too far man. Just get the job done.
<andrewvos> ConnectionParameters.
rue has joined #ruby-lang
fayimora has joined #ruby-lang
rohit has joined #ruby-lang
znz_jp has joined #ruby-lang
dhruvasagar has joined #ruby-lang
AndChat| has joined #ruby-lang
tla has joined #ruby-lang
lsegal has joined #ruby-lang
burns180_ has joined #ruby-lang
<krzyhoo> ok, fuck nestes hashes
<krzyhoo> am going with proper naming conventions
<krzyhoo> p_EMPLOYEE_g_SAMPLE_SCHEMA_t_DEPT
<krzyhoo> p_EMPLOYEE_g_SAMPLE_SCHEMA
<krzyhoo> p_EMPLOYEE
Joeysomo has joined #ruby-lang
chimkan__ has joined #ruby-lang
sandbags has joined #ruby-lang
toretore has joined #ruby-lang
rubyplusplus has joined #ruby-lang
verto_ has joined #ruby-lang
<rue> Try object-oriented programming
<andrewvos> That will never take off.
<darix> rue: dont you think the overhead will be too high?
<rue> Of using Ruby? Probably.
<krzyhoo> it did :D
<krzyhoo> flies like an angel now
Stefan__ has joined #ruby-lang
alim has joined #ruby-lang
<Stefan__> Hi, I have a small problem. I have a hash {'foo' => 1, 'bar' => 2} and an array containing ['foo'] and I want to have the value of the hash at the key 'foo'. Normally I could do hash.value_at('foo') - but I want to do hash.value_at(['foo']) which doesn't work. How can I do what I want?
m3nd3s has joined #ruby-lang
knobo has joined #ruby-lang
mark_locklear has joined #ruby-lang
burns180 has joined #ruby-lang
<darix> Stefan__: hash[array.first]
<darix> Stefan__: hash[array[0]]
<darix> array.map {|k| hash[k] }
<darix> pick your poison^wsolution
<Stefan__> darix: thanks, but the hash and the array are much longer than in my example here.
verto has joined #ruby-lang
<Stefan__> darix: Basically I have an array containing all the keys of the hash where I want to have the values to
<darix> Stefan__: then use the map line
<darix> it will return you an array with all the values
<Stefan__> darix: okay, with {|k| array.include? k} ?
<rippa> Stefan__: hash.values_at(*array)
<darix> or that.
<Stefan__> rippa: No, its hash.values_at(key, key, ....): http://www.ruby-doc.org/core-1.8.7/Hash.html#method-i-values_at
<rippa> Stefan__: exactly
<Stefan__> rippa: That's the soution I already tried...
<rippa> no
<darix> Stefan__: uhm ... well you could zip it to strip the nil values ... but that would make them different size
<rippa> you didn't
<rippa> because it works
<darix> Stefan__: the * will unpack your array
<darix> try it
<rippa> splat operator
<Stefan__> darix: Ah okay :)
<darix> also note the values_at vs your own value_at
<Stefan__> darix: I think that's what I searched for :)=
<manveru> >> {a: 1, b: 2, c: 3}.values_at(*[:a, :a, :c])
<manveru> => [1, 1, 3]
<Stefan__> darix: yes, that was a mistype ^^
<Stefan__> okay it works, thanks darix
<darix> you mean rippa
<Stefan__> yes, rippa too :)
<Stefan__> didn't know about the * :)
tommyvyo has joined #ruby-lang
burns180_ has joined #ruby-lang
moemen has joined #ruby-lang
retro|cz has joined #ruby-lang
Sailias has joined #ruby-lang
<Stefan__> How can I concat lines 2-4 into one line? http://pastie.org/3577325 Format of the replacement array/hash isn't important
Sailias_ has joined #ruby-lang
<sym-> why would you want to? it looks prettier the way it is
<kyrylo> Stefan__, the block of Array#each method doesn't accept two arguments.
<Stefan__> kyrylo: take each_with_key ;) My real code looks a little bit different ;)
<Stefan__> sym-: hm, lines 2-4 could get much more lines...
burns180 has joined #ruby-lang
Tukeke has joined #ruby-lang
yalue has joined #ruby-lang
<shevy> Stefan__ that is already terse
<Stefan__> shevy: in which function?
canton7 has joined #ruby-lang
cdnz has joined #ruby-lang
<shevy> function?
<shevy> I am not sure you can make this code much more compact
Stalkr_ has joined #ruby-lang
<shevy> you could pass the values through a method perhaps though
<Tukeke> Hi People
<Tukeke> :D
workmad3 has joined #ruby-lang
Tukeke has quit ["
Asher has joined #ruby-lang
mssola has joined #ruby-lang
malev has joined #ruby-lang
beiter has joined #ruby-lang
seydar has joined #ruby-lang
<seydar> how do i do bulk insert with Sequel?
bglusman has joined #ruby-lang
FiXato has joined #ruby-lang
malev has joined #ruby-lang
lele|w has joined #ruby-lang
<Stefan__> sym- kyrylo shevy: I now did it this way: http://pastie.org/3577518
dv310p3r has joined #ruby-lang
leonL has joined #ruby-lang
burns180_ has joined #ruby-lang
ankurgel has joined #ruby-lang
justinxreese has joined #ruby-lang
<ankurgel> ahoy!
<ankurgel> Help me out with this https://gist.github.com/2021880 please.
<ankurgel> How do I create method chaining myself? ^
<rue> 1.to_s.reverse
<canton7> heh, we had someone with this coursework yesterday as well
<tobiasvl> ankurgel: method chaining is just that the latter method is called on the object returned from the next-to-last method call, etc
<tobiasvl> no magic
futurechimp has joined #ruby-lang
<ankurgel> How does it decide the previous method before chaining?
<tobiasvl> (1.to_s).reverse
<ankurgel> confused in that par.
<seydar> tobiasvl: there's coursework on method chaining?!?!
<tobiasvl> seydar: what? i dunno? coursework?
<tobiasvl> are you talking to canton7 ?
<ankurgel> tobiasvl: I know method chaining.. but I want to create that there myself in that class.
<ankurgel> coursework? Is that eing directed to me?
<ankurgel> being*
<seydar> whoops, yeah, sorry
<tobiasvl> ankurgel: well just define the method `in`?
<tobiasvl> by skimming the code it seems you return self (times some stuff), right
<ankurgel> in takes a symbol, so I parse it to to_s to work?
kurko_ has joined #ruby-lang
<canton7> ankurgel, just use symbols as your hash keys
<ankurgel> yes.
<tobiasvl> yeah
<tobiasvl> what canton7 said actually
<tobiasvl> why use strings as hash keys at all
<canton7> that's more "proper" (and a lot cheaper I think)
<ankurgel> oh. I can use symbols as keys then., right?
<canton7> you can call .to_sym on the method_id to accept string arguments as well
<manveru> method_missing always gets symbols in 1.9
<manveru> unless you call it directly.... in which case you should know better :)
<ankurgel> manveru: when I am passing 1000.rupees , that rupees is being passed as symbol?
<manveru> yes
<manveru> ι ~ % ruby -e 'def method_missing(*a); p(a) end; 1000.rupees'
<manveru> [:rupees]
<ankurgel> I can't do gsub on symbol, right?
<ankurgel> using string there to remove trailing 's', rupee/rupees, euro/euros et al
<manveru> yeah, that needs to_s then
<ankurgel> Okay. So basically, to do something like 1000.rupees.in(:euros), I can just create in method in that class itself which will take a symbol as a param.
<ankurgel> def in(:symb) #this?
<tobiasvl> no
<tobiasvl> just def in(symb)
<tobiasvl> no colon there
<tobiasvl> symb is a variable that holds the symbol
<ankurgel> yeah, right. :)
<tobiasvl> otherwise, seems fine ;)
slaytanic has joined #ruby-lang
alim_ has joined #ruby-lang
JEG2 has joined #ruby-lang
<canton7> manveru, any reason you're capturing *args, but not passing them to super?
ankurgel has joined #ruby-lang
<manveru> they are passed to super automatically
<canton7> (or is arg-passing done automatically...?)
<canton7> aha, ta
<manveru> if you don't use super() or super(something)
<ankurgel> got disconnected.
<manveru> wrong number of args in method_missing is one of the craziest things to debug :P
<canton7> there's some crazy indentation in there
<ankurgel> crazy as in bad?
<ankurgel> I'm liking that.
<canton7> as in weird....
<canton7> aha, tabs vs spaces
<ankurgel> I should set indentation.. working on different machines is screw up
<Tasser> ankurgel, I'd use a class to represent the currencies
rayners has joined #ruby-lang
Sailias_ has joined #ruby-lang
<canton7> Tasser, so would most other people on here. It's part of their assignment, though, unfortunately
<ankurgel> Tasser: class to represent currencies on it's own? Isn't creating class variable better way then that?
<canton7> ankurgel, the point is you have a Currency class, which keeps track of the origin value, value in some base currency, current currency, etc. Then you might monkey-patch Numeric to have .rupee, etc, but these methods return an instance of Currency. #in is defined for Currency
Defusal has joined #ruby-lang
Defusal has joined #ruby-lang
<Tasser> ankurgel, huh? class Currency; def in(symb); end; end; class Numeric; def mm(*args); ... Currency.new(self, args.first); end; end
alim has joined #ruby-lang
<Tasser> canton7, then the assignment is stupid
<canton7> Tasser, I don't doubt
<ankurgel> assignments are trivial.
setmeaway has joined #ruby-lang
<canton7> manveru, I like. Any point in having #in throw a reasonbly sensible error if the argument isn't a good currency?
<manveru> sure
wubino has joined #ruby-lang
<wubino> Hello all
<wubino> How do I find what directory IRB is working out of while in an IRB session?
<canton7> Dir.pwd would probably do it, methinks?
slyphon has joined #ruby-lang
<Tasser> wubino, or use pry and do .pwd
<wubino> Thanks canton7
<wubino> You know I found pry today
<wubino> pry installed but is not recognized at the cl
<wubino> I am using rvm
<ankurgel> I installed pry gem today itself too. Was suggested earlier on this channel itself.
<ankurgel> wubino: If gem installed properly, it must work!
<wubino> If I were on windows I would add it to the env_vars but too knew to ubuntu / linux / rvm / ruby to figure it out right now
<ankurgel> rvm does exist in your path, right? Check "gem -v"
<ankurgel> also, using ruby in rvm by --default?
<wubino> 1.8.17
<ankurgel> ruby -v ?
<ankurgel> pry must work then.
<wubino> $ruby -v -> ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-linux]
<ankurgel> wubino: weird. Everything is set in your rvm then. pry -v
<ankurgel> Pry version 0.9.8.4 on Ruby 1.9.2
<ankurgel> works perfectly!
<wubino> pry: command not found
<ankurgel> wubino: you did 'gem install pry', right?
<wubino> Yep
<wubino> can't sudo it since I am using rvm
mistym has joined #ruby-lang
<ankurgel> wubino: mm-hmm. Maybe other can help you on this here. I can't think of any solution. :/
<wubino> ankurgel thanks for trying
Sailias_ has joined #ruby-lang
<ankurgel> wait! wubino, you created gemset?
<wubino> no whats that?
<wubino> gemset
<wubino> ?
<ankurgel> maybe that's why it's not working.
<ankurgel> gemset are required to associate our gems for current gemset which contain current ruby version we are working on + gem . AFAIK
<ankurgel> wubino: type: rvm --create use 1.9.3@mysetup
<ankurgel> then: rvm --default use 1.9.3@mysetup
<rue> No, a gemset isn't necessary
<rue> It could be a problem if you've somehow gone/installed into a different one, but you can work with the default set
<ankurgel> rue: hm. maybe his default set is different then.
looopy has joined #ruby-lang
<ankurgel> rvm list?
<wubino> what is the worst that could happen if I try?
<ankurgel> wubino: agreed. try those two commands. Then reset your terminal.
<ankurgel> then do gem install pry again.
<wubino> RVM is not a function, selecting rubies with 'rvm use ...' will not work.
burns180 has joined #ruby-lang
<ankurgel> aah.
macmartine has joined #ruby-lang
<ankurgel> rvm is not a function.
<ankurgel> wait
Austin__ has joined #ruby-lang
<ankurgel> wubino: echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile
<ankurgel> execute ^, then reset terminals.
<wubino> same
<wubino> what is ^ supposed to mean?
<andrewvos> wubino: Look up
<ankurgel> "above"
<ankurgel> wubino: type "type rvm | head -1"
<ankurgel> and tell us it's output
indstry has joined #ruby-lang
<wubino> rvm is hashed (~/.rvm/bin/rvm)
<ankurgel> wubino: Ubuntu version?
<wubino> 11.10
<ankurgel> echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bashrc
<wubino> (in regards to Ubuntu - > I like it, I fear upgrading to a newer distribution even if it is LTS)
<ankurgel> try this, then reset terminal and check output of "type rvm | head -1"
robbrit has joined #ruby-lang
cesario has joined #ruby-lang
<wubino> rvm is a function
<ankurgel> bingo
slyphon_ has joined #ruby-lang
<ankurgel> gem install pry
<ankurgel> enjoy
<wubino> assuming this works; what was wrong?
<ankurgel> rvm was not a function. It should be function for gems to work.
<wubino> Way to go ankurgel, it works!
<ankurgel> wubino: rue was right, gemset wasn't actually necessary.
wmoxam has joined #ruby-lang
<ankurgel> wubino: but good that you are now working on gemsets. Gives you opportunity to try other gems+ruby-ver combinations for your work
<wubino> ankurgel: are you involved with it sdevelopment?
<ankurgel> "it's" ?
<wubino> yep
<wubino> pry
<ankurgel> what do you mean by 'it's' ? oh.
<wubino> its'
<ankurgel> oh
<ankurgel> I installed it today itself. Looks cool.
Stefan___ has joined #ruby-lang
<ankurgel> sophisticated and better than irb.
<wubino> Any experience in python?
<ankurgel> nope. ruby #FTW
<wubino> Well, I am python programmer working on polishing some gems with ruby, but it has been baffling at times.
<ankurgel> wubino: I'm not that experienced with gems either. Learning.
* canton7 cringes at the thought that someone might consider its' to be a valid word
<wubino> sorry, I for got my english 101 -> I cringed too
<wubino> How is Ruby OO but RVM a function??
sdeobald has joined #ruby-lang
judofyr has joined #ruby-lang
kurko_ has joined #ruby-lang
dejongge has joined #ruby-lang
<deryldoucette> because RVM isn't part of Ruby. RVM is bash shell scripts.
<deryldoucette> Ruby the language is Object Oriented. Bash is not, nor does it intend itself to be
ankurgel has joined #ruby-lang
scampbell has joined #ruby-lang
lchi has joined #ruby-lang
heftig has joined #ruby-lang
adambeynon has joined #ruby-lang
burns180_ has joined #ruby-lang
slyphon has joined #ruby-lang
unixabg has joined #ruby-lang
rippa has joined #ruby-lang
jbwiv has joined #ruby-lang
<unixabg> Greetings, what is best way to pull and save web based mjpeg stream?
dv310p3r has joined #ruby-lang
enebo has joined #ruby-lang
fayimora has joined #ruby-lang
ryez has joined #ruby-lang
<sym-> (0..50).map { 'blah' } makes an array of 50 'blah's, gotta love ruby
Koia has joined #ruby-lang
<Koia> Hey everyone
<judofyr> hey Koia
<judofyr> sym-: actually, that's 51
<shevy> sym- 50.times.map { 'blah' } does too
<canton7> sym-, so does ['blah'] * 50
<shevy> :)
<judofyr> canton7: not the same
<lianj> sym-: (0..50) is 51 though
<ankurgel> so does Array.new(50,'blah')
<judofyr> canton7: that creates an array with 50 occurrences of the same string.
<Koia> I got a question, but don't fall down reading it, I'm just trying to make sense to concepts I read. What is actually the difference between an Actor and an Object ? Couldn't we say an Actor is kind of a special Object ? I'm trying to oppose the actor-model and object-model and this difference is kinda hard to explain for me :/
<canton7> judofyr, hmm? 50.times.map{ 'blah' } == (['blah'] * 50) => true here
<shevy> who uses the word Actor Koia
* shevy hands a gun to Koia.
<shevy> now you have a handle against them :)
<judofyr> canton7: a = 50.times.map { 'blah' }; b = ['blah'] * 50; a[0].replace("nope"); b[0].replace("nope"); a == b # => false
<canton7> judofyr, ah, of course. Forgot my pass-by-reference
<judofyr> Koia: actors are asynchronous
<erikh> actors belong to the SAG
<rue> But, curiously, there's less sag among actors than any other group.
<robbrit> what's SAG?
<andrewvos> Screen Actors Guild
<andrewvos> rue: Subtle
<rue> I've been extra subtle this weekend
<judofyr> subtlerue
cdnz has joined #ruby-lang
frem has joined #ruby-lang
<erikh> ruetle
Stefan___ has quit [#ruby-lang]
malev_ has joined #ruby-lang
gray has joined #ruby-lang
coreydaley has joined #ruby-lang
Phrogz has joined #ruby-lang
Indian has joined #ruby-lang
burns180 has joined #ruby-lang
butchanton has joined #ruby-lang
vmatiyko has joined #ruby-lang
srbaker has joined #ruby-lang
dhruvasagar has joined #ruby-lang
jxie has joined #ruby-lang
chimkan has joined #ruby-lang
rushed_ has joined #ruby-lang
canton7 has joined #ruby-lang
<Asher> anyone have ruby-debug working with 1.9.3?
dhruvasagar has joined #ruby-lang
<ddfreyne> Asher: there is a ruby-debug19 iirc
<Asher> yeah it seems not to compile properly w/1.9.3 and then once you either 1. modify 1.9.3 or 2. use the updated (but not pushed) version it segfaults
jmontross has joined #ruby-lang
<judofyr> andrewvos: there is a debug.rb in 1.9
<judofyr> oops
<judofyr> Asher: there's a debug.rb in 1-9
<judofyr> 1.9*
<judofyr> Asher: ruby -rdebug
<Asher> the one using set_trace_func?
<Asher> pry_debug (using set_trace_func) wouldn't work for this
<judofyr> yeah
<judofyr> why not?
<Asher> not sure but i'm dealing w/code hanging and it also hung
sdeobald has joined #ruby-lang
<judofyr> gdb?
<Asher> it's ruby code i can't step through it w/gdb
<judofyr> why do you want to step through it? just run it and see where it hangs
<Asher> yep
<Asher> how do i see where it hangs
<judofyr> Ctrl-C
<judofyr> and "bt" for backtrace
<Asher> in gdb? but that will give me a backtrace of the VM not of the ruby stack
m3nd3s has joined #ruby-lang
pemeon has joined #ruby-lang
kyrylo has joined #ruby-lang
kyrylo has joined #ruby-lang
gsav has joined #ruby-lang
slimfit has joined #ruby-lang
shnee_ has joined #ruby-lang
S2kx has joined #ruby-lang
burns180_ has joined #ruby-lang
<Asher> thanks - that's actually one of the sources i had been working from
<Asher> tried everything there
<Asher> which results in it loading as a gem
<Asher> but then segfaulting at the first "debugger"
* workmad3 shrugs
<workmad3> I don't use the ruby debugger
m3nd3s has joined #ruby-lang
sdeobald_ has joined #ruby-lang
<ankurgel> quick question. If I'm working on master and a new_branch and commit any newly made change in master, it gets reflected automatically in new_branch?
<ankurgel> I mean, no need to merge master in new_branch to do that?
francisfish has joined #ruby-lang
publicvoid__ has joined #ruby-lang
lightcap has joined #ruby-lang
lucas_ has joined #ruby-lang
<wubino> Is there any reason why var will not show up in IRB but methods will from an imported script?
Avanine has joined #ruby-lang
hexo has joined #ruby-lang
H2H has joined #ruby-lang
<whitequark> ankurgel: if we're talking about git, no.
<whitequark> you need to merge new_branch with master
<whitequark> wubino: because local variables are local to the context (script in this case), but methods are defined globally
<whitequark> "def a; def b; end; end; a" leaks the definition of `b' to the global namespace too
<wubino> how / can I make script variables global?
<whitequark> use global variables
<whitequark> $a = 1
<wubino> Thanks!
<whitequark> also: this is considered a bad coding practice. just so you'd know.
<shevy> but ruby uses it a lot
<manveru> it doesn't
<shevy> $PROGRAM_NAME, $stdin ...
kaiwren has joined #ruby-lang
<whitequark> in other words, if you'll try to write a big app with global vars you'll shoot yourself in the leg
<whitequark> shevy: they're _actually global_, as they track the program itself
m3nd3s has joined #ruby-lang
<whitequark> $stdin is a property of the process, not restricted to any particular ruby context
<whitequark> (by the way, perlish $, $: $` and whatnot are definitely bad, but they'll probably be around forever for compatibility reasons)
sbabiy has joined #ruby-lang
<manveru> $std* exists to make redirecting the standard ios easier
<shevy> the $ are everywhere
<shevy> even in your pants
<whitequark> manveru: afaik redirecting io with $std* may lead to unexpected behavior
<shevy> I can never remember what $` means
<whitequark> like STDIN not matching $stdin
<whitequark> shevy: I neither
<manveru> whitequark: that's the goal
<shevy> $: I finally know without having to look up
<Stereokitsune> hm, who may recall any popular CLI software for Unix written in ruby?
<shevy> Stereokitsune hmmmmm
<manveru> all ruby methods use $stdin, STDIN exists if you really absolutely have no other option
<whitequark> Stereokitsune: metasploit
<shevy> Stereokitsune rubygems? :)
<Stereokitsune> whitequark: oh, really, I've forgot
<whitequark> manveru: also, there's forking and so on. $stdin = File.new won't replace fd 0
<manveru> whitequark: it shouldn't replace it
<manveru> that's the point :P
<whitequark> manveru: it's broken then
<whitequark> because stdin _is_ fd 0
<robbrit> there's a gem that replaces the $X variables with something more human readable, just can't remember the name at the moment
<whitequark> (well, it's FILENO_STDIN if we follow POSIX, but that doesn't really matter much)
<manveru> ι ~ % ruby -rstringio -e '$stdout = StringIO.new; puts "hi"; STDOUT.puts($stdout.string)'
<whitequark> robbrit: require 'English'
<manveru> hi
<whitequark> not a gem
<shevy> hi manveru
<whitequark> manveru: and what's the point of doing tht?
<robbrit> whitequark: that explains why googling 'ruby english gem' did not give me the right results
<whitequark> manveru: I understand how puts and friends work
<shevy> why don't you use the japanese version require 'Engrish' ?
<whitequark> shevy: rofl
<manveru> whitequark: to demonstrate that puts uses $stdout and not STDOUT?
<whitequark> manveru: I know that
<manveru> same as gets uses $stdin
<manveru> so you should do the same
<whitequark> manveru: but by Unix semantics, stdin is fd 0, not some random variable in random code in random language
<manveru> when's the last time i cared about unix semantics? :P
<shevy> that's a lot of random
<Stereokitsune> japanese version makes ruby code like misa language? :D
<shevy> misa?
<shevy> what is that
<shevy> I know miso is the soup
<whitequark> manveru: like now, because the OS you're using now follows Unix semantics in stdio
<shevy> no worries whitequark, I'll convert manveru to RubyOS one day
<whitequark> manveru: may it be windows or anything POSIX-compat
<manveru> sorry, but what does that have to do with ruby?
<manveru> you can always use IO.for_fd(1) if you don't want people to redirect stdout
heppy has joined #ruby-lang
<whitequark> manveru: ruby misleads programmer into thinking that s/he should assign stdin (thus breaking unix semantics) instead of doing sane STDIN.reopen like any other language
<manveru> ok, i give up, talking here is just pointless
<wmoxam> heh
<whitequark> before you do (I somewhat agree that it _is_ pointless), can you provide any valid example where redefining $stding while leaving fd 0 (or similarly for stdout/stderr) is actually sensible?
manojhans has joined #ruby-lang
tbuehlmann has joined #ruby-lang
manojhans has joined #ruby-lang
<shevy> $stdin vs STDIN is confusing
<shevy> matz should ignore 2.0 and move to 3.0 directly
<manveru> no, because enough people use STDOUT/STDERR reopen instead of assigning to $stdout/$stderr to render my point useless
<manveru> they're damn constants, why do people always try to change constants :(
<shevy> because ruby allows them to change them
slimfit has joined #ruby-lang
<whitequark> STDOUT.reopen doesn't change STDOUT at all
<shevy> I think it was bad to make constants non-constants
<whitequark> the fact that you can assign to constants is ruby's dirty secret. I'd say that this should be eliminated
<whitequark> but STDOUT.reopen is a valid operation
rippa has joined #ruby-lang
<shevy> what is the difference between $stdout.reopen and STDOUT.reopen?
<shevy> you know what, I think there are two matzes
<whitequark> shevy: none normally, because initially $stdout and STDOUT point to the same IO instance
<shevy> they are constantly battling the design out in the matz-persona
<manveru> ι ~ % ruby -rstringio -e 'STDOUT.reopen("foo"); puts "oh noes"; warn STDOUT.to_i'
<manveru> 1
malev has joined #ruby-lang
<manveru> sorry, no reason for the require
<shevy> that you are all typing that
<shevy> :)
<whitequark> manveru: yeah, I know that as well
<whitequark> that's how you should change where stdout writes go to
<shevy> has matz ever recommended any usage guide for ruby? a style guide? the matz way?
<whitequark> shevy: open wikipedia. it describes "the matz way".
burns180 has joined #ruby-lang
<manveru> he's helped publishing some books
<lianj> shevy: start with writing tests and using vcs :p
<shevy> naaah
<manveru> gods, i hate amazon links
<shevy> that is all not the matz way!
<lianj> thats your guess
<whitequark> I even seen a Russian translation of such a book once
<whitequark> through it was outdated
kurko_ has joined #ruby-lang
<whitequark> iirc it was the 1.8 edition in 2010 or early 2011
alim has joined #ruby-lang
<shevy> a russian translation?
<whitequark> of the book co-authored by mat
<whitequark> *matz
<rue> #include <istringstream>
slimfit has joined #ruby-lang
<whitequark> rue: and what?
lucas_ has quit [#ruby-lang]
<shevy> we are going back to the roots
<shevy> evolution in programming languages starts in C
<shevy> it makes me sad :(
<whitequark> what
<deryldoucette> it starts in B yeah thats it!
<deryldoucette> though really assembler but..
<whitequark> i'm starting to doubt either my or yours sanity
<shevy> it is true!
<deryldoucette> i doubt everyone's sanity. makes it simpler hehe
<whitequark> maybe I should just go away and cry
<deryldoucette> why?
JEG2 has joined #ruby-lang
<manveru> whitequark: shevy was proven insane already
<shevy> C is the grandaddy, C++ is the hipster son, Obj-C the old business son
<shevy> granddaddy
<shevy> then somehow Java got into things and messed everything up
<shevy> even TIOBE :(
<deryldoucette> if assembler isn't the right answer for evolution in programming languages starts in __. or B (since C came from B according to Ritchie and Kernigan) then what is?
<whitequark> deryldoucette: machine code?
<manveru> whitequark: he's still building a "ruby operating system" that consists for bash aliases that modify themselves using genetic algorithms
<Mon_Ouie> lambda calcul?
<deryldoucette> whitequark: ok you got me there
<rue> andrewvos: See how subtly I did that?
<shevy> manveru ah I can't use bash in the long run, that must be replaced slowly :)
<manveru> shevy: zsh?
<andrewvos> rue: You Sir deserve a medal.
<deryldoucette> but actually is machine code really a programming language? ;)
<whitequark> manveru: either he's crazy, you're crazy, you are both crazy, I'm crazy or everyone likes
<whitequark> *lies
<whitequark> or all of the above
<rue> andrewvos: OK, but only a very modest one.
<shevy> manveru nah, for me bash and zsh are in the same boat, zsh is just better
<deryldoucette> i vote for All of The Above
<whitequark> deryldoucette: you can program in it. why not?
<deryldoucette> whitequark: crap
<andrewvos> rue: #include <medal>
<whitequark> rue: hehe, nice one I'd say
<deryldoucette> whitequark: stop makign sense! you're losing your right to be called insane! sheesh
<whitequark> I'll earn my left to be called insane
<deryldoucette> heh
<whitequark> like, left now
<whitequark> through I haven't actually right
<deryldoucette> if left is right and right is left do two rights make a right or a lefT?
<shevy> you are nuts
<deryldoucette> I'M SO CONFUSED!
<shevy> I think they neutralize one another
<shevy> left + right = middle
* whitequark is a peanut
<deryldoucette> ok, now i'm *utterly* confused
<deryldoucette> thanks for the hellish day that will entail
<whitequark> achievement unlocked!
<deryldoucette> hah!
<shevy> deryldoucette I wonder about machine code too
<shevy> can you code something that works like a human brain?
knobo has joined #ruby-lang
<whitequark> I think that peasants are related to peanuts
<whitequark> if you're calling yourself a sant then you're nuts
<shevy> ok
<lianj> shevy: if we had working blueprints
<shevy> I shall call myself a saint then
<deryldoucette> shevy: yeah because its at the same level as the machine. to me, and i'm sure NOT to the rest of the world, assembly would be the first language. isn't it marked as a 1G language?
<whitequark> shevy: yes. you can code quantum equations, then you can just simulate the entire brain
<deryldoucette> shevy: mental drival for the day :)
<shevy> lianj well humans! they are out there everywhere!
<whitequark> through it would take longer than the expected lifespan of universe
<whitequark> hm, is "reverse engineering humans" an euphemism for "killing for science"?
<lianj> shevy: tv's too. do you know how they work in every detail?
<shevy> YES!
<lianj> ofc ;)
<shevy> :(
* whitequark particularly likes lianj's "they"
<deryldoucette> I read a book called The Footprints of God by Greg Iles that hit pretty much on that same thiong. (quantum programming)
<shevy> I want my computer to be really clever
<deryldoucette> s/io/i/
macmartine has joined #ruby-lang
<shevy> well
<whitequark> shevy: I want myself to be really clever
<andrewvos> deryldoucette: Cool story bro.
<whitequark> doesn't really work as it should
<deryldoucette> andrewvos: you read it?
<shevy> quantum programming sounds easier than coding something that genuinely works like a human brain
<deryldoucette> good book
<shevy> whitequark, I gave up that quest for myself a long time ago
burns180 has joined #ruby-lang
<andrewvos> rue: Am I getting better? ^
<shevy> andrewvos, the andies will FOREVER rule!!!
<andshevy> hi andrewvos
<deryldoucette> isbn 978-1-4165-6409-6 for those even remotely interested
<andshevy> where is andkerosine when you need him...
<rue> andrewvos: Better, but still a little heavy-handed
<whitequark> shevy: human brains can be thoroughly implemented with an arduino
<andshevy> deryldoucette you mean for those even remotely insane? :)
<deryldoucette> andshevy: haha!
<whitequark> eat. drink. sleep. have sex. write nonsense in #ruby-talk
<andshevy> whitequark, ok I shall remember that the next time I see an arduino
<deryldoucette> whitequark: oh, a good day!
<andshevy> lol
<whitequark> andshevy: use an anduino instead
<andshevy> now that's quite a life an arduino has here
<whitequark> also: they're more clever than they look like
<whitequark> and they spy on you
<whitequark> and plot
<andshevy> do they spy with or without the sex or during the sex?
<whitequark> both
<andshevy> hmm
<andshevy> perhaps computers should not be too clever after all
<whitequark> too late
<deryldoucette> don't hold me to it, but i believe thats what was the basis of a TINY ass system a friend showed me. looked like a friggin USB stick with a usb port on one end and a hdmi port on the other. its a full damned system!
<andshevy> deryldoucette is he a TERRORIST HACKER
<deryldoucette> has 8GB flash drive in it for storage. funky little thing. never seen anything like it
<deryldoucette> andshevy: hehe, no he's one of those guys that sees interesting stuff and just has to buy it
<whitequark> deryldoucette: yeah, but that was somewhat more powerful than an arduino. it definitely had a microcontroller core inside, some flash memory, and a hw hdmi encoder
<andshevy> ah ok deryldoucette
<whitequark> and the microcontroller probably was something from ARM family
<deryldoucette> doesn't know dickall about programming, how to run linux ect, but he's *constantly* buying these little gadget things
Jay_Levitt has joined #ruby-lang
<andshevy> one of my friend is like that when it comes to apple... every i* wave he has to buy ...
<lianj> andshevy: twice!
<deryldoucette> andshevy: hehe yeah he's always bugging me for info because I do know linux and how to code ect ect.
manojhans has joined #ruby-lang
<andshevy> hehe
<deryldoucette> one of those guys that always calls at supper and says you gotta come NOW NOW NOW and check XYZ out that I just got!
<whitequark> andshevy: why is he still alive if you're around? should have been dead long ago because of trolling overdose
manojhans has joined #ruby-lang
<whitequark> deryldoucette: can you cite entire linux source code from your memory?
<deryldoucette> whitequark: to the ARM comment, that might be. I haven't seen a spec sheet on it. I should call and bug HIM for a change hehe
<deryldoucette> whitequark: shit no
<deryldoucette> I'm crazy not stupid
<whitequark> deryldoucette: well I'm fairly certain it is ARM. might also be MIPS, but that's less frequently used core
<whitequark> not much other variants
<deryldoucette> whitequark: was really weird. never seen anything like it before. cool as hell. probably not emmensely useful, but was definitely trippy
manojhans has joined #ruby-lang
<whitequark> deryldoucette: I'd say it _is_ useful, at least if/when there'll be widespread hdmi adoption
<deryldoucette> yeah but just how powerful could the thing be?
<whitequark> deryldoucette: you don't really need much power if you have hardware video encoder
<deryldoucette> i mean its about as big as the damned usb sticks you get from walmart
<deryldoucette> ehh i can see that point
* Stereokitsune feels a stupid reading all of this
<deryldoucette> for you to have hdmi don't you *have* to have hw vid enc/dec?
<whitequark> the core just DMA's some bytes from the flash, then DMA's them again to the hw encoder (or maybe recoder. it has to know MPEG/h264/etc.)
burns180 has joined #ruby-lang
<lianj> do you need a HD encoder for output, no decoder?
<whitequark> deryldoucette: hdmi video isn't compressed over the wire afaik
<whitequark> it's like digital VGA
burns180 has joined #ruby-lang
<deryldoucette> god there's just so much to learn hehe
<whitequark> so there is no such thing as "HDMI codec"
<deryldoucette> easily go into info overload :)
<shevy> whitequark I am not trolling! :(
<lianj> shevy: thats the sad part :P
<whitequark> it can be encrypted through if HDCP is used, and you definitely want hardware support for this
<deryldoucette> doh!
<deryldoucette> whats the C in that?
<whitequark> copy protection
<shevy> deryldoucette yeah but also remember, the more you know, the more you forget as well!
<deryldoucette> ah
<deryldoucette> shevy: thats very true.
<whitequark> already broken ofc. master key leaked.
<deryldoucette> whitequark: ahh ala libdvd!
<whitequark> so it is rendered practically useless
<whitequark> libdvd had secret algorithm
<whitequark> it's a flawed approach. algorithms can easily be reversed
<deryldoucette> well witht he power of even basic laptops i'm suprised *more* algos aren't broken.
<whitequark> deryldoucette: it wasn't bruteforced
<deryldoucette> oh
babinho has joined #ruby-lang
<deryldoucette> just a straight up leak?
seydar has joined #ruby-lang
<seydar> ok wtf i gots a string substitution issue here guys
<shevy> seydar kill it!
<seydar> "David Avacado' Wolfe".gsub "'", "\\'"
<seydar> run that
<seydar> tell me what you get and if it agrees with your logic
<whitequark> deryldoucette: for libdvd? no, some clever man just got a binary for a multimedia player, disassembled it and rewrote the algorithm
<deryldoucette> ahhh didn't know that part of the history
<seydar> shevy: that's blowing my mind right now. right out onto the streets
<whitequark> deryldoucette: but in HDCP the algorithm was open from the first day. it's AES.
<shevy> "David Avacado' Wolfe".gsub "'", "\\\'" # => "David Avacado Wolfe Wolfe"
<shevy> "David Avacado' Wolfe".gsub "'", "\\\\'" # => "David Avacado\\' Wolfe"
<deryldoucette> oh someone came in the other day about that
<deryldoucette> how many \\\ to use ect
<shevy> seydar, I proudly have not thought about this at all yet!
<seydar> why the extra \?
<deryldoucette> regexp and I aren't really friends as it is, and i couldn't figure it out right in irb
<whitequark> deryldoucette: the key was secret, and if it hadn't leaked it won't really be so easy to break
<shevy> try it with less seydar
twittard has joined #ruby-lang
<whitequark> deryldoucette: devices had the derivatives of master key. if some chinese vendor had his key leaked, it could have been revoked
<shevy> "David Avacado' Wolfe".gsub "'", "\'" # => "David Avacado' Wolfe"
<shevy> there you go, problem solved!
<whitequark> but some stupid/nice (depends whether you work for MPAA) guy has leaked the key from Intel
<deryldoucette> hehe love your quantifier there
<whitequark> and I like how you used the word "quantifier"
byped has joined #ruby-lang
<deryldoucette> I understand the RIAA/MPAA stance. I just think A) they're overly draconian and B) they definitely do NOT pay their artists enough
<whitequark> they don't understand how digital media works
<whitequark> that's the main issue
<whitequark> they think that you can somehow restrict a video so that it could be played but not copied
<whitequark> this is FUBAR because playing = copying (to video RAM)
looopy has joined #ruby-lang
virunga has joined #ruby-lang
<whitequark> even worse, they're trying to solve a social problem (people not wanting to pay, at least according to MPAA), with a technical solution
<whitequark> that fucking never works
<whitequark> never.
<deryldoucette> they don't understand how a lot of things work, i fear. they did studies that showed that around college towns/areas where torrents of music and the like were rampant that their sales rates went *up* because the kids wanted their own copies. RIAA tried to have that study squashed before it was released
<whitequark> they're greedy, crazy, and stupid
<whitequark> they will die
<deryldoucette> agreed
<whitequark> it is a matter of time
<deryldoucette> when the populace has finally had enough all together, they're not going to like the consolidated backlash.
<deryldoucette> and i'm not sure they'll survive it
<lianj> whitequark: like capitalism?
gianlucadv has joined #ruby-lang
<whitequark> they only have the time until the generation who has sharing & torrents in their genes will be at the right age to throw them out
<deryldoucette> capitalism should be renamed GREED :)
<lianj> but its alive and still growing :(
<deryldoucette> whitequark: actually i think they know that and thats why they're targetting my kids.
<whitequark> lianj: I'd say that you never have "pure" capitalism, or "pure" communism or whatever. every political system is a crazy mix, and you really shouldn't analyze them out of context
<andrewvos> deryldoucette: Targeting*
<deryldoucette> lianj: unfortunately. I mean the original idea of capitalism i don't have a problem with. its when control of the markets is embedded in the few that we have problems
manoj has joined #ruby-lang
<deryldoucette> oh single t?
<andrewvos> deryldoucette: No there's two
<erikh> i farted
* deryldoucette heads for the febreeze can
<andrewvos> erikh: You add such value to our chats
<deryldoucette> andrewvos: actually if you look at where they're heading the really seem to be targetting the kids especially. they're the ones growing up with torrents and the like as mainstream.
<deryldoucette> andrewvos: lol
<erikh> andrewvos: I do.
<andrewvos> deryldoucette: Targeting*
<whitequark> deryldoucette: they look like stupid old farts to the kids (which they are), so they'll never win that
<whitequark> and it's good
<deryldoucette> guh
<deryldoucette> wow i am so slow at times. 2 Ts. I was meaning back to back, andrewvos meant in the entire word.
* deryldoucette is a numbnut sometimes
<deryldoucette> erikh: thats it you fart one more time, I'm sticking you in a closet with my rottie after she has anything with milk
<whitequark> andrewvos: grammatik macht frei?
naz has joined #ruby-lang
achiu has joined #ruby-lang
<andrewvos> whitequark: Freedom through grammar?
<whitequark> andrewvos: kinda. google for the phrase.
<andrewvos> whitequark: I know the phrase
facefox has joined #ruby-lang
solars has joined #ruby-lang
<shevy> phrase for the google
Fullmoon has joined #ruby-lang
<shevy> grammatik is overrated in today's hipster generation
<andrewvos> How old are you shevy?
<Phrogz> Gammar Nazi's Unite!
headius has joined #ruby-lang
<Stereokitsune> why google translate doesn't know slanguages :(
nofxx has joined #ruby-lang
dr_bob has joined #ruby-lang
Fullmoon has joined #ruby-lang
<gray> it works, but what i do wrongbut what am I doing wrong?
<shevy> how shall people know gray ;)
<shevy> there could be 100000000 problems
<gray> shevy: hmm )
<shevy> does it give you the expected and correct result?
<gray> shevy: i don't know you much better know ruby than i
<gray> shevy: yes
<shevy> yes but it is your code
<shevy> I myself would not use method names likeThisHere for instance
looopy has joined #ruby-lang
<Stereokitsune> why don't you use loops?
<shevy> btw funny :D -> puts "Tree dies... :( bye!"
<workmad3> where are the tests?
<shevy> you can shorten some code
<shevy> from @fruits = @fruits - number to
<shevy> @fruits -= number
<shevy> @treeyears = @treeyears + 1 to @treeyears += 1
<shevy> etc..
<Stereokitsune> and if I understand ruby fine, you may use case..when instead of a lot elsifs
imperator has joined #ruby-lang
<imperator> greetings programs
<Stereokitsune> hi
<shevy> darth imperator has arrived
<shevy> anyone caught smiling will be disciplined!
<Stereokitsune> grammaton cletic?
<workmad3> the flogging will continue until morale improves!
<workmad3> gray: also, I'd probably take it as bad practice that when the tree dies, it kills the entire ruby process with an 'exit'. What about any other orange trees you have that aren't as old as this one?
<gray> Stereokitsune where i should use loops?
bababa has joined #ruby-lang
bababa has quit [#ruby-lang]
<shevy> workmad3 all orange trees must die
<Stereokitsune> gray: too many oneYearPasses calls
<Stereokitsune> i think
dr_bob has quit [#ruby-lang]
<gray> shevy: thanks for this @treeyears = @treeyears + 1 to @treeyears += 1
<Asher> if i use #method_missing and conclude the method is actually missing, is there a way to re-raise the exception at the line that called method_missing?
<workmad3> shevy: but then where will I get my orange juice?
<gray> shevy: this nice
<shevy> workmad3 with apples + chemical flavour modifications of course :)
<workmad3> Asher: just call super in the case of your own method_missing not handling the case
<Stereokitsune> workmad3: juice is the blood of the trees, don't you feel sorry for them?
futurechimp has joined #ruby-lang
<shevy> pffft
<shevy> take some juice won't kill anyone
<shevy> that's what the vampires found out a long time ago
<shevy> but then they got greedy
<shevy> and hunted down
<shevy> sad story :(
<cout> you know this from experience?
<shevy> cout I saw this in movies!
<shevy> lost boys, interview with a vampire and the vampire hunters!
robbrit has quit [#ruby-lang]
<workmad3> shevy: and twilight!!!
<shevy> oh no
mark_locklear has joined #ruby-lang
<Stereokitsune> May the vampire be written as a class?..
<shevy> I have managed to avoid twilight
<workmad3> oh wait, that's not a film about vampires... it's a film about stupid sparkly fairies that drink blood...
<Asher> workmad3 - perfect, thanks
<shevy> I would not know! but I dont feel like its target audience, it seems to cater to people +20 years younger than I am!
zmack has joined #ruby-lang
<workmad3> Asher: and a quick bit of ruby knowledge - when you hit method_missing, no exception has been raised... the NoMethodException is what happens in the default method_missing, not something that prompts a method_missing call ;)
<workmad3> shevy: what? you're only 21? :)
<Asher> workmad3 - yea good point
<lianj> Asher: call super
darkf has joined #ruby-lang
Tearan has joined #ruby-lang
trappist has joined #ruby-lang
<trappist> undefined method `capture3' for Open3:Module <-- I can see it right in the docs, did this get removed in 1.9.3 or something?
leonL has joined #ruby-lang
<imperator> capture3?
<imperator> Open3.popen3
<trappist> or 1.9.3, same
<trappist> I started with popen3 and I'll go back to it if I can't get capture3 working, but capture3 looks better suited to what I'm doing
srbaker has joined #ruby-lang
<imperator> wow, never knew those methods existed; those must be 1.9 additions
AndChat| has joined #ruby-lang
<Phrogz> imperator: Looks like 1.9.2 additions.
burgestrand has joined #ruby-lang
<imperator> hm, Open3.methods(false) shows a :capture3 method in irb
<imperator> quit
<trappist> it's /quit ;)
<imperator> doh, dunno what happened there
<imperator> i meant to quit irb ;)
<nofxx> imperator: Ctrl D
<trappist> I'm a quit man myself. Stupid Apple doesn't put the ctrl key in the same place as everybody else so I avoid it when I can.
<imperator> trappist, works for me
<imperator> you sure you were using 1.9.3 when you tried it?
<trappist> otherwise I'm all twisting my wrist, careful to keep a finger on the home row, to actually look for the dang ctrl key
<trappist> imperator: yeah, double-checked
<imperator> although....it doesn't seem to actually capture the output :(
<trappist> by which I mean no, it was actually 1.8.7
<trappist> so, yeah
slyphon has joined #ruby-lang
* imperator figured that ;)
<trappist> I was never here
trappist has quit [#ruby-lang]
<imperator> lol
<nofxx> trappist: yeah, that 'fn' sucks. I enjoy it for internationalized content... accentuation
<imperator> nofxx, too late
* imperator waves to slyphon
<nofxx> imperator: hehehe..
dejongge has joined #ruby-lang
<nofxx> imperator: btw, check out 'pry' too
<imperator> nofxx, been meaning to, but haven't had a compelling reason to try it yet
musl has joined #ruby-lang
havenn has joined #ruby-lang
Sailias has joined #ruby-lang
twittard has joined #ruby-lang
dr_bob1 has joined #ruby-lang
seoaqua has joined #ruby-lang
leonL_ has joined #ruby-lang
facefox has joined #ruby-lang
musl has joined #ruby-lang
MrPunkin has joined #ruby-lang
dr_bob1 has quit [#ruby-lang]
gianlucadv has joined #ruby-lang
l0st1 has joined #ruby-lang
musl has joined #ruby-lang
vmatiyko has quit [#ruby-lang]
Austin__1 has joined #ruby-lang
gy4e8d has joined #ruby-lang
mrsolo has joined #ruby-lang
<slyphon> imperator: hello!
brianpWins has joined #ruby-lang
<imperator> slyphon, how you been?
<slyphon> awesome!
<slyphon> not really
<slyphon> going through project planning nonsense
<shevy> sounds exciting!
<slyphon> lemmetellya
boxmo has joined #ruby-lang
justinmcp has joined #ruby-lang
facefox has joined #ruby-lang
gregf has joined #ruby-lang
vlixes has joined #ruby-lang
francisfish has joined #ruby-lang
curtism has joined #ruby-lang
curtism has joined #ruby-lang
<imperator> monster.com is just regurgitating google search results now for job searches - lame
FACEFOX has joined #ruby-lang
ilyam has joined #ruby-lang
<shevy> hmm
apeiros_ has joined #ruby-lang
setmeaway has joined #ruby-lang
ankurgel has quit [#ruby-lang]
<imperator> bnagy, so, where's that rbuggery release?
havenn has joined #ruby-lang
Karmaon has joined #ruby-lang
dejongge has joined #ruby-lang
nofxx has joined #ruby-lang
futurechimp has joined #ruby-lang
slimfit has joined #ruby-lang
gix has joined #ruby-lang
Fractality has joined #ruby-lang
havenn has joined #ruby-lang
chimkan_ has joined #ruby-lang
kurko_ has joined #ruby-lang
theoros has joined #ruby-lang
ankurgel has joined #ruby-lang
<ankurgel> unable to gem install pg
<ankurgel> log : https://gist.github.com/2024318 , please to help.
Banistergalaxy has joined #ruby-lang
<ankurgel> gotcha. nvm
<imperator> any time ;)
tr-808 has joined #ruby-lang
<ankurgel> imperator: again, same thing. I need to push this rails project on heroku. It use PostgreSQL. When I do 'bundle install' it fails with same error as in that logfile.
<ankurgel> consequently can't push it. :/ Solution?
<ankurgel> "You may have to install gems with bundle install --without production to ignore the PostgreSQL gem for your local installation."
<ankurgel> how do I ignore that? When I change in Gemfile, it does work but again, heroku deployment fails!
dejongge has joined #ruby-lang
<burgestrand> ankurgel: you can either make it possible to install the pg gem locally, or you can put the gem inside the :production group inside your Gemfile and follow the advice with "--without production"
Banistergalaxy has joined #ruby-lang
kurko_ has joined #ruby-lang
slimfit has joined #ruby-lang
Natch has joined #ruby-lang
<ankurgel> done! :)
macmartine has joined #ruby-lang
kurko_ has joined #ruby-lang
ezkl has joined #ruby-lang
jeremytarling has joined #ruby-lang
postmodern has joined #ruby-lang
Nisstyre has joined #ruby-lang
dfr|mac has joined #ruby-lang
y3llow_ has joined #ruby-lang
leonL has joined #ruby-lang
s0ber_ has joined #ruby-lang
kurko_ has joined #ruby-lang
dfr|mac_ has joined #ruby-lang
y3llow has joined #ruby-lang
FACEFOX has joined #ruby-lang
y3llow has joined #ruby-lang
y3llow has joined #ruby-lang
ankurgel has joined #ruby-lang
y3llow has joined #ruby-lang
fayimora has joined #ruby-lang
hagebake has joined #ruby-lang
hagebake has joined #ruby-lang
macmartine has joined #ruby-lang
Teddy2steper has joined #ruby-lang
ankurgel has quit [#ruby-lang]
stephenp has joined #ruby-lang
malev_ has joined #ruby-lang
slimfit has joined #ruby-lang
havenn has joined #ruby-lang
<stephenp> i feel like i'm being stupid here. i've got a spork / guard / rspec combo working for my non-rails project. i added a coverage rake test, and can run the task - my spec files are required, but the specs themselvs are never executed. what am i missing?
havenn has joined #ruby-lang
mighty_max has joined #ruby-lang
adambeynon has joined #ruby-lang
io_syl has joined #ruby-lang
<Fullmoon> Wasn't there a short way to get the ascii value of a character?
<mighty_max> ord?
<rue> stephenp: Why do you have a spork for not rails?
<stephenp> shorter version - requires a lot of database setup to get going
<Fullmoon> I could have sworn it was ?a
<Fullmoon> But that just returns "a"
<mighty_max> Fullmoon: ?foo is shorthand for declaring Strings
<Fullmoon> mighty_max: Hm, maybe it was returning numbers in 1.8?
<matled> Fullmoon: yes, in 1.8 ?x and "x"[0] used to return the numeric value of the byte
<mighty_max> yeah they changed that in 1.9
<matled> Fullmoon: in 1.9 you can use #bytes on a string
<Fullmoon> Oh never mind, I'll just use the bytes enumerator
<Fullmoon> Ah, hehe, thanks @matled
benanne has joined #ruby-lang
<Fullmoon> I want an array of the first four anyway... stream.bytes.take(4).to_a # <3 enumerable
<Fullmoon> first four bytes
zmack has joined #ruby-lang
cored has joined #ruby-lang
<jmontross> why not just take a checksum of file?
<Fullmoon> jmontross: Do you mean me? I am trying to guess the file type given the first four bytes, like `file'
<cored> hello
<mighty_max> Fullmoon, there's a gem for that. Unless this is for learning purposes
<cored> wny isn't this working ?
<cored> I want to change the behaviour for === operator
<cored> as you can see
<cored> but it doesn't work with the switch statement
qpingu has joined #ruby-lang
<mighty_max> cored, that code works for me
<mighty_max> that is, the switch puts "red"
<Fullmoon> mighty_max: It kinda is, yeah
<rue> mighty_max: It's not, ?foo isn't valid.
<rue> ?f is
Jade has joined #ruby-lang
<mighty_max> sorry, bad example :[
Defusal has joined #ruby-lang
Defusal has joined #ruby-lang
<cored> mighty_max: http://www.pastie.org/3580665
<cored> check that one
H2H has joined #ruby-lang
<mighty_max> cored, I get blue, red, other. as expected
<mighty_max> what version are you using?
t has joined #ruby-lang
<cored> 1.9.2
<mighty_max> I'm stumped. You running that in irb?
<cored> nop
<theconartist> did you not read the error cored ?
<theconartist> the string you are comparing it too doesn't have the method #color
srbartlett has joined #ruby-lang
<theconartist> you are calling 'this time operator works!'.color
<burgestrand> don’t forget to use respond_to? in your #===
<cored> theconartist: oh ok
<cored> you mean the method call in initialize for the Car class?
<mighty_max> oooh. I thought he was getting different output in the switch and the String error was intentional
<cored> theconartist: ?
<burgestrand> cored: no
<burgestrand> cored: Car.new('blue') === object_that_does_not_respond_to_color # <- what will happen?
fayimora has joined #ruby-lang
<shevy> the car will be blue
<shevy> :)
<cored> burgestrand: yes but I'm not talking about that
<cored> burgestrand: the switch is going directly to else not getting inside "does not work in case" with the "yellow" call
<burgestrand> cored: as for your case/when statement, the string will be the left-hand side of the comparison, it will become: "does not work in this case" === car
<cored> that's what I don't get
<cored> I did that un purporse my problem is with the 29 line
<burgestrand> and since String#=== does not match your car, it will return false
<cored> hm
<mighty_max> in general, === isn't reflexive. 2 === (1..3) # false; (1..3) === 2 # true
<cored> ok but wait
<cored> why isn't the car getting compare
<cored> with "does not work in case" then "did nothing"
<cored> case car
<cored> why the comparation is not been trigger on that case it's going down to the else of the case
<burgestrand> cored: read my pastie
slimfit has joined #ruby-lang
<cored> oh ok
<cored> so if that's correct
<cored> why isn't breaking the execuation wiht an error
<cored> because the string doesn't have a .color method
<cored> that's my compalin
<cored> or are you telling me that the evaluation happends from left to right
<cored> ?
<burgestrand> yes, for case/when it does
<mighty_max> which is what lets you use Ranges for the whens
<cored> oh ok
<burgestrand> it always does, but case/when is a bit special in that it uses the object in the when-statement to compare with
<cored> I thought it was some sort of WAT
<cored> but it's seems right now
<cored> thanks
<mighty_max> I'm having trouble with a blocking read inside a Thread
sbabiy_ has joined #ruby-lang
<burgestrand> mighty_max: what is joystick.event?
<mighty_max> joystick.event calls the C read function, which is blocking. But even though it's in its own Thread it still blocks the other one
<burgestrand> mighty_max: you’ve written it?
<mighty_max> yeah
<burgestrand> mighty_max: have a look at rb_thread_blocking_region
<burgestrand> mighty_max: if you want to allow ruby to run other threads while doing blocking calls in C you’ll need to unlock the GVL for the duration of that blocking call
<mighty_max> would that be in the extension or in the script?
<burgestrand> mighty_max: in the extension
<burgestrand> mighty_max: have you ever heard of the GIL/GVL before?
<cored> can I do something like this
<mighty_max> yeah, never had problems with it though
<cored> array = Array.new
<cored> def array.===()
<cored> end
<cored> ?
kylemcgill has joined #ruby-lang
<burgestrand> mighty_max: essentially, while your C function is blocking, it is still holding the GVL so ruby cannot run any other threads in parallel
<cored> irb say so
<cored> let me add something to my implementation
<mighty_max> cored: you want define_singleton_method I think
<burgestrand> cored: yes you can, but it’s considered evil to override methods on core classes
<burgestrand> but in this case it’ll be okay, since it’s not a global change
<burgestrand> but still in this case it’s considered a bit bad form, but is sometimes necessary to hack around things
<cored> burgestrand: yes
<cored> I just want to have some pattern matching
<cored> in Ruby
<burgestrand> remember that when you stand on the edge of apocalypse
<mighty_max> burgestrand: awesome! that should do it
<burgestrand> mighty_max: don’t forget the unblocking function, it’s important to have if you want to interrupt the blocking call, say if you ^C your script to exit it or whatever
<burgestrand> (it’s not always possible, but if it is do use it)
<mighty_max> I've seen that used in other extensions, never knew what it did
<burgestrand> mighty_max: ruby use it in bignum.c when calculating huge numbers, to allow the calculations run in parallel with other threads :)
<burgestrand> (probably other places too)
workmad3 has joined #ruby-lang
<cored> don't know why people doesn't do this more often
<cored> the code looks more concise this way
<mighty_max> burgestrand: thanks for the help
igaiga has joined #ruby-lang
<cored> burgestrand: check that out
<burgestrand> cored: it looks like java :o
<cored> burgestrand: you think?
<cored> burgestrand: more like C#
<cored> you can't do that with Java
SashaGrey89 has joined #ruby-lang
<apeiros_> eeew, Array.new…
<SashaGrey89> how can I see all the methods on an object?
<apeiros_> SashaGrey89: .methods
<apeiros_> (very surprising, I know…)
<SashaGrey89> apeiros_: Thank you :-)
<apeiros_> cored: why not CentralPoint = Point.new(0,0) ?
<cored> apeiros_: yes, that's was an example it make more sense as you are saying
<apeiros_> and: class Point; def ===(other); @x === other.x && @y === other.y; end
<apeiros_> then you can have UpperPoint = Point.new(Smallest, Any)
<cored> apeiros_: can you modify the pastie, please?
<apeiros_> oh, sry, you don't have Smallest/Biggest/AnySize
<apeiros_> sure
<cored> thanks
<apeiros_> make it a gist? :)
<cored> of course
<cored> :-D
<apeiros_> gotta go do some stuff first, but will be back in ~10min
<cored> oki doki
virunga has joined #ruby-lang
FACEFOX has joined #ruby-lang
srbaker has joined #ruby-lang
slimfit has joined #ruby-lang
<apeiros_> cored: back. I just noticed what you do is a bit different from what I thought you do, so maybe may patterns is not the best, it is probably still worth a look…
<apeiros_> I'll retrofit what I have
Banistergalaxy has joined #ruby-lang
tomzx has joined #ruby-lang
alim has joined #ruby-lang
<andrewvos> ruby-lang: I still don't have an cool sci-fi space movie to watch :(
gsav has joined #ruby-lang
bglusman has joined #ruby-lang
<Phrogz> andrewvos: You're looking for recommendations? Or downloads? :p
<andrewvos> recommendations
<Phrogz> Stargate? :p
<Phrogz> That's one of those movies that I wish I could forget so that I could watch it fresh again.
jmontross has quit [#ruby-lang]
<andrewvos> nahh seen it a lot
<Phrogz> Moon? That's a little rough, but I'm glad I watched it.
<rue> andrewvos: Solaris, Moon, Sunshine (I liked, many didn't)
<Phrogz> Solaris, shit, that is slow and awesome.
<rue> Event Horizon
<andrewvos> seen seen seen seen
<andrewvos> rue: Original Solaris?
<rue> Either. The remake isn't bad
wallerdev has joined #ruby-lang
<andrewvos> Well this isn't very helpful http://www.reddit.com/r/movies
kain has joined #ruby-lang
<rue> Titan AE?
<andrewvos> hmm
<andrewvos> seen it
pablo__ has joined #ruby-lang
woollyams has joined #ruby-lang
slyphon has joined #ruby-lang
Carnage\ has joined #ruby-lang
<andrewvos> Ok going to watch Sword of the Stranger
<andrewvos> Because there are no cool sci-fi movies anymore.
volty has joined #ruby-lang
* andrewvos sheds a tear
WillMars_ has joined #ruby-lang
<andrewvos> Anyone seen Immortals?
<burgestrand> Yeah, about three hours ago.
<andrewvos> burgestrand: And? Should I watch it?
<andrewvos> I'll pretty much watch anything right now
<burgestrand> Both me and my GF liked it; can’t tell if you will though. :)
<andrewvos> Ok well that's good news
<andrewvos> Also, this is cool http://httpstatus.es/
<burgestrand> It’s a bit gory, reminded me about 300 in a way.
<burgestrand> Hm, interesting.
<andrewvos> Cool sounds like fun
tommyvyo has joined #ruby-lang
Boohbah has joined #ruby-lang
coreydaley has joined #ruby-lang
<volty> irc seems dead compared to the past, any new means for interraction that I miss?
<andrewvos> volty: Meh.
<volty> andrewvos: in italy it's Beh :)
<volty> hi, what's best consised tutor/doc to get accostomed with rails? I need it now to play with especially with ActiveRecord & qtruby.
<andrewvos> volty: reddit.com/r/programming and news.ycombinator.com seem to attract a few people
<andrewvos> volty: Try RubyOnRails
<andrewvos> volty: We all hate rails here.
<volty> ahahah
<volty> why?
Fullmoon has joined #ruby-lang
<andrewvos> I'm just joking really.
<andrewvos> Though there may be some truth in that.
<volty> btw, i find rails cookbook by o'reilly pretty laborious
<andrewvos> rails for zombies is a thing?
<volty> maybe rails itself, but i beleive that i miss a short good guide
<andrewvos> Right movie time
<andrewvos> volty: Try rails for zombies. It was quite fun if I recall correctly.
<volty> ah, ok, now I got it :), kind of a zombie (me)
wallerdev has joined #ruby-lang
volty has quit ["Konversation terminated!"]
gsav has joined #ruby-lang
Banistergalaxy has joined #ruby-lang
Joeysomo has joined #ruby-lang
havenn has joined #ruby-lang
Joeysomo has joined #ruby-lang
tomzx has joined #ruby-lang
spox has joined #ruby-lang
y3llow has joined #ruby-lang
naz has joined #ruby-lang
hagebake has joined #ruby-lang
hagebake has joined #ruby-lang
S0lign0c has joined #ruby-lang
gokul has joined #ruby-lang
petercooper has joined #ruby-lang
aroop has joined #ruby-lang
macmartine has joined #ruby-lang
slackstation has joined #ruby-lang
verto has joined #ruby-lang
aza_kibo_ has joined #ruby-lang
havenn has joined #ruby-lang
mikeric has joined #ruby-lang
shevy has joined #ruby-lang
workmad3 has joined #ruby-lang