« Back to channel list

#ruby - 22 February 2015

« Back 1 day Forward 1 day »
[00:25:56] shevy: is there a way to get ENV variables into ruby .cgi scripts?
[00:26:50] crome: guess it depends on what launches the cgi scripts
[00:28:38] shevy: hmm ... lighttpd right now
[00:29:43] crome: I know you can specify an env with fastcgi
[00:34:35] shevy: aha, interesting
[00:34:39] shevy: perhaps I should switch to fastcgi
[00:39:05] pontiki: you have the standard CGI environment
[00:39:26] pontiki: anything else would have to be set in lighty's env
[01:55:40] shevy: how do I split a string into an array, with a chunk of 80 characters in each slot of the array?
[01:58:21] jhass: .scan /.{,80}/
[01:59:53] shevy: ohhh I was trying without the ,
[02:06:35] stef204: hi, i noticed I have gems in my $HOME/.gem/ruby/2.1.0 directory; which are not seen by gem as am now running ruby 2.2.0 and gem path is set to HOME/.gem/ruby/2.2.0. How do I ge rid of the gems in 2.1.0?
[02:11:18] stef204: i guess i could add the .gem/2.1.0 dir to my path before the 2.2.0 and possibly gem would uninstall them
[02:14:35] weaksauce: stef204 use bundler
[02:14:49] weaksauce: and use some sort of ruby version manager. I like chruby
[02:16:20] stef204: weaksauce: I could use bundler I suppose. I'm not too keen on installing more package management packages to handle other package management (gem) but I could try
[02:16:50] weaksauce: stef204 if you don't use bundler, you will be one of the only rubists that don't use it
[02:17:05] weaksauce: it's really that ubiquitous
[02:17:07] stef204: weaksauce: ok, we don't want that then!
[02:17:40] jhass: stef204: you can safely just rm -f that folder
[02:17:41] stef204: weaksauce: ok, didn't realize was ubiquitous
[02:19:00] jhass: weaksauce: bundler will not solve that, it'll scope install locations to the ABI version too
[02:19:38] stef204: the path 'trick' doesn't wrk, btw
[02:20:00] jhass: and chruby is actually worse, as it scopes to the ruby version, not the ABI version
[02:20:54] havenwood: https://github.com/rubygems/rubygems/issues/1049
[02:24:08] stef204: jhass: so rm -f the entire $HOME//.gem/ruby/2.1.0 , cirrect?
[02:26:09] jhass: havenwood: maybe related, but https://github.com/postmodern/chruby/issues/235 is what I'm talking about
[02:26:45] havenwood: jhass: with 1.9's EoL on Monday the blocker for chruby supporting `~/.gem/$ruby/X.Y` is RubyGem's defaulting to --env-shebang ^, yeah
[02:27:35] jhass: mmh, I've to reread the issue, I don't quite get why that's needed
[02:28:43] havenwood: jhass: Instead of using the current Ruby (/usr/bin/env ruby) by default, RubyGems hardcodes the path unless you opt for --env-shebang.
[02:29:08] jhass: yeah, just got it again, too late here ;)
[02:29:10] tohuw: I have a particularly long line that I???d like some help understanding how to best not make??? well, unbearably long (and annoying to read). https://gist.github.com/tohuw/51aaeeff9eac070506bc
[02:29:42] eam: tohuw: use a temporary variable
[02:29:54] eam: (or, a few)
[02:30:01] postmodern: jhass, see also https://github.com/rubygems/rubygems/issues/1049
[02:31:46] tohuw: eam: so, assign e.g.: page.data['title'] to a variable, page.data['tags'].to_s to another, and so on, then concat the variables?
[02:31:58] jhass: tohuw: I'd go with http://paste.mrzyx.de/p4uq2sbao
[02:32:00] tohuw: apologies, I???m an utter neophyte
[02:33:18] jhass: postmodern: yeah, havenwood linked it earlier, thanks
[02:33:53] tohuw: jhass: ok, that makes sense. Thank you! Does the shebang also make it a string, like .to_s?
[02:34:23] jhass: string interpolation ("#{}") calls to_s, yes
[02:34:49] jhass: a shebang is #!/some/binary in the first line of a file
[02:35:18] tohuw: oh right, thanks
[03:16:54] significance: Hello all! Writing a beginning ruby project here, what's the best way to get started? Does `bundle gem` setup a good default?
[03:21:25] softinio: I have a vps for hosting my rails apps
[03:21:32] softinio: I am using nginx as web server
[03:21:55] softinio: puma or passenger or what is your guys recommendation to use with nginx?
[03:49:12] axisys: hi I am trying to generate a file using erb template.. this is what I have tried so far.. http://dpaste.com/0ETM5BM .. newbie here.. any help is appreciated
[03:49:48] weaksauce: axisys @users doesn't equal users
[03:51:12] axisys: updated the first line with @users .. still same error
[03:51:59] axisys: http://dpaste.com/1MG9NF5
[03:52:19] weaksauce: make them both users
[03:52:35] weaksauce: actually is that in the erb file?
[03:52:47] weaksauce: you need to escape the code that you want to run
[03:53:05] weaksauce: <% @users = ['foo', 'bar'] %>
[03:53:06] axisys: weaksauce: yes that is a erb file
[03:53:23] weaksauce: note that there is no <%= it's a <%
[03:53:41] weaksauce: the <%= will output the ruby to the file and the <% will just run it
[03:54:14] axisys: worked! .. sweet!
[03:57:07] axisys: how to get rid of the extra newline .. seems like it does not like -%>
[03:57:09] axisys: http://dpaste.com/04MSK17
[03:57:42] weaksauce: the - should only get put on output tags
[03:59:46] axisys: weaksauce: moved to the output tags .. still errors
[03:59:49] axisys: weaksauce: http://dpaste.com/0M29TM1
[04:00:51] weaksauce: not sure. I don't really use erb much
[04:01:01] weaksauce: but I thought that was valid
[04:05:40] jhass: axisys: puma, or passenger standalone, let's you keep your packaged nginx
[04:06:33] jhass: er, softinio ^
[04:10:02] softinio: jhass: thanks ! Good idea about standalone. Which one do u like more and why?
[04:10:28] jhass: I didn't use passenger standalone yet
[04:19:18] significance: Hello all! How do you make a gem install executables into $PATH?
[04:19:34] significance: I used `bundle gem`, but when I install, running <gemname> <scriptname> does nothing.
[04:20:43] significance: Anyone there?
[04:21:16] weaksauce: significance relax. people will answer if they know and on their terms
[04:21:27] significance: Awesome - thanks!
[04:55:44] theta88: I just realized I could have an array of Procs today
[04:58:03] pontiki: you know what's *really* weird: you can have a Proc as a hash key
[05:04:54] theta88: pontiki that is *really* weird
[05:04:55] apeiros_: you can even have a Method as hash key!
[05:05:00] apeiros_: or a Class!
[05:05:09] theta88: can you have a method in an array?
[05:05:12] apeiros_: ruby - the awesome never stops!
[05:05:16] pontiki: or an Array of Procs!!
[05:05:19] apeiros_: theta88: not a method, a Method
[05:06:58] theta88: this is nuts
[05:08:31] apeiros_: >> a = [1,2,3].method(:size); b = -123.method(:abs); c = "hello".method(:upcase); [a,b,c]
[05:08:31] eval-in: apeiros_ => [#<Method: Array#size(length)>, #<Method: Fixnum#abs>, #<Method: String#upcase>] (https://eval.in/291900)
[05:08:37] apeiros_: ^ array of Methods
[05:08:54] apeiros_: >> a = [1,2,3].method(:size); b = -123.method(:abs); c = "hello".method(:upcase); [a,b,c].map { |x| x.call }
[05:08:54] eval-in: apeiros_ => [3, 123, "HELLO"] (https://eval.in/291901)
[05:12:59] theta88: how would i call the proc if it were a key in a hash?
[05:13:17] apeiros_: theta88: the same way you call it when it's elsewhere
[05:13:23] apeiros_: you retrieve the object and invoke .call on it
[05:13:49] theta88: but wouldn't have to invoke it by referencing the proc itself?
[05:13:50] apeiros_: >> h = {proc { "weee!" } => "123"}; h.keys.first.call
[05:13:51] eval-in: apeiros_ => "weee!" (https://eval.in/291902)
[05:14:02] theta88: hash.Aproc.call
[05:14:18] apeiros_: I didn't say it makes much sense to use a proc as a key and wanting to invoke it by key
[05:14:30] apeiros_: but then again, it never makes much sense wanting to retrieve *a key* from a hash
[05:14:43] apeiros_: the key is usually what you have to retrieve *a value*
[05:14:49] cyberfab007: there are so many setups for ruby , can someone give me a link to the proper setup of ruby on rails / GEMS setup for ubuntu 14.10 64
[05:15:44] theta88: cyberfab007 have you looked at rvm?
[05:21:07] cyberfab007: theta88 yes ,
[05:21:38] cyberfab007: but I set up ruby on my other system I tried using that and someone I cant remember who it was over a month ago told me it was wrong and gave me instructions on how to do it
[05:21:44] cyberfab007: and it worked fine after that
[05:22:23] theta88: what is the problem you're having with it?
[05:23:59] theta88: pontiki that is fascinating, im referencing the value of the hash proc inside the proc, it works
[05:25:17] apeiros_: also funny: reference the proc inside the proc
[05:25:34] apeiros_: >> x = proc { x.call }; x.call # funky infinite loop
[05:25:34] eval-in: apeiros_ => stack level too deep (SystemStackError) ... (https://eval.in/291903)
[05:28:35] cyberfab007: I will try the one off ubuntus site again and come back with any issues in running my scirpts
[06:39:15] axisys: if I want ldap search for multiple uids.. is there a better way to filter that like this
[06:39:18] axisys: filter = Net::LDAP::Filter.eq( 'uid', 'foo' ) | Net::LDAP::Filter.eq( 'uid', 'bar' )
[06:40:38] axisys: s/that like/than like/
[06:41:26] j_mcnally: http://www.rubydoc.info/gems/ruby-net-ldap/0.0.4/Net/LDAP/Filter
[06:41:30] j_mcnally: did u check that
[06:43:07] axisys: j_mcnally: I read it.. hmm.. what section are you referring to?
[06:44:29] axisys: j_mcnally: wish there is an example.. hard to understand for a ruby newbie
[06:46:31] axisys: I am trying to do something like this (|(uid='foo')(uid='bar')) (from ldapsearch syntax)
[06:46:58] axisys: but I have about 1000 users
[06:47:34] axisys: so doing a .join means lot of lines of filterX
[06:58:15] axisys: how to skip NoMethodError ?
[06:58:42] axisys: ldap.search( :base => base, :filter => filter ) do |entry|
[06:58:56] axisys: puts "#{entry.mail}"
[06:59:11] axisys: for entries that has no email geta NoMethodError
[06:59:45] axisys: I tried unless entry.mail == nil , but that did not help
[07:27:43] phat4life: is does it make sense to use a priority queue for a network buffer
[07:47:05] axisys: how do I read from ~/.ldap-pass instead of /home/foo/.ldap-pass ?
[07:47:38] axisys: File.read('/home/foo/.ldap-pass') works but File.read('~/.ldap-pass') does not
[07:49:46] zly: Don't you need to extend the path?
[07:50:39] axisys: zly: in python I read it like this
[07:50:42] axisys: zly: open(os.path.expanduser('~/.ldap-pass'))
[07:50:54] axisys: looking for equivalent in ruby
[07:51:30] zly: in Ruby you use File.expand_path('~/.ldap-pass')
[07:51:36] zly: I think it should work
[07:53:03] axisys: zly: yep that works
[07:53:14] axisys: zly: File.read(File.expand_path('~/.ldap-pass')) to get the pass
[07:53:16] axisys: zly: thanks
[07:59:23] streaxy: Anyone alive in here?
[08:20:21] zly: nope, all dead
[08:59:19] wasamasa: dead or alive!
[08:59:40] wasamasa: streaxy: you should just directly ask your question, chances are you'll get help
[09:07:32] streaxy: Was just seeing how everyone is doing. Didn't really have a question.... Yet
[09:12:59] fakam: Hi how do you remove the decimals and the trailing digits ?
[09:16:22] no_gravity: Hello! What could "nr" stand for in the variable name "nr_sessions_to_process"?
[09:53:36] shreknet: Hey guys and girls, I need your help. I am a normal PHP Server Guy who runs Redmine and Gitlab on a server. We needed to update mysql on our debian wheezy host from 5.5 to 5.6 with this commands: http://www.devops.zone/debian-howtos/installing-mysql-5-6-on-debian-wheezy/ now I gem uninstalled mysql2 and gem installed mysql2 again and restarted all the processes, but both applications still complain about a version missmatch:
[09:53:36] shreknet: Incorrect MySQL client library version! This gem was compiled for 5.5.38 but the client library is 5.6.23.
[09:54:41] shreknet: now one of my thoughts was, that the apt package libmysqlclient-dev ( which is required from ruby afaik ) could be build for 5.5, but I don't know how to check this or how to get a newer version... Any hints?
[10:02:47] cyberfab007: are these proper setup instrutions for ruby on rails
[10:02:54] cyberfab007: https://gorails.com/setup/ubuntu/14.10
[10:04:29] cyberfab007: anyone in here
[10:05:20] zly: how about you try that and tell us about the result
[10:05:35] cyberfab007: zly, you talking to me
[10:06:56] zly: yeah, 'me talking to you'
[10:07:12] cyberfab007: zly, I install like this before using these instrutions, but when I went to run a ruby script using a wrapper via a shell command from my php script
[10:07:35] cyberfab007: someone here told me I installed wrong and then gave me instrutctions which I lost and the wrapper worked fin
[10:08:07] zly: well, looks like it's your problem if you're trying to wrap ruby on rails in php
[10:08:18] zly: there's nothing about php in the link you pasted
[10:09:14] cyberfab007: well no , just my php takes the output from a ruby script , works fine no issues on my one server I just cant remember how the guy had me install it
[10:09:28] cyberfab007: and I think I deleted the logs a few months ago where the commands were
[10:09:59] zly: if you're trying to install ruby/rails - your link is fine
[10:10:12] zly: if you want to pair it with php, I can't help you
[10:10:47] cyberfab007: do you know what I mean by a ruby wrapper ?\
[10:11:58] zly: in this context? not really
[10:12:15] zly: anyway, I'm out
[10:12:16] zly: good luck
[10:18:14] cyberfab007: hey whats the best way to install ruby RVM from source or using rbenv
[10:26:08] cyberfab007: thats what sucks about living in ASEAN , the time difference
[10:34:20] jhass: cyberfab007: that question is highly religious, so: whatever works for you
[10:34:38] jhass: further options are chruby + ruby-install
[10:34:55] jhass: personally I do chruby + packages (archlinux)
[10:38:15] cyberfab007: im using ubuntu
[10:38:49] cyberfab007: I went through this before and my script worked but when I went to use a ruby wrapper and execute it through a bash command in php it was giving me issues
[10:38:55] cyberfab007: and someone in here help me fix it
[10:53:09] crome: scriptception
[10:53:12] crome: we have to go deeper
[10:57:37] purezen: Hi guys, I am using grape to make an api endpoint.. I am able to display all records of a model using a get request.
[10:59:51] purezen: However, I am unable to retrieve a single record using the same. I am trying to do so using params but it doesn't work yet.
[11:00:10] purezen: Btw, I am using mongodb if that matters.. Thanks :)
[11:22:19] jhass: apeiros_: fyi https://github.com/jhass/configurate/blob/master/.rubocop.yml I bluntly stole some of your reasoning ;)
[12:18:55] Cork: i'm spawning child processes in a loop and giving it STROUT as :out => https://pastebin.mozilla.org/8822783
[12:19:09] Cork: but i need to get a "copy" of the text for later processing
[12:19:31] Cork: what is the best way to do this, as i'm spawning a lot of processes in this loop
[12:27:07] apeiros_: jhass: do you have a diff?
[12:30:03] crome: Cork: pass in your own class that acts like an io
[12:30:23] crome: you can use stringio if you don't care about printing stuff to stdout
[12:30:51] Cork: ok, so a class
[12:31:34] Cork: crome: where should i look to see what this needs to expose?
[12:32:22] crome: the IO base class in the stdlib for starters
[13:43:02] SumoBoy: folks please i need a help ---> ruby very basic assignment
[13:43:14] shevy: here it is
[13:43:23] shevy: a very basic assignment
[13:43:45] SumoBoy: hahaha not that basic i guess
[13:44:16] SumoBoy: https://gist.github.com/anonymous/e7c030bab9b0a1c924b7
[13:45:37] SumoBoy: i solve it but it's about on thing is not correct and i know it exactly but i can't find way to correct it
[13:45:51] centrx: It doesn't look solved
[13:46:02] centrx: There is no code
[13:46:03] shevy: so where is the ruby code
[13:46:05] SumoBoy: https://gist.github.com/anonymous/b18722b2125bbc068066
[13:46:31] shevy: now first off, please indent consistently
[13:46:47] SumoBoy: the problem sure very clear in - elsif grand_son == 'BYE'-
[13:46:48] shevy: line 7 is not on line with 9; and why they are all one indent level to the right eludes me as well
[13:47:56] centrx: It is mysterious
[13:47:56] shevy: I tested your code
[13:48:01] shevy: when I type 'BYE'
[13:48:09] shevy: puts 'NO, NOT SINCE ' + (rand (1950)).to_s
[13:48:13] shevy: so the second clause is never reached
[13:48:33] shevy: so your first clause: if grand_son == grand_son.upcase
[13:48:36] shevy: intercepts BYE too
[13:50:00] SumoBoy: yeah i think you've read the assignment ? the problem just in BYE it all in capitals it will print the first if term
[13:51:15] SumoBoy: shevy : yeah bro that's it i want to print the BYE clause also
[13:51:25] zly: think for a second
[13:51:35] shevy: SumoBoy then you must change the code
[13:51:37] zly: how the if is executed?
[13:51:44] shevy: the second clause could be integrated into the first one
[13:51:46] zly: randomly? or from top to bottom?
[13:51:53] shevy: or from bottom to top!!!
[13:52:01] centrx: from right to left
[13:52:10] zly: from left to right
[13:52:10] shevy: arabic programming
[13:52:12] zly: it's from middle east
[13:52:23] shevy: oh it starts in the middle and then proceeds both left and right in sync
[13:52:36] zly: async way
[13:52:40] shevy: now that is the true brainfuck way
[13:53:00] SumoBoy: should i change the whole code ?
[13:53:38] centrx: What does it mean
[13:56:04] shevy: SumoBoy it is your code, only you can solve the dilemma :)
[13:56:53] SumoBoy: thnx bro i'll try again
[14:09:58] fox_mulder_cp: hi, can somebody give me cases, when i can use yield, proc and lambda. i'm newbie and learn ruby at codeacademy
[14:10:08] shmoon_: On doing a `cd` I get this error (rvm related) http://pastie.org/9971598 - any idea why ?
[14:10:33] fox_mulder_cp: i cat write at perl, bash, c#, powershell before
[14:10:58] zly: shmoon_: there's .rvmrc or .ruby-version in this directory
[14:11:26] centrx: fox_mulder_cp, Proc and lambda are like first-class functions
[14:11:48] centrx: fox_mulder_cp, yield is for using the parameters of a block
[14:11:55] centrx: A block is also like a function
[14:12:35] fox_mulder_cp: centrx: hm, can i see proctice examples for using this stuff?
[14:12:53] shmoon_: zly: yes there is a .ruby-version containing ruby-2.0.0
[14:12:59] fox_mulder_cp: codeacademy don't give more theory
[14:13:00] shmoon_: is that something important ? i cloned it from github
[14:13:07] zly: fox_mulder_cp: google for: ruby when to use yield
[14:13:28] zly: shmoon_: there's your answer
[14:13:29] fox_mulder_cp: zly: || use proc || use labda? )
[14:13:48] zly: fox_mulder_cp: don't search for everything at once
[14:13:57] zly: (even if topics are related :P)
[14:14:48] shmoon_: zly: is there some way to install 2.0.0-p481 as just 2.0.0 ? as I don't think I can change the .ruby-version file ?
[14:15:07] zly: shmoon_: Of course you can change it
[14:16:00] zly: I doubt that the app itself is using something that was in ruby 2.0.0 and is not in the newer version
[14:16:00] shevy: fox_mulder_cp yield is very easy, you yield into the content of a passed block
[14:16:14] shevy: proc and lambda are similar; so when you have a use case for a proc, you also have one for a lambda
[14:16:47] shmoon_: zly: how? what is the rvm install command for that?
[14:16:55] shmoon_: or does it have to be done in some other way
[14:17:49] zly: how about you use some googling?
[14:18:10] shevy: use ruby from source!
[14:18:20] shevy: wget ftp://ftp.ruby-lang.org/pub/ruby/2.2/ruby-2.2.0.tar.xz
[14:18:38] fox_mulder_cp: && make && configure && make deb )
[14:18:39] shevy: then you don't have to read boring rvm docus
[14:18:39] zly: nah, ruby from source is too mainstream
[14:18:49] zly: use the one from aptitude
[14:18:55] shevy: that one is modified
[14:19:02] shmoon_: i did can't find on rvm.io doc
[14:19:11] zly: well then
[14:19:16] zly: copy every file from github
[14:19:32] shevy: shmoon_ do you really want to read so much docu
[14:19:33] zly: if ruby source is on github
[14:20:01] shmoon_: shevy: i don't mind, i mean we do read docs as coders
[14:20:02] fox_mulder_cp: thanks, lot of reading can help me
[14:20:14] shevy: I never do! I always go by trial and error!
[14:20:39] shevy: I had to collect my own docu for ruby
[14:20:43] shevy: because the official docu stinks
[14:20:44] shmoon_: given that the .ruby-version has 2.0.0 and i know they're others are using 2.0.0-p481 , I have to figure out how to install 2.0.0-p481 as 2.0.0
[14:20:54] shmoon_: oh I see, that is interesting
[14:21:25] shevy: ftp://ftp.ruby-lang.org/pub/ruby/2.0/
[14:21:32] shevy: ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p481.tar.gz
[14:21:54] shmoon_: but then i have to compile it
[14:22:02] shmoon_: which is a complicated process
[14:22:04] shevy: rvm installs a binary for you?
[14:22:06] shmoon_: make makfile source and what not
[14:22:17] shmoon_: ya it does install a ruby binary
[14:22:23] zly: did you actually read the docs on rvm.io?
[14:22:25] shmoon_: wait is it a good idea to use rvm ? i thought yes
[14:22:29] zly: doesn't look like...
[14:22:32] shmoon_: i found this https://rvm.io/rubies/named
[14:22:56] zly: I think you should search for something like: 'rvm install specific version'
[14:23:46] shmoon_: i know how to install a specific version that is simple
[14:23:55] shmoon_: rvm install 2.0.0-p481
[14:24:17] zly: soooooooo what exactly is the problem?
[14:24:34] shevy: I think he wants to fake this as 2.0.0
[14:24:47] shmoon_: how to install that as 2.0.0 as the .ruby-version file has just ruby-2.0.0
[14:24:54] zly: install what?
[14:25:00] shevy: 2.0.0-p481
[14:25:00] shmoon_: and i dont want to (cannot) change ruby-version
[14:25:14] zly: you can use ruby version only for specific project
[14:26:12] zly: if you want to have only one ruby version installed you can always remove the .ruby-version file and it should work fine
[14:26:22] shmoon_: i want to install ruby 2.0.0-p481 as 2.0.0 via rvm
[14:26:47] shmoon_: without the "-p481" since my .ruby-version has ruby-2.0.0 , and i know the team is using 2.0.0-p481
[14:27:24] shmoon_: so basically then doing a cd won't give that error
[14:27:29] shmoon_: is that possible?
[14:27:34] zly: then install ruby 2.0.0 as it's not specified which patch you have to use
[14:28:01] shmoon_: not specified as in the .ruby-version file?
[14:28:31] zly: try to guess
[14:29:14] shmoon_: i wish you could just tell me that installing 2.0.0-p481 as 2.0.0 is not possible, would have been simpler to resolve this.
[14:30:21] zly: 2.0.0-p481 is 2.0.0
[14:30:35] zly: patch number doesn't actually matter that much
[14:30:58] zly: but if you insist: it's not possible, stick with 1.8.6
[14:31:20] shmoon_: that's fine, but i really thought there would be some way to solve http://pastie.org/9971643 without changing the current .ruby-version file then
[14:31:33] zly: install the ruby 2.0.0 then
[14:31:43] zly: if you don't want to 'change the .ruby-version' file
[14:31:47] daed: why not install ruby-2.0.0-p598 then?
[14:32:06] Fluent: seks, sec I mean, sec
[14:32:07] zly: you gave him another idea
[14:32:09] shevy: shmoon_ has so many difficulties
[14:32:23] shmoon_: team has instructed to use p481 and its there in the readme file too, sorry anyway
[14:32:34] zly: then install 2.0.0-p481
[14:32:40] shevy: wget ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p481.tar.gz
[14:32:48] shevy: btw shmoon_ I can not believe that rvm uses binaries
[14:32:57] shmoon_: but then that error comes, but anyway nvm
[14:33:00] shevy: does it have binaries for every version?
[14:33:02] daed: why would the ruby-version file point to another patch levle then
[14:33:11] daed: if they want you to use 481, and why do they want 481
[14:33:19] zly: ruby-version is not pointing to different patch
[14:33:26] zly: it just has '2.0.0' in it
[14:33:32] zly: I think that PEBKAC
[14:33:36] shmoon_: shevy: ya, i hope it is recommedned to use rvm, i am new to ruby
[14:33:42] shevy: I recommend the source
[14:33:47] Fluent: It is recommended
[14:34:02] shevy: you get nothing from rvm that you can't do on your own either
[14:34:09] shevy: all the versions are in versioned app-dirs
[14:34:22] Fluent: RVM just makes things easy
[14:34:26] shevy: you had that on distributions like GoboLinux for all programs anyway; so ruby would be in /Programs/Ruby/VERSION_HERE
[14:35:03] Fluent: But you would still need to configure some things to let Ruby point to some specific version
[14:36:21] Fluent: If you have three versions of Ruby installed, it wouldn't know which one you want to use. It will use what it's configured to use.
[14:36:22] shevy: the actual version of a program will be available through a symlink at /Programs/NAME/Current
[14:36:58] shevy: I am sure rvm either uses a symlink, or a file with the information, too, to find out which version to use
[14:37:26] Fluent: I was saying if you don't use RVM
[14:37:44] shevy: rvm does the same!
[14:38:12] Fluent: I think you are misunderstanding me, but yes.
[14:38:27] shevy: it just has the commands inbuilt like rvm --default use 1.9.3
[14:38:44] Fluent: Right, which is configuring some things so Ruby knows what to use
[14:38:46] Fluent: That's all I meant
[14:40:08] nickchow: #reddit_abq
[15:44:35] paolochiodi: do you now of any method to convert a ???natural language number string??? to an integer? (e.g.: ???one??? => 1)
[15:46:52] centrx: paolochiodi, https://rubygems.org/gems/numerizer
[15:47:08] art-solopov: centrx: Wow, TIL. ^_^
[15:47:19] paolochiodi: centrx: thank you
[16:27:59] shevy: https://github.com/jvns/julias-first-programs/blob/master/2005/grepstuff.pl
[16:28:09] shevy: is this pretty or is it eam
[16:30:28] centrx: nice one julia
[16:43:47] willharrison: so, I am just wondering. is rails polluted by noobs? I am just getting into ruby and it seems like a lot of these rails devs are cocky but just started developing maybe half a year ago
[16:44:36] kaleido: i hate rails. pretty much everything about it.
[16:45:07] willharrison: I looked at the app structure and it didn't seem anything spectacular but everyone talks like it's a godsend
[16:45:27] kaleido: i like sinatra, personally
[16:45:43] willharrison: sinatra is smaller, right?
[16:46:06] centrx: willharrison, There is a lot of good stuff in Rails, even if it is the go-to thing to learn for noobs
[16:46:17] kaleido: smaller and it just makes more sense to me
[16:46:34] centrx: Also many of those over-excitable people have moved on to the next fad (node.js)
[16:47:06] willharrison: centrx yeah, I don't doubt it. I am just scared of being lumped in with the noobs :/
[16:47:09] willharrison: kaleido ah ok, I see
[16:51:40] pontiki: it is easy to get into rails, but there is a ton of depth and learning one has to do in rails to really grok it, and not make a hash of things
[16:52:25] pontiki: i think a lot of noobs pick it up as a first thing, and i *don't* think it lends itself well for a brand new to development arena
[16:52:43] pontiki: but i'm no gatekeeper, either
[16:52:58] pontiki: in fact, i help people new to development a lot
[16:54:34] willharrison: I see, guess I just have started having a stigma toward it
[16:55:12] pontiki: willharrison: it's easy to acquire, i think, given a lot of noobish behaviour
[16:56:34] willharrison: yeah, it doesn't seem too difficult to pick up. it seems very similar to laravel 4. I still have to learn ruby much better before I try any frameworks, tho
[16:57:21] pontiki: symfony2 (and I think 1) was based on rails, and laravel is a departure from symfony, and then you have the basic sort of MVC framework thing going on anyway
[16:57:57] pontiki: willharrison: i highly recommend the black book for getting into ruby
[16:58:27] pontiki: i don't have the link off the tip of me fingers...
[16:58:27] willharrison: hm, I don't know the black book. I ordered "Eloquent Ruby" on the recommendation of somewhere here the other day. should arrive tomorrow
[16:58:37] ariestiyansyah: Hey everyone out there using ruby and jekyll, I am release new jekyll hacker style theme, please check out now : https://github.com/ariestiyansyah/naringu
[16:58:52] pontiki: http://manning.com/black3/
[16:59:22] pontiki: olsen's books are *all* great, too
[16:59:45] willharrison: Ah, I actually looked at that one because I always like the books with those medieval pictures lol (have c# in depth)
[17:00:18] willharrison: do you think I should read the black book after eloquent ruby?
[17:00:41] willharrison: I also want to read metaprogramming ruby before starting any frameworks
[17:00:52] pontiki: oh, definitely!! that is an excellent one
[17:01:04] pontiki: there are several really great reads
[17:01:09] willharrison: yeah, I have read from several places that it is good
[17:01:13] pontiki: sandi metz's POODR is a must as well
[17:01:45] willharrison: ah yeah, I wanted to read that too
[17:02:03] pontiki: i'll recommend a rails book right now before you even start learning rails: practicing rails. the first chapter is a manifest on How To Learn
[17:02:19] pontiki: i'm pretty sure the first chapter is a free download
[17:02:22] willharrison: nice, I will check it out
[17:02:29] pontiki: the book isn't fully published yet, still in beta
[17:02:35] pontiki: but wow, that first chapter
[17:02:40] pontiki: i cried, i did
[17:02:49] willharrison: haha, sounds like an intense book
[17:02:59] pontiki: it's something *i've* wanted to be able to tell people for *ages*
[17:03:25] willharrison: is it this? https://www.justinweiss.com/practicing-rails/
[17:03:41] pontiki: THAT'S IT!
[17:03:52] pontiki: he is *so* good
[17:04:01] willharrison: cool, I will get it after I finish these other ones
[17:04:09] tejas-manohar: what was the latest stable version of ruby 1.x.x
[17:04:19] willharrison: so, in your opinion, what order should I read these books we talked about?
[17:04:40] pontiki: read the first chapter of weiss's book FIRST. NOW. BEFORE YOU DO ANYTHING ELSE!!!!!!! :)
[17:05:01] pontiki: after that, hmm..
[17:05:05] willharrison: haha, will do
[17:05:12] pontiki: not sure it matters *all* that much
[17:05:19] pontiki: you already have a background in programming
[17:05:37] pontiki: you probably already have a preferred learning style for new languages, syntax, idioms, etc
[17:06:04] willharrison: no preferred style really, I just like to read a lot of books before I really start using it
[17:06:30] tmtwd: there is just one chapter in weiss book?
[17:06:41] willharrison: tmtwd first chapter is free
[17:06:48] pontiki: yeah, i think the books we've mentioned, a few others, it's kind of like a big pile of yarn, you pick up thread and start pulling, and it will soon unravel
[17:06:57] tmtwd: willharrison: is the full book available to buy?
[17:07:05] pontiki: it is, but it's still beta
[17:08:01] pontiki: willharrison: another author i highly recommend is avdi grimm
[17:08:22] tmtwd: why is the book so good?
[17:08:25] pontiki: willharrison: i also highly recomment avdi's podcasts, RubyTapas
[17:08:45] willharrison: pontiki cool, I will have to add those to my phone
[17:08:48] pontiki: tmtwd: he's a great writer. the first chapter is an essential manifest on how to learn
[17:09:03] willharrison: I'll also probably end up with a railscasts sub at some point
[17:09:15] pontiki: railscasts is great at $9 forever
[17:09:17] tmtwd: ok how do I get the first chapter?
[17:10:01] pontiki: rubytapas is $9/month and so *well* worth it
[17:10:14] centrx: is it edible
[17:10:17] pontiki: avdi's put out almost 300 eps
[17:10:25] willharrison: crazy that's a lot of content
[17:10:49] tmtwd: if you pay for ruby tapas, you get the back catalog?
[17:11:20] pontiki: i built a scraper, if you have the creds
[17:12:29] pontiki: https://rubygems.org/gems/scrapers
[17:13:01] pontiki: that really deserves an update one of these days
[17:13:53] willharrison: pontiki I like your use of underscores for a username lol, I also do that
[17:15:55] tejas-manohar: https://gist.github.com/tejasmanohar/f904eb37ab120eec93df
[17:16:00] tejas-manohar: do you know what this could be caused by?
[17:18:13] pontiki: you say what caused it on the last line of that gist
[17:19:12] tejas-manohar: pontiki: so i have to point $PATH to /home/tejas/.rvm/gems/ruby-2.2.0/bin ?
[17:19:18] tejas-manohar: specific ruby version
[17:19:19] jhass: apeiros_: sorry, was away for a few hours. diff of what?
[17:19:47] tejas-manohar: pontiki: then?
[17:22:05] pontiki: you should export your path in .bashrc as `export PATH=$HOME/.rvm/bin:$PATH`, *then* source the rvm script
[17:23:46] pontiki: tejas-manohar: what is your current $PATH?
[17:42:16] tejas-manohar: pontiki: /home/tejas/.rvm/gems/ruby-2.2.0/bin:/home/tejas/.rvm/gems/ruby-2.2.0@global/bin:/home/tejas/.rvm/rubies/ruby-2.2.0/bin:/home/tejas/.rvm/bin:/home/tejas/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
[17:42:21] tejas-manohar: pontiki: via echo $PATH
[17:53:24] phale: is codecademy good for learning ruby
[17:54:26] shevy: the only real way to learn ruby is by writing ruby code
[17:54:51] phale: yeah but you dont expect me to just start with no syntax knowledge
[17:55:11] art-solopov: phale: Is CodeAcademy the free one or not? I keep mistaking it for CodeSchool.
[17:55:46] phale: art-solopov: yes its free
[17:56:28] art-solopov: phale: Ah, thanks. =) I think it's quite good for a beginner, albeit a little short.
[17:56:51] phale: alright, thanks
[17:56:58] phale: i know some C
[17:57:03] phale: so i should be able to grasp ruby quickly
[17:59:19] phale: "Learn to program in Ruby, a ???exible language used to create sites like Codecademy."
[17:59:20] dorei: phale: object oriented paradigm is totally different from the C paradigm
[17:59:30] phale: dorei: i know
[17:59:34] phale: but who said im going to do OOP
[17:59:45] dorei: then why do you need ruby? :p
[17:59:52] phale: because i can't learn c
[18:00:22] art-solopov: phale: Umm... Ruby is quite a lot OOP, I think.
[18:00:30] phale: okay then i'll use oop
[18:00:37] phale: keep in mind that i'm unable to learn C
[18:00:51] wasamasa: why are you unable to learn C?
[18:01:11] shevy: phale in ruby there is no way to avoid OOP. if you do "def foo", this becomes a private method on class Object if I recall correctly
[18:01:11] phale: to be honest, i don't know. I know how to use the language but there are things that I just can't do
[18:01:30] wasamasa: is that what they call a /WTFpart?
[18:01:56] shevy: he must have been spoiled by java OOP
[18:02:32] art-solopov: shevy: Show him JavaScript them, it'll refresh him. =P
[18:22:48] apeiros: jhass: the rubocop conf
[18:24:32] jhass: apeiros: you mean opposed to yours?
[18:24:49] apeiros: yes, a diff comparing yours & mine
[18:25:42] jhass: mmh, not really, I went through all cops and made my own opinion about them, just stole some reasoning from you where we end up with the same settings sometimes ;)
[18:26:29] jhass: well, not all cops but most of them
[18:26:50] jhass: and then running it on some of my smaller code bases to find the remaining defaults I disagree with
[18:34:52] arup_r: I never understood what you guys always discuss..
[18:35:41] centrx: arup_r, http://www.internationalhero.co.uk/r/robocop.jpg
[18:37:33] arup_r: to hifi!!!!
[18:40:47] jhwhite: I'm working on Project Euler problem #80 and it wants to add the sum of some numbers 100 decimal places long. But Ruy keeps truncating. I tried BigDecimal but that puts it in scientific notation. Is there a way to get that number of places in Ruby?
[18:42:37] jhass: that scientific notation is just another representation, it's still the very same number
[18:42:54] centrx: scientific notation is NOT science
[18:42:55] centrx: spread the word
[18:43:19] jhass: but I wanted to proclaim that programming is science :(
[18:43:53] art-solopov: jhass: It's not science, it's engineering. Which is damn close to science, but not quite.
[18:44:08] ponga: i dnt say its science
[18:44:18] apeiros: jhwhite: integers? or are you using floats?
[18:44:28] apeiros: is you use floats: wrong. use integers. and ruby doesn't truncate integers.
[18:44:33] jhass: but my math prof always made fun of the engineers :(
[18:44:49] centrx: Putting theory into practice is low-class
[18:44:50] apeiros: oh, wait, decimal places??? behind the decimal sign. ignore me :D
[18:45:03] ponga: well mathmaticians are true geniuses.. we gotta admit that
[18:45:29] oddmunds: jhwhite: i assume what you are after is a string representation that does not use scientific notation?
[18:45:31] centrx: ponga, Thank you, that's very kind
[18:45:47] ponga: lol centrx are you one of the kind?
[18:45:54] jhwhite: oddmunds: sure. I have to do addition on the strings, but I can convert that to integers
[18:46:01] ponga: that was random
[18:47:00] oddmunds: jhwhite: i think bigdecimal does what you want, though. apart from it using scientific notation. it will do proper arithmetic.
[18:49:24] jhwhite: oddmunds: thanks
[19:11:58] shreknet: Hey ho, I need to rebuild the gem mysql2 because I updated the mysql from 5.5 to 5.6. How to do this with rvm?
[19:14:22] jhass: shreknet: gem install mysql2 -v $version
[19:14:44] jhass: or maybe gem pristine actually rebuilds or has a flag for that
[19:16:36] shreknet: jhass: it is trying to install it to /usr/local/lib/ruby/gems/2.1.0 and not to ~/.rvm/gems/ruby-2.1.0/gems/
[19:17:51] jhass: then you didn't activate your rvm ruby
[19:19:04] shreknet: hmm. I changed the source, gimme a moment =) thanks so far!
[21:32:57] multi_io: rbenv install downloads rubies from strange urls
[21:33:01] multi_io: http://dqw8nmjcqpjn7.cloudfront.net/7671e394abfb5d262fbcd3b27a71bf78737c7e9347fa21c39e58b0bb9c4840fc
[21:33:21] multi_io: that's ruby-2.2.0, supposedly
[21:33:33] multi_io: no https? really?
[21:39:00] aef: multi_io: i think rvm has done a lot in regards to download verification lately. maybe give it a try. can't say though if it uses https everywhere.
[21:39:51] havenwood: multi_io: Either ruby-install/chruby or RVM.
[21:43:48] havenwood: multi_io: ^ Those options have gpg-signed install scripts, use https and validate checksums.
[21:46:06] havenwood: multi_io: Just an aside, but ruby-install actually validates MD5, SHA1, SHA256 and SHA512 checksums--all four.
[21:47:21] havenwood: So even if you manage to create a collision for one...
[21:56:42] Majost: Is it acceptable to make an empty class for namespacing subclasses?
[21:58:05] art-solopov: Majost: What do you mean by "Namespacing subclasses"?
[21:59:35] Majost: What I mean is, I want to have a main class which for now does nothing, and create classes which extend the main class
[21:59:41] havenwood: Majost: Use a module when you're not instanciating. For example: https://github.com/lotus/lotus/blob/master/lib/lotus.rb#L11-L12
[22:00:21] havenwood: Majost: Oh, I may have misunderstood your question.
[22:00:50] havenwood: Majost: `extend` is a term of art :P
[22:01:19] havenwood: Majost: http://ruby-doc.org/core-2.2.0/Object.html#method-i-extend
[22:02:41] havenwood: Majost: If your question is just how to namespace then a Module.
[22:06:53] havenwood: Majost: Or tell us more about what you're wanting to do if there's more to it.
[22:09:53] havenwood: Majost: Some examples if it's the simple namespacing you're wanting: http://rubymonk.com/learning/books/1-ruby-primer/chapters/35-modules/lessons/80-modules-as-namespaces
[22:11:33] Majost: havenwood, sure -- So I am working on a "heavy-weight" resouce for Chef.
[22:11:34] Majost: https://github.com/rhass/ros/blob/master/libraries/ros.rb
[22:11:40] Majost: This is what I have right now
[22:12:57] Majost: So there are some additional things I want to add to the resouces/providers -- but I want to have it something like Resource::Ros::Catkin::Workspace and Resource::Ros::Catkin::Package
[22:13:21] Majost: The issue is, for the moment -- I don't know what Catkin will do
[22:13:32] Majost: but I do know what the other resources will do
[22:14:05] Majost: So maybe a module is in order here -- but I have just enough ruby knowledge to confuse myself and others. hehe
[22:14:20] havenwood: Majost: Catkin, hmm. Maybe it has something to do with a cat's family?
[22:14:46] havenwood: Majost: Yeah, sounds like a module. :)
[22:15:05] Majost: for the application I am using, its actually a depsolver of sorts -- so you are pretty much correct
[22:16:01] havenwood: Majost: A class is a module plus extra class stuff, so when you don't need the class stuff always use a module.
[22:18:19] havenwood: Blaze_Boy: hi
[22:22:32] multi_io: havenwood: alright, thanks
[22:23:09] havenwood: multi_io: no prob, there're #rvm and #chruby channels if you opt to switch to one of those and have any questions :)
[22:24:59] havenwood: multi_io: you can also use ruby-install with rbenv if you want to
[22:26:34] havenwood: https://github.com/postmodern/ruby-install#integration
[22:56:42] phat4life: why is there no peak method for queus
[22:56:53] phat4life: i really need a peak method on the Thread::Queue class
[22:58:27] phat4life: is there a thread safe way to implement a peek function for ruby queues?
[23:03:58] phat4life: god damn there is so many people in here, why no one answer
[23:04:13] jhass: phat4life: mmh, implementing a queue on your own is not too hard
[23:04:26] jhass: you need a mutex and a condition variable
[23:04:42] jhass: so the Monitor mixin comes in handy
[23:04:56] phat4life: it just seems a bit odd there is no peak method on the core ruby queue class
[23:10:34] apeiros__: phat4life: just make sure you name it peek, not peak ;-p
[23:11:00] apeiros__: you can copy active record's queue class, and add a peek method
[23:12:01] havenwood: >> class Queue; def peak; puts "/^\\" end end; Queue.new.peak
[23:12:01] eval-in: havenwood => /^\ ... (https://eval.in/292024)
[23:13:26] Radar: "why no one answer" <- It's better to let people think you're an idiot than to open your mouth and remove all doubt.