« Back to channel list

#ruby - 03 April 2014

« Back 1 day Forward 1 day »
[00:00:06] f0ster: I cannot figure out what pattern/structure to create this with, https://gist.github.com/f0ster/96a7091a76af06665cdf . basically, I just want to have somethign that's liek a static class which has data stored in, i take in an object, based on the object, i look something up in the static hash and return a value
[00:01:05] f0ster: I don't want to have to instantiate an object of this class ju;st to use it, hence the self. But there isnt anyway to have "static" member variables on an uninstantiated class as far as I know
[00:03:34] f0ster: bilbo_swaggins: ah right, that is what i am doing now
[00:03:38] f0ster: not workgin for some reason
[00:03:50] f0ster: "unitialized class var"
[00:04:56] f0ster: i need like a singleton class that checks to see if an instance has been instantiated yet when someoen tries to access it
[00:05:01] horrorvacui: What about lazy initialization?
[00:05:51] f0ster: thats kind of what i mean but doing it manually, what are you thinking horrorvacui ?
[00:06:38] f0ster: like.. @@property ||= self.new kind of thing
[00:06:50] f0ster: since i am using class vars
[00:07:12] f0ster: i could also create a new of my class, but i dont really want the need to do that, since all the methods on it are class methods
[00:07:14] horrorvacui: yeah but I still don't see what is wrong with how you are doing it
[00:07:45] f0ster: well if i just call MyClass.method, when m ethod tried to acccess @@var it just fails, even though @@var is hardcoded in the class def
[00:07:52] f0ster: because MyClass has never been instnatiated
[00:08:17] f0ster: i coudl not use a class, and module, since i am doing only class methods, e.g. def self.method... but then how do I store the hardcoded string ?
[00:10:40] user___: Whats causing this error? https://dpaste.de/uCiW
[00:11:34] havenwood: user___: do you have sqlite installed?
[00:12:41] horrorvacui: user___: what OS are you running?
[00:12:57] user___: horrorvacui: yeah sqlite3 is installed, ubuntu
[00:14:07] user___: 'Could not find gem "sqlite3 (>= 0) ruby" in the gems available on this machine'
[00:14:10] horrorvacui: user___: are you sure you installed libsqlite3-dev though?
[00:14:24] havenwood: user___: sudo apt-get install sqlite3 libsqlite3-dev -y
[00:15:22] user___: ah apparently ihadn't installed that package, ythanks
[00:29:18] BP-out: hey all. I have a Message class and a PrivateMessage subclass. Can I check for a variable or attribute in the Message initialize method and determine there if it should be a regular Message or PrivateMessage? Or is there a better place to do the check
[00:29:39] BP-out: Also I'm sort of certain this would be a good place to use a factory method
[00:30:04] nahkunt: is Learn Ruby The Hard Way a bad book?
[00:30:18] nahkunt: my friend told me it's bad, and i've only just started on it... seems alright to me so far
[00:32:28] wallerdev: nahkunt: do you have experience with programming
[00:32:58] horrorvacui: nahkunt: Its okay but I've read better. However, I'd defer to someone else as to whats best because I've pieced my learning from so many books and websites I can't really remember which is which.
[00:33:06] wallerdev: BP-out: i think you're using inheritance wrong, if you want specific behavior for privatemessage you should put it in the privatemessage class
[00:33:34] horrorvacui: nahkunt: My favorite was Well Grounded Rubyist
[00:33:55] wallerdev: _why's poignant guide
[00:34:11] nahkunt: no why's poignant guide is too silly for me
[00:34:14] nahkunt: i'm a very distractible person
[00:34:18] nahkunt: i need no nonsense
[00:34:21] nahkunt: even though it's a funny book
[00:34:33] wallerdev: haha yeahi tried to read it awhile back, but couldnt make it through haha
[00:35:00] wallerdev: i read pickaxe in like 2008 or something and it was a good read, not sure whats out now though
[00:35:01] horrorvacui: its short and sweet lazy :P
[00:35:40] BP-out: wallerdev: it has specific behavior, but it seems like it makes sense to inherit from Message parent classs
[00:36:12] wallerdev: you should override the method thats different in the child class
[00:36:19] BP-out: okay, I see
[00:36:25] horrorvacui: Pickaxe book is good but if you are just beginning ruby I'd get something else first.
[00:36:33] BP-out: I'll refactor this a bit
[00:37:34] horrorvacui: nahkunt: I liked Bastard's book but every time I've suggested it someone yells at me for recommending an incomplete book.
[00:37:37] horrorvacui: http://ruby.bastardsbook.com/
[00:38:04] horrorvacui: I like that it uses projects to teach ruby. Something I feel is missing in a lot of the other books.
[00:39:02] crome: does it have talking foxes?
[00:39:27] horrorvacui: They said why's was not for them though :(
[00:39:35] wallerdev: tryruby.org has talking foxes
[00:40:05] horrorvacui: I totally forgot that it had them too.
[00:42:21] nahkunt: horrorvacui: well i haven't really programmed before but i've used linux for 8 years so i do know bash and sed and things. so i don't like to read a whole chapter explaining how to open cmd.exe
[00:42:57] nahkunt: horrorvacui: think pickaxe sounds good or still maybe too hard for me?
[00:43:18] horrorvacui: nahkunt: just do what I do. Give them all a try. I just don't like one books chapter on say classes for example, I look at another books description.
[00:43:42] horrorvacui: If thats not an issue money wise.
[00:44:40] nahkunt: it is, yes. but i spose i have some swedish friends who could help me out with that
[00:44:41] horrorvacui: nahkunt: I think pickaxe will be fine because its like the ruby bible and you'll want it later anyhow.
[00:45:23] horrorvacui: Just make sure you get the latest one.
[00:45:53] horrorvacui: I've got the one from 2008 unfortunately but I'm pretty sure there is a new one for ruby > 2.0
[00:49:22] nahkunt: the well grounded rubyist is for 1.9... should i be looking for >2.0 books?
[00:49:55] havenwood: nahkunt: there is a new beta release of Well Grounded though, seems to be coming along well
[00:51:01] nahkunt: havenwood: will it be a problem to use the 1.9 version for now?
[00:51:19] nahkunt: i'm on ruby 2.1.1p76
[00:51:28] havenwood: nahkunt: nope, but you'll quickly run into little things that wont work - for the most part it is all fine though
[00:51:48] havenwood: nahkunt: but it looks like they have most of the early chapters done in the beta, you might just want to get the new edition
[00:52:12] havenwood: nahkunt: http://www.manning.com/black3/
[00:53:30] nahkunt: too expensive
[01:21:52] nahkunt: why do so many people have a hatred of ruby? i try to ask people what they suggest to learn ruby and most of the time i get told not to learn it
[01:23:51] arubin: nahkunt: Are you asking in #python?
[01:24:29] benzrf: via my brother:
[01:24:40] nahkunt: arubin: haha
[01:24:46] benzrf: 'im in a band called 1023MB. we havent got a gig yet.'
[01:24:52] arubin: benzrf: heh
[01:25:18] benzrf: nahkunt: it's because ruby and python fill the same niche
[01:25:25] zorak: im trying to run some scrips, but im getting this error
[01:25:26] zorak: irb -r factorial1.rb -r fibonacci1.rb
[01:25:26] zorak: /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require':LoadError: cannot load such file -- factorial1.rb
[01:25:26] zorak: /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require':LoadError: cannot load such file -- fibonacci1.rb
[01:25:26] zorak: irb(main):001:0>
[01:25:32] benzrf: if you learn one then you will probably have no need for the other
[01:25:41] benzrf: [unless youre like me and prefer one and switch to it]
[01:29:34] horrorvacui: nahkunt: Who told you to stay away from ruby?
[01:30:59] benzrf: yo charliesome u should try quick
[01:33:54] zorak: solved adding ./ to the script name
[01:34:03] zorak: irb -r ./factorial1.rb -r ./fibonacci1.rb
[01:40:08] godd2: afternoon, all
[01:48:21] BP-out: why does var = "\d
[01:48:31] BP-out: why does var = "\d" in pry return "d" ?
[01:49:11] wallerdev: because its not a valid escape character?
[01:49:32] BP-out: but then "\\d" returns "\\d"
[01:49:37] BP-out: is this just a pry thing?
[01:49:45] BP-out: because repl.it shows "\\d" as returning "\d"
[01:50:15] wallerdev: \\ will be \ when outputted
[01:50:26] wallerdev: so "\\d" will output as \d
[01:50:26] BP-out: it escapes once output through like puts
[01:50:29] BP-out: right, ok
[01:50:30] BP-out: thank you
[01:50:31] wallerdev: if you print it
[01:50:45] wallerdev: "\d" is an unrecognized escape sequence so it just assumes you meant "d"
[02:05:10] zorak: whats the name of this "||="??
[02:05:33] snkcld: how can i get this to work?
[02:05:33] snkcld: puts ???#{my_name}??? if my_name = ???joe"
[02:05:37] BP-out: conditional assignment, zorak
[02:05:49] zorak: BP-out: thanks!
[02:05:52] BP-out: as in, "assign this variable on the condition specified"
[02:06:13] BP-out: snkcld: change the = to a double ==
[02:06:19] BP-out: single = is assignment, == is comparison
[02:06:48] glide: I have a simple question about accessing arrays. Can someone help me?
[02:06:54] BP-out: also the quotes after the puts are redudant, since my_name is a string anyways
[02:06:56] BP-out: go ahead, glide
[02:07:05] snkcld: BP-out: but i want to assign on the right
[02:07:08] snkcld: im not comparing it
[02:07:14] snkcld: my_name doesnt exist at that point ;P
[02:07:24] BP-out: but an "if" statement requires a condition
[02:07:29] BP-out: what are you trying to do, anyways snkcld
[02:08:20] glide: Thanks, BP-out. array = [:peanut, :butter, :and, :jelly], array=[5,0] returns nil; but array=[4,0] returns []; why?
[02:08:25] snkcld: puts "order #{order_id} already exists" if order = Order.where(order_number: params[:order_number])
[02:08:34] snkcld: sorry, that should be:
[02:08:40] snkcld: #{order.id}
[02:08:55] centrx: Order.exists?
[02:09:19] BP-out: you don't need the order =
[02:09:29] BP-out: simply ... if Order.where(conditions)
[02:09:34] BP-out: since that returns a truthy value
[02:09:38] BP-out: assuming the order is found
[02:10:54] snkcld: puts "order #{order.id} already exists" if Order.where(order_number: params[:order_number])
[02:11:36] snkcld: but 'order' does not exist at this point
[02:12:26] BP-out: why not something like puts "order #{params[:order_number]} already exists" if Order.where(..)
[02:12:40] BP-out: unless you want to show the existing ID
[02:13:08] BP-out: in which case you can do order = Order.where(...) and on a new line puts "order #{order.id} already exists" if order
[02:13:13] BP-out: so, it kinda has to be 2 lines
[02:13:25] snkcld: yea... lemme provide a better example ;P
[02:14:03] snkcld: puts "You already have an order in place, with id: #{order.id}" if order = Order.where(name: params[:name], state: "active")
[02:15:06] BP-out: yeah, so you will have to break it into 2 lines
[02:15:24] BP-out: order = Order.where(...)
[02:15:32] BP-out: puts "you already have that order" if order
[02:16:03] BP-out: which is pretty standard in rails controllers, which i assume is what this is for?
[02:16:19] snkcld: eh, its sinatra
[02:16:20] snkcld: but regardless
[02:16:45] BP-out: well is there a reason you /need/ it to be a one liner?
[02:17:22] snkcld: just easier to read the code
[02:17:35] snkcld: because i have a few lines taht are like, error 40x "message" if ...
[02:19:01] benzrf: coffeescript is a language
[02:19:08] benzrf: so why not coffee
[02:20:40] glide: Hey guys, I had a question but I figured it out.
[02:20:58] glide: Any pointers on learning Ruby from scratch as a first language?
[02:21:58] snkcld: i learned ruby by making a gem
[02:21:59] benzrf: glide: dont
[02:22:04] benzrf: glide: start w/ python
[02:22:29] arubin: ACTION eyes benzrf suspiciously. 
[02:22:32] benzrf: having used both i prefer ruby, BUT i do think python is better for a beginner
[02:23:17] benzrf: ruby has much more in the way of wacky idiosyncrasies and an extra paradigm v. python
[02:23:27] benzrf: and the syntax is very more complicated
[02:23:43] glide: benzrf: I chose Ruby because it seems to be an in-demand language. Is the ease of learning of Python worth starting with it instead?
[02:23:54] ericwood: they're both great
[02:23:58] ericwood: I learned on python
[02:24:05] ericwood: but ruby gels better with my brain
[02:24:30] ericwood: in my mind they're even in terms of learnability for beginners
[02:25:06] glide: Speaking of idiosyncrasies, I came here to ask the a question about arrays that does involve something odd (array = [:peanut, :butter, :and, :jelly], array[5,0] returns nil; but array[4,0] returns [])
[02:25:42] glide: snkcld: I'm still at the point where I don't fully know what a gem is!
[02:25:59] glide: ericwood: Why did you choose to start with Python instead?
[02:26:02] ericwood: >> (1..10).to_a[5..0]
[02:26:03] eval-in: ericwood => [] (https://eval.in/131053)
[02:26:19] ericwood: glide: I was in middle school, my dad recommended it after doing some research
[02:26:30] ericwood: it was before ruby really caught on and became popular
[02:26:43] benzrf: ericwood: ruby is not significantly more in-demand than python \
[02:26:54] benzrf: and u can always hop over afterward
[02:26:54] ericwood: I never said anything about demand
[02:27:02] ericwood: I think demand is a shitty reason to learn your first language
[02:27:02] benzrf: ericwood: hence '* glidw'
[02:27:09] benzrf: ericwood++
[02:27:34] ericwood: I actually really like the idea of JS as a first language, quickly followed by another language
[02:27:56] ericwood: instant feedback, ubiquitous, tons of great APIs for making neat stuff immediately
[02:28:14] ericwood: but I like it as an entry point as far as teaching goes
[02:28:38] arubin: glide: "Additionally, an empty array is returned when the starting index for an element range is at the end of the array. Returns nil if the index (or starting index) are out of range."
[02:28:39] glide: Of course I'm trying to understand underlying principles so that I can learn more, but I thought Ruby was popular, has a big community, and I can learn to make something sooner.
[02:28:51] ericwood: Ruby is a great language
[02:29:09] glide: JS = javascript?
[02:29:10] arubin: I am not sure how "at the end of the array" is not "out of range".
[02:29:39] glide: arubin: Yeah I just figured that out. It's wierd!
[02:29:43] arubin: The documentation even shows an example of this: http://www.ruby-doc.org/core-2.1.1/Array.html#method-i-5B-5D
[02:30:46] arubin: Perhaps Ruby arrays are really lisp cons!
[02:31:03] glide: Thank you, arubin. I'm still learning how to use the documentation efficiently and effectively
[02:31:50] glide: ericwood: What is a good starting point to learn JS?
[02:31:51] soahccc: The problem with ruby is that once you get to it you don't want to use the other crap anymore :)
[02:31:58] arubin: soahccc: I agree.
[02:32:08] benzrf: soahccc: that can be said of any lang
[02:32:15] benzrf: besides the ones that it cant
[02:32:29] benzrf: glide: just sstart with python
[02:32:38] soahccc: yeah but with ruby it's something different??? it's not only the language itself but all the things around it
[02:33:01] benzrf: trust me, ive been programming for 10 years
[02:33:06] glide: Like what, soahcc? (Forgive me, I'm a newb)
[02:33:10] arubin: benzrf: That's it?
[02:33:22] benzrf: arubin: =[
[02:33:38] soahccc: And everytime I use a different language I miss all the tiny bits. It's like when I have to use windows again for some reason
[02:33:39] glide: benzrf: What about both at once? :)) What resources do you recommend?
[02:33:45] arubin: soahccc: heh
[02:34:05] arubin: glide: I disagree with benzrf, but I do not care to argue about it.
[02:34:39] glide: arubin: Of course. I'm just happy to hear different perspectives :)
[02:34:53] soahccc: glide: I was referring to the gems. you can make such good DSLs with ruby which integrate so seamlessly??? and the community is also pretty good
[02:35:12] benzrf: glide: the way i see it python is just simpler and more no-frills than ruby
[02:35:19] benzrf: which is good when you're starting out
[02:36:19] glide: benzrf: How long would it take to learn to make an interesting web app or something fun?
[02:36:29] glide: soahcc: I see. Cool.
[02:36:35] benzrf: glide: learn to program
[02:36:43] benzrf: then learn to use that knowledge to make a web app
[02:37:52] benzrf: arubin: try quick :-3
[02:38:29] arubin: Oh, your project.
[02:39:21] arubin: ACTION starts the new slow programming movement. 
[02:41:10] soahccc: arubin: http://data-sorcery.org/2010/12/29/hammock-driven-dev/ =)
[02:48:16] benzrf: i will sleep at this point in time
[02:48:23] benzrf: lest my brain fall out due to exhaustion
[02:48:28] glide: benzrf: Sleep well!
[02:53:00] brucelee_: does gem not install dependancies?
[02:53:13] centrx: It should
[02:53:15] brucelee_: from bundlers site, it seems bundler install dependencies
[02:53:22] brucelee_: but if gem does it, why would bundler be needeD?
[02:56:45] arubin: brucelee_: The purpose of Bundler is to manage the dependencies of a project.
[02:57:14] arubin: brucelee_: For example, you might have two different Rails projects, each of which requires a different version of some gem.
[02:58:10] brucelee_: arubin: ohh ok
[02:58:17] brucelee_: arubin: thats more clear
[02:58:19] brucelee_: arubin: thanks
[02:58:27] arubin: Have you read the front page of the Bundler site?
[02:58:30] arubin: It is quite nice.
[02:58:34] arubin: http://bundler.io/
[02:58:55] brucelee_: arubin: yeah i read it
[03:08:48] ozzloy: http://ruby.railstutorial.org/chapters/a-demo-app#sec-demo_users_resource what's the difference here between bundle exec rake db:migrate and just a plain rake db:migrate?
[03:08:56] ozzloy: why get bundler involved?
[03:09:51] arubin: ozzloy: It will make sure that the gem versions used are the ones in your gemfile.
[03:10:03] arubin: And not the ones that are installed on your system.
[03:11:23] ozzloy: arubin, thanks!
[04:55:57] Jonah11_: assuming `def square(x) x*x; end` is already defined, is there a more compact way to write `[1,2,3].map{|x| square(x)}`?
[04:57:36] godd2: >>[1,2,3].map{|x|x*x}
[04:57:37] eval-in: godd2 => [1, 4, 9] (https://eval.in/131101)
[04:57:44] godd2: I mean, if you're playing code golf
[04:58:54] obbo: is there an easy way to detect if an image is an animated gif using RMagick?
[04:59:37] Jonah11_: godd2, sorry, i didn't mean that. i was thinking more along the lines of a shortcut similar to [1,2,3].reduce(:+) -- the thing is if yoiu pass in a proc iw will be called upon each elm in map, rather than doing proc.call(elm)
[05:00:14] godd2: Jonah11_: what's your goal? fewer characters? fewer method calls? faster code?
[05:01:19] Jonah11_: godd2, clearer, more concise code.
[05:02:41] Jonah11_: godd2, basically, same reasons you'd write `arr.each(&:foo)` instead of `arr.each{|x| x.foo}`
[05:03:23] havenwood: Jonah11_: well, you could do `class Fixnum; def squared; self ** 2 end end` and then `[1, 2, 3].map &:squared`, but yeah
[05:03:40] godd2: oh so I should be doing threads.each(&:join) ?
[05:04:11] Jonah11_: havenwood, sure, but without the monkey patching :)
[05:04:12] godd2: but yea havenwood's approach works well since you're wanting to send the symbol of a method name on each element.
[05:04:18] havenwood: Jonah11_: refinements
[05:04:27] havenwood: Jonah11_: :P
[05:04:50] havenwood: Jonah11_: but yeah, no syntactic sugar like that
[05:05:03] Jonah11_: havenwood, ok, didnt think so, but wanted to make sure
[05:07:48] godd2: obbo: do you mean as opposed to being an unaninmated gif?
[05:08:03] godd2: that is, that the file you're looking at has at least two unique frames?
[05:08:27] obbo: godd2: yeah, i have a folder of mixed image formats, some gifs aren't animated. trying to find the animated ones
[05:09:31] obbo: godd2: is there a method or technique for just getting a count of frames?
[05:12:15] godd2: I'm on Windows so I can't test this for you, but I would try to make a new ImageList passing a gif and checking its #length
[05:12:24] godd2: http://studio.imagemagick.org/RMagick/doc/ilist.html#length
[05:15:18] godd2: of course, be sure that your test file is known to have multiple frames.
[05:16:54] havenwood: frames = `identify -format %n example.gif`.to_i
[05:23:56] obbo: havenwood: there's no rmagick equivalent for doing that? it works that way but just wondering
[05:25:37] godd2: obbo: just so you know, you'd be running this command line tool which is installed with imagemagick: http://www.imagemagick.org/script/identify.php
[05:26:53] godd2: It seems that the equivalent for identify is Image#inspect
[05:26:59] godd2: http://studio.imagemagick.org/RMagick/doc/optequiv.html
[05:27:37] godd2: As for getting the number of frames in a gif, perhaps scene will help? http://studio.imagemagick.org/RMagick/doc/image2.html#inspect
[05:27:51] godd2: If not, then It would appear you have to do it haven's way
[05:27:55] havenwood: obbo: Magick::Image.read('example.gif').size
[05:29:49] obbo: havenwood: ah thanks, that's it
[05:32:06] godd2: Just don't forget that you may get a "false positive" from gifs which have multiple frames which are the same image.
[06:03:21] mozzarella: do you know of great ruby forum apps?
[06:03:55] mozzarella: I want to launch a forum and I don't want it to be in php
[06:04:18] mozzarella: and discourse is kind of too monolithic for me???
[06:39:23] justinas: hi guys, how to make a static method in ruby?
[06:41:48] dr0ff: def self.method_name
[06:43:35] justinas: thank you very much
[07:11:48] mozzarella: you know what's great?
[07:28:49] mozzarella: WHY was rake missing?
[07:29:11] mozzarella: I thought it came installed with ruby 2.1
[07:30:34] dr0ff: missing where?
[07:30:47] donnoc: I think that was i joke
[07:46:45] xardas: hello, when injecting dependencies into a class where is then the object instatiation happening? i guess this is application specific?
[07:49:31] mozzarella: dr0ff: I have to gem install it manually
[08:40:15] znub: hi, ruby newbie here, I would like to know if there's a better way to do : hash[:foo] = get_foo if get_foo where get_foo method obviously returns (or not) the value for :foo key in the hash.
[08:47:51] linuxer1: I need to convert a string that actually has a binary value to a Fixnum...problem is to_i drops the leading zeros and jacks the binary all up. How can I get a string to a fix num without losing the leading zeros? My string is "0110111"
[09:03:11] diverdude: hello, i am trying to do sudo gem install rmagick -v '2.13.2' but i get the following error: http://paste.ubuntu.com/7197827/ what is going wrong?
[09:11:31] Hanmac: diverdude: apt-get install libmagickcore-dev
[09:26:44] luckyruby: is there a ruby method that does https://gist.github.com/luckyruby/9951244?
[09:30:13] canton7: luckyruby, nothing built-in. something like hash.map{ |k,v| [k, v.first] }.to_h also does the trick
[09:31:12] luckyruby: canton7: is that an improvement over what I have?
[09:31:33] canton7: if you define these: https://gist.github.com/havenwood/4964517, you can do hash.map_values(&:first)
[09:31:42] canton7: it doesn't mutate the hash, which might be important :P
[09:41:04] repinski: is ruby mostly used for web development? is it used for systems administration or application development?
[09:41:29] ghr: repinski lots of use in systems admin. Check out Chef and Puppet
[09:42:07] repinski: ghr: thanks
[09:43:39] ghr: no problem
[09:43:54] Hanmac: repinski: i also use it for GUI applications and also for 3D rendering
[09:44:36] repinski: Hanmac: that is pretty darn interesting
[09:55:53] papasierra: hi, i have a very simple question, i'm trying to use ruby to turn a hash into a formatted string, like so https://gist.github.com/paulsschwarz/ca34280e8ce904ae1233
[09:57:08] canton7: your desired input format is slightly off - should be { .... } not [ ... ]
[09:58:02] canton7: >> {'foo' => 'bar', 'baz' => 'bee'}.map{ |k,v| "'#{k}' => '#{v}'" }.join(", ")
[09:58:03] eval-in: canton7 => "'foo' => 'bar', 'baz' => 'bee'" (https://eval.in/131162)
[09:58:43] papasierra: canton7: sure, i wasn't sure of the exact ruby syntax for a hash. but cool. also, i have ruby installed locally, what's the REPL command?
[09:58:57] canton7: (or install pry, and use that)
[09:59:27] papasierra: ah yeah! right, you suggestion looks good. i'm going to try now. is pry also a repl?
[09:59:40] canton7: yup, one on steroids
[10:00:43] papasierra: nice, well ty v much. ruby is beginning to make a lot more sense to me that it was a few months ago
[10:12:20] papasierra: canton7: sorry, as much as your answer was accurate, my question way not! here's what i'm really trying to do https://gist.github.com/paulsschwarz/ca34280e8ce904ae1233
[10:12:57] canton7: I'm afraid I don't know what chef does
[10:13:12] canton7: or rather, how it does it
[10:13:18] papasierra: oh, as in that's some dsl?
[10:13:26] canton7: but this sounds like a chef question. Maybe a backslash on the end of each line?
[10:13:33] canton7: (except the last)
[10:14:20] papasierra: from inside chef's cookbook :php_options => params[:php_options] || {},
[10:14:32] papasierra: so it's looking for a hash
[10:15:10] papasierra: and http://www.hastebin.com/gatelekoyi.rb
[10:15:15] olivier_bK: how to compare two date ? i try to now if this date is grater 2013-12-31 than 2014-04-02
[10:15:59] canton7: papasierra, some brackets would also do it: php_options(\n'php_....' => 'on',\n....\n)
[10:16:41] papasierra: canton7: trying that now...
[10:17:13] papasierra: it looks to me like it's not some dsl, but more some ruby syntax sugar where you don't have to specify {} to declare a hash
[10:17:44] papasierra: hmm... syntax error, unexpected tASSOC, expecting ')'
[10:18:06] canton7: might need some more backslashes :P
[10:19:12] papasierra: canton7: http://pastie.org/private/dc4itpc9ilmsjmzbcvrpa
[10:19:56] papasierra: oh, it needs the \n? ok, sorry the whole idea was simply to split this over multiple lines to make it more human readable.
[10:20:27] canton7: by \n I meant a newline
[10:20:27] papasierra: i have about 20 hash entries (php_options) and the horizontal scroll is nasty. so i just wanted to have one hash entry per line
[10:20:51] papasierra: sure, as per my pastie?
[10:20:51] canton7: and OK, my guess about how chef worked was incorrect
[10:21:02] canton7: you're best looking for chef-specific answers
[10:21:15] papasierra: right. i have a guess...
[10:23:07] papasierra: canton7: http://pastie.org/8990904
[10:23:35] papasierra: yup, time to ask in #chef, or to look into the guts and work out how it's formatting this stuff
[10:23:36] canton7: wrong sort of brackets
[10:24:01] papasierra: well, chef is doing an .each, so that sounds like [] to me, no?
[10:24:15] canton7: you can .each a hash
[10:24:51] canton7: >> {'foo' => 'bar'}.each{ |k,v| puts "Key = #{k}, Value = #{v}" }
[10:24:52] eval-in: canton7 => Key = foo, Value = bar ... (https://eval.in/131163)
[10:26:00] papasierra: right of course. it seems to be the whole newline thing it doesn't like
[10:43:12] papasierra: canton7: final solution: http://pastie.org/private/wcknmeldlyrw5jcfcgikq
[10:43:53] apeiros: papasierra: though shall not put a space between method name and argument-parens! (line 2
[10:44:17] papasierra: OR use an implicit hash, which means i can drop the ({ ... }), but i have to have the first item on the first line
[10:44:25] papasierra: apeiros: just noticed that, ty :)
[10:44:42] apeiros: papasierra: keep the (), drop the {}, then you can keep the items on the subsequent lines
[10:47:38] papasierra: apeiros: ty. final final solution http://pastie.org/private/q8l9jlxjwnsfomj9ejgog
[10:48:30] jlebrech: i want to gsub something out of a string but just at the beginning ie images/http-google.com.png I wanna remove 'images/' from the start but not from anywhere else in the string.
[10:49:11] jlebrech: regex maybe
[10:49:38] zaargy: regex yes
[10:50:26] zaargy: "images/http-google.com.png".gsub(/^images\//, "")
[10:50:45] jlebrech: thanks \Aimages\/ :)
[10:50:53] jlebrech: sorry you just told me
[10:52:47] apeiros: zaargy: sub instead of gsub if you know it'll only be once
[11:14:26] catphish: is there a way in ruby to monitor 10,000 IO sockets for data in a threadsafe manner?
[11:15:26] catphish: spawning a thread for each seems like madness, select can't support enough sockets, and poll() doesn't work in a threaded environment
[11:16:41] popl: catphish: What are you trying to accomplish?
[11:16:58] catphish: i have a ruby server that listens on a very large number of tcp sockets
[11:17:04] catphish: i want to accept connections on any of them
[11:17:24] catphish: and talk to the connected clients
[11:17:38] popl: catphish: use processes, not threads: http://godrb.com/
[11:18:07] catphish: i think that's genuine insanity, but thanks
[11:18:12] apeiros: catphish: threads + select on smaller numbers?
[11:18:26] catphish: apeiros: that makes a lot of sense :)
[11:18:43] catphish: i'll break it down into selects of 1,000 sockets and put each in a thread
[11:18:53] apeiros: catphish: maybe use a library which supports notification (push instead of poll)
[11:19:01] popl: why is it insane?
[11:19:02] catphish: the other option is to use poll and put *everything* in the poll (clients and listeners)
[11:19:42] catphish: popl: running tens of thousands of pre-forked processes just seems unmanageable
[11:19:48] popl: you asked for a way to do it in a threadsafe manner.
[11:20:16] popl: That's what the framework is for.
[11:20:43] catphish: forking isn't "threadsafe"
[11:20:57] apeiros: it kinda is :)
[11:21:04] apeiros: being in separate processes and all???
[11:21:43] apeiros: but probably comes with its own set of problems for your scenario
[11:21:47] catphish: apeiros: thanks anyway, i'll try getting everything into a poll() as that seems the most efficinent, failing that i'll use threaded selects
[11:22:25] catphish: my app is a tcp proxy that listens on a wide range of ports, so everything is io driven and may be able to work in a single thread
[11:22:46] apeiros: catphish: alternatively: no threads, select iteratively on small arrays without blocking
[11:23:11] workmad3: catphish: have you considered using something like EventMachine?
[11:23:16] catphish: that's a tad cpu hungry i fear
[11:23:35] popl: I try to avoid threads when I can.
[11:23:35] catphish: workmad3: not yet, i guess that uses one huge poll()
[11:24:05] catphish: popl: that's the safest approach if you don't understand them well, but sadly they're often very useful
[11:24:36] catphish: particularly as a way to handle multiple network clients
[11:24:55] sandstrom: What is this syntax `0x25` in Ruby? It returns the 37 fixnum
[11:25:16] maasha: bleh :o( something is not right in my fork pool. When I hit it with lots of real data the parent process is busy, the workers are mostly idle, and it blows memory: https://gist.github.com/maasha/9d0b7e88ca6cf200cfed
[11:25:19] sandstrom: catphish: thanks
[11:25:50] catphish: sandstrom: also be aware of octal eg: 020
[11:26:02] maasha: and it is slow.
[11:26:08] catphish: 020 != 20 :)
[11:26:30] sandstrom: catphish: thanks!
[11:26:54] catphish: i assume you knoe what hex it
[11:27:30] pontiki: treachery of fingers
[11:27:39] eval-in: jmaister => 16 (https://eval.in/131196)
[11:27:54] eval-in: catphish => 32 (https://eval.in/131199)
[11:28:03] jmaister: I just realised eval-in is pronounced everlyn
[11:28:16] pontiki: >> 0xdeadbeef
[11:28:16] eval-in: pontiki => 3735928559 (https://eval.in/131200)
[11:28:21] jmaister: eval-in: Hi babe
[11:29:22] pontiki: come now, that's not how you speak to her
[11:29:41] pontiki: >> "Hello, dear"
[11:29:41] eval-in: pontiki => "Hello, dear" (https://eval.in/131205)
[11:30:22] jmaister: >> make me a sandwich
[11:30:22] eval-in: jmaister => undefined local variable or method `sandwich' for main:Object (NameError) ... (https://eval.in/131206)
[11:30:44] jmaister: Well, that's a new excuse
[11:31:45] apeiros: jmaister: try that in bash
[11:32:11] jmaister: make: *** No rule to make target `me'. Stop.
[11:32:15] jmaister: but that's zsh though
[11:33:06] popl: make isn't a shell command
[11:33:24] popl: so it shouldn't matter :)
[11:33:34] catphish: apeiros: now i'm confused, i just ran it with no threads using select on 10,000 listeners and it didn't break
[11:34:15] catphish: isn't that supposed to explode in a spectacularly fiery mess?
[11:34:17] apeiros: nice. so you don't need to break it down it seems.
[11:34:36] workmad3: catphish: what happens when you throw realistic levels of data at the sockets?
[11:34:55] jmaister: It's so dissappointing when something you expect to explode fails to do so
[11:35:00] apeiros: well, it depends on your OS' select
[11:35:14] apeiros: I was a bit surprised when you said 10k wouldn't work with select, but took it at face value
[11:35:14] popl: jmaister: That's the best defense against a troll.
[11:35:50] pontiki: "Where was the Earth-shattering ka-boom?"
[11:36:06] catphish: workmad3: nmap localhost -p10000-19999 - no issues
[11:36:08] popl: pontiki: in her pants
[11:36:21] catphish: all 10,000 get accepted
[11:36:23] workmad3: popl: I find the best defense against a troll is to push them off the bridge... but I'm somewhat old-skool
[11:36:37] workmad3: catphish: right... but what about when data is flowing in?
[11:36:46] pontiki: how can you push them off a bridge when they live under it?
[11:36:52] apeiros: aahahaha: "poll and select are basically the same speed-wise: slow."
[11:37:00] catphish: i don't know, i'm not putting the data streams into the select
[11:37:05] workmad3: catphish: as it's not really about whether they're accepted, it's about if you can get data through your system fast enough ;)
[11:37:08] catphish: each actual client stream gts a thread
[11:37:31] workmad3: catphish: are you using jruby or rubinius? or will you have the GIL to contend with?
[11:37:50] catphish: i'm using MRI 2.1.1
[11:37:59] apeiros: catphish: from a quick google, I'd say a libev wrapper would perform best
[11:39:19] catphish: it's working great, i just don't understand why
[11:39:26] workmad3: catphish: so that's a 'yes' on the GIL front... which is why you should be checking if that setup can perform at the expected data load rates (as only one thread will be active at a time)
[11:40:00] catphish: sure, well the main thread is normally just waiting on select()
[11:40:12] catphish: which helps
[11:40:54] workmad3: catphish: 1 thread waiting amongst 10,000 doesn't seem like much help personally ;(
[11:41:49] catphish: there aren't 10,000 threads, one thread to listen on 10,000 ports, then one thread for each client, almost all will be waiting for data with select()
[11:42:04] catphish: but that's not to say load testing isn't in order
[11:42:09] catphish: more interested in making it works first
[11:43:28] catphish: and it does appear to
[11:43:38] catphish: thanks all, thats a few things for me to try now :)
[11:47:46] osxorgate: my osx comes with ruby 2.0, i try to run a particular gem but it fails, apparently because it was designed for 1.9 . Is there a way for me to run this gem using 1.9 instead of 2.0 ?
[11:48:36] pontiki: huh. which gem, osxorgate ?
[11:49:08] osxorgate: pontiki: this guy https://github.com/dingbat/clockout , my actual goal is to extract hours worked from a git repo
[11:49:10] pontiki: you *could* install a 1.9.3 using a ruby version manager
[11:49:17] osxorgate: for tax purposes
[11:50:29] Hanmac: osxorgate: it says it does support 2.0 ... why does it fail for you, or what specially does happen?
[11:51:33] osxorgate: yup it does say that, but many repos (not all) give an error like this : https://gist.github.com/xorgate/0c551adb660adffe10eb
[11:55:41] Hanmac: looks more like a bug in grit for me ...
[11:56:29] Hanmac: or a problem that grit might not compatible with your git version
[11:58:07] tulak: Hello, I am having two arrays of objects of class MyObject, and I am trying to do the substraction a = [obj1, obj2]; b = [obj2, obj3]; a - b => [obj1, obj2] but it does not substract array b from a. The class MyObject implements method <=> for comparing, and even a[1] == b[0] is true. What else should I implement to get this working ?
[12:00:21] osxorgate: Hanmac: maybe i can use RVM ? (i am 100% ruby noob)
[12:00:48] Hanmac: osxorgate: i am not 100% sure if that would solv your problem
[12:01:47] Hanmac: tulak: did you include the Comparable module? if yes, try to add the methods #hash and #eql?
[12:13:40] gr33n7007h: This is the out put => http://sprunge.us/WihZ I had to ctrl+c because it was hanging :) I think it's nearly there
[12:13:57] gr33n7007h: This is the out put => http://sprunge.us/WihZ I had to ctrl+c because it was hanging :) I think it's nearly there
[12:14:21] canton7-mac: yup, looks like it was still running
[12:14:33] canton7-mac: and you've hit the problem of multiple threads all writing to stdout at once ;)
[12:15:44] gr33n7007h: is there a way to delay it slightly?
[12:15:51] canton7-mac: what do you mean?
[12:16:14] gr33n7007h: like setting a timeout or something?
[12:16:38] canton7-mac: on the socket open?
[12:17:44] canton7-mac: you can use the Timeout class, although it's a little bit of a bodge
[12:18:33] gr33n7007h: What would you say set a timeout of a second maybe?
[12:18:48] canton7-mac: portscans do take a while :P
[12:19:05] gr33n7007h: well, yeah true :)
[12:19:16] gr33n7007h: lemme redo it
[12:25:03] shredding: I use highline in a capistrano project. both have a ask() func
[12:25:15] shredding: Even if i do HighLine::ask('Your choice: ') i get the error:
[12:25:16] gr33n7007h: hey canton7-mac does this look right => http://sprunge.us/PbjI
[12:25:25] shredding: .rvm/gems/ruby-2.0.0-p247/gems/capistrano-3.1.0/lib/capistrano/dsl/env.rb:30:in `ask': wrong number of arguments (1 for 2) (ArgumentError)
[12:25:38] shredding: How can i force the usage of the highline method?
[12:25:47] shredding: I thought the namespace would be sufficient.
[12:26:25] canton7-mac: gr33n7007h, surely you want to say 'port closed' if a timeout occurs?
[12:29:11] gr33n7007h: canton7-mac, bloody hell that was fast new code => http://sprunge.us/NhNF
[12:29:58] canton7-mac: bear in mind that 0.3 seconds isn't very long
[12:30:04] gr33n7007h: canton7, awesome it works well fast
[12:30:04] shredding: My problem: $terminal.ask
[12:30:12] gr33n7007h: what about 0.7
[12:30:20] canton7-mac: I'd leave a few seconds at least
[12:30:30] canton7-mac: sometimes it does take a while to get a connection
[12:30:43] gr33n7007h: ok one sec lemme try 3 secs
[12:34:48] gr33n7007h: It seems to be working but sometimes it says port 443 is closed when using 3 second timeout when port 443 is open
[12:35:33] canton7-mac: maybe it takes longer than 3 secs? maybe there's a firewall blocking your spamming?
[12:35:56] gr33n7007h: should I try a higher timeout?
[12:36:19] canton7-mac: I'd just use nmap :P
[12:36:51] gr33n7007h: well true, but really i'm just trying to understand threads :)
[12:37:48] canton7-mac: which is fair enough
[12:39:37] gr33n7007h: So close yet so far away
[12:41:03] gr33n7007h: canton7-mac, Thanks for your help buddy :)
[12:41:59] gr33n7007h: you too Mon_Ouie :)
[12:45:35] gr33n7007h: Just a quick question do threads automatically join in a pry/irb session?
[12:45:42] r_rios: Is there any (official, preferably) documentation on creating virtual attributes in Rails 4?
[12:46:03] apeiros: gr33n7007h: no
[12:46:27] apeiros: r_rios: #rubyonrails is probably more competent on that
[12:46:38] canton7-mac: gr33n7007h, no. although, in your case, the process stopped executing before the threads completed, which killed the threads. that won't be the case in irb
[12:46:59] gr33n7007h: apeiros, canton7-mac got ya! cheers
[12:55:41] DEA7TH: What do people typically use Ruby for, outside of Ruby on Rails?
[12:58:04] olivier_bK: DEA7TH, i use ruby for creat some task like send mail , backup mysql , connect to irc ..
[12:58:33] olivier_bK: DEA7TH, i use ruby also for create an ide
[12:59:34] olivier_bK: and if i have a time in few month i would want to creat a game with gosu
[12:59:50] canton7: general sysadmin stuff, general glue, sinatra websites/webservices, we use a unit testing framework for C written in it
[12:59:53] tobiasvl: DEA7TH: I use ruby for anything
[13:00:05] DEA7TH: I mean, Python is common in numeric/scientific applications, and I heard networking
[13:00:12] canton7: and if I need to knock something up quickly, I'll use ruby
[13:00:21] DEA7TH: C++ for systems programming and high-performance and scientific stuff
[13:00:28] tobiasvl: I mostly use ruby as a Perl replacement (I'm a sysadmin)
[13:00:32] DEA7TH: PHP for web development (unfortunately)
[13:00:36] DEA7TH: and so on
[13:00:36] shevy: tobiasvl \o/
[13:00:44] shevy: I do everything in ruby right now
[13:00:49] tobiasvl: but also for web stuff (although not rails, I've used sinatra for example)
[13:01:04] DEA7TH: of course everything can be done in everything, even websites in C++, but some languages have typical usages
[13:01:18] shevy: DEA7TH yes, all usages are covered with ruby here, not sure what else to tell you :)
[13:01:22] DEA7TH: and I observe that this channel has twice the amount of visitors as #RubyOnRails
[13:01:31] shevy: #RubyOnRails is restricted
[13:01:34] shevy: you must register to join
[13:01:36] tobiasvl: DEA7TH: ruby is a multi-purpose scripting language. I use it to write scripts. :)
[13:02:22] DEA7TH: canton7: general blue?
[13:02:30] DEA7TH: oops misread
[13:03:28] shevy: DEA7TH I would assume you would get just about the same answer on #python and #perl
[13:04:09] DEA7TH: I know every language can be used for everything, but some *tend* to be used for specific things - I'm not commenting on whether they are good at those things
[13:04:28] DEA7TH: although most of the time they should be decent
[13:04:32] tobiasvl: DEA7TH: and ruby tends to be used with rails. there's no denying that. what are you actually wondering about?
[13:04:58] elisarver: DEA7TH: I use ruby to build test automation using selenium and cucumber
[13:05:15] DEA7TH: tobiasvl: my question was about other usages of Ruby, if there are some not mentioned already
[13:05:33] elisarver: DEA7TH: we also use it to process xml from one system's format to another, filling in the missing information via atom queries
[13:05:43] shevy: DEA7TH languages that are catered towards a specific usage domain are often having a very bad design
[13:05:45] elisarver: DEA7TH: and of course there's puppet
[13:05:45] shevy: DEA7TH like php
[13:05:59] elisarver: DEA7TH: and vagrant
[13:06:16] DEA7TH: but I suppose there are no specific fields for Ruby? except for web dev, I mean
[13:06:18] shevy: DEA7TH rails didn't exist when I started with ruby, ruby is really for most everything a better variant of perl in my opinion
[13:06:30] shevy: why you keep on writing "web dev" :P
[13:07:03] DEA7TH: shevy: because obviously Ruby is famous for Rails - even if it didn't start that way, right now Rails is a big subset of Ruby's usages
[13:07:19] shevy: well I use ruby since 10 years without rails still
[13:07:56] tobiasvl: https://www.ruby-lang.org/en/documentation/success-stories/
[13:08:38] shevy: the specific field is - general purpose. Everything. Glue.
[13:08:53] shevy: specific field of php is: too awful to use aside from web
[13:09:03] elisarver: I've never used rails beside trying to learn it years ago. I should give it a go now that I more deeply understand the underlying language
[13:09:24] shevy: obviously where scripting languages would fail is competing for speed against C-like languages
[13:09:32] DEA7TH: I wouldn't use PHP even for web ^^
[13:09:36] shevy: (or if they have an awful design, like php, then they fail in itself)
[13:09:45] shevy: TIOBE says php is better than ruby!
[13:09:57] shevy: http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
[13:10:01] shevy: ruby dropped 6 ranks in one year!!!
[13:10:08] DEA7TH: actually popularity is a useful property
[13:10:25] shevy: I estimate ruby lost 20% devs in a year according to TIOBE
[13:10:35] gr33n7007h: canton7-mac, Is there away to get the output sane?
[13:10:42] chichou: It's really hard to find ruby dev :)
[13:11:01] DEA7TH: why would people move away from Ruby
[13:11:13] shevy: old folks often know perl, python is larger than ruby, php is used a lot for web-related stuff
[13:11:23] DEA7TH: growth of BigData -> less interpreted languages?
[13:11:25] shevy: DEA7TH I would not know but that is what TIOBE says!
[13:11:44] shevy: DEA7TH nah, you will rarely see clusters use just one language, they tend to use multiple languages at the same time
[13:12:17] DEA7TH: growth of VB.NET according to TIOBE? it could be that it's just growth of developers then
[13:12:28] chichou: DEA7TH: they don't move away from, just that less people learn ruby than learn php
[13:12:31] DEA7TH: perhaps development used to be done by a more selective part of the population
[13:12:59] canton7-mac: gr33n7007h, either use some locks, or get all threads to post their messages back to a single thread (could be the main thread), which prints them
[13:13:25] DEA7TH: oh well, at least Scala has a bright future :)
[13:14:13] elisarver: DEA7TH: except grumbling that jdk 8 will kill it with incompatiblities :(
[13:14:42] gr33n7007h: canton7-mac, I'll lookup locks on ruby website thanks
[13:14:42] chichou: Go is #36, behind COBOL on TIOBE :D
[13:15:14] elisarver: and I disregard TIOBE, since it's mainly a measure of people trying to get *help* in a language (based on searches of forum community size, number of (potentially stupid) topics posted, etc.)
[13:15:56] DEA7TH: yeah TIOBE is weird for some things
[13:16:16] DEA7TH: and VB is like #7? it's not even maintained for more than a decade now
[13:16:30] shevy: but there are still people making money with it!
[13:17:01] linuxthefish: why ruby broken? :(
[13:17:12] linuxthefish: /usr/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:55:in `gem_original_require': no such file to load -- json (LoadError)
[13:18:27] shevy: linuxthefish works fine here
[13:18:31] shevy: >> require 'json'
[13:18:34] eval-in: shevy => (https://eval.in/131257)
[13:19:25] shevy: that bot is weird
[13:19:29] linuxthefish: >> require 'json'
[13:19:29] eval-in: linuxthefish => (https://eval.in/131259)
[13:19:45] linuxthefish: -bash: require: command not found
[13:19:51] shevy: tried to do gem install json ?
[13:19:58] shevy: bash does not know the require command
[13:20:08] gr33n7007h: is a lock a mutex?
[13:21:01] linuxthefish: mkmf.rb can't find header files for ruby at /usr/lib/ruby/ruby.h
[13:21:07] linuxthefish: tried that before
[13:21:34] chichou: maybe your ruby installation is broken
[13:21:59] linuxthefish: it's blank CentOS so i think bug :S
[13:22:08] shevy: mkmf is part of default ruby
[13:22:12] linuxthefish: i tried on another server and that just install old version and won't compile
[13:22:17] shevy: so thank your distribution for being so awesome ;P
[13:23:35] linuxthefish: i've installed rubygem-mkrf-0.2.3-5.el6.noarch and still no :S
[13:23:43] linuxthefish: and it won't compile from source
[13:24:08] linuxthefish: well it compiles fine but ruby -v dosn't do anything :/
[13:26:44] shevy: you got some broken system there man
[13:27:19] linuxthefish: nah it's fine now it was put in /usr/local/bin/ruby -_-
[13:27:58] linuxthefish: is there gem command to install most common ones?
[13:28:11] linuxthefish: /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- zlib (LoadError)
[13:28:31] tobiasvl: gem install zlib
[13:28:51] linuxthefish: /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- zlib (LoadError)
[13:29:49] lenoxe: hello all
[13:29:56] lenoxe: ./join #ruby-lang
[13:31:06] shevy: linuxthefish zlib bindings are in ruby source tarball in ext/zlib directory
[13:31:07] lenoxe: i need coffee
[13:31:22] linuxthefish: yeah i've done that shevy :(
[13:31:22] shevy: linuxthefish your distribution did not provide you with that, which is typical
[13:31:50] linuxthefish: "/usr/bin/ld: cannot find -lzdll" in the make file error log though
[13:32:23] shevy: what is zdll
[13:32:25] shevy: sounds like windows
[13:36:17] linuxthefish: shevy what OS do you use? :(
[13:37:23] shevy: linuxthefish linux, originally slackware but about 98% is self compiled
[13:37:25] j416: is !! as a boolean caster considered good or bad practice?
[13:39:06] toretore: j416: depends
[13:39:12] shevy: j416 I only use !
[13:39:17] canton7-mac: I haven't seen a good argument for that since pre-stdbool C :P
[13:39:20] shevy: >> x = true; x = !x; x
[13:39:20] eval-in: shevy => false (https://eval.in/131271)
[13:39:32] eval-in: canton7-mac => /tmp/execpad-8dc5a507cbaf/source-8dc5a507cbaf:2: warning: string literal in condition ... (https://eval.in/131272)
[13:40:04] canton7-mac: >>s = "hello"; !!s
[13:40:04] eval-in: canton7-mac => true (https://eval.in/131273)
[13:40:19] DEA7TH: what's the difference between this channel and #ruby-lang?
[13:40:29] toretore: ruby-lang is better
[13:40:50] canton7-mac: j416, so yeah, if you can show me a use-case for !! in ruby, I bet I can show you a better alternative ;)
[13:40:56] j416: use case being e.g. when defining an ? method (say, def valid?) and whatever checks things in it returns nil or not nil
[13:41:15] toretore: j416: personally, i use !! on ? methods
[13:41:33] toretore: i expect one to return true or false
[13:41:49] canton7-mac: if it's a ? method which returns a bool, why use !! at all?
[13:41:57] j416: canton7-mac: inside it.
[13:42:19] canton7-mac: ah, makes more sense
[13:42:20] banisterfiend: canton7-mac you're against !! ? y?
[13:42:32] toretore: connection.open? #=> <#Connection::Channel 0x54e54e43w>
[13:42:43] toretore: connection.open? #=> true
[13:43:01] shevy: box.open? #=> "Yes."
[13:43:15] j416: shevy: lol
[13:43:41] canton7-mac: say with that connection.open? inside the definition of open? you might have '!!@connection'. why not have '!@connection.nil?' or '@connection != nil' ?
[13:43:45] toretore: cat.dead? #=> both
[13:44:10] shevy: lol toretore
[13:44:21] j416: this is a real use-case
[13:44:22] j416: def exists?(something_id)
[13:44:24] j416: !!@db.exec(<<-SQL, [something_id]) { true }
[13:44:26] j416: SELECT 1 FROM something WHERE something_id = $1::int
[13:44:37] j416: blergh, indentation failed, but you see.
[13:44:40] canton7-mac: j416, so you're expecting that to return nl, or something else?
[13:44:48] shevy: today is typing fail day
[13:44:58] j416: canton7-mac: it's a ? method, so expected to return true or false, nothing else
[13:45:07] shevy: I want to return either nl or tre
[13:45:09] shevy: or perhaps flse
[13:45:16] canton7-mac: j416, sorry, mistype. you're expecting @db.exec to return somethign that is either nil, or some object?
[13:45:29] j416: canton7-mac: @db.exec returns true or nil
[13:45:45] toretore: j416: your use of !! is fine
[13:46:04] toretore: i do it like that too, and i am perfect
[13:46:04] canton7-mac: j416, ouch :P yeah, it is fine. personally I'd check using .nil? or == nil
[13:46:22] shevy: j416 you don't like !! ?
[13:47:04] canton7-mac: in languages where lots of things are falsy, !! makes more sense - it will turn an emptystring, emptyarray, emptyhash, 0, 0.0, etc, into false. in ruby that isn't the case
[13:47:14] toretore: the reason people sometimes don't like !! is because of people not understanding what it does and just slapping it on expressions everywhere
[13:47:31] canton7-mac: the only things it'll turn into false are false and nil. the false is pointless, and the nil you might as well just check yourself
[13:47:48] j416: canton7-mac: but it'd be != nil
[13:48:02] j416: shevy: I don't dislike it, I think it looks rather elegant
[13:48:03] canton7-mac: j416, and !....nil?, yes
[13:48:12] vasilakisFiL: hey do you have any better alternative for this boilcode? Imagine that I had 1000 such values.... https://gist.github.com/vasilakisfil/35077a16c1f7a68c8249 (the json comes frome an external API that's the reason of CamelCase)
[13:48:19] j416: shevy: just wondering if it's generally seen as good or bad practice
[13:48:48] shevy: ok so we use !! in ruby to get back either true or false in a reliable way?
[13:48:48] toretore: vasilakisFiL: why are you putting them in instance variables?
[13:48:58] canton7-mac: in pre-stdbool C it's really important. it'll turn a value that's >1 into one that's == 1, and a bool value that's >1 is full of potential subtle bugs
[13:49:00] j416: shevy: that's .. how I use it
[13:49:57] linuxthefish: Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources
[13:50:00] toretore: vasilakisFiL: gist the whole file plz
[13:50:04] linuxthefish: i've installed openssl, how to rebuild?
[13:50:12] canton7-mac: but in ruby the only thing that there's any point in using it on is nil, and imo just checking for nil is cleaner and more obvious :P
[13:50:23] j416: vasilakisFiL: you could just store the hash as-is, or you could if you want loop through the keys you need and assign using meta
[13:50:24] toretore: linuxthefish: how did you install it?
[13:50:32] linuxthefish: compiled from source :D
[13:50:37] linuxthefish: i tried recompile but no :/
[13:50:39] toretore: then re-compile
[13:50:46] j416: canton7-mac: !@db.exec(<<-SQL, [something_id]) { true }.nil?
[13:50:48] linuxthefish: how do i remove old?
[13:50:53] j416: canton7-mac: do you think that is better?
[13:51:03] toretore: i don't know if there's a make uninstall, but try
[13:51:29] toretore: linuxthefish: also, you should consider using something like rbenv, it's much cleaner
[13:51:45] canton7-mac: j416, personally, yeah, but it's up to you
[13:51:50] linuxthefish: i can't, not allowed :(
[13:51:59] j416: canton7-mac: thanks.
[13:52:14] j416: canton7-mac: to me, !! is more readable. perhaps because I've gotten used to it.
[13:52:18] vasilakisFiL: toretore this is an initialization of an ActiveRecord model without database.. https://gist.github.com/vasilakisfil/35077a16c1f7a68c8249
[13:52:28] j416: thanks for all the input! :)
[13:52:40] toretore: linuxthefish: you're allowed to install ruby globally, but not install it in your ~?
[13:53:35] toretore: vasilakisFiL: look up which method is used to get an attribute
[13:53:45] toretore: instead of just calling a method
[13:53:55] toretore: then override that to look it up in the json
[13:53:55] linuxthefish: rm -rf /usr/bin/ruby /usr/lib/ruby /usr/local/bin/ruby /usr/local/lib/ruby
[13:53:57] linuxthefish: this deletes?
[13:56:05] toretore: vasilakisFiL: use ActiveModel::AttributeMethods
[13:56:15] toretore: i can't link to it because of some js bs
[13:56:31] toretore: but it lets you define an `attributes` method
[13:57:44] vasilakisFiL: aha ok thanks !
[14:03:26] nooteh: hi there, I'd like to ask if one of you has some experience with http://ruboto.org. I'm thinking of using it for one app
[14:04:01] shevy: linuxthefish there may be some more "binaries" in /usr/bin like irb ri rdoc
[14:04:30] shevy: linuxthefish if you compile from source with the --prefix=/usr then it should not matter, as already existing files will be "overwritten" when you do make install
[14:04:53] linuxthefish: i'm trying with some rvm thing
[14:05:37] toretore: linuxthefish: not rvm
[14:05:43] toretore: use rbenv or that other thing
[14:06:18] shevy: come on man, use the source: wget ftp://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.1.tar.bz2
[14:11:28] linuxthefish: yey, compile from source worked for one server :D
[14:14:04] shevy: what does ruby -v say there
[14:14:46] stevenliang: hi, everyone. have you installed rubydns?
[14:16:50] stevenliang: from rubydns installation doc, it need to rum "gem", "bundle", and etc.
[14:17:32] stevenliang: my question is how to prepare ruby env for rubydns? thank you.
[14:18:15] benzrf: hows it goin ruby people
[14:18:55] benzrf: im thinkin of finally picking up rails426
[14:19:28] benzrf: i finally read up on what REST is exactly and it sounds like a pretty good set of guidelines
[14:19:36] shevy: what is REST benzrf
[14:19:44] benzrf: so i think i get how rails could use MVC to accomplish that
[14:19:44] DouweM: benzrf: nice
[14:19:59] benzrf: shevy: it is a set of rules and ideas about how to design APIs
[14:20:06] benzrf: and other kinds of interfaces i guess??
[14:20:12] rails426: benzrf you picking me up?
[14:20:17] benzrf: rails426: of course i am
[14:20:30] shevy: rails426 he often mis-tab-completes on IRC
[14:20:39] benzrf: >tfw tab compleatang
[14:20:47] shevy: I am trying to have him fall into stupid work-nicks
[14:21:12] shevy: but he is much more creative than I am
[14:22:42] benzrf: shevy: can u into REST
[14:23:35] benzrf: anyway now that i understand how to design things in a RESTful manner i get why MVC is a good approach for that o=
[14:23:46] benzrf: ACTION has turned into a buzzword spout
[14:24:02] benzrf: any day now im gonna start using a macbook and spending all my time in starbucks
[14:29:21] DouweM: benzrf: :D
[14:29:37] benzrf: whut is happen
[14:29:53] benzrf: im too hipster to be this mainstream hipster
[14:30:10] benzrf: DouweM: try quick god daddit
[14:30:16] benzrf: it will like
[14:30:20] benzrf: EXPLODE UR MindfulMonk
[14:30:29] DouweM: nah I've got shit to do and I don't feel like spending hours to fail to install fuse :P
[14:30:34] benzrf: ur loss dude
[14:30:39] benzrf: [so much loss omg]
[14:31:47] soulkey: Hi I wondered if someone with experience with Omniauth could help out or point me in the right direction for a channel. Lets say I've gone to a URL auth/developer?foo=bar can i get the callback to include foo in params on return?
[14:32:33] DouweM: benzrf: screencast of mindblowing stuff you've added? :P
[14:33:02] benzrf: hold on o-o
[14:33:43] benzrf: DouweM: basically just now u can use a regular command instead of putting in code
[14:33:53] benzrf: DouweM: remind me what ive showed u so farn
[14:33:54] DouweM: ah yeah you mentioned
[14:34:06] benzrf: hold on i will do a thing
[14:34:13] DouweM: just that you can add/edit files with a couple ofm ethods that'll be loaded into the repl automatically
[14:35:45] Nukepuppy: anyone have a good suggestion on porting all my gem versions to another desktop? can i just make a Gemfile for all my gems and versions?
[14:39:13] benzrf: DouweM: made a short recording of its use
[14:39:18] benzrf: let me upload it, 1 sec
[14:39:45] benzrf: ah man it's in the middle of outputting
[14:42:40] ruby-newbie: Time#to_i returns seconds from 1970-01-01 00:00:00-00 right?
[14:42:51] Jamo: I think so
[14:44:03] Jamo: Iv been using (Time.now.to_f*1000).to_i to get it in milliseconds, and then its same as Javas timeInMillis()
[14:45:41] benzrf: DouweM: kk https://www.youtube.com/watch?v=pOEzPnI1_6k
[14:46:04] benzrf: oh fuck whats wrong with the output o-o
[14:46:21] benzrf: god dammit
[14:49:23] sigurding: sorry, back again. anyone has an idea suggestion?
[14:50:45] benzrf: sigurding: for what again?
[14:51:00] DouweM: benzrf: how about uploading a working vid
[14:51:48] sigurding: benzrf: for my previous question. I just repeat it: is there any option to build a pluggable (extendable) Optionsparser. Based on the include via require, I want to output all options
[14:55:34] benzrf: DouweM: http://showterm.io/22d8cc7e55405a4083f4f
[14:55:37] benzrf: there we go
[14:55:54] benzrf: sigurding: why not us an existing framework like slop or thor
[14:57:16] soahccc: sigurding: what's wrong with the stdlib optparse? Not sure what you mean with pluggable
[14:57:45] sigurding: soahccc: the problem I have is: I have standard set of optparses
[14:58:20] sigurding: but I want to be able to require mylib.rb, and therein define additional optparser, which should be automatically wired into the standard set
[14:58:28] benzrf: aw wait wtf
[14:58:34] benzrf: it froze near the end >:o
[14:58:47] benzrf: DouweM: would u like just the typescript/timings without a fancy website to host e
[14:59:11] DouweM: yeah it froze, but even what I've seen is pretty fucking awesome
[14:59:26] DouweM: yeah sure, gimme the script
[14:59:27] soahccc: sigurding: well you can extend it if you initiate the optparse in a singleton and parse it after all plugins are loaded/registered
[15:00:01] sigurding: soahccc: the next thing I am struggeling with is, that I need some params to be required
[15:00:12] soahccc: sigurding: if you define an option twice it overrides the old one though
[15:00:15] sigurding: which seems to the next pretty difficult task
[15:00:31] benzrf: DouweM: let me just add them to my repo
[15:00:35] benzrf: then u can just dl em from github
[15:00:39] soahccc: sigurding: optparse supports required options
[15:01:11] soahccc: sigurding: well not really required options but that the option requires a value but it's not hard to check
[15:01:23] sigurding: soahccc: hm
[15:01:39] sigurding: soahccc: I found myself having some trouble with it today
[15:01:49] benzrf: DouweM: kk it's up
[15:02:03] soahccc: sigurding: after parse! your ARGV still includes non option arguments if you want to use these
[15:03:13] benzrf: DouweM: fun fact i discovered the other day btw
[15:03:32] benzrf: DouweM: if you pipe scriptreplay into netcat you can serve scripts over netcat connections
[15:04:00] benzrf: DouweM: just have the other person 'nc -l 9001', then 'scriptreplay whatever -ttiming | nc their_ip 9001'
[15:04:28] sigurding: soahccc: what do you think of highline?
[15:05:23] DouweM: benzrf: ha, cool
[15:07:03] DouweM: benzrf: cool demo man. I have no idea when this would be useful, but it's a cool PoC
[15:08:36] DouweM: benzrf: but I hate you for using tabs for indentation
[15:08:49] benzrf: DouweM: i was thinking use it as a dev env for working on normal ruby projects
[15:09:36] benzrf: DouweM: whenever youre doing codes, you boot up quick and require your existing project
[15:09:43] benzrf: DouweM: you write some more code in a live env
[15:09:53] benzrf: then when its working right you copy the code back to your static project dir
[15:10:11] benzrf: ima add dmtcp integration also so that you can freeze and thaw sessions if you need to pause work
[15:10:19] DouweM: yeah, that could be useful
[15:10:40] benzrf: ive heard rumors that emacs already has something like this
[15:10:42] benzrf: ignore them
[15:10:51] DouweM: now figure out a way to automate the "copy back into static project" step :P
[15:10:54] benzrf: it's probably horribly buggy and in alpha or something
[15:10:56] benzrf: ACTION coughs
[15:11:15] benzrf: DouweM: i can probs do that
[15:11:58] benzrf: do 'quick export <other dir>' and it sticks your code files into 'class ::Foo' wrappers, then copies them to <other dir>
[15:12:12] benzrf: or something along those lines
[15:12:55] DouweM: I can't really envision a perfect way of automatic exporting .you probably want those new methods etc in a logical place in your current class file
[15:13:35] shevy: <benzrf> EXPLODE UR MindfulMonk
[15:13:45] benzrf: it already depends on ruby_parser to validate that you arent trying to smuggle non-method-def code into a class tho
[15:13:53] mrbrdo: gotta hate rounding errors :) https://gist.github.com/mrbrdo/9956281
[15:14:04] benzrf: so maybe i can have it scan ur project dir for equivalent classdefs
[15:14:07] benzrf: and insert in
[15:14:08] DouweM: benzrf: ah!
[15:14:11] benzrf: ACTION shrugs
[15:14:26] DouweM: benzrf: yeah you could, although there'll always be the manual "move to right place in classdef" step
[15:14:42] benzrf: maybe have it glom onto certain comment formats
[15:15:14] benzrf: leave a comment like '# @quick' and it puts new method defs above it
[15:15:44] DouweM: meh, the methods will probably be at different places in the file
[15:15:53] kith: guys is there a faster snmp lib than that: http://rubygems.org/gems/snmp/
[15:15:57] kith: in particular the snmpwalk
[15:15:59] DouweM: you can just add 'm in at the start, end or whatever, and the dev can manually move them
[15:16:23] benzrf: how about when you do export, it sticks files in your clipboard one by one, then it opens the correct file for you to paste em in
[15:16:32] benzrf: in your $EDITOR
[15:16:46] DouweM: that would be pretty much perfect
[15:18:23] benzrf: mrbrdo: just use Rationals
[15:19:38] benzrf: >> (Rational(22, 10)..(Rational(35, 10)).step(Rational(2, 10)) { |i| puts i }
[15:19:39] eval-in: benzrf => /tmp/execpad-f129f2f837a9/source-f129f2f837a9:3: syntax error, unexpected keyword_rescue, expecting ')' ... (https://eval.in/131322)
[15:20:12] benzrf: >> (Rational(22, 10)..Rational(35, 10)).step(Rational(2, 10)) { |i| puts i }
[15:20:12] eval-in: benzrf => 11/5 ... (https://eval.in/131323)
[15:20:25] kith: why is an snmp lib with C extentions so much faster than a pure ruby one?
[15:20:32] benzrf: kith: because c is faster than ruby?
[15:20:51] kith: its just a few strings...
[15:20:59] bilbo_swaggins: benzrf are you talking about Quick again?
[15:21:09] benzrf: bilbo_swaggins: :3
[15:21:13] arubincloud: >> require 'bigdecimal'; (BigDecimal.new("2.2")..BigDecimal("3.5")).step(BigDecimal.new("0.2")).each {|n| puts n}
[15:21:13] eval-in: arubincloud => (https://eval.in/131324)
[15:21:15] benzrf: bilbo_swaggins: hows it goin learning about REST
[15:21:37] arubincloud: http://ideone.com/ggvz1Y
[15:21:40] bilbo_swaggins: The first PDF was more of a powerpoint overview and inscrutable, because it never really defined certain important things
[15:21:49] bilbo_swaggins: but I have Fielding's original dissertation as well
[15:21:54] benzrf: bilbo_swaggins: it is p simple really
[15:21:59] benzrf: bilbo_swaggins: the basic idea is:
[15:22:05] benzrf: 1. your api is composed of RESOURCES
[15:22:06] bilbo_swaggins: it seems like it, but there was a lot of obfuscatory language
[15:22:09] DouweM: arubincloud: why bah?
[15:22:11] benzrf: each resource is at some uri
[15:22:18] kith: i mean it seems to be worse with snmp stuff... i dont get why
[15:22:21] benzrf: a resource is usually either a thing or a collection of things
[15:22:30] benzrf: [this is REST as applied to HTTP btw]
[15:22:37] bilbo_swaggins: and you pass state back and forth
[15:22:46] arubincloud: DouweM: Because the bot's output was not helpful in that case.
[15:22:48] bilbo_swaggins: rather than maintaining it at any one location
[15:22:51] benzrf: that's a requirement to be considered RESTful
[15:22:54] benzrf: well not precisely
[15:22:55] DouweM: arubincloud: ah
[15:22:59] benzrf: there is no /session state/ on the server
[15:22:59] bilbo_swaggins: the doc never defined "resource"
[15:23:04] benzrf: but it's fine for resources to have state
[15:23:15] bilbo_swaggins: I realized that had to be true for a multi-user game
[15:23:26] benzrf: 2. you interact with all resources using a set of universal predefined verbs
[15:23:31] benzrf: bilbo_swaggins: a game could be a resource :u
[15:23:47] benzrf: in the case of REST over HTTP, those verbs are the http verbs
[15:23:53] bilbo_swaggins: I'm not going to send clients secret info though
[15:23:53] benzrf: usually GET, POST, PUT, and DELETE
[15:24:03] bilbo_swaggins: it's a game for programmers, they'll hack and cheat :P
[15:24:13] bilbo_swaggins: so some info can't be shared
[15:24:19] benzrf: so keep it on the server
[15:24:30] benzrf: but a /session with an application/ should not have state on the server
[15:24:37] benzrf: if you have a resource on the server that can be modified and updated, that's fine
[15:24:46] benzrf: don't keep an interaction session on the server though
[15:24:56] DouweM: benzrf: PATCH ftw
[15:25:01] bilbo_swaggins: is there something like ActiveRecord that automatically maps class structure to URIs?
[15:25:03] benzrf: DouweM: fu patch is fail
[15:25:10] benzrf: bilbo_swaggins: i think that's what rails does actually
[15:25:18] benzrf: bilbo_swaggins: i just read about this stuff yesterday and today ;p
[15:25:21] DouweM: benzrf: PATCH and PUT have different semantics, via HTTP
[15:25:35] benzrf: bilbo_swaggins: a resource can be represented in different formats
[15:25:53] benzrf: so return xml or html or something based on what the client asks forced_request
[15:26:08] benzrf: the point is for each uri to be a resource, not a document
[15:26:12] benzrf: a resource is more abstractj
[15:26:20] benzrf: it represents some kind of thing you can deal with
[15:26:23] bilbo_swaggins: stop hitting tab
[15:26:25] benzrf: which may have multiple representations
[15:26:38] benzrf: finally there's HATEOAS
[15:26:38] bilbo_swaggins: that's where the definitions eluded me
[15:26:50] bilbo_swaggins: what do you mean "multiple representations"
[15:26:57] benzrf: if you have some object on your server
[15:26:59] bilbo_swaggins: I understand a resource is basically an object of any kind
[15:27:01] benzrf: or row in a db
[15:27:11] benzrf: a representation is some kind of way of representing the abstract resource
[15:27:15] benzrf: such as, as json or xml
[15:27:19] benzrf: or even html
[15:28:00] benzrf: HATEOAS is the idea that an api should behave like a state machine
[15:28:13] bilbo_swaggins: I think for this project I may be better off with Sinatra and ActiveRecord than full on Rails
[15:28:40] benzrf: bilbo_swaggins: it's p simple actually
[15:28:57] benzrf: bilbo_swaggins: basically each response should contain links to other resources labelled with their relationship
[15:29:06] benzrf: bilbo_swaggins: i.e. actions that modify the current state
[15:29:30] benzrf: bilbo_swaggins: so if you GET a resource representing a match in your game
[15:29:42] bilbo_swaggins: I never realized the web was a state machine
[15:29:48] benzrf: the representation should somehow indicate the URIs for related resources
[15:29:53] benzrf: and how they are related
[15:30:15] bilbo_swaggins: so the client agent can decide based on the labels
[15:30:26] benzrf: like how you do when browsing the web
[15:30:43] bilbo_swaggins: so it's really as simple as <a href=URL>label</a>
[15:30:48] benzrf: more or lessless
[15:30:53] benzrf: it depends on your representation :-)
[15:30:56] bilbo_swaggins: You gonna support git integration for managing revisions of your smalltalk-VM-ish Ruby project checkpointy things? (do you have names for these concepts yet?)
[15:31:04] benzrf: bilbo_swaggins: maybe?
[15:31:17] benzrf: quick has kinda turned into more of a live dev env than a true smalltalky thing
[15:31:21] bilbo_swaggins: I've never used smalltalk proper
[15:31:23] benzrf: ruby isnt really equipped or suited for that
[15:31:25] bilbo_swaggins: but I like the idea
[15:31:49] bilbo_swaggins: well the idea of live editing code and then *saving that revision* when it works is neat
[15:31:58] benzrf: download pharo
[15:32:20] bilbo_swaggins: don't want to learn ANOTHER language right now :P
[15:32:26] abstractj: benzrf I would like to be a document, please
[15:32:27] benzrf: {links: [{rel: 'bets', href: 'http://ur_website.com/matches/34/bets'}, {rel: 'self', href: 'http://ur_website.com/matches/34'}]}
[15:32:31] benzrf: abstractj: :P
[15:32:49] benzrf: bilbo_swaggins: dw smalltalk is pretty similar to ruby
[15:32:52] benzrf: or vice versa actually
[15:33:01] benzrf: the actual usage is p different
[15:33:05] benzrf: but there are few new concepts
[15:33:35] benzrf: it's mostly syntactic
[15:33:38] bilbo_swaggins: I'm sure if you were able to implement git integration you'd have a popular project
[15:33:41] benzrf: [and in how you structure things]
[15:33:45] benzrf: bilbo_swaggins: probably :P
[15:33:54] benzrf: that can come later >.>
[15:34:07] bilbo_swaggins: but now it's starting to click for me what you're really trying to do
[15:34:18] benzrf: i'm not trying to make smalltalk in ruby
[15:34:21] benzrf: smalltalk is already a thing
[15:34:29] benzrf: im being much more conservative than that
[15:34:42] benzrf: im just making a live-coding environment that happens to be a bit closer to full-on smalltalk than most
[15:35:57] bilbo_swaggins: so why do you need FS integration?
[15:36:18] benzrf: >that happens to be a bit closer to full-on smalltalk than most
[15:36:34] bilbo_swaggins: that's pretty vague, man
[15:36:38] kith: hmmm is there a snmp lib that has C modules and supports snmpwalk? :D
[15:36:56] kith: only found this: https://github.com/mixtli/net-snmp but that doesnt do snmpwalk
[15:37:02] bilbo_swaggins: we can take this out of channel
[15:37:09] benzrf: more like an all-encompassing environment than an editor snap-in basically i guess
[15:37:26] bilbo_swaggins: or I'll just observe it as it develops
[15:37:32] bilbo_swaggins: you seem to be here regularly
[15:37:33] benzrf: still intended to be more of something for working on standard ruby projects in a more useful environment
[15:37:38] benzrf: than a whole new way of doing things
[15:37:55] benzrf: i.e. it's intended to be for work on things that end up as gems or whatever
[15:37:59] benzrf: not fully image-based
[15:38:06] bilbo_swaggins: I guess I could use git on top of it myself
[15:38:16] bilbo_swaggins: and it would still have things going for it
[15:38:17] benzrf: feel free to fork it :P
[15:38:26] benzrf: there's not a whole ton of code in there atm
[15:40:09] benzrf: sloccount says:
[15:40:10] benzrf: Total Physical Source Lines of Code (SLOC) = 435
[15:40:16] bilbo_swaggins: well I've got my own projects for now
[15:40:19] benzrf: it also says:
[15:40:19] benzrf: Total Estimated Cost to Develop = $ 11,273
[15:40:22] benzrf: im getting stiffed ;-;
[15:40:43] bilbo_swaggins: how'd you estimate that
[15:40:46] benzrf: ran sloccount
[15:50:29] platzhirsch: ACTION roars
[15:50:39] platzhirsch: What's up people of the sun
[15:55:41] shevy: we are busy writing ruby code
[15:56:55] platzhirsch: good, let me join you
[16:02:34] DouweM: ssh you're distracting me
[16:03:29] shevy: go away platzhirsch
[16:03:43] shevy: are you finally in london?
[16:03:54] platzhirsch: I was last week though for three days
[16:04:01] shevy: and what did they say
[16:04:16] shevy: "your english is not british enough"
[16:04:20] platzhirsch: They said greetings Platzhirsch, let's develop rad code in two days
[16:04:40] shevy: better than "down with your pants!"
[16:04:40] platzhirsch: I came, I saw, I developed rad code
[16:04:49] shevy: that's a nice quote actually
[16:05:01] shevy: if caesar would have been a programmer ...
[16:05:20] platzhirsch: Most likely I will burn down my apartment in April to make my move to London
[16:05:36] DouweM: sounds like a great plan
[16:05:40] shevy: platzhirsch in the ghetto
[16:05:45] platzhirsch: and then pay 15 EUR for a burger in a restaurant
[16:05:52] shevy: you are kidding
[16:06:04] platzhirsch: or 150 EUR for a monthly underground ticket
[16:06:15] platzhirsch: respectively, "who I learned to ride a bike again"
[16:06:16] shevy: that's quite a lot but not thaaaaat much
[16:06:28] shevy: that's 1800 euro a year
[16:06:41] shevy: in vienna it is ... about 400 euro a year
[16:06:52] platzhirsch: yeah, about the same
[16:07:06] shevy: but london is 4x as huge so it should be 4x as costly!!!
[16:07:26] DouweM: whoa, 150/month is crazy
[16:07:46] platzhirsch: I don't mind, I wawnted to became a Platzhirsch on a Bike anyway
[16:07:50] benzrf: mmm pizza
[16:07:58] DouweM: I like bikes
[16:08:00] benzrf: w/ chicken & hot sauce & bleu cheese
[16:08:20] platzhirsch: I think these Dutch bicycles are pretty hipster stuff
[16:08:51] platzhirsch: http://www.passportbicycles.com/wp-content/uploads/2013/03/Man-with-dutch-bike.jpg
[16:08:55] DouweM: The thing is that Dutch people don't care about their bikes, so we're all riding around on pieces of crap
[16:09:04] DouweM: yeah because that's the prototypical Dutch male
[16:09:13] platzhirsch: looks, that's pretty much me
[16:09:23] DouweM: But bikes like that are common for sure
[16:09:47] platzhirsch: Except that my beard, if I would start growing one, would look more like the one of a 15 yo
[16:10:13] DouweM: My bike has had this loud CLICK on every turn of the pedals for like 4 months but I'm not quite bothered enough to get a new one
[16:11:22] workmad3: DouweM: you could always, I dunno, make sure your gears aren't loose or that one of the teeth isn't breaking or something... or just oil your chain!
[16:11:53] DouweM: yeah I went to the bike repair shop and they said is was beyond repair, they were surprised it was still working at all, and that I should get a new one
[16:11:56] DouweM: That was 3 months ago
[16:12:11] platzhirsch: DouweM: and you should buy a new one in their shop of course
[16:12:21] DouweM: of course
[16:12:36] bitglue: Given some identifier in some method somewhere, how can I go about finding where that identifier is assigned, and what it is? For example, 'backend' at https://github.com/serverspec/serverspec/blob/2d97f9d519208388454c23be82e29496c98e9c4a/lib/serverspec/type/command.rb#L7 . It doesn't appear to be a method, or assigned anywhere at all in that codebase, from what I can find.
[16:13:13] DouweM: but seriously, getting a crappy new bike is usually cheaper than getting a good new one. and getting a good new one is stupid, because nice bikes are stolen in a week
[16:13:36] DouweM: I didn't mean to say "getting a good new one", meant "repairing your current one"
[16:14:18] benzrf: vjbhyrdhjguy
[16:14:19] benzrf: ftgvhjkdtcf hbn\
[16:14:38] DouweM: are you possessed by an evil spirit?
[16:16:04] workmad3: DouweM: or a kitty walked over the keyboard
[16:16:14] workmad3: DouweM: which is an evil spirit, but probably not a possession :)
[16:16:39] benzrf: DouweM: no
[16:16:49] benzrf: DouweM: the guy sitting next to me antagonized me
[16:16:53] benzrf: so i retaliated
[16:17:00] benzrf: then he mashed my kbd :[
[16:17:03] platzhirsch: anyone worked with highline to create a CLI?
[16:17:12] benzrf: platzhirsch: ive just used Thor so far
[16:17:16] benzrf: & only the basics
[16:17:34] platzhirsch: maybe that one is better
[16:17:55] benzrf: theyre different is what they are
[16:18:08] benzrf: platzhirsch: thor is for subcommand and option parsing stuff
[16:18:12] benzrf: i believe bundler uses it
[16:18:21] benzrf: afaict highline is for interactive interfaces
[16:18:23] platzhirsch: ah ok, no I meant really a CLI
[16:18:39] mikecmpbll: rails uses thor too: http://rubygems.org/gems/railties
[16:19:14] DouweM: platzhirsch: I've heard good things about highline
[16:19:40] platzhirsch: DouweM: Highline is a cool DSL, but I can't get menu choices like I 3 2 working where I is the menu choice and 3 and 2 are parsed as arguments
[16:22:50] platzhirsch: ah there is an example to build shells
[16:22:51] platzhirsch: maybe that's it
[16:23:51] shevy: DouweM hah my bike had that as well, damn crap bikes... cheap and crappy
[16:24:20] shevy: this whole crap minimalism for mass production is so annoying
[16:24:51] DouweM: Dutch bikes aren't crap because of mass production, they're crap because they're just tools to us, and shiny tools get stolen
[16:25:05] benzrf: highline more like LOWline o snapcase
[16:25:23] DouweM: I'm starting a petition to stop benzrfs abuse of the tab key
[16:25:48] shevy: I will counter this proposal
[16:25:54] shevy: it provides so much entertainment on #ruby
[16:26:11] shevy: <benzrf> EXPLODE UR MindfulMonk
[16:26:17] workmad3: DouweM: ItSANgo__ wormwood benzrf fudanchii ignoch hermanmunster dik_dak ignoch willb1 evenix wormwood (it would be funny if he did it with every work... and sorry for the highlights everyone)
[16:27:05] DouweM: shevy: yeah that one was great
[16:27:18] shevy: workmad3 lol
[16:27:26] shevy: workmad3 but it's not as funny when it is pre-planned :(
[16:27:47] shevy: we even have hermanmunster here...
[16:27:57] shevy: 50% are like never writing anything
[16:28:31] DouweM: I don't recognize any of those names
[16:28:46] GaryOak_: just fbi bots listening in
[16:28:59] shevy: I think there are only a total of like 3 dozen people talking here on #ruby
[16:29:08] horrorvacui: I'm confused, I don't understand whats happening.
[16:29:16] shevy: horrorvacui go have a beer
[16:29:31] DouweM: shevy: 3 dozen regulars, and the occasional newbie
[16:29:37] horrorvacui: I can't drink I've severe GERDs
[16:30:00] horrorvacui: Alcohol is like gasoline on the fire.
[16:30:11] horrorvacui: Actually it is...
[16:30:44] DouweM: that doesn't sound fun horrorvacui :/
[16:31:48] horrorvacui: It's not to bad, I get to eat healthy because there is no other option.
[16:33:08] f0ster: are there any performance differences with looking up a var from ENV vs an value on a instantiated class
[16:33:10] sigurding: is it possible to add list of parser.on() (Optionparser) to an existing list?
[16:33:32] shevy: f0ster I think ENV is pretty much as fast as a normal hash, perhaps just a wee bit slower
[16:33:49] shevy: I hate optionparser so much
[16:33:54] f0ster: shevy: figured.. not 100% sure what ENV is doing
[16:34:08] horrorvacui: f0ster did you see my response on your gist from earlier?
[16:34:10] f0ster: would ENV stuff be in RAM or on the HEAP
[16:34:18] f0ster: horrorvacui: no actually, i was just coming up with a solution still
[16:34:23] f0ster: now that the day is anew here at work
[16:34:33] shevy: f0ster it should have all environment variables, usually in bash those who have defined via $ (or access via $ in bash); and it has some extra methods, like ENV.to_hash
[16:34:42] shevy: *have been defined
[16:34:48] f0ster: horrorvacui: my coworker said i should just put the hash values in yaml from an initializer, then fetch them everytime from a helper module function
[16:34:49] horrorvacui: f0ster: you had a typo in the variable that is why class variables weren't working.
[16:34:56] f0ster: horrorvacui: lol oh really
[16:35:32] shevy: f0ster I guess yaml files might be slightly better, some environments have different ENV, like if you try to use ENV in a ruby .cgi script for instance
[16:36:07] shevy: and ENV can be tainted too
[16:36:19] shevy: In the past, I used to write ruby classes like so:
[16:36:22] shevy: class Foo
[16:36:35] shevy: HOME_DIR = ENV['MY_VIDEO_STUFF']
[16:36:50] f0ster: shevy: right but he was saying yaml -> initializer -> env -> helper
[16:36:53] shevy: INFO_FILE = HOME_DIR+'/videos.info'
[16:37:10] shevy: and that was bad because some environments might not have that set
[16:37:32] shevy: I dont know what is an "initializer", sounds terribly fancy. he just means to load the dataset or? what env and helper is I have no idea
[16:37:36] shevy: why does he not say what he means!
[16:37:44] shevy: f0ster I hate your coworker already
[16:38:07] f0ster: no no, so he has these hash definitions in a yaml file
[16:38:09] kauto: Anyone familiar with mechanize?
[16:38:10] workmad3: shevy: an 'initializer' is most likely a rails initializer... which is just a file in config/initializers
[16:38:18] f0ster: on an intializer he loads them to the env, then the helper method just fetches the hash values form teh ENV
[16:38:19] shevy: ohhhhh... railsers. ok
[16:38:24] f0ster: yeah rails, my bad
[16:38:24] shevy: they use strange names
[16:38:33] shevy: factory girl and factory mom
[16:38:55] shevy: kauto I used to use it like 5 years ago
[16:39:02] shevy: I could even click on stuff
[16:39:09] kauto: Well, that is pretty amazing
[16:39:31] shevy: then mechanize changed, either it got away from hpricot ... I think it moved to nokogiri. nokogiri did not work for me back then, since then I lost all interest in it, I get frustrated too easily
[16:39:43] kauto: Yeah it moved to nokogiri I believe
[16:40:17] kauto: I'm just having trouble getting this field to not be hidden so I can scrape it
[16:47:45] f0ster: thanks again horrorvacui, i was disappointed i couldnt use my approach
[16:47:49] f0ster: glad to know it was just a dumb typo
[16:48:16] platzhirsch: How do I access the hash values/set values inside the Hash class itself (monkey patching)
[16:48:17] horrorvacui: yeah well it took me actually trying your gist before I found the typo, its one of those you can overlook a 100 times.
[16:49:04] workmad3: platzhirsch: self[key] or self[key] = value
[16:49:11] platzhirsch: right, thanks man
[16:49:16] f0ster`: horrorvacui: yeah i still didnt even see it at first glance, just replaced my refs to my class var
[16:49:22] workmad3: platzhirsch: you could also use fetch
[16:50:27] workmad3: platzhirsch: and update
[16:58:35] Guest77325: http://www.marketglory.com/strategygame/galahad1st for online gamers, if you didn't already, use this link to register on MerketGlory: a free2play financial strategy game where virtual currency can be converted into real money. It starts out slow but in time you can turn a good profit that is if you have the necessary patience to grow a little bit every day :P
[17:02:04] horrorvacui: Somone make a ruby controlled robotic lawnmower
[17:07:50] shevy: a lawnmoaner?
[17:22:44] benzrf: >lawnmoaner
[17:24:23] benzrf: ping-pong:
[17:53:17] kbarry: I'm struggling with a ruby question
[17:56:30] canton7: no-one's going to answer a statement like that ;) they might, however, answer a question
[18:00:38] shevy: kbarry hehehe
[18:00:51] shevy: iswop is abot
[18:06:07] mary5030: when one conditionally creates a ruby object how do we make sure to conditionally destroy it?
[18:06:33] benzrf: mary5030: hmm?
[18:06:38] mary5030: ex: find or create when destroying want to conditionally destroy
[18:06:48] benzrf: i dont understand
[18:06:50] mary5030: not ruby sorry active record
[18:06:51] jhass: mary5030: provide some example code of your problem
[18:07:16] shevy: mary5030 just keep track that you created it
[18:07:31] jhass: there should be a better solution
[18:07:38] jhass: this is most likely a design issue
[18:07:46] jhass: or at least a code structure one
[18:07:48] mary5030: by keeping track you mean assign it to a veriable?
[18:08:06] workmad3: mary5030: just check that you found an object before trying to call .destroy on it
[18:08:47] shevy: mary5030, yeah that would be a simple way. if you could do so without having to use a variable, that would be even better
[18:08:58] ovrflw0x: why is "gem install rails" taking so long to download?
[18:09:02] ovrflw0x: is it a large file?
[18:09:08] shevy: ovrflw0x probably a lot of docu
[18:09:40] workmad3: ovrflw0x: lots of dependencies
[18:09:45] jhass: mary5030: if you want a definite answer show your actual code
[18:09:59] ovrflw0x: can anyone tell me approximate size of rails? 100MB?
[18:10:07] mary5030: for ex: remove_public_ip_block = public_block.destroy i only want to destroy the once that were created
[18:10:25] workmad3: ovrflw0x: the rails gem itself is pretty tiny... it's just an umbrella gem for the rest of the gems in the framework
[18:10:29] shevy: rails 4.0.2 gem is 1548800
[18:10:49] shevy: so 1.5 MB
[18:10:57] neolithic: hi all, for any chef users, would you happen to know if its possible to use Ohai data in knife.rb? Im looking to call platform_family? but cant find any references to proper syntax, so dont know if I can just call it directly or if I have to get it from node['platform_family'].
[18:11:26] ovrflw0x: shevy: how about "rails +dependecies" what's the size then?
[18:11:41] shevy: I am not using rails, the guys on #rubyonrails are
[18:11:44] jhass: mary5030: it still makes no sense to me, show your whole method
[18:11:46] workmad3: ah, the rails gem also has all the guides in it
[18:11:47] shevy: it has a lot of dependencies
[18:11:49] jhass: mary5030: in a gist
[18:12:01] mary5030: thanks i will in afew?
[18:12:03] workmad3: ovrflw0x: http://rubygems.org/gems/rails <-- follow the dependencies in that, add it up
[18:12:04] shevy: ovrflw0x I'd say it has about 40 MB
[18:12:34] shevy: there is a download for rails on windows btw
[18:12:36] shevy: standalone
[18:12:59] shevy: railsinstaller-2.2.2.exe
[18:13:08] shevy: also includes ruby.exe :P
[18:13:51] benzrf: >using windows
[18:13:53] benzrf: >not using unix
[18:13:57] benzrf: >not using FLOSS
[18:14:17] workmad3: ovrflw0x: most of the time when a gem install takes a while, it's nothing to do with size, it's because a request to rubygems for resolving some dependencies is being a bit slow
[18:14:47] workmad3: ovrflw0x: you could ctrl-c the install and redo it with a -V param turn on verbose mode
[18:15:21] ovrflw0x: shevy should I stop "gem install rails" command and download rails-installer.exe?
[18:15:42] workmad3: ovrflw0x: are you using windows?
[18:15:54] shevy: you are on windows
[18:15:57] shevy: you have my comforts man
[18:16:04] workmad3: ovrflw0x: I'd probably suggest using rails-installer then, yes
[18:16:05] shevy: I'd use the .exe
[18:16:18] shevy: and I'd try to abandon windows one day ;P
[18:16:33] workmad3: shevy: 'one day' == 'tomorrow', right? :D
[18:16:41] ovrflw0x: shevy: what OS are you using OSX?
[18:16:44] shevy: he is using ruby so that makes windows not as annoying
[18:16:47] workmad3: shevy: ah, saturday then :)
[18:16:49] shevy: ovrflw0x linux
[18:16:55] ovrflw0x: which distro?
[18:17:06] shevy: ovrflw0x slackware but it does not matter, I compile from source
[18:17:23] workmad3: ACTION should start responding OS/2 when asked what OS he is using
[18:17:25] shevy: on this machine only glibc and the default linux kernel are from slackware (ok, and qt ...)
[18:17:25] mrbrdo: btw verbose mode is lower-case v not upper-case
[18:17:40] mrbrdo: oops nevermind, I thought this was another channel :D
[18:17:44] shevy: workmad3 what OS are you using?
[18:18:03] workmad3: shevy: BeOS
[18:18:14] ovrflw0x: should I download from here? http://railsinstaller.org/en
[18:18:21] shevy: ovrflw0x yeah
[18:18:30] workmad3: shevy: you're right... I wish I used BeOS... I'm really stuck on GNU/Hurd
[18:18:42] shevy: I tried haiku OS a few years ago
[18:18:44] shevy: it was not so bad
[18:18:54] shevy: it feels as if it got outpaced by linux though :(
[18:19:30] shevy: I tried it only through qemu though
[18:19:36] shevy: it probably would have crashed on a real install hahahaha
[18:20:19] ovrflw0x: I want this ruby version > 2.0 and rails version > 4.0
[18:20:40] shevy: you are on windows
[18:20:45] shevy: be lucky that anyone is using it ;)
[18:21:07] ovrflw0x: shevy: do I have to download this file? https://github.com/railsinstaller/railsinstaller-windows/releases/download/3.0.0-alpha.2/railsinstaller-3.0.0.exe
[18:21:09] shevy: Packages included are:
[18:21:10] workmad3: shevy: be nice to the poor windows user... most of them don't know any better ;)
[18:21:11] shevy: Ruby 1.9.3
[18:21:11] shevy: Rails 3.2
[18:21:33] benzrf: ovrflw0x: the solution is use an operating system that is not an abomination upon the face of computing
[18:21:41] shevy: ovrflw0x on that site it seems there are no other options available, sorry.
[18:21:42] benzrf: i suggest mint
[18:21:50] benzrf: or ubuntu
[18:21:57] shevy: no please don't use ubuntu
[18:22:03] ovrflw0x: benzrf: how about OSX?
[18:22:05] benzrf: u bun tu?
[18:22:09] benzrf: ovrflw0x: sure
[18:22:12] shevy: mint is better
[18:22:13] benzrf: its nonfree though =[
[18:22:14] platzhirsch: Deal closed, moving to London, starting as an Android developer. Oh yeah
[18:22:18] benzrf: platzhirsch: sweet
[18:22:22] workmad3: shevy: there's nothing wrong with ubuntu... it's only unity that's an atrocity
[18:22:26] shevy: no surprise given that mint ranks number 1 on http://distrowatch.org/
[18:22:27] benzrf: im sorry to hear that youll have to work with java
[18:22:34] shevy: ubuntu was bad before unity
[18:22:37] shevy: with unity it killed itself
[18:23:06] ovrflw0x: bb again on linux
[18:23:21] shevy: that was one funny guy though
[18:23:44] shevy: we forgot to ask him why he wants to learn ruby
[18:27:48] ArchBeOS: are there any inherit setbacks or flaws from using require_relative?
[18:28:23] Sou|cutter: not that most people care about 1.8 anymore
[18:28:47] benzrf: if youre relying on 1.8 then u suck
[18:28:47] ArchBeOS: so require_relative is ok to use for an app buing built with 2.x MRI?
[18:28:52] jhass: ArchBeOS: it can be a smell, if you do it in a gem, you're doing it wrong
[18:29:00] ballPointPenguin: fwiw Ubuntu 14.04 Gnome (not unity) on MacBook retina is best linux + retina experience I've had yet
[18:29:13] jhass: ArchBeOS: and it still might be better to just append $LOAD_PATH instead
[18:29:33] ArchBeOS: jhass: damn, i should use LOAD_PATH
[18:30:10] shevy: ArchBeOS it's longer to write
[18:30:34] shevy: ArchBeOS require itself works perfectly fine when someone has a gem-like structure in a project too
[18:31:07] ArchBeOS: shevy: ok. i need to re-think how im bringing in my ruby files and I think LOAD_PATH might be the right way for me to do this
[18:31:31] shevy: just layout a gem-like structure and let gem or setup.rb install into SITE_DIR, then LOAD_PATH should have it
[18:31:49] shevy: in my main directory where I keep my ruby stuff, let's call it x
[18:32:22] shevy: I have it setup like this, for project called "foobar", I'd put into x/foobar/lib/foobar/ <-- and here I usually put foobar.rb which loads the other files below that hierarchy
[18:32:56] kbarry: I want to use ".match" but get the second result
[18:33:05] kbarry: I "thought" that might be done with
[18:33:17] kbarry: variable.match(/regex/)[1]
[18:33:21] ArchBeOS: thanks shevy
[18:33:48] shevy: for non-gem projects I cheat
[18:34:01] shevy: I simply symlink that main dir into ruby site dir x/
[18:34:16] shevy: then I can do like: require 'x/tools/purge_directories.rb'
[18:34:46] shevy: kbarry how does your regex and your string look?
[18:35:21] shevy: >> 'abc def'.match(/(.+) (.+)/)[2]
[18:35:22] eval-in: shevy => "def" (https://eval.in/131393)
[18:35:27] shevy: works just fine
[18:35:55] shevy: let's make a poll:
[18:35:59] kbarry: shevy: node['hostname'].match(/\d\d/)[0].to_i
[18:36:02] shevy: - Who heres loves Regular Expressions?
[18:36:15] kbarry: node['hostname'] = "nm01server01"
[18:36:17] shevy: kbarry and what is that
[18:36:18] mr_snowf1ake: ACTION does to some degree
[18:36:34] kbarry: i expect that to return 1
[18:36:35] mr_snowf1ake: ruby does a really elegant job with regex imo
[18:36:39] kbarry: (Which it does)
[18:36:46] shevy: kbarry but you are not using a match group, are you?
[18:37:11] IceDragon: /\d{2}/ # << same as \d\d
[18:37:14] IceDragon: ACTION walks off again
[18:37:14] kbarry: for some reason i was under the impression that .match returned an array of all matches
[18:37:34] IceDragon: use scan kbarry
[18:37:34] shevy: http://www.ruby-doc.org/core-2.1.1/Regexp.html#method-i-match
[18:37:49] shevy: >> /(.)(.)(.)/.match("abc")[2]
[18:37:49] eval-in: shevy => "b" (https://eval.in/131394)
[18:38:02] shevy: kbarry you will have to use () for matchgroups, or you just use .scan()
[18:38:25] kbarry: .scan ... looking that up,
[18:38:47] Hanmac: shevy you dont need match
[18:38:48] Hanmac: >> 'abc def'[/(.+) (.+)/,2]
[18:38:48] eval-in: Hanmac => "def" (https://eval.in/131395)
[18:38:51] shevy: kbarry when did you start with ruby btw?
[18:39:07] kbarry: ohh, i only get to use it a bit every week,
[18:39:11] kbarry: started about a month ago
[18:39:16] kbarry: (using it in chef)
[18:39:22] shevy: Hanmac I think you have to tell this those who ask the question :D
[18:39:42] shevy: one month only
[18:40:49] IceDragon: Hanmac: can I haz pancakes, also do you want an invite to keybase? https://keybase.io/
[18:42:48] rubensten: What would be a good book to start learning Ruby for an older person with no programming experience at all. I know HTML and CSS, but don't know any programming languages at all. My goal is to learn Ruby and then move to rails...
[18:44:21] shevy: rubensten the pickaxe
[18:44:24] benzrf: IceDragon: >written in javascript
[18:44:31] benzrf: im sorry why
[18:44:56] shevy: rubensten I guess the current link is http://pragprog.com/book/ruby4/programming-ruby-1-9-2-0
[18:45:03] kbarry: shevy: [2014-04-03T11:41:23-07:00] ERROR: undefined method `to_i' for #<MatchData "01">
[18:45:09] shevy: I got the old pickaxe in 2006 or something like that, it was ok
[18:45:12] shevy: I knew php before though
[18:45:19] benzrf: ruisantos: i would start with python myself
[18:45:24] kbarry: host_num = node['hostname'].match(/\d\d/,5).to_i
[18:45:24] shevy: yeah centrx
[18:45:26] benzrf: centrx: :I
[18:45:29] benzrf: inb4 php quote
[18:45:30] shevy: do you have some trigger or what
[18:45:35] shevy: you always wake up when PHP is mentioned
[18:45:44] centrx: PHP is...
[18:45:48] benzrf: centrx sez:
[18:45:49] kbarry: if my match is "01" how do I make it an interget (trim leading zero?)
[18:45:56] IceDragon: benzrf: still better than writen in php :x
[18:46:15] shevy: >> "01".to_i
[18:46:15] eval-in: shevy => 1 (https://eval.in/131396)
[18:46:18] shevy: ^^^ kbarry
[18:46:24] IceDragon: kbarry: try to_i on it
[18:46:37] kbarry: host_num = node['hostname'].match(/\d\d/,5).to_i
[18:46:42] kbarry: [2014-04-03T11:41:23-07:00] ERROR: undefined method `to_i' for #<MatchData "01">
[18:46:55] shevy: kbarry you said your match is "01"
[18:46:57] shevy: but that is a string
[18:47:03] shevy: so I would assume you do not have a string
[18:47:11] shevy: otherwise it would work :)
[18:47:19] kbarry: hmmm......
[18:47:33] kbarry: how might i display the data "type?
[18:47:41] shevy: when you have long, complicated queries, just break them up into smaller chunks and continue to work with these
[18:47:56] shevy: p node['hostname'].match(/\d\d/,5).class
[18:47:58] shevy: for instance
[18:48:07] shevy: yeah Kernel#p
[18:48:09] kbarry: what is p
[18:48:11] kbarry: show for puts?
[18:48:28] shevy: or you wont need .class actually
[18:48:31] shevy: kbarry, look there once: http://apidock.com/ruby/Kernel/p
[18:48:43] shevy: it shows you example output too
[18:49:02] shevy: dunno why p is used as name
[18:49:08] shevy: pp foo is "pretty print"
[18:49:38] shevy: pp is lovely
[18:49:48] shevy: only drawback is that you have to do: require 'pp'
[18:52:26] kbarry: class is MatchData
[18:52:59] shevy: now you know why to_i fails, you expected a string object but you have another object there
[18:53:29] shevy: >> "nm01server01".match(/\d\d/,5)
[18:53:29] eval-in: shevy => #<MatchData "01"> (https://eval.in/131398)
[18:53:52] shevy: if you use [0] you will have a string
[18:53:57] kbarry: yup, gonna needa do .to_s.to_i
[18:54:01] shevy: host_num = node['hostname'].match(/\d\d/,5)[0].to_i
[18:54:18] shevy: to_s also works
[18:54:23] shevy: there is more than one way to do it!
[18:55:49] kbarry: Thanks for the help.
[18:55:57] kbarry: I learned several things about ruby today from this.
[18:56:06] kbarry: especially the p
[18:56:14] kbarry: and how to look up and use ruby class info.
[18:56:22] shevy: quite impressive for one month
[18:56:27] shevy: you must have been using another language before
[18:56:32] kbarry: Meh, i'm l33t
[18:57:37] sdegutis: Is there a way to jump the user into an ssh session?
[18:57:45] sdegutis: I'm using Fog btw, which I think uses net/ssh.
[19:08:30] sdegutis: Ah found out I can just do system("ssh ...") and it works fine.
[19:08:32] sdegutis: Thanks all.
[19:12:30] shevy: ruby is so advanced that people can help themselves
[19:14:00] gerep: Hi all. My boos told me to find a good ruby 2 best practice book, any sugestion?
[19:14:09] gerep: *suggestion
[19:14:57] s2013: practical object oriented ruby
[19:15:16] s2013: http://www.amazon.com/Practical-Object-Oriented-Design-Ruby-Addison-Wesley/dp/0321721330 this one gerep
[19:15:46] gerep: s2013: thanks a lot :)
[19:26:24] platzhirsch: Any idea what 0.3%, vesting over three years as part of company EMI scheme means?
[19:26:53] papasierra: from these strings "foo/bar/baz" and "x/y", how do i obtain "foo/bar" and "x", respectively? i.e. discard the last part of the path?
[19:27:39] shevy: platzhirsch I dont even nkow what EMI means
[19:28:07] platzhirsch: It means I will be involved when the company makes debts
[19:28:18] shevy: papasierra several ways. simplest one is by .split('/') -ing
[19:28:20] horrorvacui: papasierra: one direct way is to split the strings on "/" and reassemble. also you can use regex to match depending.
[19:28:52] neolithic: Is rbconfig available in all ruby versions (ie 1.8.5+)?
[19:32:24] shevy: neolithic yeah I think so
[19:33:49] horrorvacui: Didn't it go through a rename somewhere in the past though? Like didn't the module use to be called Config?
[19:33:56] s2013: platzhirsch, yeah meaning in 3 years youll get .3%
[19:34:02] s2013: but until then it will be counted on a monthly basis
[19:34:09] s2013: so lets say you leave after year and half youll get .15%
[19:34:16] platzhirsch: s2013: ah okay
[19:34:19] platzhirsch: and now, from what?
[19:34:32] s2013: of the company
[19:34:34] s2013: is it for a job?
[19:34:42] s2013: 3 years vesting si a bit too much but whatever
[19:34:49] s2013: yeah then you get .3% equity in the company
[19:35:00] platzhirsch: Isn't it like, I have to buy the shares?
[19:35:13] s2013: you cant buy shares
[19:35:15] s2013: its not public company
[19:35:19] s2013: you just get shares
[19:35:23] s2013: is it a startup?
[19:35:24] platzhirsch: so after 3 years I own 0.3% of the company
[19:35:37] platzhirsch: and this becomes interesting when the company does IPO?
[19:35:39] s2013: similarly how early employees of fb/google etc made rich
[19:35:49] platzhirsch: and if they never go IPO?
[19:35:51] s2013: chances are eventually if the company still survives youll have lot less than .3%
[19:36:05] s2013: because of dilution. if they never have an ipo then if they get bought out
[19:36:10] shevy: platzhirsch, you seem to dive in head first ;)
[19:36:11] s2013: there has to be soem exit strategy
[19:36:26] platzhirsch: ah ok, if they are bought then I also get a share
[19:36:40] s2013: so if they get bought out for $100m. you get $300K assuming you still retain .3%
[19:36:40] platzhirsch: ok, so I have to make sure that my work leads to that point
[19:36:55] s2013: is it some fancy social media startup that makes no revenue?
[19:37:12] platzhirsch: they make revenue, have a paid plan
[19:37:23] s2013: are they profitable?
[19:37:36] platzhirsch: No clue at the moment
[19:37:40] platzhirsch: They will, after I start
[19:37:52] s2013: how many employees
[19:38:01] shevy: platzhirsch deserves his nick
[19:38:13] s2013: hmm .3% isnt that bad then. whats the salary offer and where are they located
[19:38:28] platzhirsch: is it bad if I tell that in the channel?
[19:38:39] horrorvacui: I'd not mention it
[19:38:42] shevy: could be competition here!
[19:38:52] horrorvacui: Keep it between you and s2013
[19:38:58] horrorvacui: Just incase :P
[19:38:59] shevy: including the hot kisses
[19:39:02] s2013: yeah just msg me then
[19:39:45] papasierra: horrorvacui: if i split('/') and then reassemble, i'll need to reassemble the first n-1 elements.
[19:40:13] horrorvacui: papasierra: yeah thats exactly why we need to know what you intend
[19:40:44] papasierra: horrorvacui: yes, 'x/y/z' becomes 'x/y' (drop the last /element
[19:41:22] shevy: papasierra yes that is simple [0..-2]
[19:41:50] horrorvacui: papasierra: well is that element variable in size? Does the element you want removed always stay 1 char?
[19:43:15] papasierra: horrorvacui: that's irrelevant. once i "split" it's just an array, doesn't matter how many chars. it's variable in size, but must always drop the *last* element. so 'a/bbb/cccccc/d' becomes 'a/bbb/cccccc'
[19:43:23] papasierra: shevy: i'm reading up on that now
[19:43:52] papasierra: shevy: so [0..-1] right?
[19:43:54] horrorvacui: papasierra: Well you mentioned n - 1 so I thought you were saying that splitting has a O(n) or something
[19:44:54] shevy: papasierra did you read what I wrote
[19:45:24] shevy: because if you would have done, I wonder how you came to -1
[19:45:26] shevy: anyway, look
[19:45:27] shevy: >> 'x/y/z'.split('/')[0..-2]
[19:45:28] eval-in: shevy => ["x", "y"] (https://eval.in/131403)
[19:45:40] shevy: >> 'x/y/z'.split('/')[0..-2].join('/')
[19:45:41] eval-in: shevy => "x/y" (https://eval.in/131404)
[19:46:12] papasierra: yes, i went off and read about it, then made a typo when i repeated back to you what i thought were my new learnings.
[19:46:13] shevy: the [] method is fairly consistent across different ruby classes
[19:46:20] shevy: you can use it on class String and class Array
[19:46:31] shevy: and you can use it in your custom class via: def self.[](i)
[19:46:51] banister: shevy there are men here who want to do you harm - i am the only thing between you and incredible suffering
[19:46:53] shevy: papasierra ok, makes sense with that explanation :)
[19:47:47] papasierra: ok i'll practice that just now (the self.[](i) thing). firstly i'll try your solution in the repl to make sure i understand it. thanks
[19:50:27] papasierra: shevy: right, so 'x/y/z'.split('/')[0..-2].join('/') works just right. so [0..-2] means "from the 0th, to the (length-2)th", have i got it?
[19:50:51] papasierra: [0..-1] would just do the entire array.
[19:51:33] papasierra: and [0..0] makes no sense. i imagine that's an array containing only the 0th element
[19:52:02] shevy: papasierra yeah
[19:52:12] shevy: it's easiest to work on a string to understand that
[19:52:18] papasierra: great! ty v much
[19:52:19] shevy: >> "foobar"[0..-1]
[19:52:19] eval-in: shevy => "foobar" (https://eval.in/131405)
[19:52:21] shevy: >> "foobar"[0..-2]
[19:52:22] eval-in: shevy => "fooba" (https://eval.in/131406)
[19:52:36] shevy: >> "foobar"[0..0]
[19:52:36] eval-in: shevy => "f" (https://eval.in/131407)
[19:52:44] shevy: >> "foobar"[0..1]
[19:52:45] eval-in: shevy => "fo" (https://eval.in/131408)
[19:52:53] shevy: >> "foobar"[0,1]
[19:52:54] eval-in: shevy => "f" (https://eval.in/131409)
[19:52:54] papasierra: right, that's cool
[19:52:59] shevy: I think that might be different in ruby 1.8.x
[19:53:15] neolithic: If i use "%USERPROFILE%\.chef" as a path on WIndows do I have to run this through File.expand_path or will things that take a path figure it out?
[19:53:15] shevy: can someone test the above in ruby 1.8.x?
[20:05:38] kbarry: shevy: about groups
[20:05:50] kbarry: I need to parse the name a different way
[20:06:04] kbarry: i need the non numbers between 2 pair of numbers
[20:06:18] kbarry: ie nm01servername04
[20:06:23] kbarry: i need "servername
[20:07:04] kbarry: i know i might do something like \d{2}\w*\d{2}
[20:07:38] kbarry: i don't evne know what its called, only that if can be done
[20:07:50] kbarry: where I can essentially so soemthing like
[20:08:10] kbarry: (\d{2})(\w*)(\d{2})
[20:09:50] BraddBitt: \d\d(\w+)\d\d
[20:10:03] BraddBitt: and your matching name will be the first group
[20:10:13] BraddBitt: assuming a name never has a number in it
[20:10:14] kbarry: Ohhhh, nice
[20:10:30] BraddBitt: yeah that should work
[20:10:33] BraddBitt: you can test on rubular
[20:10:34] kbarry: whats the difference between \w and\D
[20:10:48] BraddBitt: \d is digit
[20:10:51] BraddBitt: \D is any non-digit
[20:10:59] kbarry: in this case, its the same
[20:10:59] BraddBitt: \w is any word
[20:11:20] BraddBitt: actually \w will capture numbers iirc
[20:11:36] BraddBitt: \d\d(\D+)\d\d
[20:11:38] BraddBitt: that would be better
[20:11:55] BraddBitt: /\d\d(\D+)\d\d/.match(string)[1]
[20:12:01] BraddBitt: will extract the name
[20:12:06] Mon_Ouie: You can use ri Regexp to see what those character classes mean exactly
[20:12:19] Mon_Ouie: For instance, /\w/ - A word character ([a-zA-Z0-9_])
[20:12:21] kbarry: .match(string)[1] or [0]
[20:12:28] kbarry: and literally put "string"
[20:12:47] BraddBitt: isn't [0] the entire match result, disregarding groupings?
[20:13:06] BraddBitt: god some fucking bot on #freenode is spam querying me
[20:13:11] BraddBitt: i think itc
[20:13:18] kbarry: is this a good case or scan?
[20:13:19] Mon_Ouie: Also you can use string[regexp, capture_group_id]
[20:13:38] kbarry: a good case for scan?
[20:13:49] Mon_Ouie: Do you want to iterate over all matches of the regular expression?
[20:14:12] kbarry: there will be only one
[20:15:33] mary5030: shevy: can some check and guid me how i can conditionally destroy this active record object? it is created in line 4 and trying to remove in line 34
[20:15:35] mary5030: http://pastebin.com/9V1AK5KF
[20:15:58] mary5030: i mean whoever that is welling to help guid me on this :)
[20:16:34] shevy: I open pastebin.com
[20:16:38] shevy: and audio is played
[20:16:42] shevy: can you use another pastie mary5030?
[20:16:45] mozzarella: require 'something/{one,two}'
[20:17:05] shevy: pastie.org or http://gist.github.com/ are better alternatives
[20:17:15] shevy: mary5030 I clicked on your link and there is ad
[20:17:31] BraddBitt: yeah pastebin blows now with that ad at the top
[20:17:44] BraddBitt: not afaik mozzarella
[20:17:48] mary5030: https://gist.github.com/anonymous/9962071
[20:18:18] mary5030: that would be now line 6 and 37
[20:19:39] shevy: this code is all fairly domain specific
[20:19:54] mary5030: i understand
[20:20:07] shevy: your code does not seem to make a lot of sense to me
[20:20:15] shevy: you use a rescue => e
[20:20:17] shevy: but where is begin?
[20:20:27] shevy: and what is the specific error you try to capture
[20:20:38] shevy: another problem:
[20:20:43] shevy: remove_gateway_ip = gateway_ip.hard_deallocate!
[20:20:46] shevy: this is very atypical ruby code
[20:20:48] jhass: shevy: you don't need a begin if you start at the method
[20:21:09] mary5030: i was calling destroy on the object that was conditionally created in line 7
[20:21:13] shevy: what demon came up with that?
[20:21:27] shevy: jhass are you using that yourself?
[20:21:39] jhass: mary5030: do you really need to create it? can't you build it and save when you know that you want to keep it?
[20:21:54] jhass: shevy: implicit begin with def? yes
[20:22:00] jhass: but my methods are way shorter
[20:22:44] mary5030: shevy: i confirmed in this case i didn't need a begin
[20:23:17] shevy: https://gist.github.com/shevegen/9962177
[20:23:22] shevy: this is too awful for me sorry
[20:23:27] shevy: jhass will have to help you with such code
[20:23:37] mary5030: rescue => e
[20:23:38] jhass: mary5030: so does any of the SimpleConfig stuff load objects you created there from the database?
[20:23:54] jhass: shevy: well, I don't indent it like that :P
[20:24:07] shevy: but I really find it ugly!
[20:24:18] shevy: it reminds me of ruby's perl origins
[20:24:18] jhass: shevy: most things in ruby do for a newcomer
[20:24:48] jhass: it's actually one of the things I love about ruby
[20:25:03] shevy: if ($@->isa('MyException::File')) {
[20:25:04] jhass: since all that try { } catch stuff in the java I've to write really annoys me
[20:25:20] jhass: mary5030: will you answer my questions?
[20:25:25] shevy: if ($err->isa('MyException')) { die $err; }
[20:25:28] shevy: ok, perl is definitely worse
[20:25:41] mary5030: jhass: so in line 6 and 37 i realized i couldn't just call destroy because it was made conditionally
[20:25:53] jhass: mary5030: I got that
[20:26:05] jhass: I'm asking if you really need to persist it to the database at that point
[20:26:06] mary5030: yes it does
[20:26:06] yaymukund: is it best practice to exclude the extension when requiring a file?
[20:26:18] mary5030: load the object from the database vs?
[20:26:19] jhass: mary5030: can you explain why?
[20:26:19] yaymukund: or is that hotly debated
[20:26:42] horrorvacui: yaymukund: exclude
[20:27:01] dgarstang: wasn't there a with_index thingy or iterating over an array in an erb?
[20:27:05] yaymukund: horrorvacui: hmm okay. thanks.
[20:27:08] jhass: mary5030: foo = Foo.new; begin; do_stuff_that_my_fail; foo.save; rescue DoStuffError => e; end
[20:27:49] shevy: yaymukund I always include it, unless it is a project/gem
[20:28:20] shevy: yaymukund that way when I look at my code, I instantly know what it refers to
[20:29:42] mary5030: jhass: i was basically trying to not roll back the part that comes after rescue
[20:29:45] yaymukund: shevy: cool, that makes sense too.
[20:30:26] mary5030: jhass: and shevy thank you guys anyways I think i wasn't able to explain myself well
[20:30:40] jhass: mary5030: I do understand that. I'm saying that you should try to have no reason to rollback because you only should persist when you know it won't fail
[20:30:45] mary5030: and that is a small part of my code from two different class that i combined in one gist
[20:31:01] shevy: dgarstang there is with_index somewhere
[20:31:08] shevy: I forgot where haha ... Enumerable? Enumerator?
[20:31:32] shevy: dgarstang it should not matter whether it is erb or not btw, as long as you use ruby code, it will work, in or outside of erb
[20:31:52] shevy: of course an added difficult is that erb code is almost as ugly as embedded php
[20:32:19] mary5030: you mean shouldnt have to use transaction
[20:32:20] shevy: mozzarella require is very simple
[20:32:24] mozzarella: is test::unit dead?
[20:32:34] shevy: don't think it is dead yet
[20:32:44] shevy: people like minitest
[20:32:53] mozzarella: should I??use minitest or test::unit?
[20:32:59] mozzarella: I'm new at testing
[20:33:02] shevy: I asked the same
[20:33:06] shevy: 6 people here said minitest
[20:33:09] shevy: one guy said something else
[20:33:24] shevy: that was like 2 or 3 weeks ago
[20:33:29] crome: in the end it doesnt really matter
[20:33:31] shevy: I think jhass said minitest
[20:33:37] mozzarella: I??guess I'll use minitest
[20:33:38] shevy: or perhaps he was the odd one, I forgot :P
[20:34:07] crome: a test framework is just like anything else, you can write a crap and mostly useless test coverage with any of them ;>
[20:34:11] jhass: mary5030: you can get a long way without hitting the database in AR. The other possibility is to extend the transaction to all points that do call the database and should be reverted upon failure. Right now you seem to be half way between
[20:34:19] mozzarella: I am under the impression that my ruby installation didn't come with everything??? like, I had to install rake manually
[20:34:26] mozzarella: isn't rake supposed to come with ruby?
[20:34:33] shevy: not quite
[20:34:34] crome: mozzarella: nope
[20:34:39] shevy: it was like outside ruby for years
[20:34:57] shevy: then its author died
[20:35:05] shevy: http://en.wikipedia.org/wiki/Jim_Weirich
[20:35:11] jhass: shevy: I'm the odd one who likes rspec 3
[20:35:12] mozzarella: yeah poor jim
[20:35:19] shevy: but I assume it will become part of ruby eventually
[20:35:21] shevy: jhass oh yeah
[20:35:36] shevy: mozzarella ok so mostly minitest, and one for rspec 3
[20:35:52] shevy: and zero for anything else haha
[20:36:06] mozzarella: I created a test file??? not sure which one of minitest/unit, autorun, etc., to include
[20:36:38] mozzarella: when I??use /unit it says to use autorun instead, lol
[20:36:46] mozzarella: and autorun seems to mess with my rakefile
[20:37:29] mozzarella: I'm receving spam from users in this channel
[20:37:42] mozzarella: when I??say something (????;____;)
[20:38:06] shevy: two bots are here
[20:38:09] shevy: apeiros likes them
[20:38:40] shevy: I think they abuse the channel as they use query + notification information they recieve from the channel for non-user related "interaction"
[20:38:51] shevy: iswop is one
[20:41:21] mozzarella: Warning: you should require 'minitest/autorun' instead.
[20:41:30] mozzarella: Warning: or add 'gem "minitest"' before 'require "minitest/autorun"'
[20:42:39] soheil: what gem do you use for active record read/write db separation?
[20:44:06] samfisher: how can I check a string to be 11 chars starting with 00?
[20:44:33] benzrf: samfisher:
[20:44:34] samfisher: and loop until user inputs that correctly?
[20:45:10] benzrf: >> 'thisisstr11' =~ '.{9}11'
[20:45:11] eval-in: benzrf => type mismatch: String given (TypeError) ... (https://eval.in/131419)
[20:45:22] benzrf: >> 'thisisstr11' =~ /\A.{9}11\Z/
[20:45:23] eval-in: benzrf => 0 (https://eval.in/131420)
[20:45:31] benzrf: >> 'thisisst11' =~ /\A.{9}11\Z/
[20:45:31] eval-in: benzrf => nil (https://eval.in/131421)
[20:45:35] benzrf: >> 'thisisstr10' =~ /\A.{9}11\Z/
[20:45:36] eval-in: benzrf => nil (https://eval.in/131422)
[20:45:58] benzrf: >> '00thisisstr' =~ /\A00.{9}\Z/
[20:45:58] eval-in: benzrf => 0 (https://eval.in/131423)
[20:46:01] soheil: '00'.size == 11
[20:48:51] mozzarella: how do I??create a rake task that runs all of my tests?
[20:50:02] shevy: I never had to use rake
[20:50:08] soheil: what gem do you use for active record read/write db separation?
[20:50:21] mozzarella: soheil: define separation
[20:50:31] mozzarella: fuck that iswop guy
[20:50:33] soheil: slave/master
[20:51:24] mozzarella: soheil: what do you want to do?
[20:51:31] horrorvacui: mozzarella: what are you testing with rspec or what?
[20:51:43] mozzarella: horrorvacui: no, minitest
[20:51:43] noob101: I love ruby.
[20:51:44] soheil: balance load on our db servers
[20:52:13] soheil: send reads to slaves and writes to master
[20:53:50] soheil: mozzarella: any ideas?
[20:54:24] samfisher: can I easily integrate Ruby on serverside apps? Something easy, PHP-like?
[20:54:28] horrorvacui: mozzarella: look up rake TestTask
[20:55:02] mozzarella: samfisher: yes
[20:55:09] samfisher: mozzarella: pls show me
[20:55:35] mozzarella: soheil: wait a minute
[20:56:15] soheil: _Andres: hey
[20:56:17] horrorvacui: mozzarella: here is a good link for an example http://crashruby.com/2013/05/10/running-a-minitest-suite/
[20:56:19] mozzarella: samfisher: well, say you're using sinatra, all you have to do is run the app and make sure you're using the production environment
[20:56:31] _Andres: soheil: Hello
[20:57:17] horrorvacui: mozzarella: Half way down the page is what I used last time I did any rake
[20:57:37] mozzarella: soheil: you can have multiple connections, do you know how?
[20:58:01] soheil: mozzarella: shards.yml?
[20:58:01] mozzarella: I??think the port you're using to connect to the database indicates if it's read-only or not
[20:58:13] shevy: noob101 hah I remember you
[20:58:22] shevy: noob101 you wrote many times before that now is the time that you will learn ruby
[20:58:27] shevy: since a few years now right ;)
[20:58:46] noob101: shevy who? me? I started ruby some months ago lol!
[20:58:54] noob101: However I know more now which was great.
[20:59:07] noob101: I also remember you cause you helped me! :)
[20:59:28] soheil: mozzarella: is that right?
[21:00:22] mozzarella: soheil: this will depend on how you setup your stuff I??guess
[21:00:27] mozzarella: are you using ruby on rails?
[21:00:36] mozzarella: or only activerecord standalone?
[21:00:41] soheil: mozzarella: ror
[21:00:49] mozzarella: well I??suggest you ask in #rubyonrails
[21:15:18] mozzarella: horrorvacui: thank you, I went with the last one
[21:18:26] glide: Hey guys, Can anyone help me with a Ruby Koan?
[21:19:05] glide: about_triangle_project_2 on the online version.
[21:22:50] jhass: do not crosspost
[21:22:57] jhass: or at least tell that you do
[21:26:26] railzForDaiz: can someone tell me why this wold not work
[21:26:29] railzForDaiz: test_text = 'RubyMonk Is Pretty Brilliant'
[21:26:30] railzForDaiz: nash = test_text.match(/ ./)
[21:26:32] railzForDaiz: number = test_text.index('nash')
[21:26:35] railzForDaiz: freedom = test_text.match(/ ./, number)
[21:26:36] railzForDaiz: puts "#{freedom}"
[21:27:08] railzForDaiz: test_text = 'RubyMonk Is Pretty Brilliant'
[21:27:09] railzForDaiz: nash = test_text.match(/ ./)
[21:27:11] railzForDaiz: number = test_text.index('nash')
[21:27:14] crome: how about no
[21:27:16] railzForDaiz: freedom = test_text.match(/ ./, number)
[21:27:16] railzForDaiz: puts "#{freedom}"
[21:29:08] jhass: railzForDaiz: /topic
[21:29:30] railzForDaiz: http://pastebin.com/R5YRvm4G
[21:30:15] toretore: to_s and to_i do not mutate
[21:30:23] railzForDaiz: what yo mean ?
[21:30:33] jhass: also what's your expected and what's your actual result
[21:30:57] jhass: >> s = '123'; s.to_i; [s, s.class, s.to_i.class]
[21:30:58] eval-in: jhass => ["123", String, Fixnum] (https://eval.in/131430)
[21:31:23] railzForDaiz: 'RubyMonk Is Pretty Brilliant'.match(/ ./, 9)
[21:31:25] toretore: first, explain wth you're trying to do there
[21:31:46] toretore: >> 'RubyMonk Is Pretty Brilliant'.match(/ ./, 9)
[21:31:46] eval-in: toretore => #<MatchData " P"> (https://eval.in/131431)
[21:31:47] railzForDaiz: instead of putting 9 in manually
[21:32:18] toretore: >> 'RubyMonk Is Pretty Brilliant'.index('nash')
[21:32:18] eval-in: toretore => nil (https://eval.in/131432)
[21:32:34] toretore: someone kill that spamming dickbag
[21:32:55] jhass: toretore: have fun getting explained by #freenode that spam is your problem
[21:33:29] toretore: eh. surely the operators of a channel can choose to ban a spammer
[21:34:05] jhass: this one won't
[21:34:08] centrx: I think there is only one active op in this channel, and he says he can't ban in channel for spam sent by private message
[21:34:31] toretore: but who is making that decision?
[21:34:40] toretore: apeiros: ^?
[21:35:02] centrx: toretore, Yes
[21:35:30] toretore: no, i mean i thought apeiros could chime in himself if he wanted to
[21:35:36] centrx: toretore, It might be something fflush told him, but fflush is never here now
[21:35:39] toretore: if he's not making the final decision
[21:36:14] toretore: so it's out of his hands, and the guy whose hands it's in isn't here
[21:36:43] jhass: I think it's his own decision
[21:42:17] apeiros: toretore: what?
[21:42:31] dewolfe: Hey guys can anyone tell me how to patch 1.9.3 against CVE-2014-2525 with rvm?
[21:43:05] jhass: just update your libyaml
[21:44:17] feniix: hello I am trying to use RSpec::Puppet::Coverage and I keep gettin this error coverage_spec.rb:1:in `block in <top (required)>': uninitialized constant RSpec::Puppet::Coverage (NameError)
[21:45:15] feniix: i'd appreciate some pointer on how to look at that
[21:46:16] toretore: apeiros: we were just talking about the spammers, but my questions have been answered
[21:55:51] Joel: array of files, any of the files might be a glob, how can I check the files exist?
[21:58:38] iitywimwybmab: Joel: files.all? {|f| File.exist?(f) } .... http://www.ruby-doc.org/core-2.1.1/File.html#method-c-exist-3F
[21:59:12] Joel: file doesn't work on globs, you have to use File.glob
[21:59:17] Joel: and I have no idea how to do a double block
[21:59:24] Joel: since File.glob returns an array
[21:59:40] shevy: can you convert it all into an array before using .all? ?
[21:59:45] Joel: sorry, File.exists doesn't work on a pattern.
[22:00:34] centrx: Very strange
[22:02:49] Joel: so not really sure what to do
[22:03:22] Joel: is there a channel op around?
[22:03:25] Joel: two spammers in the channel
[22:05:35] apeiros: Joel: ary.flat_map { |glob| Dir.glob(glob) }.any? ???
[22:05:56] Joel: apeiros, wow, will try, thanks.
[22:06:10] apeiros: I doubt it'll help??? but well???
[22:06:30] apeiros: apeiros kicked iswop:
[22:06:34] apeiros: apeiros kicked illumination:
[22:06:44] iitywimwybmab: Joel: files.all? {|f| Dir[f].present? }
[22:06:46] centrx: They're unstoppable!
[22:06:58] shevy: centrx lol
[22:06:58] apeiros: +b *!~ircap@*
[22:06:59] apeiros: apeiros kicked illumination:
[22:07:01] apeiros: apeiros kicked iswop:
[22:07:11] shevy: centrx they were written in php
[22:07:32] centrx: Like the most vile demons
[22:07:34] iitywimwybmab: Joel: although you may not have a #present? method... basically if the array is not empty, they're there
[22:08:28] eval-in: iitywimwybmab => ["input-fc29a2198e6e", "source-fc29a2198e6e", "output-fc29a2198e6e"] (https://eval.in/131443)
[22:09:24] apeiros: -o apeiros
[22:26:45] Joel: so, trying to stick with the spirit of the code I'm trying to fix, this is what I have: if missing_file = files.detect { |f| Dir.glob(f) { |fg| !File.exists?(fg) }}
[22:26:58] Joel: The only issue in this case is if a file doesn't exist that's in files it doesn't return nil
[22:28:01] Joel: I think detect is the issue in this case
[22:28:25] jhass: hm, Dir.glob(f).any? {|fg| File.exists?(fg) } I think
[22:29:20] dr0ff: it return false
[22:29:45] jhass: er, !File.exists?(fg) still
[22:29:46] Joel: The trick is getting back what file, if any, is missing.
[22:29:51] dr0ff: File.exists?(fg) || nil
[22:30:14] jhass: files contains glob patterns?
[22:30:53] jhass: do you need to optimize for first match?
[22:31:33] jhass: files.map {|pattern| Dir.glob(pattern }.flatten.find {|f| !File.exists?(f) }
[22:32:55] Joel: I don't think that spits back a non match file?
[22:33:42] jhass: actually glob shouldn't even return anything if the file doesn't exists
[22:33:57] jhass: so files.find {|pattern| Dir.glob(pattern).empty? }
[22:35:30] Joel: jhass, hot
[22:35:32] Joel: jhass, want to make out?
[22:37:31] iitywimwybmab: jhass: Dir.glob(x) vs Dir[x] ... why one over the other?
[22:37:49] jhass: I don't care too much about this one
[22:38:16] iitywimwybmab: I suppose I'd care if you said "performance"
[22:40:59] jhass: ah, apparently Dir[pattern] calls Dir.glob(pattern, 0)
[23:09:31] Jonah11_: say you building an array to track numbers you have already seen. when you encounter a new number, you will use the array solely to search and check if the new number is already there. is an array, hash, or some other structure fastest for this in ruby?
[23:12:09] shinobi_one: Jonah11_: hashes are fizast
[23:12:27] shinobi_one: Jonah11_: how many numbers are you dealing with?
[23:13:10] Jonah11_: shinobi_one, thousands, maybe 10k, not that many... if i use a hash, would i just be putting in keys with nil values, since i only care about key existence?
[23:17:39] kbarry: i got the following.
[23:23:22] BraddBitt: can I create a Logger object that writes to both STDOUT as well as a specific log file?
[23:25:03] lupine: or you could use tee
[23:25:47] BraddBitt: how would i do it with ruby's native Logger class?
[23:27:06] lupine: i'd tell it to log to stdout then call my-program | tee logfile. otherwise, just build an IOArray class that duplicates writes to multiple fds, and create the logger around that, I guess
[23:28:18] lupine: you probably just need to intercept #write, I don't know offhand
[23:37:05] LiquidInsect: BraddBitt: so... this is an ugly hack I did, and works with Rails.logger and not the native one, but a similar pattern might do what you want... https://github.com/babney/log_raider/blob/master/lib/log_raider.rb
[23:37:58] LiquidInsect: this was intended to log errors to Rails.logger and also send them to NewRelic... like I said, similar pattern
[23:38:46] BraddBitt: awesome, looks good
[23:38:56] BraddBitt: also is it particularly bad to have a global logger object?
[23:39:42] BraddBitt: like in my kick off initialization method create @@logger = Logger.new
[23:41:07] dgarstang: If I'm trying to use chef search with chef zero, is there a way I can 'fool' the recipe into thinking chef search returns data?
[23:48:38] dgarstang: If I'm trying to use chef search with chef zero, is there a way I can 'fool' the recipe into thinking chef search returns data?
[23:49:32] dgarstang: or, put another way, how do I use chef search with solo and vagrant?