« Back to channel list

#ruby - 16 October 2014

« Back 1 day Forward 1 day »
[00:09:17] ramfjord: totimkopf: what are you hoping recipe_for_cake will be?
[00:09:25] ramfjord: ditto for recipe_for_chicken
[00:09:35] ramfjord: name error because they aren't defined anywhere
[00:11:52] totimkopf: ramfjord: ah, true, I guess the code wasn't supposed to work
[00:12:22] totimkopf: I thought that it would magically do something with the @recipes array...
[00:12:35] totimkopf: the book does hint that it should do something other than error
[00:15:29] ramfjord: totimkopf: could it have defined those earlier? They seem to need to respond to :main_ingredient, so it would make sense if the book defined a Recipe class earlier
[00:22:29] totimkopf: ramfjord: possible
[00:29:57] shevy: code code code
[00:29:59] shevy: we need less code
[00:33:40] ramfjord: shevy: that's what high level languages are for, right?
[00:34:17] shevy: ramfjord well, one still writes quite a lot of code in them
[00:38:11] shevy: I'd like to specifcy code differently
[00:42:11] shevy: do you guys do rather this:
[00:42:16] shevy: foo = array[0]
[00:42:20] shevy: foo = array.first
[00:46:32] havenwood: shevy: i prefer a method without arguments, except for example for uniformity like [0] when it's next to [1] and [2]
[00:54:59] Rubie: hi all: im having a hard time wrapping my head around calling functions in different methods, not sure why this goes into an infinite loop would someone mind taking a look? https://gist.github.com/gabrie30/4aff1e53ee867dbf2143
[01:03:09] shevy: havenwood so you would use .first in the example above?
[01:03:38] havenwood: shevy: yeah, i would
[01:12:02] afhammad: rubie: you are doing "if true" instead of "if prime?(i)"
[01:12:45] afhammad: rubie: "if true" will always be true, i will never increment, hence infinite loop
[01:12:48] Rubie: i thought this would check if_prime(i) to be true
[01:13:09] Rubie: but wouldn't go on to the next step
[01:13:28] afhammad: no, you can either do "if prime?(i)" or "if prime?(i) == true"
[01:14:11] Rubie: oh gotcha so it never goes to i +=1
[01:14:34] Rubie: perfect thank you!
[01:19:47] shevy: rubie, now that was a slipup you must remember for the rest of your life:
[01:20:04] shevy: "Hey, I thought it would check for the size of the universe, and return 42!"
[01:21:01] Rubie: lol, yes that is something i won't ever forget
[01:21:45] Rubie: newbs....
[03:09:31] shevy: it's time to make ruby more kick ass
[03:14:36] benzrf: static typing!!!!!!1
[03:15:59] shevy: well that is one idea
[03:16:09] shevy: problem is that it is orthogonal to dynamic typing
[03:16:25] shevy: I would not know of a language that has managed to combine both approaches
[03:16:49] adamsilver: why it says no match here: http://rubular.com/r/4F461BBFHi
[03:17:37] shevy: so (?=[a-z]+) alone matches
[03:17:51] shevy: however when you make it into: (?=[a-z]+)(:)
[03:17:53] shevy: it no longer matches
[03:18:24] shevy: when you turn it into: ([a-z]+)(:)
[03:18:25] shevy: it matches
[03:18:30] shevy: so the culprit must logically be the ?=
[03:18:35] shevy: what does ?= mean adamsilver
[03:19:45] adamsilver: shevy: lookahead
[03:21:05] shevy: obviously it does not work
[03:22:04] benzrf: wow what with this (:) it almost looks like youre writing haskell
[05:31:42] zmyrgel: I need a bit of debugging help for my script
[05:31:46] zmyrgel: https://gist.github.com/zmyrgel/244b84bfedc251d3db02
[05:32:09] zmyrgel: the gist is bit out-dated but the problem is in the parse_zip_file
[05:32:58] zmyrgel: the script crashes with err: No such file or directory - N:/939204.SAA (Errno::ENOENT)
[05:33:49] zmyrgel: I'm a bit puzzled by that as the parse_zip_file method should be extracting the file from the zip and creating it under N:/ drive
[05:49:02] tagrudev: certainty, ping
[05:51:57] zmyrgel: hmm, seems to be issue with network drive, it doesn't seem to be mounted when the script is run
[06:41:50] arup_r1: Why the below is giving 8 ? I am expecting it to give as 2
[06:41:53] arup_r1: >> ((17 - 1 ) / 4 * 2) || 0
[06:41:53] eval-in__: arup_r_ => 8 (https://eval.in/206526)
[06:42:21] sevenseacat: basic mathematics?
[06:43:02] havenwood: >> 16 / 4 * 2
[06:43:03] eval-in__: havenwood => 8 (https://eval.in/206527)
[06:43:52] arup_r1: >> (2 - 1 ) / 4 * 2 || 0
[06:43:52] eval-in__: arup_r_ => 0 (https://eval.in/206528)
[06:44:05] arup_r1: >> (2 - 1 ) / 4 * 2 || 50
[06:44:06] eval-in__: arup_r_ => 0 (https://eval.in/206529)
[06:44:10] arup_r1: Ok.. Got it
[07:23:12] shevy: havenwood my brother!
[07:23:16] shevy: I am going to adopt you
[07:23:19] shevy: and keep you as my house mascot
[07:23:23] shevy: next to my old cat lady
[07:23:53] havenwood: shevy: you can't keep a cat lady as a pet!
[07:24:05] shevy: well she is more like the owner here
[07:24:27] shevy: but I am allowed to use nearby spaces provided that food and lodging is otherwise ok
[07:46:49] sigurding: good morning, is there any way to avoid the installation of ruby-dev when using JSON in ruby?
[08:41:43] mrcloud: hello. Does anyone know how to check the number of arguments in slop?
[08:55:41] maasha: anyone up for a little challenge? -> rewrite String#scanf to be truly fast and awesome
[09:06:15] rpag: mrcloud, ARGV.size ?
[09:06:43] mrcloud: rpag: *facepalm* ... Im stupid xD Thank you
[09:08:14] rpag: youre welcome
[09:14:19] mbuf: is there a recommended approach to archive log files created using Logger in Windows?
[09:27:13] pontiki: mbuf: if you use the full set of parameters on Logger.new, you can roll log files automatically: http://www.rubydoc.info/stdlib/logger/Logger:initialize
[09:27:37] mbuf: pontiki, I am able to roll log files, but, I would like to take a dump of the log files, every day
[09:27:48] pontiki: what does that mean?
[09:28:33] mbuf: pontiki, I have @logger = Logger.new(file, 10, 1024 * 1024)
[09:29:04] pontiki: are you talking about emulating linux's logrotate thing?
[09:29:05] mbuf: pontiki, so, I get about 10 logs, but, that keeps rotating right? like a circular buffer
[09:29:32] mbuf: pontiki, I want to take a snapshot of the 10 log files every day, zip them and store them to a different network folder (say)
[09:29:32] rpag: "Number of old log files to keep, or frequency of rotation (daily, weekly or monthly)."
[09:29:57] mbuf: rpag, neither
[09:30:09] pontiki: i don't know how one does that sort of thing on windows, sorry
[09:30:32] mbuf: rpag, keeping the old files will occupy disk space, I just want to take a copy of the log files, and copy them to a different folder, say a network drive
[09:30:48] mbuf: rpag, log rotation will override the log files, right?
[09:31:08] pontiki: if you use the numeric shift_age, yes
[09:31:42] sigurding: good morning, is there any way to avoid the installation of ruby-dev when using JSON in ruby?
[09:32:02] pontiki: if you set it to 10, there will only ever be at most 11 log files (1 current, 10 old)
[09:32:11] rpag: sigurding, use a pure-ruby parser
[09:32:30] sigurding: rpag: which would be?
[09:33:18] rpag: maybe https://rubygems.org/gems/json_pure or google around
[09:34:00] rpag: json lib ships with ruby btw so you shouldnt need ruby-dev unless youre installing the gem and compiling C srcs
[09:34:48] sigurding: rpag: ok from which version on?
[09:35:03] rpag: 1.9+ as far as i know
[09:38:48] sigurding: rpag: hm I am using require ???json??? but it forces me to install make/ruby-dev on ubuntu, when doing bundle install
[09:39:55] workmad3: sigurding: json is in the stdlib... but there are also various gems that provide different libraries
[09:40:08] workmad3: sigurding: it sounds like you've got one of them in your Gemfile for this project
[09:42:21] pontiki: workmad3: o/
[09:42:45] workmad3: pontiki: </sarcasm>? ;)
[09:44:05] pontiki: well, no, not in that case :/
[09:44:49] rpag: sigurding, yes it sounds like what workmad3 says, you've got "json" gem in your Gemfile
[09:47:27] tmoore: sigurding: why don't you want to install ruby-dev?
[09:47:52] sigurding: tmoore: I like it, when my gems have a minimum footprint
[10:00:29] bulters: hi! Question: I want to define a module (empty) based on a string (say "MyNamespace")
[10:01:10] bulters: and later on execute some code in that module based on the same string... any ideas how to pull this off without resorting to eval(all_the_things)?
[10:03:40] rpag: const_set(str, Module.new {}) im not sure about the last part
[10:04:02] rpag: maybe module_eval
[10:10:49] ax: array.find(:predicate?) # returns the first element where element.predicate? is true -- how can I best return the first element where predicate?(element) is true, instead ?
[10:11:53] rpag: use a block
[10:12:10] ax: rpag: wasn't sure if there was a shorter way of doing it
[10:12:44] rpag: there's not
[10:12:48] aep: any idea why i get this when starting sinatra from systemd instead of shell?
[10:12:50] aep: dependency.rb:298:in `to_specs': Could not find 'bundler' (>= 0) among 14 total gem(s) (Gem::LoadError)
[10:13:25] ax: rpag: it's kind of a shame that it's not available in core. It's a very common pattern, especially for folk with FP experience
[10:13:46] rpag: .find { |e| pred?(e) } isnt that long
[10:16:43] tmoore: aep: probably a different PATH or GEM_PATH configured
[10:17:23] tmoore: a_: try array.find(method(:predicate?))
[10:17:28] aep: tmoore: both identical (GEM_PATH not set)
[10:17:52] tmoore: aep: how did you install Ruby and Bundler?
[10:18:04] aep: ruby is from the system, bundler as a gem
[10:18:24] aep: so i added ~/.gem/ruby/2.1.0/bin/ to the path
[10:18:28] tmoore: a_: sorry I think that should be array.find(&method(:predicate?))
[10:19:01] tmoore: aep ~ is probably a different directory for you than the user systemd is running as (presumably root)
[10:19:05] lolmaus: Is there syntactic sugar to reduce "foo = defined? bar ? bar ? baz" to something like "foo = bar || baz", that would not fail if "bar" is not defined?
[10:19:14] aep: tmoore: both root
[10:19:37] aep: oh wait, systemd might screw up HOME
[10:19:43] aep: that's probably it
[10:20:13] workmad3: lolmaus: don't write code that condititionally defines local variables? :/
[10:20:23] ax: tmoore: awesome - how does that work?
[10:20:44] tmoore: method(:predicate?) searches for a method named :predicate? in the current scope
[10:21:03] tmoore: you can also call it on an object some_object.method(:foo) looks for a method called :foo on some_object
[10:21:20] tmoore: it returns a proc that calls the method on whatever arguments you pass it
[10:21:29] tmoore: then &proc converts the proc to a block
[10:21:33] aep: yep that was it, thanks tmoore ~
[10:21:52] tmoore: no worries... glad it's working :-)
[10:22:00] workmad3: tmoore: it returns a Method object rather than a Proc btw
[10:22:04] bulters: rpag: thanks, will try it out
[10:22:09] tmoore: ah right yes thanks workmad3
[10:22:33] workmad3: tmoore: or, if you wanted to unify the terms, procs and methods are both callables ;)
[10:22:34] rpag: what does '~' on its own mean?
[10:22:49] workmad3: rpag: binary not iirc,
[10:22:56] tmoore: and &object actually calls object.to_proc and converts that to a block I think
[10:22:57] rpag: i mean on IRC :)
[10:23:03] lolmaus: workmad3: i was gonna use it in Rails for instance variables defined from controller. And Rails would not crash on an undefined variable somehow. E.g. `puts @undefined_var || "foo"` woult print "foo" in Rails.
[10:23:25] workmad3: lolmaus: that's not rails
[10:23:35] workmad3: lolmaus: that's ruby not throwing exceptions on undefined instance variables
[10:23:42] rpag: instance variable look up doesnt raise a NameError just returns nil
[10:23:43] workmad3: lolmaus: which has always been the case
[10:23:53] rpag: aep, what does '~' mean as a smiley?
[10:23:54] lolmaus: workmad3: rpag: oooh, thank you.
[10:23:55] workmad3: rpag: no idea on IRC ;)
[10:24:07] aep: rpag: i mistyped !
[10:24:23] rpag: oh okay, i seen someone else do it and i presumed it was a thing
[10:24:35] workmad3: aep: y u no use a mac? :(
[10:24:36] aep: probably they mistyped :P
[10:24:56] aep: workmad3: because i work on embedded devices. with ruby. its awesome
[10:25:31] workmad3: aep: it's great how the specific typos people make can reveal stuff about their kb layout and their hardware ;)
[10:25:45] aep: actually i have a mac next to me and the layout is the same
[10:26:11] workmad3: aep: the top-left key of the main block on all the macs I've seen has been the crazy ?? character rather than a ~
[10:26:31] tobiasvl: I have that on my Norwegian PC keyboard too
[10:26:45] rpag: ?? and ?? here
[10:28:51] workmad3: my kb claims that key should be `, | and that sideways L that I can't seem to find anywhere in my current layout :)
[10:29:07] aep: https://www.dropbox.com/sc/40110lheauf901r/AAC-d-ZxPiUC8MUeYbOr7XLMa
[10:29:21] toretore: ???? is where it's at
[10:29:39] workmad3: aep: aha, a different kb layout :)
[10:29:58] aep: dunno. inherited the thing. i assumed its standard
[10:30:40] tobiasvl: wow, caret on 6. I guess the NO keyboard is pretty weird then, we have & there.
[10:31:08] workmad3: tobiasvl: it's ^ on 6 and & on 7 for british
[10:32:00] workmad3: also, I have 3 different ways of producing ??... ??, alt+??, and alt+6...
[10:40:33] hrrz: hey, i'm trying to make a postgres query using ruby, i'm doing an "where in" query but i fail to pass an array
[10:40:47] hrrz: here's my loc: @conn.exec("select * from tags where lower(title) in ($1)", keys)
[10:40:56] hrrz: as keys = ["title1", "title2"] etc..
[10:43:20] toretore: hrrz: what is @conn ?
[10:43:40] hrrz: PG.connect object
[10:44:16] toretore: from where?
[10:47:12] hrrz: toretore: pg gem
[10:48:48] Aova: morning :)
[10:50:10] toretore: hrrz: well, first of all, it looks like it expects an array of params as its second argument
[10:50:25] toretore: so your array should be the first element of this array
[10:51:41] hrrz: so how can i pass all the elements of the array?
[10:58:36] maasha: What is the fastest way to parse a CSV table so that data types are automagically converted? ie. not everything as strings, but integers as Fixnum and floats as Float etc.?
[10:58:53] maasha: It turns out to be non-trivial
[10:59:35] maasha: scanf is no-go -> too slow. Same with Integer and Float.
[11:00:42] workmad3: maasha: I believe you can pass an array of converters to CSV.new
[11:01:18] tobiasvl: yep http://ruby-doc.org/stdlib-1.9.2/libdoc/csv/rdoc/CSV.html#method-c-new
[11:02:26] workmad3: maasha: I believe what happens is that CSV attempts to use each converter in turn and the first non-error is determined as the converted result... but I'm not confident on that so you should probably check it out ;)
[11:04:55] workmad3: maasha: however, if it's a case of the conversions are too slow... not sure what to suggest there... you're dealing with string-parsing operations after all
[11:05:31] maasha: workmad3: I suppose what I am after is an updated version of scanf!
[11:05:45] maasha: like the C version of sscanf
[11:05:48] tobiasvl: yeah, I was interpreting the problem as it being too slow to check for type in every field, which is not surprising, so converters should help with that (it'll know what converter to apply to each field)
[11:05:59] hrrz: toretore: how can i pass the entire array? u know?
[11:08:19] maasha: hrrz: you need a ruby book
[11:09:01] hrrz: maasha: how about giving a tip rather than a useless comment?
[11:09:41] maasha: useless comment? - I'd bet you that many people in here would say this is the best piece of advice you will get today.
[11:09:48] workmad3: maasha: looks like your tips aren't desired anymore :P
[11:10:21] maasha: hrrz: I can suggest you a book, if you like.
[11:10:47] hrrz: maasha: you probably feel very good with yourself
[11:10:48] workmad3: hrrz: seeing as it's the pg gem you're dealing with btw, it may behoove you to look up the docs for that gem
[11:11:17] maasha: hrrz: http://www.rubyinside.com/media/poignant-guide.pdf
[11:11:42] workmad3: hrrz: if you're looking for specifics, I'd suggest you look through the gem docs for how to pass arrays to prepared statements
[11:12:13] workmad3: hrrz: which is another way of saying 'read some stuff about it' like maasha's suggestion, but saying 'read about the thing you're using' rather than 'read about ruby' ;)
[11:12:21] ax: tmoore: a.find(&method(:predicate?)) <- why does #call get invoked, as Method expects?
[11:12:33] hrrz: workmad3: it is a bit more useful
[11:12:52] tmoore: a_: so the & prefix converts it to a block, passed to find
[11:13:04] hrrz: and it has less pretentious %
[11:13:07] tmoore: then inside find, when it yields to the block, it calls the proc
[11:13:21] workmad3: tmoore: & also calls .to_proc btw
[11:13:33] tmoore: yep as I mentioned above :-)
[11:14:04] workmad3: tmoore: so I'm gonna guess that Method#to_proc produces a proc equivalent to proc{|*args| method(:whatever).call(*args)} ;)
[11:14:26] workmad3: tmoore: which, if true, makes it clearer how it works :)
[11:16:40] tmoore: sounds about right
[11:17:41] workmad3: hrrz: btw, getting sarky and insulting back to regulars who give fairly normal advice to a question that, taken on its own, is a fairly trivial ruby question is likely to make people rather snappy and grumpy ;)
[11:18:59] txdv: >> 22 ** 22
[11:18:59] eval-in__: txdv => 341427877364219557396646723584 (https://eval.in/206605)
[11:19:07] txdv: >> 22 ** 22 ** 22
[11:19:08] eval-in__: txdv => /tmp/execpad-0ffdb13e3de7/source-0ffdb13e3de7:2: warning: in a**b, b may be too big ... (https://eval.in/206606)
[11:19:11] hrrz: workmad3: we can argue on the 'normal advice' he suggested. But this isn't a fairly trivial ruby question, i'm sorry. It is a a PG gem question that by it docs seems that it has no normal way of receiving array as input, and i asked maybe there's a ruby way to manipulate the input so it fits the docs
[11:19:29] workmad3: hrrz: yes... but that context was over 30 minutes ago in the scrollback
[11:19:48] workmad3: hrrz: so in isolation, your question was trivial
[11:20:03] workmad3: hrrz: and that's the question that maasha answered with 'maybe you should read up on ruby a bit'
[11:20:30] workmad3: hrrz: i.e. your repeat of the question didn't mention that it was pg... and that context was quite distant temporally
[11:20:49] hrrz: my secondary question was a follow up question and i was directing it to the person who helped me at the begining
[11:21:52] hrrz: the 'maybe you should read up on ruby a bit' answer was unrelated, sarky, snappy and grumpy without even understanding the context
[11:22:24] workmad3: hrrz: right... but it did come after an almost identical, undirected, context-free repeat of the same question about 10 minutes previously
[11:23:20] DefV: I missed all the drama?
[11:23:26] workmad3: hrrz: and hell, I'm not trying to get into a big argument here... just pointing out that getting pretty insulting back isn't exactly going to ingratiate you with people :P
[11:23:35] rpag: DefV, no, you can scroll back!
[11:23:44] tobiasvl: hey guys, what did I miss
[11:23:45] DefV: I live in the moment!
[11:24:06] txdv: I thought everyone programming ruby is a nice person
[11:24:14] rpag: tobiasvl, something about postgres & ruby
[11:24:22] txdv: but then I remembered that humans are assholes
[11:24:23] workmad3: txdv: nah, just the ones that the @hats haven't kicked out of here ;)
[11:24:56] workmad3: txdv: or the ones like me who hide a towering, arrogant ego behind a thin veneer of civility ;)
[11:25:15] txdv: everyone is an selfish asshole
[11:25:22] workmad3: txdv: s/an/a/
[11:25:43] txdv: yeah, an asshole, a selfish asshole
[11:26:03] rpag: when is irc gonna move to google hangouts & webcam
[11:26:12] rpag: i think thats part of the problem
[11:26:15] workmad3: rpag: that would require people to put on clothes...
[11:26:16] txdv: If i type it out loud while thinking, I get it sometimes wrong.
[11:26:23] rpag: workmad3, hahahaha
[11:26:28] txdv: Good luck having a hang out with 881 people :D
[11:27:21] rpag: 870 are idlers, just kick em
[11:27:57] workmad3: rpag: you could always go and set up a public 'ruby drop-in' hangout ;)
[11:28:12] workmad3: rpag: people join, ask a ruby question, insult you a bit and then leave ;)
[11:28:22] rpag: sounds great! on it!
[11:30:00] rpag: read all of this: http://www.seebs.net/c/c_tcn4e.html , because #bored
[11:30:01] workmad3: rpag: I expect to see it set up after lunch ;)
[11:30:34] bulters: i love the insulting part
[11:30:57] bulters: would be nice to be on the receiving end of said insults
[11:31:22] bulters: as some kind of psychological hardening scheme... maybe have people pay to be an insultee or something
[11:31:32] rpag: if you want to be insulted like a pro, join #c
[11:32:08] rpag: #ruby is usually way more mellow :)
[11:32:15] bulters: rpag: my c flamebaits are a bit rusty
[11:32:51] bulters: all I remember from uni is that using void*'s is considered a best-practice to do everything
[11:44:36] workmad3: bulters: go to #c and suggest that it's best practice to roll your own memory management by grabbing a huge void* array on program startup and then simply dealing with that internally ;)
[11:45:12] rpag: or just say 'hello'
[11:45:15] rpag: that usually does it
[11:45:23] workmad3: I've not been to #c
[11:45:36] rpag: ah im overreacting of course
[11:46:43] bulters: wouldn't it be way nicer to suggest that you require help devising a partitioning scheme for said block of memory into chunks large enough to hold one result set from a not-to-be-named large scientific experiment which involves throwing really small things against each other
[11:47:47] bulters: (disclaimer: i worked for an institution that contributes to one of said experiments)
[11:49:46] bulters: damn.. #c actually has "Be civil" in the topic...
[11:49:56] bulters: Guess #ruby consists of savages
[11:52:09] workmad3: bulters: #rubyonrails has MINASWAN in the /topic
[11:52:13] workmad3: bulters: but not here, for some reason :(
[11:52:23] workmad3: or #ruby-lang
[11:53:16] workmad3: bulters: of course, you can be civil while also being a pretentious, arrogant jackass ;)
[12:05:28] bulters: workmad3: isn't that a requirement to 'contribute' on #rubyonrails ???
[12:06:00] workmad3: bulters: by 'contribute' do you mean 'answer questions from ignorant peons'?
[12:06:08] bulters: workmad3: yes
[12:06:20] workmad3: bulters: well, I'm there right now doing just that ;)
[12:06:30] bulters: also lurking on #haskell, but I'm afraid to contribute since I don't have a Phd....
[12:06:54] bulters: let me help you out with that ;-)
[12:18:11] mostlybadfly: Hey I'm an ignorant peon:p
[12:18:50] workmad3: mostlybadfly: ok, stand right there while I'm rude and condescending to you ;)
[12:19:08] bulters: I use Rails for work...
[12:19:23] bulters: but get paid to do research on other stuff ;-)
[12:19:24] mostlybadfly: I'm trying to get to a place where I can
[12:20:38] bulters: mostlybadfly: join a small company, and code your ass up the chain, give yourself a nice title and job description which involves research and trying stuff out to gain a competitive advantage...
[12:21:49] mostlybadfly: Yeah I need to get outta here
[12:22:52] mostlybadfly: bulters: been trying to find a job that'll let me do just that
[12:23:13] zwischenzug: hello, i'm trying to do byte manipulation in ruby and it's starting to drive me crazy....wondering if someone could help me out
[12:23:24] mostlybadfly: Seems like here all they ever go with are bootcamp grads or the many people with prior experience
[12:24:03] bulters: zwischenzug: what are you trying to accomplish?
[12:24:23] zwischenzug: i'm trying to implement the following: A = MSB(64, B) ^ t where t = (n*j)+i. a is a bitstring, and t is an int
[12:24:39] zwischenzug: and i'm trying to xor them together
[12:24:51] banister: zwischenzug nerd
[12:25:09] zwischenzug: so far i have (caution: this is really ugly): a = b.slice(0..6) + [(b[7].ord ^ t).to_s(16)].pack("h*")
[12:25:58] zwischenzug: sorry.....it's actually: a = b.slice(0..6) + [(b[7].ord ^ t).to_s(16)].pack("H*")
[12:27:20] zwischenzug: but this doesn't work, because at the end, if the hex string is single digit, and it gets packed into H*, the endian-ness gets flipped
[12:27:39] zwischenzug: >> ["9"].pack("H*").unpack("H*")
[12:27:39] eval-in__: zwischenzug => ["90"] (https://eval.in/206618)
[12:27:46] zwischenzug: >> ["a9"].pack("H*").unpack("H*")
[12:27:47] eval-in__: zwischenzug => ["a9"] (https://eval.in/206619)
[12:28:22] zwischenzug: that doesn't work, because it breaks double-digit hex strings
[12:28:22] endzyme: are there any good materials online around best practices for installing ruby based applications on an OS. Example, looking to package a grape-api app so it can be installed and startable as a service. Currently using fpm but having concerns on how required gems get installed and included.
[12:28:30] zwischenzug: >> ["9"].pack("h*").unpack("H*")
[12:28:30] eval-in__: zwischenzug => ["09"] (https://eval.in/206620)
[12:28:37] zwischenzug: >> ["a9"].pack("h*").unpack("H*")
[12:28:38] eval-in__: zwischenzug => ["9a"] (https://eval.in/206621)
[12:28:53] workmad3: endzyme: you could look up omnibus
[12:29:32] endzyme: workmad3: i was looking at that, it's basically a heavy "include everything" type install right? Doesn't require anything on the OS?
[12:29:42] workmad3: endzyme: pretty much, yeah
[12:29:54] zwischenzug: i need something that returns ["09"] and ["a9"] respectively (or an entirely different approach since this seems like a huge hack)
[12:29:59] endzyme: workmad3: have you used it before? Im curious if it's hard to maintain
[12:30:32] workmad3: endzyme: I've not created my own omnibus packages... I've installed the chef packages, which are omnibus and it makes installation pretty damn easy :)
[12:31:06] workmad3: endzyme: afaik, the creation of the packages is geared around being scriptable pretty easily though, so it shouldn't be problematic to maintain
[12:31:18] endzyme: workmad3: cool - thanks! I'll poke around -
[12:36:18] machty: sanity check: does Ruby internally trap all (non-terminating) signals, and _then_ check if the running ruby code has registered trap handlers?
[12:36:49] machty: i'm asking because i just realized that even if you don't trap a signal, a SignalException will be raised
[12:37:09] machty: i was previously expecting the process to terminate if you didn't trap it for, say, SIGINT
[12:37:20] machty: but Ruby gives you one last chance to catch it as a raised exception
[12:37:33] machty: sorry, talking out loud here, it's my ah ha moment of the day
[12:51:40] siwica: what the most elegant way of iterating from the 2nd to the (n-2)th element of a collection which has n elements?
[12:53:40] banister: siwica what kind of collection
[12:54:19] banister: siwica but typically: [1..-2]
[12:54:54] siwica: oh sorry. any that mixes in enumerable
[13:36:22] phat4life: how to crash your computer: type ('1.' + ('9' * 99999999999999)).to_f in irb. My mac was using 8GB of swap before I killed ruby
[13:38:45] shevy: awesome man
[13:39:04] shevy: I let my cat program
[13:52:09] acmehandle: Can I ask rails questions here?
[13:52:15] acmehandle: Or is there another channel for that?
[13:53:35] tobiasvl: acmehandle: #rubyonrails
[13:56:59] dawkirst: is it good practice to indent everything underneath `private`?
[13:57:44] tobiasvl: dawkirst: no
[13:58:03] dawkirst: tobiasvl: thanks
[13:59:40] shevy: dawkirst it is bad because elsewhere in the code you would not have indent
[13:59:42] shevy: class Foo
[14:00:10] tobiasvl: yeah. there's no "end" to the private scope
[14:00:22] shevy: there is no end to cats either
[14:00:24] dawkirst: shevy, tobiasvl, makes a lot of sense
[14:00:38] tobiasvl: dawkirst: btw, for reference. there's no official style guide but there are some popular ones like https://github.com/bbatsov/ruby-style-guide and https://github.com/styleguide/ruby
[14:00:39] shevy: and the moebius strip is also moving an end
[14:00:55] shevy: I am not quite awake yet ...
[14:05:25] waxjar: i always unindent the call to private by one level
[14:05:42] dawkirst: tobiasvl: thanks for the links
[14:06:01] tobiasvl: waxjar: heathen
[14:09:42] waxjar: it's pretty! https://gist.github.com/britishtea/81819d7f396a8a8200cd
[14:15:57] nerium: Anyone knows a good way of downloading chunks of a stream?
[14:16:24] nerium: I???ve an infitive stream that I want to get chunks from
[14:17:47] geekbri: Is there perhaps a way in ruby to get a list of all forked processes from a parent without just recording the pids as your fork them?
[14:18:45] linduxed: so i've looked around for a bit and i'm wondering: is there some way to have a variable be impossible to reassign?
[14:19:05] linduxed: constant, preferrably
[14:21:11] shevy: waxjar that hurts my eyes man!
[14:21:26] shevy: waxjar can you put the above code into an additional top namespace please? :>
[14:21:30] shevy: I wanna see how it looks ;P
[14:21:38] waxjar: constants print a warning when you reassign them, i think that's the best you can do
[14:21:59] shevy: actually here would be an alternative
[14:22:00] shevy: end; private :super_secret_private_method
[14:22:03] shevy: but nobody wants to do that
[14:22:47] txdv: >> "shevy " * 100
[14:22:47] eval-in__: txdv => "shevy shevy shevy shevy shevy shevy shevy shevy shevy shevy shevy shevy shevy shevy shevy shevy shevy shevy shevy shevy shevy shevy shevy shevy shevy shevy shevy shevy shevy shevy shevy shevy shevy sh ... (https://eval.in/206694)
[14:23:04] waxjar: i like that you can do private def x ... end now, but that rules out 1.9 :(
[14:23:07] waxjar: shevy: https://gist.github.com/britishtea/81819d7f396a8a8200cd
[14:23:31] wm3|away: waxjar: also rules out 2.0
[14:24:28] shevy: look txdv, I got my own module ^^^
[14:24:47] shevy: I feel kinda iconic now
[14:24:49] shevy: like Paris Hilton
[14:24:55] rpag: waxjar, do you want your code to look like java or sth? :P
[14:25:07] ismell: hey, does anyone know the name of that site that allowed you to specify javascript libs in y our Gemfile?
[14:27:06] waxjar: rpag: nope, i tend to skip over the private if i don't do it this way :p
[14:27:32] waxjar: it's no worse than the rescue blocks in a method, imo
[14:29:23] ismell: https://rails-assets.org/
[14:29:26] ismell: thats what I was looking for
[14:30:35] shevy: yeah waxjar I hate rescue blocks inside of a method as well
[14:30:42] shevy: I like specific indent for being/rescues
[14:30:55] shevy: waxjar but now that you showed one of your atrocities
[14:30:58] shevy: I'm gonna show you one of mine
[14:31:49] shevy: waxjar watch in awe please -> http://pastie.org/9652773
[14:32:54] waxjar: good lord! that'll trip you up
[14:33:26] shevy: the reason is actually twofold
[14:33:32] shevy: my brain can not really deal well with multiple indents
[14:33:38] shevy: and I am lazy
[14:33:52] shevy: I really have to constantly press the space button
[14:34:09] shevy: I could use tab->2 spaces but that somehow does not work well for me, the tab key is out of my hand's reach
[14:34:17] workmad3: shevy: how can you be too lazy to indent? your editor does that for you, surely!
[14:34:20] waxjar: doesn't your text editor indent for you?
[14:34:33] shevy: workmad3 my editor is a bit better than notepad
[14:34:38] shevy: waxjar nope
[14:34:47] shevy: I have to hit the space button all the time :)
[14:34:49] workmad3: shevy: doesn't sound like it's much better :P
[14:34:53] shevy: well actually, I can copy/paste two ' '
[14:35:04] shevy: workmad3 it's simple!
[14:35:18] waxjar: get sublime! def [tab] fill in method name [tab] fill in method by
[14:35:32] workmad3: shevy: does it cry if you try to feed it multi-byte utf8?
[14:36:10] shevy: I only get weird characters shown
[14:36:18] shevy: but since I don't use utf, I eliminate those, then save into ISO
[14:36:23] shevy: 8815 or something like that
[14:36:36] workmad3: shevy: you're one of the reasons we can't have nice things :(
[14:37:02] workmad3: shevy: ISO8859-1 is an awful encoding :(
[14:37:09] shevy: it's simple!
[14:37:29] workmad3: shevy: not particularly...
[14:37:39] workmad3: shevy: it contains no way to say which code-page you're using
[14:37:47] shevy: all the time I spent into UTF just to get the snowman working...
[14:38:00] shevy: http://www.fileformat.info/info/unicode/char/2603/browsertest.htm
[14:38:05] workmad3: shevy: so 8859-1 and 8859-2, and 8859-X are indistinguishable
[14:38:15] shevy: I think that is great
[14:38:20] shevy: nobody has to spend time what to think really
[14:38:26] shevy: unlike UTF 16!
[14:38:52] shevy: hmm... actually I use 8859-1 consistently
[14:39:00] workmad3: shevy: right... but I asked about utf-8, not 16 :P
[14:39:21] workmad3: shevy: utf-8 and ascii interoperate below byte values of 127 :P
[14:39:39] shevy: well UTF-16 has a higher number than UTF-8 so it must be better than 16
[14:39:50] shevy: ascii is indeed a bit too limited these days
[14:40:03] workmad3: shevy: why not screw it all and go UTF-32 everywhere then?
[14:40:12] shevy: I wait for UTF-64
[14:40:20] shevy: so that aliens also are included into the language
[14:40:23] workmad3: shevy: get rid of multi-byte characters and get all the characters you could ever want!
[14:40:26] csmrfx: ok, tell him! http://news.dice.com/2014/10/09/5-programming-languages-marked-for-death/#comment-2169188
[14:40:39] shevy: csmrfx we had a python user the other day
[14:40:43] workmad3: shevy: pretty sure 'aliens' are already included... I believe there's a section of unicode marked for klingon ;)
[14:40:50] shevy: who referred to that no-content article above
[14:41:18] csmrfx: its like a hot-rod mechanic wrote an article on which guitars are best for classical music
[14:41:35] shevy: well there are crappy guitars
[14:41:43] shevy: I know because I bought one of them :(
[14:42:05] workmad3: csmrfx: and then based his opinions on what a particular rock-star decided to use ;)
[14:42:06] shevy: also, playing piano is much simpler than playing the guitar, I found that out as well
[14:42:47] csmrfx: ACTION buys a new bass guitar every 3 months
[14:43:26] shevy: what happens to your old bass guitar?
[14:43:55] csmrfx: if its good it sits on the stand
[14:44:12] csmrfx: the reasons are the same as with languages
[14:44:26] csmrfx: if it is fun to use, or must be used in some tracks, you keep it
[14:44:38] csmrfx: if its no use, or feels painful to use, you ditch it
[14:45:13] shevy: for a moment I thought the topic would be about girlfriends
[14:45:27] shevy: I think my fingers are too thick for a guitar
[14:45:32] csmrfx: and yeah, ultimately the instrument doesn't matter, its what you do with it that matters
[14:45:45] csmrfx: oh shit I am lat4
[14:45:51] workmad3: shevy: it does kinda still make sense if you do a 's/guitar/girlfriend' throughout...
[14:46:41] shevy: I rather like the Ukulele
[14:46:47] shevy: it's so small and silly that it is rather cute
[14:46:48] workmad3: shevy: but doing so does make it look like you and csmrfx are talking about something decidedly more dodgy... "there are crappy girlfriends. I know, because I bought one"
[14:47:14] shevy: hey you can get them for free somewhere?
[14:47:36] shevy: actually, perhaps we can get guitars for almost free with 3D printers eventually :)
[14:47:46] workmad3: shevy: I've heard they exist free-range in a variety of clubs, pubs, bars and other venues
[14:48:00] shevy: enemy territory
[14:50:35] shevy: there could be zombies in pubs
[14:50:40] shevy: I learned that from shaun of the dead
[14:50:49] shevy: plus, my british accent
[14:51:11] workmad3: shevy: I dread to think what your british accent is likey :P
[14:54:50] shevy: likey blimey slimey
[14:59:35] naftilos76: hiyosi, i am using daemons gem to make my ruby script a daemon but i cannot find a way to get the pid number of the process although i can see the pid number in tasks manager in ubuntu. The pid file is nowhere to find. The dir of the script does not contain anything and the /var/run/ does not either. Can anybody help?
[15:00:35] naftilos76: That was to everyone in the channel
[15:02:49] gizmore: naftilos76: maybe Thread.current.inspect has it?
[15:03:57] suy: >> Process.pid
[15:03:57] eval-in__: suy => 18932 (https://eval.in/206732)
[15:04:26] suy: naftilos76: that above is helpful?
[15:04:58] gizmore: now we can hardcode the const PID = 18932 :P
[15:05:07] naftilos76: i have no idea what that means
[15:05:23] gizmore: Process.pid is the process id of current process
[15:05:48] naftilos76: basically at some point in the script i do Daemons.daemonize and then the script ia a daemon
[15:07:25] naftilos76: i tried var = Daemons.daemonize and wrote its' contents in a file
[15:07:36] workmad3: naftilos76: try doing 'Daemons.daemonize(:dir_mode => :system)'
[15:07:43] naftilos76: the content of var was DEFAULT
[15:07:44] suy: naftilos76: I mean, Process.pid contains... the pid of the process, no?
[15:08:14] naftilos76: at what point am i supposed to do that?
[15:08:27] naftilos76: obviously after daemonizing, right?
[15:09:06] suy: I suppose yes, if that's what you want
[15:09:06] heftig: tbh I wouldn't bother with daemonizing
[15:09:17] heftig: let a service manager do that
[15:09:44] workmad3: ^^ I'm with heftig nowadays... just have the process run forever and let the sysadmin choose their preferred process supervisor
[15:10:22] workmad3: but still, Daemons.daemonize(:dir_mode => :system) should instruct Daemons to write the pid-file to the system location (e.g. /var/run)
[15:12:39] havenwood: https://www.mikeperham.com/2014/09/22/dont-daemonize-your-daemons/
[15:13:30] naftilos76: suy: Thanks man, simple as that Process.pid did the job
[15:13:47] naftilos76: i want that so that i can terminate at any time
[15:19:29] olivier_bK: can i sign in on website with nokogiri it's possible ?
[15:34:53] siwica: olivier_bK: Yes it is
[15:36:17] siwica: When I loop through an array with foo_array.each{|obj| p obj}, whats the best way to access the array element after obj?
[15:36:57] Axilla: how would i read a string by start at the end and deleting everything up to and including /
[15:52:39] jeer: Does anyone know if there is an alternative to SSLv3 for rest_client?
[15:53:24] jeer: 3rd party product we paid for decided to dump SSLv3 with zero notice/notification and now we have a warehouse of employees with nothing to do because of this.
[15:53:53] jeer: Sidenote, Bigcommerce is cancerous.
[15:59:35] Axilla: jeer: tls
[16:00:00] jeer: but does rest_client support tls?
[16:00:02] Axilla: all of the rest clients our app integrates with switched to tls, and turned off sslv3
[16:00:32] Axilla: oh not sure about rest_client?
[16:01:03] jeer: Yeah, I don't think the dependency chain we have has a solution for this unfortunately.
[16:03:42] workmad3: jeer: it looks like you can pass an :ssl_version to the rest-client constructor
[16:03:54] workmad3: jeer: valid values are held in OpenSSL::SSL::SSLContext::METHODS
[16:04:41] workmad3: jeer: I'd suggest using :TLSv1_2 if possible
[16:10:26] jeer: Looking for exact syntax now. Thanks for the lead, work.
[16:30:19] explodes: I doubt this is the best channel for it, but I don't know where to start. I'm on OSX 10.9, I used homebrew to install openssl. Recently, I upgraded to 1.0.1j, and now using the CLI to connect to Heroku breaks talking about SSL errors.
[16:50:40] mistermocha: question about class vars ... my understanding is that @somevar should be accessible throughout the class, but what about on the instance? (ex https://gist.github.com/mistermocha/5dc34f962bc55ce48109 ... see comments)
[16:53:05] Hanmac: mistermocha: hm it does works for me
[16:53:37] Hanmac: mistermocha: you need attr_reader or attr_accessor
[16:53:41] mistermocha: Hanmac: ??? yeah that's weird ... I would expect that to work, but I get errors on those puts statements.
[16:54:17] mistermocha: Hanmac: I read up on attr_accessors, but the docs I found said that I needed to do @@two_at_symbols ... and I just wanted to understand more
[16:54:44] Hanmac: NO ... attr_* functions has NOTHING todo with @@vars
[16:54:58] mistermocha: ACTION nods
[16:55:09] Hanmac: let me guess you come somehow from Rails right?
[16:55:32] mistermocha: no, I've been exclusively a python dev for the last several years, and exclusively perl for several years prior
[16:55:36] mistermocha: I'm just picking up ruby
[16:57:06] mistermocha: speaking of python... inheriting from object brings about the full datamodel, which has tons of fun built-in hooks for overriding basic methods on functions. Is there similar practice in ruby?
[16:57:24] mistermocha: a la https://docs.python.org/2/reference/datamodel.html
[16:58:09] j2p2: ruby's kind of a lawless land as far as objects go, you can redefine anything anywhere
[16:59:13] mistermocha: I get that, it's a matter of finding out what built-ins are there with new objects that I can override
[16:59:44] mistermocha: e.g., is there an analogous iterable feature that can be overridden in ruby?
[16:59:50] mistermocha: and if so, how do I?
[17:04:19] hadifarnoud: how can I install a gem globally? I use rbenv
[17:05:19] benzrf: mistermocha: ppl just use #each usually
[17:05:25] benzrf: >> [1, 2, 3].each {|n| puts n}
[17:05:26] eval-in__: benzrf => 1 ... (https://eval.in/206774)
[17:05:36] benzrf: mistermocha: altho
[17:05:43] benzrf: if you define each like that and then mix in Enumerable
[17:05:51] benzrf: you'll get a shitload of handy methods like #map
[17:21:57] havenwood: hadifarnoud: rbenv is hardcoded to a local user install as far as i know, though you can jump though a series of hoops to get a multi-user install location i wouldn't suggest it
[17:22:26] hadifarnoud: havenwood: is there anything I should add to my PATH?
[17:23:09] havenwood: hadifarnoud: maybe considering swapping out rbenv for chruby: https://github.com/postmodern/chruby#readme
[17:24:10] hadifarnoud: havenwood: I don't know anything about chruby. you know how I can fix this?
[17:24:19] havenwood: hadifarnoud: sudo ruby-install will default to installing in /opt/rubies, which is automatically detected by chruby
[17:24:51] havenwood: hadifarnoud: I guess first off, do you need to switch Rubies or are you just trying to install latest stable?
[17:24:59] havenwood: hadifarnoud: What OS/Distro?
[17:25:19] hadifarnoud: havenwood: oops. I had to do "rbenv rehash"
[17:25:29] havenwood: hadifarnoud: heh, shims...
[17:26:14] havenwood: hadifarnoud: Still not available to other users, or was that not what you were shooting for and I just misunderstood?
[17:27:06] havenwood: hadifarnoud: there should be an #rbenv channel that just chants the mantra: rbenv rehash
[17:27:40] hadifarnoud: havenwood: gem should do it automatically. seems stupid that I have to do it for every install
[17:27:47] havenwood: hadifarnoud: so use chruby :P
[17:27:54] havenwood: hadifarnoud: that's rbenv's fault
[17:28:07] hadifarnoud: :D looks like I have to havenwood
[17:28:56] havenwood: hadifarnoud: You can always easily point chruby at your rbenv rubies, but easy to build em with ruby-install: https://github.com/postmodern/ruby-install#readme
[17:29:19] hadifarnoud: havenwood: cool
[17:55:10] mistermocha: I'm confused... shouldn't rubydoc stdlib show documentation for standard libs? http://www.rubydoc.info/stdlib/mathn/2.0.0/frames
[18:04:13] renier: hey, maybe someone here can throw me a hint. I use puma for a webserver. Does anyone know how to configure the ssl protocols? This is to guard against the poodle openssl vulnerability. You have to disable SSLv3. has anyone done this with any of the usual ruby web servers? (thin, puma, unicorn, etc.)
[18:05:36] wallerdev: i usually put something like nginx in front
[18:05:40] wallerdev: then just handle it there
[18:06:33] renier: wallerdev, right. I'm going to have to, unless there is a way to handle it in ruby's server config
[18:06:58] TeresaP: Is there a way to use String.ends_with? with wildcards?
[18:07:10] renier: TeresaP, use a regexp
[18:08:27] renier: TeresaP, s = "this is the end" ; s =~ /end$/
[19:15:53] gizmore: i got a funny idea... turn two balance queries (one user +=, one user -=) into a single write query statement without creating additional data
[19:17:12] gizmore: oh nvm... i feel a bit dumb now
[19:17:45] csmrfx: because this is neither rails nor db channel?
[19:29:16] kombi: "Could not find rack(~>1.1.0) amongst[...rack-1.4.5...]" <- am I missing something?
[19:33:03] csmrfx: kombi: pastie complete errors or forget trying to get help
[19:33:40] csmrfx: or who knows, maybe some competent psychic also competent with rack is here
[19:36:46] kombi: csmrfx: http://pastebin.com/CqdaJuaU
[19:37:22] kombi: ..that being the complete error message, I just can't make head or tail of it...
[19:40:46] kombi: csmrfx: a much higher version of rack is clearly among them..
[19:41:40] csmrfx: clearly it is not a version of rack that your bundler understands
[19:41:51] csmrfx: or, what is generating that error
[19:42:02] csmrfx: perhaps I need to consult a psychic here as well?
[19:42:26] csmrfx: kombi are you sure you want help? perhaps you just want to tease us with this guessing game of your problem
[19:42:40] csmrfx: (or perhaps this is an excercise for psychics)
[19:43:11] kombi: cwmrfx: absolutely not, and I whish I could consult with a psychic for these kind of problems myself..
[19:43:16] csmrfx: anyway, I think I'll rather go read on music-theory than guess at your probs
[19:43:22] csmrfx: good luck!
[19:44:04] kombi: csmrfx: c7 #11 b13
[19:46:11] kombi: csmrfx: what kind of information can I provide so it is possible to untangle for a ruby-knower? (which I am not)
[19:46:56] kombi: csmrfx: btw I recommend "The Rest Is Noise" by Alex Ross
[20:03:26] csmrfx: kombi: well, to enable others to help you
[20:04:27] csmrfx: you would at the least need to describe what you are trying to do, which version of ruby, what OS, which libraries involved, pastie errors, source code, at the least the snippet that causes the error
[20:04:46] shevy: kombi this means you can not have the given gem installed
[20:04:46] csmrfx: ^ this should happen *every* time someone asks help with code, IMO
[20:05:25] kombi: csmrfx: fair point! Just found out that one can install a specific version of a gem
[20:05:36] shevy: the problem lies in when authors specify specific version like rack (~> 1.1.0)
[20:05:44] shevy: in my opinion this is almost always abused
[20:06:13] csmrfx: how do you mean "abused"?
[20:06:22] csmrfx: "misused"?
[20:06:24] shevy: they specify a restriction on usage of their gem
[20:08:06] kombi: csmrfx: but it seems I've gotten past that, now fighting with errors from Redmine (a project managment tool based on R'n'R)
[20:12:51] csmrfx: kombi: great
[20:13:51] csmrfx: kombi: I'll read the Ross book later, I have yet to finish the intro to chromatic jazz theory, solfege and sightreading book
[20:31:43] sterns: Hello, Server A is going to dump a list of 10,000 URLs (HTML pages) that need to be fetched into a mysql database. An array of worker servers will be configured to work that queue. Is ruby+Nokogiri one of the better solutions for the worker servers to perform this task? And secondly, is there a go-to solution for monitoring a work queue like this?
[20:33:22] ramfjord: sterns: have you heard of Resque?
[20:33:26] ramfjord: https://github.com/resque/resque
[20:33:40] ramfjord: backed by redis, not mysql, but it comes with a cool monitor and management of worker pools
[20:33:45] sterns: ramfjord: no, thanks, I'll check it out
[20:34:37] ramfjord: I've also found mechanize (https://github.com/sparklemotion/mechanize) to be a lot nicer than the standard Net::HTTP
[20:34:50] epitron: mechanize is great
[20:34:51] ramfjord: which, for instance, doesn't follow redirects automatically
[20:35:05] epitron: it does need a lot of cleanup though, and they should really change their HTTP backend
[20:35:13] epitron: (i recommend the 'http' gem :)
[20:35:35] epitron: the documentation needs work too
[20:35:57] ramfjord: "This Gem has the worst name in the history of SEO"
[20:35:59] ramfjord: haha, no kidding
[20:36:14] ramfjord: I've never heard of http, might check it out myself
[20:37:04] epitron: it's much nicer than Net::HTTP
[20:37:17] epitron: one really nice thing is that it streams the HTTP response
[20:37:31] epitron: (it has a streaming HTTP protocol parser)
[20:37:37] pipework: Faraday is my favorite.
[20:37:54] epitron: faraday doesn't do streaming though
[20:37:56] pipework: I don't know if it streams the response though, haven't looked.
[20:38:03] epitron: it's surprisingly rare for them to implement that, in ruby, for some reason
[20:38:11] epitron: despite how easy it is to do with ruby blocks :)
[20:38:21] epitron: http.get().each_chunk {|data| ... }
[20:39:01] epitron: oh yeah, this is what bugged me about mechanize's redirects: "agent.redirect_ok = false"
[20:39:10] epitron: what an annoying option to remember
[20:39:20] epitron: agent.redirects = true; agent.follow_redirects = false; so much simpler
[20:39:27] skullz: Hey guys, how can I get the element that has the lowest price from those who have the biggest quantity?
[20:39:37] skullz: This is the hash, @total = {6=>{:price=>#<BigDecimal:5a2c178,'0.5458E2',18(27)>, :quantity=>2, :products_by_meta=>{218=>1004}}, 5=>{:price=>#<BigDecimal:59dfcb0,'0.438E2',18(27)>, :quantity=>2, :products_by_meta=>{218=>1971}}}
[20:39:48] csmrfx: you mean, the value
[20:40:02] csmrfx: skullz: are you familiar with "ri"?
[20:40:13] epitron: skullz: i think you need a distance metric, since you have two dimensions now
[20:40:21] skullz: csmrfx: nope
[20:40:35] ramfjord: or just sort by price -> total
[20:40:45] epitron: a simple distance metric is to come up with some common units
[20:41:00] epitron: then do euclidean distance
[20:41:18] csmrfx: ok you want to install "ri", open your terminal, and type "ri Enumerable", "ri Enumerable#sort_by" -- and perhaps "ri Hash" too
[20:41:23] epitron: (euclidean distance: sqrt(x**2 + y**2))
[20:42:15] ramfjord: coll.sort { |a,b| a[:quantity] = b[:quantity] ? b[:price] <=> a[:price] : a[:quantity] <=> b[:quantity] }
[20:42:41] epitron: ramfjord: that's just a hierarchical sort
[20:42:56] epitron: coll.sort_by { |a| [a[:quantity], a[:price]] }
[20:42:58] epitron: same thing :)
[20:43:14] ramfjord: price sort needs to be lower first
[20:43:20] ramfjord: quantity sort nees to be higher first
[20:43:26] epitron: throw a negative sign in there!
[20:43:30] epitron: coll.sort_by { |a| [a[:quantity], -a[:price]] }
[20:43:58] csmrfx: hehe, great to see #ruby still has bright and helpful people!
[20:44:00] epitron: i think you want a distance metric, though
[20:44:38] skullz: epitron: is that number theory?
[20:44:46] epitron: no, it's just geometry
[20:44:59] epitron: imagine a plane
[20:45:03] epitron: price on one axis, quantity on the other
[20:45:14] literary: Never mind.
[20:45:15] epitron: you want to find everything in one corner of the graph
[20:45:16] literary: Figured it out.
[20:45:20] sterns: ramfjord: resque looks perfect! I'm not using mysql yet, so redis will be fine. Do you have experience with any of the providers listed here : http://en.wikipedia.org/wiki/Redis
[20:45:46] epitron: so, you could graph it
[20:45:56] skullz: Are you talking about simplex on 2d?
[20:45:59] epitron: OR, you could come up with a formula that finds the distance between points
[20:46:08] epitron: aka. a distance metric
[20:46:17] epitron: then you can sort by distance from that ideal point
[20:46:22] ramfjord: sterns: I've used redistogo
[20:46:24] epitron: (the ideal point being the corner you want)
[20:46:30] csmrfx: the reason why I simply referred to ri -docs -- the metric I can only guess at
[20:47:01] ramfjord: epitron: why does hierarchical sort not work?
[20:47:30] epitron: ramfjord: because it's not weighing both values at the same time
[20:47:45] csmrfx: which is better? 1000 of the $1 items or 400 of the $3 items?
[20:48:11] sterns: epitron: ramfjord: Do you feel that the other solutions you mentioned are superior to nokogiri for the HTML fetching? All I'm doing with the files at the moment is writing them to disk and possibly into a RDB of some kind later.
[20:48:23] ramfjord: but he needs to prefer weighing quantity to weighing price
[20:48:54] epitron: ramfjord: so he wants to buy a lot of something, and he doesn't care what it costs?
[20:48:55] ramfjord: sterns: nokogiri is a html parsing library?
[20:49:06] ramfjord: I don't think it will help you donwload files
[20:49:27] epitron: sterns: mechanize is is better than nokogiri, because it includes nokogiri :)
[20:49:28] csmrfx: sterns: I once made a scraper for a huge bunch of websites with nokogiri
[20:49:33] csmrfx: it worked fine
[20:49:35] epitron: mechanize is nokogiri PLUS
[20:50:00] ramfjord: "how can I get the element that has the lowest price from those who have the biggest quantity?
[20:50:01] csmrfx: hm, maybe I used open-uri
[20:50:01] sterns: ramfjord: epitron: sorry, I meant to refer to typhoeus / hydra
[20:50:10] sterns: which is what I'm using now
[20:50:25] epitron: hydra is good if you wanna go nuts with downloads
[20:50:38] sterns: too many gem names!
[20:50:55] skullz: the problem is, I need the most products I can get
[20:51:22] csmrfx: actually, your problem is simply to define a clean metric
[20:51:23] skullz: Indeed I should be using something more clever... but it's ok for a MVP
[20:51:34] epitron: skullz: i still think you want to at least want a function that weights quantity and price
[20:51:38] ohwhoa: How to install unpacked ruby gem into system rubygems (without bundler and path option), also I need to put it in list when I type gem list. One solution is to install gem and then replace, but this is so shitty.
[20:52:30] csmrfx: epitron: did you use bundler?
[20:52:43] sterns: epitron: Yes, I appreciate the concurrent request etc offered by typhoes / hydra. I'm not married to using ruby for this purpose. Do you think that hydra is one of the best solutions available for this purpose, regardless of language/stack?
[20:52:45] epitron: skullz: instead of giving the user a sorted list, you could graph all the values
[20:53:00] epitron: skullz: then let them pick from a region in the chart... d3 is good for that
[20:53:06] livcd: Hey guys. What is the best way to interact with a website's elements ? Like logging,clicking on buttons etc
[20:53:26] csmrfx: livcd: you mean, "scrape" a site?
[20:53:31] skullz: epitron: I'm plotting this data on a table (request from client...)
[20:53:37] ramfjord: skullz: If you just want an easy solution for the moment, try the code epitron or I pasted
[20:54:01] livcd: csmrfx: yeah basically
[20:54:10] epitron: sterns: i dunno... i haven't used it. downloading a lot of stuff quickly is not usually the bottleneck :) you can always throw threads at the problem in ruby
[20:54:26] csmrfx: livcd: how about you read on nokogiri?
[20:54:31] epitron: skullz: tell the client you found a better solution :)
[20:54:37] epitron: skullz: or do both! :D
[20:54:42] csmrfx: livcd: unless you need a headless browser?
[20:54:53] csmrfx: for testing purposes theres many things
[20:54:55] skullz: both seems better (;
[20:54:58] epitron: skullz: d3 takes a couple minutes to make work if you already have a data table
[20:55:42] csmrfx: livcd: for testing sites selenium is common, theres headless browsers like capybara
[20:56:27] skullz: then it's just to pick up the right chart
[20:57:30] livcd: csmrfx: i don't think so...i need to interact with a web application which gets a stream of "items" and then i want to click on a button and fill certain forms
[20:57:37] sterns: epitron: I don't know if I'll be able to do it, but I'm hoping to be able to scale up downloading 10000 pages in about 15 seconds. I can currently do about 3000 in 15 seconds now with a single non-optimized server.
[20:58:09] livcd: csmrfx: i have been googling and found anemone and mechanize but came here to ask what's "best" for what i am trying to do
[20:58:22] csmrfx: http://swizec.com/blog/scraping-with-mechanize-and-beautifulsoup/swizec/5039
[20:58:35] csmrfx: (google scraping with ruby)
[20:59:10] livcd: csmrfx: yeah well read my statement above ^^
[20:59:25] sterns: epitron: the current server is also the main web server. jamming a bunch of requests through my main interface is not good for business
[20:59:34] csmrfx: livcd: well I've used nokogiri and mechanize
[20:59:46] mallu: is it possible to tell erb(template) file to ignore a line?
[20:59:48] csmrfx: may be theres a new shiny thing out there
[20:59:57] csmrfx: mallu: you mean - comment
[21:00:27] csmrfx: http://stackoverflow.com/questions/3426671/how-does-one-comment-in-an-erb-template
[21:01:15] livcd: csmrfx: ok i guess i will read about nokogiri and mechanize and try to build up something :-) thanks for help !
[21:01:33] csmrfx: I suggest you try following that tutorial linked above!
[21:02:43] livcd: csmrfx: right ! though i think that code in that tut is python and not ruby lol!
[21:03:13] csmrfx: wow, you're right
[21:03:48] csmrfx: I should stick to stackoverflow
[21:04:04] csmrfx: livcd: how about this! mentions form data submission http://stackoverflow.com/questions/17763549/how-do-i-scrape-data-through-mechanize-and-nokogiri
[21:04:20] shevy: that's how ruby loses
[21:04:24] shevy: ruby hackers link in python articles :>
[21:05:20] csmrfx: lol I wish I was a ruby hacker
[21:05:38] csmrfx: I'm more of a "ruby geezer" - like the char from Fast Show
[21:06:50] zenspider: nokogiri ships with plenty of examples and is well documented...
[21:07:38] csmrfx: "I'm a little bit waayy, a little bit wooah, a little bit woosh.. I'm a geezer! I will hack anything!" https://www.youtube.com/watch?v=I8_U0q1jpzo#t=17
[21:13:15] j2p2: livcd: you might want to check out watir
[21:14:20] j2p2: eh, I guess if you don't need to interact with it that probably isn't necessary though
[21:14:24] ax: csmrfx: haha, love that vid
[21:16:44] csmrfx: a_: Fast Show had some fun chars... and its fun to be an open source geezer, and nick code from every place possible!
[21:26:24] shevy: I hate bugs
[21:27:14] csmrfx: I love them, wouldn't have work without
[21:28:07] whatasunnyday: Hi! Does anyone know how I can get the string generated by a template in Sinatra?
[21:30:36] csmrfx: whatasunnyday: can you yield the template?
[21:30:54] whatasunnyday: csmrfx, not exactly sure what you mean but i think so
[21:31:13] csmrfx: hm, are you using slim?
[21:32:11] csmrfx: I'm hardly knowledgeable here...
[21:32:57] csmrfx: ...but erb handlers should return a string if I'm not mistaken?
[21:33:44] csmrfx: http://www.sinatrarb.com/faq.html#partials
[21:33:47] abstrakt: csmrfx, I think the potential issue is he doesn't want the stuff that looks like erb to be interpreted
[21:33:55] abstrakt: he may want the raw text version of the file
[21:34:08] abstrakt: in which case, whatasunnyday you'll need to serve those basically as static assets
[21:34:34] abstrakt: whatasunnyday, or you could try using the EJS gem to precompile them and serve that instead, either way the files will probably/basically go somewhere in your public/static assets folder
[21:35:01] whatasunnyday: Sorry, let me clarify. erb :index returns a page and I just want the page as a string. Precompiling is pretty much what I want to do so I'll check out EJS.
[21:36:28] csmrfx: weird, I thought erb :index would return the page as a string 8D
[21:38:52] abstrakt: csmrfx, erb templates and ejs templates use the same basic <% %> syntax
[21:39:06] abstrakt: csmrfx, meaning erb will strip out the <% %>
[21:39:36] abstrakt: csmrfx, if he wants to deliver the <% etc so that javascript can use that for templating instead, he'll need to use some other method of delivery
[21:39:53] abstrakt: whatasunnyday, incidentally i think there's a sinatra plugin for this
[21:40:02] whatasunnyday: abstrakt, o rly
[21:40:09] csmrfx: ok for some reason I didn't see the javascript mention
[21:40:44] abstrakt: whatasunnyday, hmm, no maybe not... I think you'll just need to use a background/watch task to run the compile task when your EJS files change
[21:40:55] abstrakt: whatasunnyday, rails has automagic integration with EJS
[21:40:58] whatasunnyday: okay cool, i can manage that
[21:41:28] abstrakt: whatasunnyday, http://www.jacopretorius.net/2013/11/integrating-ejs-templates-into-rails.html
[21:50:29] mallu: csmrfx we are using chef template for managing a config file. When a particular service restart it update this config file which cause chef to update the file again during chef-client run. I was hoping that somehow I can have chef template ignore the lines the service update on the config file
[21:51:24] abstrakt: mallu, ask #chef ?
[21:51:29] abstrakt: or is it #opscode
[21:52:27] mallu: I was hoping that there is a way in ruby to ignore lines in erb
[21:52:51] csmrfx: since you cannot comment them, how about using separate files
[21:53:06] shevy: hmm we have .uniq
[21:53:17] shevy: but do we have the opposite of it? as in, one that returns only those entries that are duplicates?
[21:54:10] csmrfx: well isn't that just array minus the uniques
[21:55:12] shevy: let me check that
[21:55:34] shevy: that does not work :(
[21:55:51] shevy: >> array = %w( abc def ghi abc ); array - array.uniq
[21:55:52] eval-in__: shevy => [] (https://eval.in/206885)
[21:55:53] csmrfx: does drop return the dropped ones?
[21:56:05] csmrfx: ie. drop if not uniq
[21:56:38] shevy: not sure how to use that
[21:57:02] shevy: drop wants an Integer it seems
[21:57:45] csmrfx: how about map?
[22:01:20] shevy: I remember I must have some code somewhere that does that...
[22:02:31] csmrfx: >> ar = [1,2,3,4,5,6,6,7,7]; ar.detect { |it| ar.count(it) > 1 }
[22:02:31] eval-in__: csmrfx => 6 (https://eval.in/206886)
[22:03:13] csmrfx: >> ar = [1,2,3,4,5,6,6,7,7]; ar.map { |it| ar.count(it) > 1 }
[22:03:13] eval-in__: csmrfx => [false, false, false, false, false, true, true, true, true] (https://eval.in/206887)
[22:03:29] csmrfx: and so on...
[22:04:25] csmrfx: >> ar = [1,2,3,4,5,6,6,7,7]; ar.map { |it| ar.count(it) > 1 }.uniq
[22:04:25] eval-in__: csmrfx => [false, true] (https://eval.in/206888)
[22:04:47] ax: >> array = [1,2,3,4,5,6,6,7,7]; array.find_all { |it| array.count(it) > 1 }
[22:04:47] eval-in__: a_ => [6, 6, 7, 7] (https://eval.in/206889)
[22:04:55] ax: >> array = [1,2,3,4,5,6,6,7,7]; array.find_all { |it| array.count(it) > 1 }.uniq
[22:04:56] eval-in__: a_ => [6, 7] (https://eval.in/206890)
[22:04:58] csmrfx: and maybe uniq on top
[22:05:22] epitron: >> [1,2,3,4,5,6,6,7,7].group_by{|e| e}.select {|k,ks| ks.size > 1}.map{|k,ks| k}
[22:05:22] eval-in__: epitron => [6, 7] (https://eval.in/206891)
[22:05:37] csmrfx: select should work with the a_'s, too
[22:05:38] epitron: oh wait, this is rails 2.1
[22:05:44] epitron: >> [1,2,3,4,5,6,6,7,7].group_by{|e| e}.select {|k,ks| ks.size > 1}.keys
[22:05:44] eval-in__: epitron => [6, 7] (https://eval.in/206892)
[22:05:53] epitron: s/rails/ruby/ lol
[22:06:46] csmrfx: lol I'm still on 1.9.3
[22:09:41] mallu: how can I generate date like this in erb? Thu Oct 16 15:07:45 PDT 2014
[22:10:03] benzrf: strftime probls
[22:11:10] ax: epitron: that is probably the most efficient way of doing it
[22:12:36] epitron: a_: slightly more efficient would be where the values were just counters
[22:13:19] epitron: >> counts = Hash.new(0); [1,2,3,4,5,6,6,7,7].each{|e| counts[e] += 1}; counts.select {|k,v| v > 1}.keys
[22:13:19] eval-in__: epitron => [6, 7] (https://eval.in/206893)
[22:13:49] epitron: mallu: http://foragoodstrftime.com/
[22:19:11] csmrfx: got fortress?
[22:21:50] shevy: csmrfx cool, I don't think I have used .find_all before
[22:22:22] epitron: isn't find_all just select?
[22:22:57] shevy: don't say that man :(
[22:23:31] shevy: you are right
[22:23:34] shevy: csmrfx tricked me
[22:23:59] epitron: it looks like there is a difference
[22:24:02] epitron: find_all works in enumerators
[22:24:08] epitron: and returns enumerators
[22:24:44] shevy: if it looks like a duck
[22:24:48] shevy: and walks like a duck
[22:25:03] epitron: oh, i was looking at the source to Array#select and Enumerable#find_all
[22:25:16] epitron: Enumerable#select is identical to Enumerable#find_all
[22:25:28] epitron: Array#select is slightly different, and Array#find_all is just Enumerable#find_all
[22:30:24] northfurr: dumb question??? If i upgrade to yosemite will I have to setup RVM and ruby versions again
[22:30:49] claw: hey there anybody has a quick tip on how to generate a alphanumeric range ?
[22:30:58] DLSteve: northfurr, no
[22:31:18] DLSteve: northfurr, All my CLI stuff stransfered over.
[22:31:45] northfurr: thanks DLSteve
[22:32:15] DLSteve: northfurr, np, yah I had a lot of bash aliases and vagrant setups so I was worried myself.
[22:33:52] volty: >> ('a1'..'a9').to_a
[22:33:52] eval-in__: volty => ["a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9"] (https://eval.in/206910)
[23:02:47] mallu: I want to be able to do Time.now.strftime('%a' '%b' '%d' '%H':'%M':'%S' '%Z' '%Y') in a template but it doesn't like : between hour, minute and second
[23:03:06] mallu: how can I escape : ?
[23:03:41] zenspider: it doesn't like it because it isn't valid ruby
[23:04:16] mallu: ok.. so how can I do it?
[23:04:17] zenspider: mallu: why do you have many single quoted strings there?
[23:04:39] csmrfx: mallu do you have ri installed?
[23:04:43] mallu: zenspider it was complaining without it
[23:04:58] csmrfx: $ ri Time.strftime is helpful
[23:05:34] volty: >> Time.now.strftime("'%a' '%b' '%d' '%H':'%M':'' '%Z' '%Y'")
[23:05:35] eval-in__: volty => "'Thu' 'Oct' '16' '23':'05':'\u0013' 'UTC' '2014'" (https://eval.in/206919)
[23:06:08] csmrfx: >> Time.strftime("This is now %T")
[23:06:20] csmrfx: >> Time.now.strftime("This is now %T")
[23:06:25] csmrfx: lol typical of me
[23:06:32] zenspider: mallu: "it" == ruby. you need to learn the language to use it.
[23:06:53] volty: wasn't there and advanced regex gem ?
[23:06:57] zenspider: as you can see what volty put above, that's prolly not what you want
[23:07:11] zenspider: which means you need to write your string correctly... basic ruby syntax
[23:07:22] zenspider: volty: prolly many. what do you need?
[23:08:29] csmrfx: my irb returns => "This is now 02:08:10"
[23:09:37] volty: zenspider: https://eval.in/206920, done but I wonder if there is some stuff with which I can write (almost) one-liners. etc etc
[23:10:30] zenspider: volty: key = cont[/^Keys=(.*)$/, 1]
[23:10:54] volty: that one I forgot
[23:11:19] zenspider: y = keys.split(...).map { |k| [k, url] }
[23:11:56] zenspider: also: for the love of god... no tabs. use 2 spaces per indent
[23:12:28] volty: cat & paste prob.; thx
[23:12:41] dhardison: i'm totally new to ruby and i need to write some test cases for this function: http://pastebin.com/3HKhVRGT what's the quickest way for me to get started?
[23:13:07] csmrfx: dhardison: read a ruby book?
[23:13:31] dhardison: csmrfx: that's a good idea but i need to get it done in a few hours
[23:13:33] csmrfx: perhaps, see a ruby video?
[23:13:47] zenspider: volty: https://eval.in/206921
[23:14:08] zenspider: smells like homework
[23:14:25] dhardison: more like an interview question
[23:14:36] csmrfx: 30 minutes: https://www.youtube.com/watch?v=FyyIvAwwMPM
[23:14:45] csmrfx: "Introduction to Ruby"
[23:14:46] zenspider: dhardison: assuming you can ferret out what inject and reject mean, you should be able to write test cases on paper immediately
[23:15:20] volty: zenspider: thx, but you cannot apply merge to an enumerator. Anyway the idea is right
[23:15:20] dhardison: i think i got that part down - i read up on that, but the test case stuff i'm reading about loading up what sounds to me a lot of libraries to do it
[23:15:21] zenspider: that's horribly written code, btw
[23:15:29] zenspider: if that is homework, I'd question where it is coming from
[23:16:02] zenspider: volty: wasn't sure what y was in this ... oh, now I see it. :P
[23:16:07] volty: i am expert for rudeful teachers :)
[23:16:07] zenspider: you can do << tho ?
[23:16:32] volty: yes, same as yield
[23:16:35] zenspider: dhardison: loading up what exactly?
[23:16:54] dhardison: i downloaded rubymine and there's just a lot of folders and what not
[23:17:04] dhardison: and i'm questioning how much of that i actually need.
[23:17:16] zenspider: obviously. most of us don't use rubymine
[23:17:28] zenspider: if you have ruby installed, that's all you need
[23:17:41] zenspider: any text editor will work. terminal to run.
[23:19:52] csmrfx: I would install irb and ri
[23:19:54] dhardison: csmrfx: thanks for the video - im watching it now btw
[23:20:10] csmrfx: code examples past 8 minutes
[23:20:46] csmrfx: (irb so you can test whatever, and ri to show docs)
[23:20:52] volty: irb, ri, a nice quickref, and, above all, a nice book
[23:25:31] volty: so, is there something advanced that can slurp into arrays ^Keys=(.*)$ and ^Query=(.*)$? (I am just curious what is out there, in the world of the gems).
[23:25:58] volty: I mean in one line
[23:26:37] csmrfx: whats "slurp"
[23:27:03] zenspider: volty: I've given you everything you need to do that in one line
[23:27:25] zenspider: text[/regexp/, 1].split(/,/)
[23:27:59] volty: zenspider: I said at the beginning that I do not have problems -- that I am just curious
[23:28:24] volty: I already modified my code (and thanked you)
[23:29:54] csmrfx: Nothing known about .slurp
[23:30:30] volty: i do not talk to strict context ppl, sorry csmrfx :)
[23:32:26] zenspider: volty: so I'd add a method parse_keys(text, regexp) to wrap it up and make it obvious what it is for
[23:34:00] volty: no no, i found it how, working on it (for fun, since tired and lazy)
[23:34:04] thisguy123: is there a rails channel?
[23:34:11] volty: cont.scan /^(Keys|Query)=(.*)$/
[23:34:54] apeiros_: thisguy123: no. #rubyonrails is the rails channel. aka #ror and #rails
[23:35:20] apeiros_: pong banisterfiend. sorry, was (and still am) cleaning my home office room :-S
[23:37:21] thisguy123: i get sent to ##namespace when i try to join #rubyonrails
[23:37:25] thisguy123: sry, kind of an IRC noob
[23:38:26] zenspider: volty: that's not going to give you what you want...
[23:38:41] apeiros: thisguy123: you need to have your nick registered to join #ror
[23:38:52] apeiros: thisguy123: /msg nickserv help register
[23:40:09] thisguy123: still can't get in to #ror, I'm registered
[23:40:54] volty: zenspider: i'm fine, cont.scan(/^(Keys|Query)=(.*)$/).to_h, and will see after how to handle multiple keys
[23:41:20] csmrfx: maybe try with ##
[23:41:45] volty: (i'm going to collect them)
[23:42:09] apeiros: thisguy123: registered and authenticated?
[23:42:48] thisguy123: yep, it says I'm logged in
[23:43:32] apeiros: hm, then you should be able to join
[23:48:30] thisguy123: It looks like im joining #ror then getting kicked back to a NickServ window? does that help at all?
[23:48:54] volty: i can't remember if there, and how if there: e.reduce(...) i receive { |accum, obj|, obj is a pair (an array), i want { |accum, k, v| but do not remember the syntax (if there at all)
[23:50:57] ramfjord: volty: I'm pretty sure there's no such method, but its only a little line to do
[23:53:23] zenspider: volty: { |acc, (k, v)| ... }
[23:53:24] volty: ramfjord: thx, I remember there was talking about the syntax on how to do it directly in the params list, but maybe it was dropped, or my memory spoiled
[23:53:41] dhardison: what would you consider doing to improve the following function: http://pastebin.com/3HKhVRGT
[23:53:47] dhardison: (what i pasted earlier basically)
[23:53:49] volty: yes, there was, and remained
[23:53:53] dhardison: chaining it together?
[23:55:06] zenspider: dhardison: lots. writing it idiomatically would be a start.
[23:55:39] zenspider: dhardison: but as I said before: smells like homework
[23:55:48] dhardison: interview question
[23:56:19] zenspider: dhardison: same thing.
[23:56:31] csmrfx: ACTION checks
[23:56:33] zenspider: where are you interviewing? and what sort of position?
[23:56:50] csmrfx: "would I qualify for the job"
[23:56:57] dhardison: just a general developer but apparently they use ruby for something
[23:57:04] zenspider: and if I improve the code, do _I_ get the job?
[23:57:26] volty: at the _|_ :)
[23:57:31] dhardison: not sure, there's other requirements too such as understanding tcp/ip
[23:57:39] dhardison: this is where i'm lacking though
[23:57:45] dhardison: so maybe -- you should apply
[23:58:24] zenspider: where is it?
[23:58:36] dhardison: i'll tell you after i'm done applying :)
[23:59:03] banisterfiend: dhardison for a start don't give your variables such demented names
[23:59:25] zenspider: sorry... hayduke
[23:59:45] banisterfiend: and you have a local variable that shadows the var you're iterating over