« Back to channel list

#ruby - 03 March 2015

« Back 1 day Forward 1 day »
[00:00:18] havenwood: jen_: edit it and change 1.8.7 to 2.2.1
[00:00:26] havenwood: 2.2.0 rather ;)
[00:00:52] havenwood: in your case, 2.2.0 since that's what you installed
[00:01:48] jhass: now the app will probably break since it was written for 1.8 :P
[00:02:36] jen_: shoudl I do bundle install?
[00:03:17] jen_: no issues there
[00:05:20] jen_: script runs but I get this: Error occured: OpenSSL::SSL::SSLError - hostname "localhost" does not match the server certificate
[00:05:40] jen_: er. http://pastie.org/9994789
[00:06:00] jen_: OpenSSL issue :(
[00:06:51] jen_: for this Google API, would they need this site doing the server call to have an SSL cert?
[00:07:20] nickjj: what's the syntax to do something like: arr.collect(&:strip, &:downcase) ?
[00:07:34] nickjj: am i stuck having to chain .collect?
[00:07:44] jhass: nickjj: no abbreviation possible, do arr.map {|item| item.strip.downcase }
[00:07:55] nickjj: jhass, ah good idea. thanks
[00:10:18] jhass: nickjj: that's the normal syntax &:foo is the shortcut ;)
[00:10:56] jhass: jen_: this one is hard without knowing what you're actually doing
[00:11:19] nickjj: jhass, so then i could just use .collect still?
[00:11:26] nickjj: with the non-shortcut variant
[00:11:33] havenwood: nickjj: or `arr.map(&:strip).map(&:downcase)`, can fit two #map in a #collect :P
[00:11:47] havenwood: if you don't mind the performance hit
[00:11:50] jhass: nickjj: collect and map are aliases
[00:12:11] jhass: havenwood: that's actually longer than writing it out :P
[00:12:25] nickjj: the source code is identical?
[00:12:40] jhass: calling .collect or .map makes no difference
[00:12:52] jhass: it's the same method, just under different names
[00:12:54] havenwood: nickjj: most folk use map
[00:13:07] nickjj: ok, i thought it would have been marked as an alias in the docs
[00:13:17] nickjj: unless i missed it somehow
[00:13:25] jhass: I think it is?
[00:14:13] jhass: wow, not really
[00:14:15] jhass: that's dumb
[00:14:37] nickjj: yeah i was looking for a supplemental note
[00:14:46] jen_: jhass and havenwood . This application is suppose to send gclid values back to Google via the Adwords API. Gclid values are passed back to our database after a successful transaction occurs.
[00:14:54] nickjj: it's some blindingly massive yellow box that tells you it's an alias
[00:15:23] jhass: jen_: well, you have a rather lowlevel issue, so the what isn't as interesting as the how actually
[00:15:24] havenwood: nickjj: a diff of the source shows Array#map and Array#collect are indeed identical
[00:15:24] jen_: The data is reporting back to us okay, but sending it out back to Google is where we are having issues.
[00:15:52] jhass: jen_: like, why it's connecting to localhost via https and why what ever is listening there returns an invalid cert
[00:15:53] nickjj: map wins then, more commonly used and less characters
[00:16:08] jhass: nickjj: totally ;D
[00:16:26] jhass: the .collect'ors are insane people :P
[00:16:42] havenwood: same with Enumerable#map and Enumerable#collect
[00:16:55] centrx: also Set#map and Set#collect
[00:17:03] centrx: identical
[00:17:30] havenwood: centrx: the non bang ones are Enumerable i think
[00:18:04] havenwood: ha, and Set#map! and Set#collect! explicitly state they're aliases in the docs
[00:18:18] jhass: consistency ftw!
[00:18:36] jhass: I think I'll sneak a deprecation warning for collect into one of my gems
[00:20:17] nickjj: jhass, yeah or redefine it to do something else entirely
[00:20:23] jen_: jhass and havenwood These are my files with credentials x???d out: https://www.dropbox.com/s/hnedpf8pkicmh3g/cj.zip?dl=0
[00:20:56] jen_: Readme has description of what the script does
[00:23:45] jhass: and what command produces the error?
[00:23:56] jhass: bundle exec ruby setup_oauth2.rb ?
[00:24:56] jen_: bundle exec ruby script.rb
[00:27:55] emocakes: hallo jhass
[00:27:58] jhass: jen_: can you comment out (put # in front) lines 29-33 (but not the end on ine 34), run it again and make a pastie with the full output?
[00:28:09] jhass: of script.rb
[00:29:57] jen_: jhass: http://pastie.org/9994828
[00:30:26] jen_: I have no cert on this domain.
[00:30:36] jen_: does that matter?
[00:31:16] jhass: ugh, that script is a bit dumb
[00:31:20] jhass: the issue in the mailer
[00:31:33] jen_: listening...
[00:31:38] jhass: it connects to localhost by default via smtps or using startssl
[00:31:47] jhass: and it doesn't let you configure that at all
[00:33:13] jen_: ok, any ideas? jhass
[00:33:26] jen_: not sure why we have a mailer in there.
[00:33:34] jen_: Ruby developer skipped out of town.
[00:33:42] jen_: hence my panic here.
[00:33:54] jen_: can we disable mail?
[00:34:10] jhass: if you don't want to fix it, sure
[00:34:19] jhass: jsut edit lib/notifier.rb
[00:34:33] jhass: send_mail? method, just always return false
[00:35:11] dopie: https://gist.github.com/staycreativedesign/61fbabff14e819da39ab
[00:35:20] vhlfd: Senjai, are you Steve?
[00:35:24] blackmesa: hi all. Is it possible to create string of this format include AASM
[00:35:34] dopie: can i rewrite the if satement like that?
[00:35:53] jhass: dopie: no. What do you think defined? does?
[00:36:04] jen_: jhass: comment out everything in there?
[00:36:10] jen_: notifier.rb
[00:36:24] jhass: jen_: no, just change def send_mail? to always return false
[00:36:27] dopie: check to see if an expression is defined or not
[00:36:42] jhass: and what does defined mean to you?
[00:37:10] Senjai: vhlfd: certainly not
[00:37:10] jen_: so replace line 8 with return false ?
[00:37:13] dopie: Check to see if the variable has something in it
[00:37:21] blackmesa: sry. "A1A" to "D6F". all combinations to "D6F", which is the maximum. Ive used [*A..Z] before for generating an array of string "A" to "Z". I wonder if there something for similar
[00:37:23] dopie: hsa a value
[00:37:30] jhass: dopie: when wouldn't it?
[00:37:35] Skaag: what's a good way to measure how long an operation takes in ruby?
[00:37:42] Skaag: I need to measure it in milliseconds
[00:37:50] dopie: it wouldnt when its nil or empty
[00:38:18] jhass: nil is a value and a variable that has nil assigned is defined
[00:38:28] jhass: what your definition of empty? is I don't know
[00:38:47] jhass: anyway, to suggest a better way to write this, we would need to know what the heck approved contains
[00:39:09] jen_: jhass: http://pastie.org/9994835
[00:40:10] jhass: jen_: uh, that's going into the specifics of the adwords API I think, of which I don't have a clue (and I'm quite happy about that fact)
[00:40:34] jen_: ok. I think we made some progress here.
[00:40:55] jen_: i may have to update google-adwords-api gem
[00:41:10] jen_: how do I do that?
[00:41:23] havenwood: jen_: In your Gemfile, change `source 'http://rubygems.org'` to `source 'https://rubygems.org'`.
[00:41:41] jen_: someone told me to put it to http
[00:41:58] jhass: jen_: to actually answer the question, since your Gemfile has no restrictions on that gem, just bundle update google-adwords-api
[00:42:02] jen_: ok, changing to https
[00:42:13] dopie: approved contains either true or false
[00:42:14] jen_: do bundle update .....
[00:42:47] jhass: dopie: no, the outer one, on which you're able to call each
[00:43:22] jen_: and then do bundle install again?
[00:43:22] havenwood: jen_: That's update *all* gems possibly, while the command jhass said just updates the one. Doing `bundle update` basically nukes your Gemfile.lock.
[00:43:43] jen_: i just did bundle update google-adwords-api
[00:43:49] havenwood: jen_: then: bundle
[00:44:02] havenwood: or `bundle install` if you like typing extra letters
[00:44:08] jhass: uh, well, bundle update does install already ;)
[00:44:30] havenwood: but henceforth
[00:44:54] havenwood: jhass: good point
[00:45:04] ponga: another good day
[00:45:16] jen_: jhass: havenwood http://pastie.org/9994838
[00:45:20] havenwood: i'm sick, therefore the day is not good. an adequate day.
[00:45:31] jen_: change it back to http?
[00:45:49] Senjai: havenwood: :(
[00:45:55] Senjai: When your day is bad, my day is bad
[00:46:13] Senjai: get better soon!
[00:46:14] dopie: https://gist.github.com/staycreativedesign/61fbabff14e819da39ab
[00:46:23] havenwood: Senjai: i'm on the mend :)
[00:46:27] dopie: approved = @user.receipts.map {|receipt| [receipt.confirmation?, receipt.is_approved?] }
[00:46:55] havenwood: jen_: no, fix the OpenSSL issues - don't http
[00:46:56] jhass: jen_: no, that one is unrelated to the Gemfile
[00:46:56] Senjai: dopie: That is painful :(
[00:47:12] dopie: Senjai, I am sorry that is what im trying to improve
[00:47:20] dopie: I am a novice rubyist and have to learn
[00:47:32] jen_: so keep it https
[00:47:48] jen_: do I need an SSL cert on the domain for this script
[00:47:48] Senjai: dopie: For starters, you cannot render more than once per action
[00:48:10] Senjai: unless your looking for the first receipt that is confirmed but not arpproved
[00:48:15] havenwood: jen_: with RVM you can drop the `bundle exec` prefix from commands, it'll automatically prefix it when there's a Gemfile present
[00:48:17] Senjai: but it doesnt mater because you dont change the state at all
[00:48:21] jhass: jen_: well, it might indeed be better to hire a dev who's capable to debug this stuff on the actual environment :/
[00:48:33] Senjai: dopie: You may also want to look at #rubyonrails
[00:48:45] jhass: since guess this remote gets increasingly hard
[00:48:48] jhass: *guessing
[00:48:52] jen_: Senjai: was going to do this with me in 40 min.
[00:49:08] havenwood: jen_: What OS/distro are you on, I don't recall?
[00:49:55] jhass: dopie: is the methods intention really to ever only look at the first receipt?
[00:50:09] havenwood: jen_: yum install ca-certificates
[00:50:12] jhass: Senjai: there are ugly and return's in there
[00:50:20] jhass: so it's a convoluted .first for the moment
[00:50:25] jen_: from root havenwood
[00:50:41] havenwood: jen_: escalate permissions however you prefer
[00:50:50] dopie: jhass, no it looks at all receipts
[00:50:53] havenwood: escalators or elevators?
[00:50:57] jhass: dopie: no
[00:51:10] jhass: dopie: that may be your intention, but it's not what it does
[00:51:13] dopie: yes sorry
[00:51:24] dopie: it looks at the first receipt and see's if its paid
[00:51:35] Senjai: jhass: Yeah, I noticed after reading it the second time
[00:51:38] jhass: and that's the intention still?
[00:51:54] jhass: Senjai: why i hate and/or for control flow :P
[00:52:17] Qladstone: if I want to access and evaluate the individual characters of a string
[00:52:27] Senjai: dopie: You dont understand the problem correctly. Say aloud, in words what the problem is, and then how you'll fix it
[00:52:32] Qladstone: .split('') is the best way?
[00:52:39] Senjai: you'll note your code does something incredibly more obtuse than the verbal solution
[00:52:42] havenwood: jen_: Also confirm that your .gemrc has https not http: cat ~/.gemrc
[00:52:47] jhass: Qladston_: .each_char/.chars
[00:53:01] ponga: i was going to answer but jhass already did so
[00:53:13] Qladstone: does that do the same operation?
[00:53:39] ponga: Qladston_: "Hello world".each_char do |c| your code with c end
[00:53:43] ponga: i believe this is it
[00:53:50] jen_: havenwood: gem: --no-ri --no-rdoc
[00:53:54] jhass: Qladston_: .each_char takes a block and yield each character, without a block it returns an Enumerator. .chars returns an array of the characters
[00:53:55] havenwood: Qladston_: #chars returns the same Array, but #each_char returns an Enumerator
[00:54:35] jhass: dopie: still waiting for clarification what the methods intention is :)
[00:55:02] havenwood: jen_: these days `--no-ri --no-rdoc` is `--no-document`
[00:55:25] jen_: so does this mean that file does not exist?
[00:55:27] havenwood: jen_: but yeah, no problems there
[00:55:40] havenwood: jen_: it's fine, try installing a gem after the package install
[00:55:51] Qladstone: which is more efficient? if I don't need an array, only if it is a means to examine the characters by referencing to a hash
[00:56:33] Qladstone: the hash has keys which are characters in symbols
[00:56:51] ponga: Qladston_: if not wanting seperate array i'd say each_char is good enough
[00:57:11] jen_: havenwood: should I do bundle update httpclient
[00:58:05] havenwood: jen_: no, what jhass said a while back, that gem
[00:58:15] havenwood: or did i miss a new error?
[00:58:33] Qladstone: that halved my execution time compared to str.split('')
[00:58:56] jhass: Qladston_: yeah, allocations are expensive ;)
[00:58:58] Qladstone: I have no idea why though
[00:59:27] jen_: havenwood: not sure which gem
[00:59:37] havenwood: scroll back!
[01:00:05] jen_: bundle update google-adwords-api ?
[01:00:15] Qladstone: thanks guys ponga and jhass
[01:01:39] dopie: Senjai, jhass the what the method intention is if the 1st receipt has a file and is not approved render :show else render :payment
[01:01:45] dopie: rofl the what
[01:01:58] jhass: dopie: anyway http://paste.mrzyx.de/pzvqnkklv
[01:03:01] jen_: jhass: havenwood I give up....
[01:03:04] jen_: jumping ship
[01:03:04] jhass: dopie: behavior is probably underterministic since you define no order to reliably determine what the first receipt should be
[01:03:10] jen_: thanks for your help.
[01:03:13] jen_: We tried.
[01:03:35] dopie: jhass, thank you
[01:04:02] jhass: jen_: yeah, as I said I think this needs someone who's able to debug it hands on in the actual environment
[01:05:02] jhass: it's a simple enough thing in theory, centos and the involved APIs are just crazy I guess :P
[01:06:11] dopie: man so much simpler how you wrote it
[01:06:23] dopie: i was like doing more work for nothing
[01:07:52] dopie: I basically didnt define the first receipt
[01:08:14] jhass: as said, please define an order too to make it robust
[01:08:29] omosoj: i want to use an array defined in another file. i'm using require_relative 'path/from/file', but the array isn't accessible
[01:08:48] jhass: I have no idea what would determine what the first receipt should be in your domain logic, so I couldn't do it
[01:09:11] jhass: omosoj: return it from a method or assign it to a constant
[01:09:33] jhass: top level scope does not share local variables across files
[01:09:43] omosoj: jhass, i see, awesome, thanks
[01:10:29] dopie: jhass, totally thankful !receipt.is_approved basically checks to see if the receipt isnt approved
[01:10:46] jhass: dopie: that's clear
[01:10:54] jhass: we just don't do the is_ prefix in ruby
[01:11:10] jhass: what .confirmation? says however is completely unclear
[01:11:40] dopie: so in ruby you dont use is_approved use approved, in rails use is_approved and not approved ?
[01:12:01] jhass: you don't use is_approved? in rails either I'd say
[01:12:22] jhass: after all rails is still ruby
[01:13:35] miah: approved? > is_approved?
[01:15:45] dopie: jhass, for confirmation basically its checking if the the receipt is there
[01:15:59] dopie: receipt.confirmation? i thought would be good
[01:16:09] miah: confirmed?
[01:16:40] jhass: dopie: what does it mean whether or not the confirmation is there?
[01:17:52] dopie: basically just check if the receipt is present or not
[01:19:14] bricker: It would be a mean trick if you had a method named "confirmed?" that returned a String
[01:19:33] havenwood: String is truthy, checks out.
[01:19:44] jhass: dopie: I don't follow
[01:19:50] bricker: havenwood: *always* returns a String
[01:20:01] havenwood: bricker: ewwww, madness!!!
[01:20:06] bricker: huehuehuehueuhee
[01:21:20] bricker: havenwood: hey I saw your name somewhere http://github-awards.com/users?utf8=%E2%9C%93&type=city&language=ruby&city=Los+angeles
[01:21:44] bricker: I am bumped to the second page :(]
[01:21:51] bricker: like a chump
[01:22:15] havenwood: bricker: guess we should chase some stars! (having project have it's own repo kills your popularity!)
[01:22:30] bricker: havenwood: yes :)
[01:22:39] havenwood: bricker: but i'll take it, nice to be on a good list!
[01:26:22] havenwood: not a naughty list. coal. beans. meh.
[01:28:37] jhass: bricker: that's site's very broken
[01:28:45] jhass: claiming I had no Crystal repo
[01:29:14] jhass: well one without stars, in any case, it's wrong
[01:31:39] havenwood: what's a good example of a use case for this?: https://bugs.ruby-lang.org/issues/10883
[01:32:02] a5i: because emeralds are too mainstream
[01:32:03] yoshie902a: anyone have experience using Watir with ruby?
[01:32:51] nahtnam: Is it possible to create a 3d game in ruby?
[01:34:04] jhass: havenwood: I think there's none :P
[01:34:25] havenwood: jhass: but i *want* a use case, i like it!
[01:34:45] havenwood: jhass: i don't like having to break my method chaining to assign a var
[01:34:46] a5i: nahtnam: v ?
[01:34:49] a5i: http://old.thoughtsincomputation.com/posts/my-first-real-rails-webgl-game *
[01:35:31] jhass: maybe something that involves operators, like "123".to_i.itself {|n| n-3 }.to_s
[01:35:51] jhass: vs ("123".to_i-3).to_s
[01:36:08] jhass: but not sure that would be an improvement still tbh
[01:36:14] nahtnam: a5i: Is it not possible to create a native client?
[01:36:29] havenwood: jhass: i waaant it, but yeah it's hard to find something compelling
[01:36:35] a5i: nahtnam: I dunno, Im a noob to :P
[01:37:25] jhass: havenwood: I rather want find_itself :P
[01:37:57] havenwood: jhass: soul_search
[01:38:04] jhass: aka find_map or whatever a good name would be
[01:38:08] a5i: anyone here know steveklabnik ?
[01:38:09] jhass: .first_truthy
[01:38:12] havenwood: jhass: what would it do?
[01:38:27] jhass: return first truthy return value
[01:38:31] havenwood: interesting
[01:39:57] jen_: are you around now?
[01:41:26] jhass: havenwood: I also like .max/min/minmax_of that I added to crystal (and got flamed for that it's a bad name)
[01:41:55] jhass: which is an efficient .map().min/max/minmax
[01:42:44] havenwood: min_max_minmax
[01:43:59] a5i: http://nerds.airbnb.com/large-scale-payments-systems-ruby-rails/
[01:47:28] havenwood: >> 1.upto(3).max { |x| -x }
[01:47:29] eval-in: havenwood => 1 (https://eval.in/295286)
[01:47:56] havenwood: jhass: how bout just dropping the `_of` for min/max/minmax?
[01:48:08] jhass: not the same
[01:48:21] havenwood: ah, went over my head (my medicine head)
[01:49:18] jhass: >> (1..3).max_by {|x| -x }
[01:49:18] eval-in: jhass => 1 (https://eval.in/295288)
[01:49:35] jhass: yeah, max with a block is just max_by
[01:49:40] havenwood: >> (1..3).max { |x| -x }
[01:49:41] eval-in: havenwood => 1 (https://eval.in/295289)
[01:50:12] jhass: max_of returns you the -3
[01:50:34] havenwood: just actually read the assert >.>
[01:51:20] havenwood: i'm still confused, but it's probably just me.
[01:51:30] havenwood: i have a lot of crystal-lang studying to do
[01:51:31] jhass: so it closer to .lazy.map {|x| -3 }.max in ruby
[01:52:09] a5i: How good is Ruby with Cyber security?
[01:52:23] jhass: a5i: just as good as you and Java combined!
[01:52:41] a5i: I know Java
[01:52:54] jhass: how good is Java with Cyber security then?
[01:53:02] a5i: I dont know
[01:53:06] a5i: I never tried
[01:53:15] jhass: and how good are you with Cyber security?
[01:53:22] jhass: or Google?
[01:53:24] a5i: Rust :)
[01:53:42] jhass: how good is Rust with Cyber security then?
[01:54:11] mozzarella: rust seems to be popular among rubyists
[01:54:16] a5i: Never tried
[01:54:30] a5i: mozzarella: I went from Rust and now learning Ruby
[01:54:38] jhass: havenwood: another gem we have is Int#to, which automatically picks the right direction, so both 1.to(3) and 3.to(1) work like expected
[01:55:11] mozzarella: they're two different languages serving a different purpose
[01:55:16] jhass: a5i: can you answer any of my questions? if so I might be able to answer yours
[01:55:31] havenwood: jhass: i like that, very nice
[01:55:57] jhass: havenwood: yeah, it's especially nice if you don't know the values for one side
[01:55:57] a5i: jhass, I dont know
[01:56:12] jhass: a5i: what is cyber security then?
[01:56:24] jhass: what is hax?
[01:58:04] a5i: What is life?
[01:58:08] jhass: havenwood: invented it to dry up code into this method :P https://github.com/manastech/crystal/blob/master/samples/2048.cr#L296
[01:58:28] jhass: just in case I didn't tease your med head enough already :P
[01:59:11] jhass: a5i: so you asked a question about qualities of X in Y, without knowing what Y is? :)
[02:00:54] jhass: well, I for one can't make sense out of the question, which is why I try to find out what you're thinking of when you say "cyber security"
[02:13:38] a5i: is JRuby Ruby syntax?
[02:13:42] a5i: im kinda confused
[02:13:59] headius: jruby is just ruby on the jvm
[02:15:24] a5i: Oh Okay
[02:15:34] jhass: Ruby the language has several implementations (=programs that interpret and execute it), most popular MRI (aka CRuby, aka the main one), JRuby and Rubinius
[02:16:06] a5i: JRuby seems to be the fastest
[02:17:18] headius: we've worked hard to make it so
[02:17:47] vhlfd: I wonder if there's pyruby.
[02:18:06] jhass: vhlfd: topaz
[02:18:10] miah: there are 2 pyrubies
[02:18:33] headius: topaz is out there but no longer developed
[02:18:37] jhass: miah: what's the other one?
[02:18:45] miah: wasnt there pyruby and topaz?
[02:18:54] headius: never heard of pyruby
[02:19:01] jhass: oh, interesting
[02:19:23] ponga: Jruby+Truffle+Graal ftw
[02:19:26] ponga: it really is fast
[02:19:28] jhass: that looks... interesting
[02:19:30] jhass: https://github.com/danielfm/pyruby
[02:19:58] ponga: interesting
[02:20:00] headius: trolly mctrollerson
[02:20:04] headius: https://github.com/danielfm/pyruby/blob/master/src/ruby.py
[02:20:29] jhass: yeah just noticed :D
[02:20:40] jhass: earns a star from me^^
[02:25:30] jhass: then there's https://github.com/mtmiron/Pyruby
[02:25:42] throstur: I have a ruby script that works on linux, but when I run it on windows I can't find my device (it's on wifi)... what does windows do that could be blocking it?
[02:26:08] jhass: and that's all I can find, miah got any link?
[02:26:28] jhass: throstur: more details!
[02:26:55] throstur: jhass: erm... ruby gem lifx-console doesn't detect a device when run on Windows 7 Ruby 2.1.5, works Arch Linux Ruby 2.2
[02:27:10] throstur: also this script works on linux not on windows https://github.com/ThrosturX/lifx-ruby
[02:27:27] throstur: jhass: lifx gem found here https://github.com/LIFX/lifx-gem
[02:28:19] a5i: Rails itself is pretty low in this round :( https://www.techempower.com/benchmarks/
[02:28:38] jhass: okay, that is just a thin wrapper around lifx and pry
[02:29:09] throstur: jhass: any idea what could block ruby lifx gem from connecting to devices?
[02:29:23] throstur: I have added a "Windows Firewall Exception" but it doesn't seem to have cut it
[02:29:39] throstur: N.B. my windows computer is not on wifi, but on ethernet
[02:30:37] jhass: throstur: https://github.com/LIFX/lifx-gem#requirements doesn't give much hope for windows support I guess
[02:30:53] throstur: jhass: it seems they simply didn't test it, what could the 'ruby' cause be?
[02:31:32] jhass: gotta find the discovery code
[02:31:46] throstur: jhass: https://github.com/LIFX/lifx-gem/blob/master/lib/lifx/transport_manager/lan.rb maybe?
[02:32:51] jhass: yeah, looks like it
[02:33:15] jhass: relies on https://github.com/LIFX/lifx-gem/blob/master/lib/lifx/transport/udp.rb
[02:33:48] jhass: https://github.com/LIFX/lifx-gem/blob/master/lib/lifx/transport/udp.rb#L34 and that's where my vague ideas of what windows might support and what not end
[02:34:04] jhass: but I suspect it could be unsupported
[02:34:25] jhass: https://github.com/LIFX/lifx-gem/blob/master/lib/lifx/transport/udp.rb#L65 especially
[02:36:27] a5i: Ermegaherd
[02:37:43] jhass: a5i: btw, random benchmarks are usually useless, you can benchmark specific alternative for a specific usecase, but not general "X is better than Y"
[02:39:02] a5i: jhass ?
[02:39:14] a5i: not really compiling u
[02:39:42] shevy: I would compile jhass any minute
[02:40:00] jhass: shevy: I do not compile well without package managers
[02:41:44] jhass: a5i: like in the json example you linked, that info is not relevant unless you know that your specific application needs fast json handling (note I'm not even saying any JSON handling at all, but whether you need fast one) and it does not say whether the fast alternative fits well into all other aspects you need
[02:41:56] jhass: a5i: there's nothing general we can learn from it
[02:42:11] a5i: what about plain text jhass ?
[02:42:21] jhass: it's only helpful when we have a specific usecase and put different factors against each other
[02:42:31] throstur: jhass: playing with sockets in ruby seems to work on windows, I wonder why it won't find the device
[02:43:06] jhass: throstur: not saying sockets don't work, I'd worry the specific opts used are supported/have any effect or even the same effect
[02:44:34] throstur: jhass: I don't know how to make a concrete runnable example but I tried this: http://mysticpaste.com/view/2lae1uxQzr;jsessionid=125vwnpyqd5ndvwzkwfpk0vwr?2
[02:45:27] jhass: throstur: so you get beacons from your device with that?
[02:45:43] throstur: jhass: no I just run both on this machine, I don't know how to talk to the device
[02:45:57] a5i: Anyone here know Voltrb ?
[02:46:01] throstur: I don't think the device sends beacons? how do I know if it sends beacons?
[02:46:30] jhass: throstur: if I followed correctly the code listens to the broadcast address
[02:46:51] jhass: and I wouldn't know how it would discover its IP otherwise
[02:47:33] jhass: ah, mmh, actually does send broadcasts (too)
[02:48:23] jhass: does wireshark work on windows? might be worth watching / comparing to the linux box
[02:49:44] jhass: seems to expect messages on the broadcast too https://github.com/LIFX/lifx-gem/blob/master/lib/lifx/transport_manager/lan.rb#L172
[02:49:50] throstur: jhass: I don't have awireless card on the windows computer, it's connected via LAN
[02:50:04] jhass: unlikely to make a difference
[02:50:22] jhass: this is TCP/UDP layer stuff
[02:50:34] jhass: difference between wireless/lan is several layers down
[02:52:24] throstur: Wireshark seems to have a windows version, but I don't really know what I'm oloking for
[02:53:04] jhass: turn of as much network stuff on your windows box as possible and just watch it for a while
[02:53:08] jhass: be adventurous!
[02:53:35] jhass: with network stuff I mean browsers, steam, messengers, stuff that uses the network
[02:54:10] throstur: I'm sshing into this weechat
[02:54:55] jhass: mmh, filtering out ssh should be fine
[02:54:59] jhass: !ssh as filter I think
[02:55:55] jhass: and actually try filtering to udp traffic
[02:56:51] jhass: and getting rid of dns should reduce it fairly well
[02:56:56] jhass: udp && !dns
[02:59:52] zachrab: having trouble parsing a date time
[03:00:13] zachrab: Time.parse "2012-??12-??02T00:30:08.276Z"
[03:00:26] jhass: zachrab: what's the spaces doing there?
[03:00:38] zachrab: jhass: what spaces?
[03:00:59] jhass: >> require 'time'; Time.parse "2012-??12-??02T00:30:08.276Z"
[03:01:07] jhass: ah, you're the one with the unicode -
[03:01:39] jhass: try .tr("-??", "-") on your input to sanitize it I'd say
[03:01:41] zachrab: im getting an argument out of range error
[03:02:13] throstur: jhass: I can only use the 'udp' filter, not !dns or !ssh
[03:02:32] jhass: throstur: huh? why's that?
[03:03:09] throstur: ah I see there's a second filter nevermind
[03:03:37] jhass: throstur: you can literally enter udp && !dns into the text field and press enter (twice)
[03:04:07] jhass: zachrab: use strptime
[03:04:14] shevy: zachrab can you try without the ?? character?
[03:04:44] throstur: jhass: I'm not sure what much of this is, there's a lot of "SSDP" thingies, and some ipv6 addresses
[03:05:54] zachrab: shevy: what character
[03:06:08] jhass: throstur: the ssdp seems to use http atop, you can filter it out with !http
[03:06:13] shevy: zachrab hmm "??" I can't display it, I am on a non UTF system
[03:06:28] shevy: emocakes hey
[03:07:59] jhass: zachrab: you got a U+00AD SOFT HYPHEN after the -
[03:08:20] jhass: shevy: it's an invisbile character
[03:08:36] shevy: what are you guys doing
[03:08:40] shevy: coding with invisible characters
[03:09:27] throstur: jhass: I don't see any packets with source of the IP that the bulb has
[03:09:50] jhass: throstur: do you see packets when you run the script?
[03:10:23] jhass: should have destination I think
[03:10:42] jhass: er, 255 for the last too
[03:12:19] jhass: shevy: it marks a position in the text where it's good for the computer to enter a linebreak
[03:12:32] throstur: jhass: I see a message to .255
[03:12:45] jhass: shevy: with adding a - at the end of line that is
[03:14:27] throstur: jhass: does it help if you see the packet from the light bulb?
[03:14:41] jhass: shevy: so "foo\u00adbar" says display "foobar" when in the sameline, "foo-\nbar" if you have to break the word
[03:14:42] jhass: throstur: so looks like the script is sending it out, might be a stupid windows firewall thing that filters it out? dunno
[03:14:42] jhass: or that hides the reply to the broadcast
[03:15:36] jhass: throstur: not sure, I don't work with windows after all
[03:18:12] throstur: jhass: I'm getting a lot of packets to/from microsoft
[03:18:17] throstur: jhass: any idea how to filter them?
[03:18:36] jhass: microsoft is no protocol
[03:18:54] jhass: nor an ip nor a port
[03:19:03] jhass: so what kind of packets?
[03:19:15] throstur: some kind of ndm-requester packets
[03:19:29] jhass: a bit vague
[03:19:43] jhass: ndmp seems to be a valid protocol
[03:20:23] throstur: jhass: what info can I give you
[03:20:41] jhass: screenshot of the packet if everything else fails
[03:21:02] jhass: but maybe you can just filter on a common destination ip or port?
[03:23:22] jhass: udp destination port is udp.dstport, destination ip is ip.dst, you can filter out specific values with simple != 12456 stuff
[03:24:02] throstur: jhass: looks like windows machine sends packet to 1.255 but doesn't get a reply
[03:24:10] throstur: when I send from linux answers
[03:24:44] jhass: yeah, so the question is whether it doesn't get an answer or it just doesn't see it (some firewall filters it out)
[03:25:22] jhass: or rather whether it actually leaves the machine in the first case
[03:25:27] throstur: jhass: windows machine sees the packet that is sent to the laptop, so it should see an identical one sent to itself -- what if firewall is blocking outgoing connection?
[03:25:47] Rennex: anyone here knowledgeable about testing? it seems to me that rspec, test::unit, minitest, shoulda all have TERRIBLE syntax, and cucumber is just stupidly verbose. Bacon looks usable to me though. But is it stupid to use that these days? Or is there something even better?
[03:25:57] jhass: yeah, that's what I meant, either the outgoing broadcast is filtered or the incoming one
[03:26:53] jhass: throstur: did you try general "lifx found from windows" google searches btw?
[03:27:00] jhass: *not found
[03:27:32] jhass: or is there any other windows software for which it works maybe?
[03:27:47] jhass: in the later case comparing the sent packet would be interesting
[03:33:04] throstur: I can't get the other tools to work either
[03:33:08] throstur: send packets but not found
[03:35:29] jhass: throstur: so your linux lap and your windows box are on the same network (same subnet)? If so, does the linux box see the broadcast packet generated by the windows box? if so does the windows box see the broadcast package generated by the linux box? if so does the linux box see a reply packet to the broadcast package generated by the windows box? or does the windows box see a reply packet to the broadcast
[03:35:30] jhass: package generated by the linux box?
[03:35:55] throstur: ok time to figure out how to use wireshark-cli :p
[03:36:04] jhass: uh, maybe not :P
[03:36:19] jhass: though you had GUI on both :)
[03:36:33] throstur: I can fetch the linux one
[03:37:01] jhass: well, GUI-less linux to GUI linux would be easy w/ ssh
[03:37:15] jhass: you just ssh -X to the GUI less one and can start gui programs
[03:37:40] jhass: windows makes everything harder :P
[03:37:54] shevy: you can play games on windows!!!
[03:38:21] throstur: I don't even know what my wireshark-gtk binary is called
[03:38:22] jhass: shevy: I played through half life on linux. Without using wine
[03:38:36] jhass: just wireshark I think
[03:39:01] throstur: yeah should've guessed
[03:39:08] throstur: zsh didn't autocomplete :p
[03:40:02] jhass: rehash ^^
[03:41:55] throstur: jhass: the linux box sees the same packet as the windows box being sent from windows to router
[03:42:15] jhass: but there's no reply on either?
[03:42:30] throstur: I ran it three times in a row and the light bulb finally replied
[03:42:33] throstur: maybe it just... takes longer?
[03:42:44] jhass: mmh, maybe, weird though
[03:43:06] jhass: the lightbulb is wireless too I guess?
[03:43:19] jhass: maybe your router is just bad at routing broadcasts lan -> wireless
[03:44:11] throstur: jhass: is there a way to check that?
[03:44:20] jhass: probably but I don't know
[03:45:19] throstur: the destination port is different in the packets
[03:45:34] throstur: linux tries 56700 windows tries 56721
[03:45:47] jhass: interesting
[03:46:11] throstur: it's actually connected now but sending to 57621
[03:46:12] jhass: https://github.com/LIFX/lifx-gem/blob/master/lib/lifx/transport_manager/lan.rb#L7 gem should default to 56700
[03:46:48] throstur: maybe I'm using 56700 already
[03:47:07] jhass: it's still pushing all traffic over broadcast?
[03:47:26] jhass: (
[03:48:26] throstur: jhass: ithe windows client is only sending to
[03:48:55] jhass: oh, right, subnet broadcast
[03:49:12] jhass: so broadcast vs multicast? mmh might explain the difference
[03:49:48] jhass: also seems to suggest the broadcast sockopt is indeed having no effect on windows :)
[03:50:16] throstur: I think it's the port though
[03:50:33] jhass: it's all udp still though, no?
[03:51:05] throstur: the reply from the light bulb is a "STUN" message
[03:51:06] shevy: hmm collections have .first and .last
[03:51:10] jhass: so unless the protocol is somehthing funky, reusing the port should be no problem
[03:51:11] shevy: not .second I suppose?
[03:51:20] jhass: STUN is a layer above I think
[03:51:27] jhass: click the packet to see all layers
[03:51:40] jhass: shevy: rails adds .second iirc
[03:51:42] shevy: jhass does crystal have .second?
[03:51:48] jhass: don't think so
[03:53:05] jhass: throstur: anyway, I kind of doubt port, reusing the port on udp should be no problem unless the protocol is doing something funky, as said, and tcp connections are unique by {srcip, srcport, dstip, dstport}
[03:53:27] throstur: jhass: but it's sending to destination port 56721 instead of 56700
[03:53:54] jhass: yeah, that seems silly
[03:54:21] jhass: but I can't be bothered to dig further into the protocol or gem tbh :P
[03:54:51] shevy: you have a lot of time!!!
[03:55:01] jhass: might even have to do with broadcast vs multicast, I don't know
[03:55:20] jhass: I think the discovery issues come from ^
[03:55:37] jhass: shevy: that I could spend on writing crystal instead!
[03:56:06] jhass: shevy: here's tetris: https://github.com/weskinner/crystal-tetris
[03:56:59] shevy: it works?
[03:57:11] jhass: not polished yet, but yeah
[04:00:34] jhass: shevy: proof http://cloud.aeshna.de/u/mrzyx/screenshots/screenshot_20150303_050019.png
[04:01:50] ponga: that's cute
[04:03:45] shevy: ponga still coding in crystal?
[04:05:45] shevy: http://www.microsoft.com/typography/OpenTypeDev/devanagari/intro.htm
[04:05:52] shevy: korean font is much simpler than hindi font
[04:06:25] ponga: shevy: kind of, yeah
[04:06:51] ponga: korean letter is line,circle,square
[04:07:04] ponga: you can even make cuty face
[04:07:06] ponga: ?????????
[04:09:22] shevy: I don't see a thing :)
[04:09:38] shevy: I wonder if we can have a better language
[04:09:43] shevy: that also is a better programming language
[04:10:04] shevy: all the languages that were developed in the past, happened out of natural communication with human beings
[04:10:24] shevy: they aren't really efficient for a computer
[04:10:34] shevy: I don't see what you are typing there either jhass
[04:10:50] jhass: shevy: must be sad to be you then
[04:11:14] shevy: I feel everything is very simple
[04:11:19] ponga: shevy: im doing similar kind
[04:11:22] ponga: better natural language
[04:11:31] throstur: bah, I'll file a bug report, they can report it upstream to ruby if it's not their own issue
[04:11:31] shevy: ponga english is simpler than german :)
[04:11:42] ponga: uh all yorop langs look crap to me anyway
[04:11:45] shevy: well, the pronounciation is a bit strange
[04:11:46] throstur: jhass: do you think I should report a bug to ruby myself?
[04:11:54] jhass: throstur: nope
[04:11:58] shevy: UK english vs. US english, like "colour" vs. "color"
[04:12:07] throstur: fair enough, it's bed time then and thanks for the help
[04:12:19] ponga: shevy: i think trunk looks more like a trunk than a boot
[04:12:21] ponga: but i say boot
[04:27:09] ponga: shevy: do you believe that there can be one better explicit human language
[04:27:21] ponga: that could better fit in computer era
[04:27:25] shevy: languages always change by usage
[04:27:37] shevy: but computers also change humans, see smartphones and tablets
[04:41:03] shevy: what is a simple way to go from
[04:41:15] shevy: "foobar-1.0.tar.xz" to "foobar-1.0"?
[04:41:19] shevy: just .gsub?
[04:41:25] shevy: or is there something better
[04:42:42] jhass: shevy: .split on . ?
[04:42:57] jhass: File.basename with second ard?
[04:49:24] ponga: => ["foobar-1", "0", "tar", "xz"]
[04:54:38] shevy: too much java in you
[04:59:35] Qladstone: hello friends
[04:59:44] Qladstone: I have a question about binary search trees
[05:00:30] Qladstone: how does a binary search tree perform compared to a regular sorted array? In terms of binary search / insert operations
[05:01:21] Qladstone: I'll be implementing it in Ruby
[05:03:40] tejasmanohar: anyone here use capybara on an arch linux box
[05:12:42] nahtnam: I have this code in my rails mode: https://gist.github.com/nahtnam/1a622c8ebe738e20c619 when I pass something like "https://nahtnam.com", the query and fragment come up as nil. How can I make it so that query and fragment are not included if they are nil without using if statements?
[05:15:38] nahtnam: sorry wrong channel. Its supposed to be on #rubyonrails
[06:02:31] ParmesanCaesar: looking at pictures of cats
[06:07:51] shevy: let cats code
[06:20:14] omosoj: blah = "not blah"; is there a way to get the actual name of that variable (blah) and make it into a string?
[06:26:04] arup_r: omosoj: http://pastie.org/private/5yyrmqwht1ce9kkjfbmx3a
[06:26:21] arup_r: you must be in Ruby 2.2.0
[06:27:26] omosoj: wow, interesting
[06:27:33] momomomomo: you wouldn't want to do that in production I'd bet
[06:28:09] arup_r: little mistake
[06:28:12] arup_r: one moment
[06:29:29] arup_r: omosoj: http://pastie.org/private/wathllsmiitwzzvcsta8aa
[06:47:25] arup_r: certainty: I'm in uncertainty.. o/
[06:52:09] omosoj: i am writing a bunch of rake tasks... what should i name the file that am storing code that's common to all the tasks? is it a concern or service or what?
[06:52:15] arup_r: >> "string".match(/str/); $&
[06:52:15] eval-in: arup_r => "str" (https://eval.in/295337)
[06:52:24] certainty: arup_r: what are you uncertain about?
[06:52:26] arup_r: $& is giving the matched string
[06:52:49] arup_r: what global will give me the umatched string?
[06:52:57] arup_r: unmacthed **
[06:53:11] arup_r: I knew it exist.. but now I forgot
[06:53:46] certainty: omosoj: i'm not aware of a naming convention for that. i'd probably place it under lib/rake/common.rb or something
[06:53:50] apeiros_: arup_r: $` and $'
[06:53:54] apeiros_: arup_r: but don't use the globals.
[06:54:08] apeiros_: .match returns a MatchData object which contains them too
[06:54:14] certainty: i was about to say
[06:54:23] certainty: i try not to use the globals
[06:54:26] arup_r: >> "string".match(/str/); p [$???, $`]
[06:54:29] certainty: are they thread local?
[06:54:34] omosoj: certainty, k, thanks
[06:54:35] arup_r: >> "string".match(/str/); [$???, $`]
[06:54:44] apeiros_: certainty: afaik they're even more restricted
[06:54:51] certainty: apeiros_: in what way?
[06:54:57] apeiros_: stack frame
[06:55:16] arup_r: this global variables now giving => [nil, ""]
[06:55:22] arup_r: not what I want
[06:55:30] apeiros_: but not sure, as I try not to use them. and it changed over time iirc.
[06:55:49] apeiros_: arup_r: because you're typing them wrong.
[06:55:56] certainty: so i'm not alone in avoiding them
[06:56:03] apeiros_: well, the first one at least.
[06:56:23] apeiros_: and if your font doesn't show that, you should use a better one :-p
[06:56:36] apeiros_: certainty: it's a good principle
[06:56:45] apeiros_: anyway, gotta commute, so bye :)
[06:58:05] arup_r: what it should be then ?
[06:58:18] gr33n7007h: >> "string".match(/str/); [$', $&]
[06:58:19] eval-in: gr33n7007h => ["ing", "str"] (https://eval.in/295340)
[06:58:36] certainty: try to copy it from here if nothing else helps :)
[06:58:59] arup_r: well Rdoc is not copy past able then http://ruby-doc.org/core-2.0.0/doc/globals_rdoc.html
[06:59:12] arup_r: gr33n7007h: THANKS
[07:00:22] certainty: hah, i just realized that i always completed gr33n... to green arrow instead of greentooth in my head
[07:00:52] certainty: arup_r: oh yeah you'r right
[07:01:39] certainty: there is another one that wont work with c&p
[07:01:50] eval-in: certainty => ["enumerator.so", "rational.so", "complex.so", "/execpad/interpreters/ruby-2.2.0/lib/ruby/2.2.0/i686-linux/enc/encdb.so", "/execpad/interpreters/ruby-2.2.0/lib/ruby/2.2.0/i686-linux/enc/trans/transdb.s ... (https://eval.in/295341)
[07:09:10] arup_r: next shoot
[07:09:24] arup_r: >> %w(a b c)
[07:09:24] eval-in: arup_r => ["a", "b", "c"] (https://eval.in/295342)
[07:09:41] certainty: yeah that's handy
[07:09:59] arup_r: but how would I create ["foo bar", "biz baz"] array using %w construct ?
[07:10:19] arup_r: >> %w(foo bar biz baz)
[07:10:19] eval-in: arup_r => ["foo", "bar", "biz", "baz"] (https://eval.in/295343)
[07:10:21] certainty: i think you can't
[07:10:28] arup_r: wouldn't work
[07:12:07] arup_r: >> %w(foo\ bar biz\ baz)
[07:12:08] eval-in: arup_r => ["foo bar", "biz baz"] (https://eval.in/295344)
[07:12:13] arup_r: certainty: ^^
[07:13:14] certainty: arup_r: ah good to know
[07:13:20] arup_r: https://simpleror.wordpress.com/2009/03/15/q-q-w-w-x-r-s/
[07:13:32] certainty: though in that case i'd just use ["foo bar", "biz baz"]
[07:17:49] Fluent: >> %W(#{'foo bar'} #{'biz baz'})
[07:17:49] eval-in: Fluent => ["foo bar", "biz baz"] (https://eval.in/295347)
[07:17:58] arup_r: Guys can you give me a 1 month part time remote job in Ruby ? I need ... :(
[07:18:13] arup_r: Fluent: that;s too much work :p
[07:18:15] Fluent: Freelancer
[07:18:16] flughafen: arup_r: those are handy
[07:19:08] arup_r: Fluent: \ is bad.. I know :)
[07:22:30] certainty: arup_r: sorry, we're not hiring at the moment
[07:22:51] arup_r: certainty: you are from ?
[07:23:36] arup_r: Ok... Good amount of Ruby work is there... I heard it :)
[07:23:44] arup_r: Good place
[07:23:49] flughafen: we're hiring ;)
[07:24:37] flughafen: oh arup_r just for 1 month...
[07:24:39] certainty: ACTION seeks a job in clojure or haskell shop :(
[07:24:53] flughafen: wo wohnnst du?
[07:25:08] arup_r: flughafen: U are from ?
[07:25:11] flughafen: <- n??rnberg
[07:25:16] certainty: the other end
[07:25:26] Fluent: The hell is that o.O
[07:25:36] flughafen: nuremberg? it's south of hamburg
[07:25:36] certainty: Fluent: in south germany
[07:25:46] flughafen: 1,5 hours nw of m??nchen
[07:26:05] Fluent: How do German's feel about foreign Americans?
[07:26:27] flughafen: Fluent: they are liked as long as you are nice. but keep in mind it's a lot different here.
[07:26:48] Fluent: I see. I'm trying to think of my backup country. America will not last.
[07:26:48] certainty: Fluent: depends on who you ask :)
[07:27:05] Fluent: I meant via general consensus
[07:27:23] flughafen: Fluent: are you american?
[07:27:27] certainty: most germans are open to people from other countries
[07:27:31] flughafen: I guess so, sorry ha.
[07:27:58] flughafen: Fluent: we're hiring ;)
[07:27:59] Fluent: Yes, I was born and raised in America. My ancestry is Cherokee Indian and Irish
[07:28:13] certainty: interesting though
[07:28:15] Fluent: The white men killed my peoples
[07:28:31] certainty: the white men killed $people
[07:28:46] wasamasa: men killed men
[07:29:06] Fluent: Men killed men of specific ethics
[07:29:15] Fluent: damn, wrong word
[07:29:27] Fluent: ethnicity lol, my brain isn't working.
[07:30:12] Fluent: So, you German's receiving all the news about ISIS too?
[07:30:20] flughafen: ACTION doesn't watch tv
[07:30:26] wasamasa: ACTION doesn't watch tv either
[07:30:33] wasamasa: but sure, it's all over the internet
[07:30:37] Fluent: I don't either, but I hear about it everywhere
[07:30:50] certainty: of course you hear about it
[07:31:34] Fluent: Yeah, my government scares me more than them. I need to go get an AR15 :D
[07:31:36] omosoj: i want to create a hash from 2 fields from an active record query.
[07:32:10] certainty: Fluent: your government scares many people. It certainly scares me more than most other
[07:32:22] certainty: other governments that is
[07:32:41] arup_r: omosoj: relation.attributes.only("field_1", "field_2")
[07:33:25] arup_r: Person.where(status: 'y').attributes.only("name", "email")
[07:33:30] arup_r: omosoj: ^
[07:34:48] arup_r: Fluent: If you set it as 'n'.. Those will be killed... And you wouldn't be in jail.. because those are killed by DB not by you
[07:35:10] certainty: also Hash[*something.pluck(:field1,:field2)] should probably work ... idk
[07:36:34] omosoj: you guys are so sharp
[07:36:59] omosoj: but i'm getting a NoMethodError, for attributes
[07:37:31] arup_r: Like Knife?
[07:37:32] certainty: then your $thing doesn't respond to attributes
[07:37:38] certainty: <- captain obvious
[07:37:58] arup_r: Person.where(status: 'y').first.attributes.only("name", "email")
[07:38:02] arup_r: omosoj: ^^
[07:38:03] omosoj: it's an active record relation
[07:38:51] omosoj: arup_r, now, NoMethoderror for only
[07:38:56] certainty: omosoj: #attributes is defined on instances of descendents of ActiveRecord::Base
[07:38:58] Fluent: It's a deprecated method anyways <3
[07:39:00] certainty: not on relations
[07:39:10] arup_r: ACTION CDing into his Rails app
[07:39:51] omosoj: yeah arup_r's recommendation hinted at that
[07:40:08] omosoj: no clue how you guys are so quick and good at this. i'm feeling a little bad
[07:40:30] certainty: omosoj: something.each_with_object({}){ |r,h| h[r.field1] = r.field2 } ... still i'd probably pluck it
[07:40:59] omosoj: i think i reached to stage where i have a good grasp of general programming stuff like thinking in pseudocode and then translating it to ruby, by i need to work on the deeper parts of the lagnauge
[07:41:09] arup_r: omosoj: your rails version ?
[07:41:32] omosoj: mine? it's a sinatra app, ruby 2.1.7
[07:44:29] shevy: arup_r what are you creating with rails?
[07:44:47] arup_r: e commerce site.. :p
[07:45:22] arup_r: omosoj: here is the correct syntax Spree::Product.where(description: "").first.attributes.slice("name", "style_code")
[07:45:41] arup_r: I messed up with as_json methods :only option,, sorry
[07:45:55] arup_r: http://api.rubyonrails.org/classes/Hash.html#method-i-slice
[07:46:24] certainty: #only used to exist. as well as #except .. both added by activesupport. idk if that's the case anymore
[07:46:52] arup_r: I'm not seeing #only here http://api.rubyonrails.org/classes/Hash.html#method-i-slice
[07:47:09] arup_r: but is is still alive with #as_json method
[07:47:42] certainty: hmm maybe #only didn't exist and my memory is failing
[07:47:43] arup_r: shevy: I didn't see any cats today
[07:47:52] arup_r: certainty: Its ok..
[07:48:08] arup_r: I need money madly.. so got mad about work
[07:49:24] arup_r: shevy: Your cat is married ?
[07:49:39] arup_r: Otherwise I'd recommend her --- https://www.facebook.com/paradise4cats/photos/a.453241181392131.106885.450334718349444/798526246863621/?type=1
[07:49:43] omosoj: arup_r, thanks. you are a ruby wizard
[07:49:53] arup_r: what does that mean?
[07:49:57] shevy: arup_r nah
[07:50:32] arup_r: BTW, I got inspired by shevy: to become a wizard omosoj: trust me
[07:50:58] arup_r: shevy: She is beautiful..
[07:51:10] arup_r: I never saw such a cat
[07:51:28] arup_r: OMG https://www.facebook.com/paradise4cats?fref=photo
[07:52:23] certainty: hah it's warm on there
[07:53:48] arup_r: You must die after seeing this -- https://www.facebook.com/video.php?v=798756473507265 :p
[07:54:09] arup_r: by laughing ofcourse
[07:54:54] shevy: arup_r fat-ass dog
[07:55:13] arup_r: he didn't know that
[07:55:16] omosoj: arup_r, are you serious? lol howso?
[07:55:37] arup_r: so so so so so
[07:56:45] arup_r: shevy: How was your breakfast with spam ?
[07:56:54] shevy: arup_r yeah, animals are kinda like "let's do this and do it quickly"
[07:57:12] shevy: not many can really think, like when monkeys panic and become dumber
[07:57:24] shevy: I had some bread and cheese actually
[08:02:34] arup_r: Anybody would like to give me http://clean-ruby.com/ .. I want to read.. No $ I have
[08:05:45] sevenseacat: begging for a job, begging for a book...? :/
[08:07:21] arup_r: _begging_ ..yes ... :/
[08:07:25] arup_r: sevenseacat: humm
[08:07:30] Fluent: For a book or a job?
[08:09:25] arup_r: Fluent: nothing.. :'(
[08:21:28] hs366: what optionparser do in simple words
[08:21:41] sevenseacat: parses options.
[08:23:32] hs366: can you explain a little bit more ?
[08:24:24] apeiros_: hs366: when you use a command line app, e.g. `gem install -v 3.2 rails`, then everything after `gem` is an option
[08:24:29] apeiros_: and optionparser parses those
[08:24:48] hs366: i usually read from ruby-doc but this "optionparser" i dont' get it yeat after 2 times reading
[08:24:55] apeiros_: though, it actually only parses the option flags, those which start with - and --
[09:20:10] Dolphi: I am creating my first text adventure in Ruby. Is there a way to control PowerShell with Ruby script? I want to take input from my user and if they press "1" it will CLEAR PowerShell before continuing the rest of the program.
[09:21:10] Dolphi: How would I go about telling PowerShell to execute "CLEAR" with Ruby code?
[09:21:29] tobiasvl: powershell?
[09:21:49] tobiasvl: so clear the terminal, you mean
[09:22:21] tobiasvl: is the command just called clear? system('clear') maybe? I barely know what PowerShell is :P
[09:23:37] toretore: powershell?
[09:25:02] Dolphi: Yes, clear the terminal
[09:25:45] Dolphi: I will give it a try tobiasvl. Will report back with results.
[09:28:06] Dolphi: Nothing happened. Time to look up some documentation. :P
[09:34:51] Dolphi: I got the desired results by using:
[09:34:52] Dolphi: puts "\e[H\e[2J"
[09:42:42] gr33n7007h: Dolphi: puts "\ec" shorter ;)
[09:43:42] Dolphi: gr33n7007h: Would puts "%x{clear}" work as well?
[09:44:13] gr33n7007h: Dolphi: yep, without the quotes
[09:44:15] Dolphi: I've only been messing with Ruby for a few days. This is my first programming language.
[09:44:25] gr33n7007h: Dolphi: cool :)
[09:44:39] Dolphi: gr33n7007h: Thanks for the help!
[09:54:08] Dolphi: gr33n7007h: puts "\ec" isn't working for me, neither is puts %x{clear}. I am running Windows.
[09:55:00] Dolphi: It would seem that puts "e[H\e[2J" is the only working solution.
[09:59:24] toretore: you should mention you're running windows as the first thing you do
[09:59:33] toretore: nobody expects or assumes that
[10:01:18] Dolphi: toretore: I'm sorry for not being specific enough. Do you have another solution to my question?
[10:01:41] toretore: i don't know anything about windows
[10:01:43] gr33n7007h: Dolphi: well, in powershell the clear command is cls
[10:02:10] Dolphi: gr33n7007h: It is? I just type "clear" and press enter to clear it.
[10:02:36] gr33n7007h: Dolphi: what are you running your ruby script from powershell?
[10:02:42] Dolphi: Pardon my newbie-ness :P
[10:03:01] Dolphi: Is that bad?
[10:03:25] gr33n7007h: do %x(cls) to get the ansi code :)
[10:04:16] gr33n7007h: "\ec" is linux specific
[10:06:09] arup_r1: Guys give me some light.. People talk about domain driven development.. domain objects... etc How to identify which objects are domain ?
[10:06:18] arup_r1: Brief me about it
[10:06:56] arup_r1: What's the principals and thoughts are behind of it ?
[10:07:11] arup_r1: What are the**
[10:08:39] toretore: domain objects are the things that are important, the stuff you work with
[10:08:57] toretore: for a bank it's Account, Transfer, AccountHolder, etc
[10:09:34] toretore: String and Integer are also important to your app, but they're not domain objects
[10:10:12] toretore: if you mention the name of a domain object to a non-developer, they'll recognize it
[10:10:42] gr33n7007h: Yep, looks like cls and clear are just aliases to Clear-Host so yeah within powershell "e[H\e[2J" would work
[10:11:37] arup_r1: Well toretore: Can I say the objects which I can map to database tables.. they are domain objects..
[10:12:37] toretore: arup_r_: don't worry too much about it
[10:12:41] toretore: it's not important
[10:13:05] toretore: in the end, everything is bullshit and nothing really matters
[10:13:15] arup_r1: I have too much understanding the issue about OOP ways
[10:13:30] arup_r1: I see toretore
[10:15:24] arup_r1: toretore: I read about private methods : make them private if it is unstable, public those are stable.. Well.. How about the protecteds then ? No I am not asking how it works.. I', saying how should I think about them.. Best way to think about them and use it properly
[10:17:11] arup_r1: I need to improve my OO understanding.. Otherwise I wouldn't get a good quality jobs.. My code is ugly.. although they are working too.. So I have to work on this ugly part.
[11:03:59] Dolphi: Should defined variables be stored in a seperate file and called from said seperate file? Wouldn't that make code look much more readable?
[11:04:47] Dolphi: I'm building a small text adventure and I already feel as if I could make it look nicer if I seperated all of the automated parts.
[11:05:01] Dolphi: toretore: Would it slow down my program?
[11:05:26] Dolphi: Thank you for the help.
[11:05:31] toretore: but it sounds like you're trying to write ruby like you would the language you're more familiar with
[11:05:46] toretore: in general you don't have this "problem" in ruby
[11:06:18] Dolphi: I first started off with Java, so that may be why.
[11:06:54] toretore: if you write a program that requires a lot of initialization, then it will go into the excutable file, and everything else is required from there
[11:07:18] Dolphi: https://gist.github.com/anonymous/9ee45f04b6288b6317ca
[11:07:39] Dolphi: Does this look good so far?
[11:07:55] toretore: it's not very ruby-like
[11:08:06] Dolphi: I mean, it works at least, but I always wonder if I should be writing it more cleanly.
[11:08:06] toretore: if you're just writing to learn it's fine
[11:08:23] Dolphi: I'm just learning right now. This is my first real program in Ruby.
[11:08:40] Dolphi: I've only made a text adventure in Java, and that is as far as my coding experience goes.
[11:08:41] toretore: if i were to write it, i would write separate classes in separate files
[11:09:15] toretore: don't worry too much about it, just have fun writing it
[11:09:46] toretore: then your next program can be "cleaner"
[11:10:16] toretore: don't define methods inside other methods though
[11:10:35] Dolphi: Thank you again for your help toretore. I should probably get ready for work haha. Enjoy your day everybody!
[11:10:43] Dolphi: Did I define a method inside of another?
[11:11:03] toretore: def start_game()
[11:11:03] toretore: def clear_console
[11:11:24] Dolphi: Ah...Where should they be defined?
[11:11:24] toretore: you should put all the method definitions at the top
[11:11:34] Dolphi: The very top of the program?
[11:11:43] toretore: in this case, yes
[11:13:13] Hirzu_: Well, defining a function inside function is fine IMHO, if you want to have local function not available anywhere else. Doesnt that function then also get handle to the context of the function is is created in?
[11:13:36] toretore: that's not how it works in ruby
[11:14:00] toretore: it will accept it, but it's the same as defining them side by side
[11:14:15] Hirzu_: havent really tried it myself, quite rare case when it would be even usefull.
[11:14:51] toretore: methods in ruby aren't functions; they belong to a class and that's it
[11:15:03] toretore: they can't exist outside the context of a class
[11:15:39] toretore: the instance of that class is the scope
[11:18:14] Hirzu_: so, module = class ?
[11:18:45] toretore: no, a module can't be instantiated
[11:18:57] toretore: you can't call a method defined in a module
[11:18:58] apeiros_: Hirzu_: other way round: Class < Module
[11:19:17] Dolphi: toretore: If you wouldn't mind, could you edit my gist? I want to see how you would define the things. I don't want you to make new files and classes
[11:19:31] Dolphi: I tried to do it and broke my program lol
[11:19:37] apeiros_: there's only instance methods in ruby. and the only container for instance methods is Module, and by inheritance Class
[11:20:23] toretore: Dolphi: also, don't use tabs, use 2 spaces
[11:20:23] apeiros_: (almost) every object has a singleton_class, which is the mechanism for things like class methods. the rest follows from those facts.
[11:21:11] Dolphi: toretore: Alright. Can you help me out please? I want to get this fixed before I head to work
[11:24:26] toretore: Dolphi: https://gist.github.com/toretore/7529d4576b5bc6fa2576
[12:00:09] avril14th: apeiros_: which objects have no Singleton class?
[12:00:34] apeiros_: immediates and numerics (not sure whether all)
[12:00:42] avril14th: immediates?
[12:00:47] apeiros_: immediates are: nil, true, false, fixnum, symbol
[12:01:00] avril14th: ACTION learnt something
[12:01:09] certainty: http://arxiv.org/abs/1503.00503 interesting read, has just been linked over in #chicken
[12:13:56] Mon_Ouie: nil, true and false are sort of weird:
[12:14:02] Mon_Ouie: >> nil.singleton_class == nil.class
[12:14:02] eval-in: Mon_Ouie => true (https://eval.in/295431)
[12:16:10] certainty: doesn't that make sense? i mean there is only ever one possible instance in those classes so both the singleton class and the class are essentially the same.
[12:19:30] Hanmac1: apeiros_ bignum also doesnt want to have a singleton_class
[12:19:31] Mon_Ouie: Yes, it sort of does, but I still find it odd that they're the only objects for which singleton_class returns just the same as class, as opposed to returning a subclass thereof
[12:19:58] Mon_Ouie: (and to list all exceptions, floats don't allow it either since some version of Ruby ??? 2.0 I think)
[12:20:54] Hanmac1: Mon_Ouie: i think its about flonum ... which only works with 64bit
[12:20:58] unshadow: My first gem: https://github.com/bararchy/safe-t-rest , what do you guys think ?
[12:21:03] Hanmac1: >> (1.2).singleton_class
[12:21:04] eval-in: hanmac1 => can't define singleton (TypeError) ... (https://eval.in/295432)
[12:23:54] Mon_Ouie: That might be why it changed, I thought it was just to make it so you can't do it with any numerical types since it would behave oddly for integers anyway
[12:30:20] avril14th: hanmac1: missing a dot? :)
[12:30:31] samfisher: how can I access browser data (history, form entries) with ruby?
[12:31:04] wasamasa: firefox saves history in a sqlite3 database
[12:31:15] wasamasa: and other data in a json file
[12:31:29] wasamasa: both are present in a profile saved in the user's directory
[12:34:21] arup_r: wasamasa: So we can connect to the FireFox Db and query and get whatever data we want
[12:34:53] apeiros_: hanmac1: yes, I said "numerics"
[12:35:05] apeiros_: floats afaik neither
[12:35:10] apeiros_: don't know about complex
[12:35:14] wasamasa: arup_r: sure
[12:35:39] wasamasa: arup_r: how do you think firefox knows the browser history in a session of a certain profile :P
[12:35:40] arup_r: wasamasa: cool
[12:35:51] wasamasa: arup_r: the json data stores state such as the tab history
[12:35:53] arup_r: humm.. I never thought about this
[12:35:56] wasamasa: arup_r: and probably much more
[12:36:06] wasamasa: arup_r: there's plenty stuff out there using sqlite3 which is pretty cool
[12:36:06] arup_r: today I did for you
[12:36:23] wasamasa: arup_r: I've once written a script that extracts a skype conversation log that way
[12:36:38] wasamasa: arup_r: the problem is just figuring out which field means what
[12:36:48] arup_r: So Skype also stores then in Sqllite DB?
[12:37:15] wasamasa: there's also embedded devices doing it
[12:37:15] arup_r: Ahh!.. Local DB?
[12:37:21] wasamasa: like my ebook reader
[12:37:29] wasamasa: it stores the last books read there
[12:37:42] wasamasa: yes, sqlite3 is a single-file/-user database
[12:37:49] wasamasa: and is excellent for embedding
[12:37:57] arup_r: I thought those are stored in their cloud hosted DB
[12:38:55] workmad3: arup_r: sqlite is a good choice for an embedded DB that acts as a local cache for data
[12:39:22] gr33n7007h: wasamasa: same for google-chrome?
[12:39:28] wasamasa: gr33n7007h: no idea, but very likely
[12:39:31] jhass: apeiros_: Ruby 2.2.1 ;)
[12:39:46] wasamasa: arup_r: nothing stops the application from mirroring the local cache to something remote
[12:39:54] wasamasa: arup_r: it's just important to have a local cache first
[12:39:58] gr33n7007h: ACTION is off to investigate
[12:40:17] wasamasa: gr33n7007h: great, report back once you've found out
[12:41:14] arup_r: wasamasa: you opened my eyes today
[12:41:26] wasamasa: arup_r: you're welcome
[12:47:17] arup_r: jhass: API is not ready in http://ruby-doc.org/
[12:47:22] arup_r: still 2.2.0
[12:48:05] jhass: yeah, they always take a while
[12:48:14] jhass: but there should be no API changes anyway
[12:49:26] arup_r: no they updated some docos.. https://bugs.ruby-lang.org/attachments/download/4882/doc_object_c.patch
[12:49:33] arup_r: So API is needed
[12:53:58] gr33n7007h: seems like history, cookies, etc are sqlite3 :)
[12:55:25] arup_r: gr33n7007h: gave the final sign-offf
[12:55:46] arup_r: ACTION heading to document these now officially.. 
[14:06:56] phale: how do i convert a character to hex
[14:08:41] certainty: >> " ".codepoints.first.to_s(16)
[14:08:41] eval-in: certainty => "20" (https://eval.in/295451)
[14:08:45] certainty: one example
[14:08:46] canton7: ' '.ord.to_s(16)
[14:08:54] canton7: >> ' '.ord.to_s(16)
[14:08:54] eval-in: canton7 => "20" (https://eval.in/295452)
[14:09:14] phale: that's a string
[14:09:25] canton7: 0x20 is a string, yes
[14:09:30] canton7: what did you want? an int?
[14:09:31] phale: but I need to compare hex values
[14:09:44] certainty: idk what to say
[14:09:54] jhass: phale: hex is the representation of a number, just like decimal is
[14:10:07] jhass: >> 0x0f == 15
[14:10:08] eval-in: jhass => true (https://eval.in/295455)
[14:10:16] phale: >> "0x20" == 0x20
[14:10:16] eval-in: phale => false (https://eval.in/295457)
[14:10:27] eval-in: jhass => 32 (https://eval.in/295458)
[14:10:37] phale: so what do i do
[14:10:37] jhass: >> "0x20".to_i(16) == 0x20
[14:10:38] eval-in: jhass => true (https://eval.in/295459)
[14:10:44] canton7: we're not sure what you want to do, right now
[14:10:46] jhass: >> "0x20".to_i(16) == 32
[14:10:47] eval-in: jhass => true (https://eval.in/295460)
[14:10:52] phale: ' '.to_hex
[14:10:54] phale: should return 0x20
[14:11:01] phale: not a string
[14:11:08] certainty: that doesn't make sense
[14:11:11] jhass: why can't it return 32?
[14:11:14] jhass: it's the same
[14:11:24] jhass: >> 32 == 0x20
[14:11:25] eval-in: jhass => true (https://eval.in/295463)
[14:11:56] certainty: >> 0x20.to_s(2)
[14:11:56] eval-in: certainty => "100000" (https://eval.in/295464)
[14:12:00] certainty: >> 32.to_s(2)
[14:12:01] eval-in: certainty => "100000" (https://eval.in/295465)
[14:12:04] certainty: same bit pattern
[14:12:30] workmad3: >> ' '.ord == 0x20
[14:12:30] eval-in: workmad3 => true (https://eval.in/295466)
[14:12:32] jhass: it's the same number, just two representations
[14:12:41] phale: workmad3 ;)
[14:12:43] phale: thanks for that
[14:13:06] jhass: >> ' ' == '\x20'
[14:13:06] eval-in: jhass => false (https://eval.in/295467)
[14:13:13] jhass: >> ' ' == "\x20"
[14:13:13] eval-in: jhass => true (https://eval.in/295468)
[14:13:35] jhass: >> ' ' == "\u0020"
[14:13:36] eval-in: jhass => true (https://eval.in/295469)
[14:13:39] workmad3: phale: although you really do need to recognise that different representations of the same value are all equal
[14:14:11] workmad3: phale: i.e. 0x20 == 32 == 040
[14:15:24] phale: really cool
[14:15:33] phale: i should read a tutorial i keep coming on here
[14:18:38] phale: how do i unsplit a string
[14:18:51] certainty: you can use String#join
[14:19:14] jhass: Array#join :P
[14:19:26] jhass: or is it even Enumerable#join?
[14:19:44] phale: i split an array with ""
[14:19:49] phale: not sure how to unsplit it
[14:20:10] phale: s/array/string
[14:20:12] certainty: sorry yeah i meant Array#join
[14:20:29] certainty: phale: http://ruby-doc.org/core-2.2.0/
[14:20:41] phale: i dont use ruby 2
[14:20:43] phale: i use 1.9.3
[14:20:53] certainty: then upgrade :)
[14:20:57] phale: i dont like parentheses
[14:20:58] ddv: 1.9.3 is EOL, phale
[14:21:05] certainty: http://ruby-doc.org/core-1.9.3
[14:21:19] canton7: this method was in 1.9 too
[14:21:20] certainty: phale: what does that have todo with parens?
[14:21:30] ponga: why am i still on 2.2.0-rc1
[14:21:30] canton7: and parantheses has bugger all to do with it
[14:21:32] ponga: gotta upgrade
[14:21:55] certainty: jhass: it's just Array#join i just checked
[14:22:14] ddv: i won't upgrade because I don't like commas
[14:22:23] certainty: though it probably made sense in Enumerable too
[14:22:48] jhass: phale: don't .split(""), use .chars/.each_char instead
[14:24:26] phale: oh that exists
[14:24:30] phale: i've been trying to implement uri encoding and decoding
[14:24:58] jhass: >> require 'cgi'; CGI.escape("/ /")
[14:24:58] eval-in: jhass => "%2F+%2F" (https://eval.in/295473)
[14:25:12] certainty: phale: http://ruby-doc.org/stdlib-1.9.3/libdoc/cgi/rdoc/CGI.html
[14:25:16] certainty: jhass is too fast
[14:25:32] phale: well i was trying to implement it myself
[14:25:45] jhass: >> require "uri"; URI.encode "/ /"
[14:25:45] eval-in: jhass => "/%20/" (https://eval.in/295474)
[14:26:06] certainty: i didn't know it was in URI
[14:26:20] jhass: note they're different
[14:26:26] jhass: URI.encode tries to be smart
[14:26:55] jhass: while CGI.escape encodes everything
[14:26:56] phale: http://codepad.org/E3UMdtF4
[14:26:58] phale: my current code
[14:27:15] certainty: ACTION consults rfc3986
[14:27:29] jhass: %20 and + is both valid ;)
[14:28:13] jhass: phale: you're aware of net/http I hope?
[14:29:02] phale: jhass: as i was saying
[14:29:06] phale: im trying to implement things on my own as an exercise
[14:30:16] wasamasa: "Let's implement it in a horrible way that teaches me nothing and call it exercise!"
[14:30:48] phale: why is it horrible
[14:31:07] wasamasa: ACTION looks at the code
[14:31:12] wasamasa: the tabs are horrible!
[14:31:20] phale: that's vim
[14:31:31] wasamasa: setting the tab width to 2 shouldn't be a problem
[14:32:18] wasamasa: the code is unidiomatic in places, such as the many return statements
[14:32:36] phale: well i used C prior to ruby
[14:32:56] wasamasa: you should strive for writing ruby, not C in ruby
[14:33:19] phale: other than the tabs and the returns
[14:33:21] phale: is it good
[14:35:08] jhass: phale: you duplicated code on lines 23, 25, 28, 31
[14:35:39] phale: how do i fix that
[14:35:50] jhass: no idea what the return false on 34 should be doing
[14:35:59] phale: yeah sorry i forgot to remove a lot of things
[14:36:25] jhass: also no need for the self.'s
[14:36:49] phale: what about the repitition
[14:37:06] jhass: and set_ua should be named user_agent= or just make it a attr_writer
[14:37:57] ddv: can't you just in inherit from TCPSocket? and then call send, I don't see a point in this wrapper class
[14:39:26] jhass: mmh, I do prefer delegation over inheritance
[14:39:45] ddv: yeah okay
[14:39:49] phale: so how do i fix the repetition
[14:39:56] jhass: look at your logic
[14:40:02] jhass: you do it always
[14:40:32] phale: does HTTP/1.0 accept
[14:40:35] phale: Host: host
[14:40:53] jhass: the RFC would know
[14:41:16] phale: "HTTP 1.1 has a required Host header by spec. HTTP 1.0 does not officially require a Host header, but it doesn't hurt to add one"
[14:41:25] phale: okay then i don't need the repetition
[14:41:29] phale: what about the user agent
[14:41:48] jhass: the RFC would know
[14:41:59] phale: no i mean in the code
[14:42:03] phale: what if @ua is nil
[14:42:12] jhass: then don't send a user agent
[14:42:44] jhass: that pastebin is crappy and won't let me get the code copy pasteable without downloading it, else I'd show
[14:44:09] ponga: use pastie, its minimal and allright
[14:45:34] ddv: use gist
[14:46:43] phale: http://codepad.org/1Hi8YuRq
[14:47:23] jhass: the return keyword on line 14 is still unnecessary
[14:47:31] phale: yeah i saw it and removed it just now
[14:47:53] jhass: if !foo.nil? -> unless foo.nil? -> if foo
[14:48:22] jhass: you don't need .nil? until false is a valid value and you need to differentiate
[14:48:25] tobiasvl: if you don't need to check that foo is specifically nil and not false
[14:50:37] jhass: phale: version for your original logic http://paste.mrzyx.de/poct5iar5
[14:51:07] phale: jhass: http 1.0 can use host too
[14:51:30] jhass: your original didn't send it in that case if I deciphered it correctly
[14:51:42] jhass: just showing how to write that clearly
[14:51:42] phale: does file need to be URI encoded?
[14:52:06] jhass: path would actually be a better name there and kind of
[14:52:21] jhass: well, actually it's a plain yes
[14:52:35] ChanServ: +o apeiros_
[14:52:35] phale: but it's a file
[14:52:45] jhass: no it's a path
[14:52:48] apeiros_: -b *!~ircap@*
[14:52:51] phale: is a file
[14:53:02] phale: \/ is a file
[14:53:10] jhass: GET / is a valid request
[14:53:20] jhass: / is not a file
[14:53:26] phale: it points to a file
[14:53:37] certainty: https://tools.ietf.org/html/rfc3986#section-3.3
[14:53:51] apeiros_: -o apeiros_
[14:54:12] phale: the last time i read a RFC is when i saw ipv6 addresses and ports
[14:54:17] phale: which created ambiguity
[14:55:00] certainty: i regularily have to read them. they are valuable resources
[14:55:15] PierreRambaud: certainty, +42
[14:55:51] certainty: some of them i should have said :)
[14:55:54] phale: 2001:4860:4801:5::91:8080
[14:56:00] phale: how wouldn't that create ambiguity for example
[14:56:06] jhass: certainty: RFC puzzle: does RFC6698 mandate DNSSEC
[14:56:07] workmad3: certainty: http2 is on my reading list atm :)
[14:56:09] phale: that's what I saw from an official IPV6 RFC
[14:56:55] workmad3: phale: it only creates ambiguity to humans
[14:57:06] PierreRambaud: workmad3, so true
[14:57:17] phale: weird protocol then
[14:57:37] jhass: the protocol never uses that presentation internally
[14:57:41] phale: anyways thanks for the help guys
[14:59:27] workmad3: phale: also, the recommended style is [2001:4860:4801:5::91]:8080
[14:59:56] PierreRambaud: workmad3, I think he rage quit :)
[15:00:08] workmad3: ah, just before I put that in :)
[15:00:18] certainty: jhass: it should. but i don't know if it does. it's on my to-read-list.
[15:00:26] workmad3: I could still tab-complete his name when I started typing ;)
[15:00:48] jhass: certainty: my stand point is that it falls apart if not, but doesn't explicitly state it ;)
[15:01:07] apeiros_: jhass: my now favorite question for people who want "an integer in hex, but not a string(!)": "what base does 'twelve' have?" because the base of a number is only representational.
[15:01:47] jhass: apeiros_: nice one, I'll try to remember it :D
[15:01:50] certainty: tlsa in theory can exist without dns and thus dnssec but dane explicitly choses to use the domain namespace to store the data
[15:02:11] certainty: and to make it usable you better be sure that records are valid
[15:03:25] jhass: yeah, there's also 4.1 which doesn't work without it
[15:04:08] workmad3: jhass: reading through the introduction, DANE seems to basically be saying "The easiest way to secure your DANE bindings is to use DNSSEC to secure your DNS records... however you may have other ways to secure your records, so we aren't strictly mandating that you use DNSSEC"
[15:04:36] jhass: workmad3: yes, that's what the introduction says. now read 4.1
[15:05:28] certainty: jhass: in that case case 3 would match, wouldn't it?
[15:05:58] certainty: say there is no dnssec then the validation state should be indeterminate
[15:06:30] certainty: so yeah it seems to mandate DNSSEC to be usable
[15:07:30] workmad3: jhass: hmm... 4.1 seems to start with "Here is a protocol that uses DNSSEC" so it kinda follows that the description is then dependent on DNSSEC, but I agree that the wording isn't perfectly clear on that front
[15:11:30] jhass: so, now open RFC6394 :P
[15:12:10] apeiros_: jhass: organizing a digital scavenger hunt?
[15:13:00] jhass: https://tools.ietf.org/html/rfc6394#section-3.1
[15:13:54] jlebrech: i'm doing group_by on an array and get this output ['my-grouped-key', [...], ...] how do i turn it into ['my-grouped-key' => [...], ...]
[15:14:36] jlebrech: array of hashes*
[15:14:59] apeiros_: group_by does not return an array of arrays
[15:15:10] apeiros_: so you must be doing something else/additional???
[15:15:25] apeiros_: >> [1,2,3,4].group_by(&:odd?)
[15:15:25] eval-in: apeiros_ => {true=>[1, 3], false=>[2, 4]} (https://eval.in/295490)
[15:15:46] apeiros_: also, [key => value] is not a thing, {key => value} is
[15:16:25] jhass: it is, it's same as [{key => value}] :P
[15:17:15] certainty: jhass: that section sounds different
[15:18:28] toretore: associative array
[15:18:52] jlebrech: yeah, i'm getting an associative array
[15:19:03] apeiros_: toretore: careful, associative array does not need to be a hash
[15:19:21] toretore: i'm just making fun of the way php does arrays
[15:19:33] toretore: and call them that
[15:19:59] certainty: for me one of the interesting ideas with DANE is the possibility to have trust anchors at the level of your desire, thus reducing the need for centralized CAs
[15:20:00] apeiros_: >> [["hi", "there"], ["associative", "array"]].assoc("associative")
[15:20:01] eval-in: apeiros_ => ["associative", "array"] (https://eval.in/295494)
[15:20:05] apeiros_: toretore: ^
[15:20:20] toretore: jlebrech: as always, gist your code if anybody's going to be bothered to look at your problem
[15:20:22] apeiros_: jlebrech: I think you're confused or use bad terminology. please clarify.
[15:20:47] jhass: certainty: whole point of it to me, sad that mozilla prefers to add a CA to the broken system instead of implementing it
[15:20:49] ponga: isn't pastie not good enough?
[15:21:05] toretore: not good enough
[15:21:09] apeiros_: ponga: gist = better paste
[15:21:19] ponga: what the fuck is better paste you bunch of geeks
[15:21:24] ponga: pastie does what it needs
[15:21:29] toretore: gist is better
[15:21:38] toretore: that's just the way it is
[15:21:40] ponga: i understand pastebin sucks but pastie does its job
[15:21:47] apeiros_: paper & pencil does what it needs too
[15:21:54] apeiros_: yet, I prefer to use a computer
[15:22:01] havenwood: cyberpen and cyberpaper
[15:22:08] toretore: to see my code, telnet me at port 22684
[15:22:23] apeiros_: ACTION fingers toretore
[15:22:50] apeiros_: what hey? I want to have infos about you before I telnet! safer telnet, uknow?
[15:22:59] certainty: jhass: yeah it's a controversial topic. For us DANE is important to secure communications between our mailers
[15:23:48] toretore: watch out or i'll `touch` your endpoint
[15:24:52] certainty: ACTION waits for the obligatory: date; cd ~; unzip; touch; strip; finger; mount; gasp; yes; uptime; umount; sleep
[15:25:05] jhass: certainty: I can see that you need to be careful when deploying DNSSEC to bigger systems, but it's still an improvement in every aspect over the CA system and we won't get an alternative in the next 10 years
[15:26:38] certainty: jhass: probably not. though a common concern with DNSSEC is that it's still somewhat centralized. in order to verify your chain of trust you go up to the owner of your root zone. which is operated by the government (most likely)
[15:26:45] jhass: and I mean, Dyn does it, Cloudflare is about to launch it to all their customers, ICANN mandates it for all new gTLDs, can't be that bad
[15:27:02] certainty: yeah it is a good move
[15:27:19] gr33n7007h: arun_p, little example, https://gist.github.com/anonymous/3ce9ee94a23e67e6a99b # and loads more now on to firefox :)
[15:31:18] jhass: certainty: monitoring root zone -> TLD for unexpected changes should be easy, could built that into OONI or something and faking DNS replies for specific clients at the authoritative servers for a TLD seems like a difficult task
[15:32:00] jhass: and even then at most a single domain is affected, with a root cert you can pretend to be anybody
[15:32:11] catsoup: certainty: the owner of your root zone will not be your gov.t
[15:32:25] jhass: well, atm it is operated by verisgin, no?
[15:32:26] catsoup: the chain of trust is a bit broken, frankly
[15:32:43] catsoup: eh, by and large
[15:32:53] catsoup: the uk is speshul, we have Nominet
[15:33:13] catsoup: which *sort of* is run byt the govt, although not really, except where it is
[15:33:57] catsoup: but orgs like ICANN have more regulatory control than national gov.ts do
[15:34:30] MrMunchie: hello I am really new to ruby, I still cannot grasp the entire concept of symbols even after a few articles online. I know you cannot assign anything to a symbol with =, but how does a symbol ever reference anything? how do you make a symbol point to anything?
[15:35:12] jhass: you don't, a symbol is a value, like a string or a number is
[15:35:12] catsoup: jhass: if you've faked a response from the root server, how come only one domain will be affected?
[15:35:43] jhass: because otherwise people will notice quickly
[15:35:58] jhass: so you would want those attacks very targeted
[15:36:19] jhass: MrMunchie: any other programming languages you know we can relate concepts to?
[15:37:01] jhass: MrMunchie: do you know enums in Java?
[15:38:06] MrMunchie: yes, a numbered list with a string identifiers,
[15:38:12] MrMunchie: i hope thats a correct definition
[15:38:41] certainty: catsoup: i suspect the ICANN gets a good amount of steering from various sides. I wanted to express that the root zones might be under the control of governments.
[15:38:42] jhass: I'm more relating to the usecases
[15:38:45] jhass: MrMunchie: ^
[15:39:54] certainty: my head aches. i'll call it a day
[15:39:58] certainty: have fun peeps
[15:40:08] jhass: MrMunchie: so where you would use an enum in Java, or a magic value assigned to a constant, you use a symbol in Ruby
[15:41:02] MrMunchie: okay, this helps. thank you very much!
[15:46:37] zotherstupidguy: is there a ruby(not rails) solution for plural words?
[15:47:06] jhass: activesupport? :
[15:47:37] zotherstupidguy: yeah exactly wht i am tryin to avoid lol
[15:47:52] jlebrech: apeiros_: thanks, i had to figure it out for myself. associative array .first returns ['key', [values]] I wanted .values.first
[15:48:00] bhaak: use a language that doesn't have marked plural endings
[15:48:12] jen_: Senjai: hey there.
[15:49:40] jhass: zotherstupidguy: https://www.ruby-toolbox.com/search?utf8=%E2%9C%93&q=plural seems to have a few
[15:49:49] canton7: zotherstupidguy, https://github.com/rails/rails/blob/6c75a111995a9aab09e19c2b6a8a42162f689bc6/activesupport/lib/active_support/inflector/inflections.rb#L105
[15:50:06] canton7: it's released under MIT, so just grab the bits you need
[15:50:59] zotherstupidguy: well thanks jhass, canton7, i was really asking for somthing more native, it seems heavy to add a gem for this
[15:51:12] canton7: it's pretty language- and use-case-specific
[15:51:21] canton7: it's highly unlikely you'll find anything like that in a stdlib
[15:51:42] jhass: also why would activesupport implement it if there's something good enoguh in stdlib
[15:51:46] apeiros_: ACTION is left wondering what "more native" is supposed to mean
[15:51:51] havenwood: zotherstupidguy: adding a gem is how we add little features that aren't in core or stdlib
[15:52:08] havenwood: zotherstupidguy: octopus -> octopi isn't going to be in stdlib >.>
[15:52:20] havenwood: of any lang that i'm aware?
[15:52:25] zotherstupidguy: http://stackoverflow.com/questions/2446156/is-there-a-pluralize-function-in-ruby-not-rails got a simple solution (2010) i was hoping it is added to stdlib by now somewhere
[15:52:56] havenwood: zotherstupidguy: no, probably not in the stdlib of any language, though i'd love to be proved wrong on that - would be interesting to see whose done it
[15:53:02] apeiros_: zotherstupidguy: IMO doesn't make sense to add something like that to stdlib
[15:53:51] apeiros_: unless you're willing to go the way of the ignoramus and say "english is enough for stdlib"
[15:53:55] zotherstupidguy: it depends on how it is implemented, is dictionary lists the only way?
[15:54:12] apeiros_: zotherstupidguy: you have literally *no idea* how plurals work in different languages.
[15:54:20] canton7: zotherstupidguy, depends on the language
[15:54:33] canton7: zotherstupidguy, some will have rules that are followed 100%. most will have some ground rules and tons of exceptions
[15:54:46] canton7: some will just have lists of words and their plurals
[15:54:51] bhaak: apeiros_: well, this is ruby, the standard language would probably be "japanese" :-]
[15:54:58] apeiros_: bhaak: indeed
[15:55:00] canton7: some will have weird and wacky concepts of plurals (one, many, lots)
[15:55:17] zotherstupidguy: @apeiros languages == encodings?
[15:55:26] canton7: no, spoken languages
[15:55:30] apeiros_: zotherstupidguy: no. languages == languages.
[15:55:42] apeiros_: like english, japanese, malay???
[15:55:54] havenwood: zotherstupidguy: https://rubygems.org/search?utf8=%E2%9C%93&query=plural
[15:56:34] zotherstupidguy: i will take into the gems, see how it is done, cheers :)
[16:02:12] zotherstupidguy: for english https://github.com/stewart/plural/blob/master/lib/plural.rb this seems to work well via rules!
[16:02:45] zotherstupidguy: neat in size too!
[16:05:19] cr3: how can I get the path to the file that defines a module, given the module?
[16:05:48] avril14th: cr3: class Stb
[16:06:10] avril14th: cr3: class Stb; include Module; end; Std.new.method(:some_method_from_module).source_location
[16:06:27] avril14th: maybe there's better though
[16:06:45] jhass: for starters you can skip the include with .instance_method
[16:06:47] cr3: avril14th: I hope so, that's rough :(
[16:08:00] zotherstupidguy: grep -r "module" *
[16:08:10] zotherstupidguy: grep -r "module MyModule" *
[16:08:18] apeiros_: cr3: you realize that there's not necessarily a single location, or maybe not even a file, which defines a module?
[16:08:32] zotherstupidguy: apeiros_ yup! :)
[16:08:43] jhass: cr3: why do you need to know? just for debugging? if so, just use pry
[16:09:38] cr3: jhass: yes, this is for debugging
[16:09:50] jhass: cr3: http://pryrepl.org
[16:09:58] jhass: inside, $ MyModule
[16:10:22] jhass: launch it as a debugger: require "pry;" binding.pry
[16:30:12] pmarreck: Is there anything in Ruby that lets me check if a symbol has already been "seen" before I convert a string to one?
[16:31:06] bradland: pmarreck: "seen" is not a term i've heard before.
[16:31:33] pmarreck: I did find this sort of discussion from over a year ago about it https://bugs.ruby-lang.org/issues/7795
[16:31:48] pmarreck: bradland: well, the symbol is defined as soon as the parser sees it.
[16:32:10] pmarreck: :this_is_a_symbol <= now it's defined
[16:33:34] bradland: ah, so defined.
[16:33:38] pmarreck: I ask because I'm investigating Elixir and I see that it has binary_to_existing_atom (binary is a string, atom is like a symbol) which is pretty smart IMHO. Lets you take advantage of symbols/atoms without running into DDoS issues
[16:33:43] bradland: i thought you meant something more by "seen"
[16:33:49] bradland: as in, has the value been used in some way
[16:33:55] bradland: have a look at Symbol.all_symbols
[16:34:00] bradland: that's an array of all defined symbols
[16:34:19] bradland: problem is, i'm not sure how you check for a symbol without using the literal... which would constitute defining it
[16:34:32] pmarreck: bradland: So you'd have to map Symbol.all_symbols to string, see if your prospective symbol (which is still a string at the time) is in that list, and THEN convert it to a symbol?
[16:34:45] pmarreck: Which is silly
[16:35:05] bradland: yeah, that's an interesting question. how to check for the presence of a symbol without using the symbol.
[16:35:16] pmarreck: That's the only way I can think of
[16:35:35] bradland: seems expensive to go through and allocate all those strings
[16:35:42] bradland: but yeah, that seems like it would work
[16:35:42] pmarreck: Symbol.all_symbols.map(&:to_s).include?(prospective_symbol)
[16:35:52] pmarreck: yes, which is why I say it is silly
[16:36:14] pmarreck: and you'd also have to run it EVERY time you check... as the global symbol list may have changed in the meantime
[16:37:13] bradland: have you dug in to see what Elixir's implementation is like?
[16:37:27] bradland: if it does something similar, they might have a different idea
[16:37:35] pmarreck: bradland: I am pretty sure it calls down into the Erlang definition, but no I haven't looked at what Erlang does yet :)
[16:37:50] havenwood: pmarreck: Why are you converting a String to a Symbol?
[16:37:58] pmarreck: I don't imagine Erlang does anything like that, since it is a BIF and is therefore at the compiler level
[16:38:03] bradland: sh, sry. not familiar with Elixir.
[16:38:04] havenwood: pmarreck: What's your concern with doing so?
[16:38:33] pmarreck: havenwood: I want to not mention a Symbol unless it is already defined. The "non-mentioned" Symbol is currently a String which has not yet been converted, or vetted.
[16:38:47] havenwood: pmarreck: Why not mention it unless it's been defined?
[16:39:00] pmarreck: havenwood: Have you heard of the symbol DDoS?
[16:39:07] bradland: isn't symbol GC possible in recent versions of Ruby?
[16:39:09] havenwood: pmarreck: Distributed denial of service?
[16:39:20] jhass: pmarreck: normalize user input to strings, not symbols
[16:39:32] jhass: if you have to mix with user input, use strings, always
[16:39:37] pmarreck: jhass: That is a band-aid solution which forces you to give up the utility of symbols
[16:39:41] havenwood: pmarreck: That doesn't really make sense. But the latest stable Rubies do GC user created Symbols.
[16:39:56] jhass: pmarreck: no, it just limits the usage of symbols to their intention
[16:40:01] jhass: String#to_sym was a mistake
[16:40:07] havenwood: pmarreck: I think the best thing to look at is how you can not String#to_sym.
[16:40:32] pmarreck: Again, I refer you guys to erlang's binary_to_existing_atom, which if it existed in Ruby would be called something like String#to_existing_sym (which has actually been discussed on the Ruby mailing lists)
[16:40:47] pmarreck: In fact, that exact name has been discussed, and I only guessed it.
[16:41:10] pmarreck: jhass: No, it was not. NOT having String#to_existing_sym was the mistake.
[16:41:20] pmarreck: You can have a whitelist of symbols.
[16:41:30] pmarreck: Without forcing everyone to use strings.
[16:41:47] bradland: curious what happens if there is no existing symbol?
[16:41:51] bradland: return nil?
[16:42:17] jhass: pmarreck: I yet have to see a case whre String#to_sym is used that wouldn't be better solved by using strings at the target instead, so if you have a real world example of that, I'd be highly interested
[16:42:26] pmarreck: bradland: Good question, and really speaks to how to handle errors/fails. I say if it has a bang on the end, throw.
[16:42:37] pmarreck: I mean raise.
[16:43:04] pmarreck: jhass: Indexing on a symbol is quite a bit faster than indexing on a string. As is searching for a symbol in a list, etc.
[16:43:30] pmarreck: jhass: Strings use way more memory. Strings in Ruby take up a huge amount of the VM space.
[16:43:43] havenwood: pmarreck: So there are strings, frozen strings, dynamic symbols and static symbols. It seems to be static symbols you're concerned about. But you can't create them.
[16:43:50] pmarreck: jhass: You don't have to deallocate a symbol.
[16:44:06] havenwood: pmarreck: The GC will do that for you, as long as you created the Symbol.
[16:44:09] bradland: i don't know that you can do this cleanly in pure ruby
[16:44:10] jhass: pmarreck: sound like academic usecases, got benchmarks of a real world app that prove that was a bottleneck in it?
[16:44:43] havenwood: pmarreck: Now using frozen Strings, that makes sense. There's a frozen String literal: 'example'.freeze
[16:44:57] havenwood: pmarreck: That ^ won't create the unfrozen String, just a lovely frozen one.
[16:45:23] pmarreck: jhass: All code that had to convert to using strings instead of symbols is circumstantial evidence. Surely they would have all used strings from the start if symbols weren't merely different.
[16:45:46] havenwood: pmarreck: Why do you need a Symbol? Have a code example?
[16:45:54] havenwood: pmarreck: Seems you want a frozen string, no?
[16:45:55] bradland: lots of code that used symbols did so for reasons that weren't related to actual reasons
[16:46:00] jhass: no, fact is people don't grasp the Symbol usecases fully and misuse them
[16:46:01] bradland: just a lot of dogma
[16:46:02] pmarreck: havenwood: I am cool with frozen strings, but I don't know what optimizations exist around that down in the depths.
[16:46:46] pmarreck: jhass: Well, that is a reasonable argument, although essentially based on accepting the ignorance of programmers
[16:46:46] bradland: if the core concern is memory overflow DDoS, that's solved by GC of symbols, no?
[16:46:54] havenwood: pmarreck: They are lovely, keep object allocation down.
[16:47:18] jhass: people are ignorant yes. Programmers are no exception
[16:47:26] pmarreck: bradland: I suppose. Symbol GC is relatively new.
[16:47:31] havenwood: bradland: the double DD means distributed, so just DoS
[16:47:39] pmarreck: jhass: I like to keep my standards high and not assume my colleagues are ignorant. ;)
[16:47:49] havenwood: bradland: And yeah, there's no Symbol DoS vector any longer.
[16:47:51] bradland: ATM Machine!
[16:48:10] havenwood: Live in the now, maaan!
[16:48:23] bradland: brah, the evidence supports the cynics in this argument :P
[16:48:38] mistermocha: Hey all, where would be the right place to ask fpm questions?
[16:48:40] pmarreck: Eternal optimist I guess ;)
[16:49:46] bradland: mistermocha: not sure fpm has a specific channel, but you can always ask here.
[16:49:49] pmarreck: havenwood: There isn't a symbol DoS vector, at least in the standard gems... but there could still be one in your code, if anyone writes code ignorant of the possibility which accepts user input and symbolizes it... although symbol GC probably mitigates that now
[16:49:51] bradland: if it's ruby related, someone can probably help
[16:50:14] mistermocha: bradland: thanks ... it's just making me scratch my head as to why things behave like they do...
[16:50:45] mistermocha: so i'm making a shared library, call it foo.dll, that has to go in /usr/local/share/foo
[16:51:03] havenwood: pmarreck: Dynamic Symbol GC ftw.
[16:52:14] mistermocha: On my box, I put down directory foo in /usr/local/share, put foo.dll into it, and ran "fpm -n foo-dll -t deb -s dir /usr/local/share/foo"
[16:52:23] mistermocha: which is what the documentation on fpm hinted at
[16:52:52] jhass: isn't .dll a windows thing?
[16:53:15] mistermocha: dpkg contents show the file put in ./
[16:53:26] bradland: holy wow, so fpm has a channel: #fpm
[16:53:27] mistermocha: but the file doesn't end up in /usr/local/share/foo ... it ends up on root
[16:53:36] mistermocha: aw snap ... ok thanks bradland
[16:53:37] bradland: jordan sissel fights for the user, btw
[16:53:44] mistermocha: ACTION facepalms at himself
[16:53:50] bradland: started looking at the docs to see if i could help
[16:53:52] bradland: and saw that
[16:54:00] pmarreck: jhass: look here http://www.sitepoint.com/symbol-gc-ruby-2-2/ The very doc about symbol GC states: "We see that indifferent access hash with a string is about half the speed of a regular hash with symbol keys. We also see that using a symbol to access the value in an indifferent access hash is a whopping 5 times slower than using a regular hash with symbol
[16:54:17] pmarreck: There's your data.
[16:54:23] bradland: do not conflate indifferent access with string based hashes
[16:54:26] bradland: that's not the same
[16:54:35] bradland: because indifferent access requires one additional layer of indirection
[16:54:43] pmarreck: HashWithIndifferentAccess stores string keys, however
[16:55:01] pmarreck: but yes, there is 1 additional layer of indirection. Fair enough. Would that account for a doubling of time?
[16:55:17] jhass: pmarreck: The point is that AS:HWIA is a mistake too, Rails should never have allowed params[:foo] for convenience
[16:55:24] _2_Suhani: hi aunty how are you
[16:55:29] havenwood: pmarreck: http://tenderlovemaking.com/2015/02/11/weird-stuff-with-hashes.html
[16:55:29] mistermocha: bradland: you're beyond awesome, thanks
[16:55:37] jhass: _2_Suhani: how's your Ruby going?
[16:56:02] pmarreck: Disclaimer: I think HashWithIndifferentAccess should die in a fire. Here's a quick question: What happens when you do this? hash_with_indifferent_access.merge!({:a => '1', 'a' => '2'})?
[16:56:35] jhass: I guess [:a] and ['a'] both will return '2'
[16:56:36] _2_Suhani: what are you telling
[16:56:36] pmarreck: If you don't know the answer to that (and all its permutations), you should stay far, far away from HWIA.
[16:56:46] jhass: _2_Suhani: what a lovely language Ruby is
[16:57:36] bradland: i stay away from HWIA in general
[16:57:36] pmarreck: jhass: You are probably correct. In order to answer that you have to know that HWIA stores strings internally. But a while back I managed to get HWIA to store a symbol key... and that resulted in a nasty, nasty bug
[16:57:48] jhass: pmarreck: there have been numerous attempts to make AS::HWIA the default Hash even, my guess is that Symbol GC is the compromise to silence those
[16:58:07] pmarreck: jhass: It's about time, then. Because that "solution" would have sucked
[16:58:49] jhass: which should point out that I see Symbol GC as mistake too, it legitimates illegitimate usecases of symbols
[16:58:53] pmarreck: Hopefully this means all the string key business/code will go away... at least once 2.2. is the standard
[16:59:18] pmarreck: jhass: You can always whitelist your sym... oh wait, no, you still can't. ;)
[16:59:23] jhass: Rails 5 targets 2.2 in order to clean that stuff up
[16:59:41] havenwood: apeiros: Speaking of 2.2, title could use a bump to 2.2.1.
[16:59:55] arup_r: Need help
[17:00:08] jhass: ACTION send a rescue dog to arup_r
[17:00:15] arup_r: How to trimmed out white spaces while playing with ERB ? https://gist.github.com/aruprakshit/a4391a32f33324c07d28
[17:00:30] arup_r: I tried this tips# 1 http://railscasts.com/episodes/100-5-view-tips
[17:00:42] arup_r: and I got too many syntax errors
[17:00:46] arup_r: jhass: hehehehe
[17:01:24] pmarreck: arup_r: get rid of the space here -%> <%=
[17:01:30] pmarreck: arup_r: that space in between the > <
[17:01:41] pmarreck: oh wait. nah
[17:01:52] arup_r: Let me try
[17:02:11] arup_r: WoWwww!!!
[17:02:14] pmarreck: yeahI thnk that's it
[17:02:19] jhass: arup_r: why don't you just use Array#join ?
[17:02:29] arup_r: But ERB don't know how to handle it ?
[17:02:33] pmarreck: your -%> only slurps up \n's, not \s's ;)
[17:02:37] arup_r: jhass: Experimenting with ERB
[17:02:48] jhass: arup_r: you can call any ruby in erb
[17:02:55] jhass: not saying you should but...
[17:03:01] pmarreck: yeah. now on to how you wrote this... it's ugly. haha
[17:04:03] arup_r: jhass: I know..
[17:04:19] ponga: why does rvm install '2.2.0-preview1' for 'install rvm 2.2.0'
[17:04:21] pmarreck: arup_r: dude do teams.join(',')
[17:04:23] ponga: isn't 2.2.0 stable
[17:04:32] jhass: ponga: rvm get stable
[17:04:39] arup_r: Yes.. Dude.. I know
[17:04:51] pmarreck: arup_r: don't skip comma on the first using an index, that's silly. that's very java. not very Enumerable. ;)
[17:04:59] arup_r: just cross checking if ERB can handle it or not
[17:05:22] ponga: arup_r: http://www.ilbe.com/5410266129
[17:05:25] ponga: uh oh wrong link
[17:05:28] arup_r: But Railscast tip #1 was buggy I proved
[17:05:29] ponga: arup_r: Unrecognized command line argument: 'stable' ( see: 'rvm usage' )
[17:05:32] ponga: it says its wrong
[17:05:46] jhass: ponga: maybe it's just rvm get these days
[17:05:49] jhass: I no longer use it
[17:05:56] ponga: yeah rvm sucks these days
[17:06:00] arup_r: rvm get stable
[17:06:00] ponga: what other is good?
[17:06:03] arup_r: is the command
[17:06:08] pmarreck: arup_r: an old railscast is likely quite outdated by now, unless they update all of them, which I doubt
[17:06:20] jhass: ponga: I stopped using it since I started maintaining the other Ruby packages in the AUR :P
[17:06:24] jhass: so I just chruby + those
[17:06:27] havenwood: ponga: `rvm get stable`, not `rvm stable`
[17:06:39] pmarreck: arup_r: well glad we figured it out. code on ;)
[17:06:53] ponga: havenwood: it installs rvm, not 2.2.0 ruby
[17:07:04] havenwood: ponga: yeah, then you: rvm install 2.2.1
[17:07:08] jhass: ponga: that's the point
[17:07:25] jhass: the latest rubies are coded in
[17:07:33] jhass: nothing autodiscovered
[17:10:38] arup_r: ponga: is nice name
[17:10:50] arup_r: jhass: is a Rubyist ..........
[17:11:24] arup_r: shevy: loves cat
[17:11:50] arup_r: apeiros: kicks always "bootys"
[17:11:59] elfuego: does anyone know how to get these items from hashie? <Hashie::Mash count=35367 time=1425340800000>
[17:12:14] ponga: ????????? cat face in korean letter
[17:12:33] jhass: elfuego: .count, [:count] or ['count'], one has to work :P
[17:12:50] ponga: havenwood: jhass thanks, it worked
[17:16:15] elfuego: not works, jhass I think ruby methods are overriding stuff
[17:17:46] jhass: elfuego: "not works"? care to elaborate?
[17:18:46] elfuego: when I do count on the object it returns 2 instead of the actual value of count
[17:20:42] jhass: elfuego: maybe you got two of them in an array?
[17:21:08] jhass: elfuego: what about the other options? how precisely do they fail?
[17:24:43] bricker: elfuego: use ['count']
[17:24:56] bricker: 'regular_reader'
[17:24:59] bricker: (they're aliases)
[17:34:51] arup_r: Well Why am I getting those blanks... In Rails view ?
[17:34:54] arup_r: https://gist.github.com/aruprakshit/a4391a32f33324c07d28#file-white_space_erb-rb-L6
[17:36:25] timanema: arup_r: it might be your link styling and/or it might be your team names have spaces in them
[17:36:33] phale: does cloudflare always block requests
[17:36:53] pipework: arup_r: Try #rubyonrails
[17:37:03] Senjai: phale: If it did, I would probably say it wouldnt be fulfilling its usecase
[17:37:05] pipework: phale: Stop trying to DoS the source. :p
[17:37:10] phale: pipework im not
[17:37:24] phale: i just requested it one time and it tells me that i have tried to access a cf ip or whatever
[17:37:39] Senjai: probably a cors issue
[17:39:41] phale: so what do i do
[17:43:01] shevy: that is odd
[17:43:08] shevy: we were even before you came jhass!
[17:43:31] jhass: shevy: but don't you know the pentabarf?
[17:44:37] jhass: or maybe more importantly the law of five?
[17:57:12] arup_r: Guys do you know this ? http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/429952
[17:57:44] arup_r: ponga: ^^^
[17:57:52] ponga: why does arup_r like me so much
[17:57:57] arup_r: We don't need to cry anymore
[17:58:07] ponga: what's this
[17:58:27] arup_r: read the mail ponga :
[17:58:30] ponga: what ..the
[17:58:42] ponga: they love python too much to do this...!
[17:58:43] arup_r: Ruby got selected in GSoF
[17:58:43] ponga: can't believe it
[17:58:46] ponga: is it legit?
[17:58:58] jhass: GSoC is weird this year
[17:59:02] jhass: mozilla got rejected
[17:59:22] havenwood: Ruby and Clojure! \o/
[18:00:00] ponga: lol they had Jruby BEFORE ruby?
[18:00:05] ponga: that's funny
[18:00:18] workmad3: ponga: google likes java
[18:03:03] aarwine: ruby's string.start_with("will", "accept", "multiple", "options") but if I have a list_of_options=["will", "accept", "multiple", "options"] how can I invoke start_with with the options from the list instead of statically?
[18:04:22] havenwood: aarwine: string.start_with? *list_of_options
[18:04:28] havenwood: aarwine: a splat!
[18:12:28] sarkis: how would i rescue from this exception? Elasticsearch::Transport::Transport::Errors::NotFound: [404]
[18:12:55] sarkis: is it simply rescue Elasticsearch::Transport::Transport::Errors::NotFound
[18:13:52] sarkis: ah it is - answered my own Q
[18:18:57] freezevee: can someone tell me how do I require a .rb file in the same folder with my rest of the files ?
[18:20:05] apeiros_: freezevee: require_relative, or set $LOAD_PATH up to include that directory
[18:20:13] jhass: freezevee: if you don't want to setup load path and have nothing that does for you (like rubygems), require_relative
[18:20:26] freezevee: require_relative works 100%
[18:20:39] freezevee: but I have seen it nowhere so I am trying with require
[18:20:56] freezevee: I've seen this $LOAD_PATH but I am not sure where do I set it up ?
[18:21:13] avril14th: freezevee: using Rails?
[18:21:23] freezevee: avril14th: no just ruby
[18:22:01] apeiros_: freezevee: setup of $LOAD_PATH is the responsibility of the executable
[18:22:04] pipework: freezevee: Pathname.glob is pretty cool. Alternately, Dir.glob
[18:23:20] freezevee: so I suppose that If I want to pack the entire project into a gem later I should go with require_relative right ?
[18:23:45] apeiros_: you go with having a proper lib dir, called 'lib'
[18:23:59] apeiros_: rubygems automatically adds that to $LOAD_PATH for installed gems
[18:24:03] jhass: freezevee: bundler gem template?
[18:24:10] apeiros_: and for local development, use ruby -Ilib
[18:24:14] jhass: or by hand?
[18:24:19] freezevee: hmm by hand
[18:24:27] jhass: then ruby -Ilib
[18:24:39] jhass: I also tend to setup load path in the spec/test_helper
[18:24:55] pipework: apeiros_: I'm actually fond of having a file only in development that modifies $LOAD_PATH that doesn't get into the gem.
[18:25:08] pipework: I'm not sure why that'd be a bad thing though.
[18:25:13] apeiros_: jhass: yes, and that's IMO ok, since that's arguably part of the (test) executable
[18:25:28] apeiros_: pipework: other than what jhass said, I have none
[18:25:34] pipework: apeiros_: Gotcha.
[18:26:29] freezevee: jhass: ruby -Ilib does nothing
[18:26:39] jhass: freezevee: on its own, yes
[18:27:06] jhass: where you did ruby foo.rb, do ruby -Ilib foo.rb
[18:27:34] freezevee: still getting /kernel_require.rb:54:in `require': cannot load such file
[18:27:57] freezevee: I suppose I don't need to include 'lib/
[18:28:05] jhass: what are you running from which folder and how does the require look like and where's that file located?
[18:28:19] jhass: ah yes, don't include lib/
[18:28:23] apeiros_: freezevee: you do `require 'lib/???'` now? if so, yes, that's wrong
[18:28:39] apeiros_: the path given to require is relative to a path in $LOAD_PATH
[18:29:00] freezevee: and I suppose also without ".rb"
[18:29:24] jhass: while it does no harm, it's not needed
[18:29:29] freezevee: jhass: I am running ruby.rb main.rb inside the /lib
[18:29:33] apeiros_: IMO preferred without
[18:29:59] freezevee: main.rb has require 'myproject' and it should load a very simple basic class
[18:30:01] apeiros_: freezevee: an executable does not belong into lib
[18:30:11] apeiros_: and you pass the path to the lib dir with -I
[18:30:17] apeiros_: so if you're within lib, it's ruby -I.
[18:30:42] jhass: so we recommend to go up one dir, move the executable to bin/ and do ruby -Ilib bin/my_gem
[18:30:54] freezevee: am I doing it completely wrong ?
[18:31:25] freezevee: rather than trying to fix something wrong, should I build it from scratch with bundle gem myproject ?
[18:31:36] apeiros_: not necessarily
[18:31:59] freezevee: jhass: I'll try what you said
[18:33:09] freezevee: ok I moved main.rb to /lib
[18:33:22] jen_: jhass and havenwood with the help of senjai. here in this room, we made some progress with the Ruby script but still getting a nagging SSL issue.
[18:33:33] freezevee: jhass: and executed ruby bin/main.rb
[18:33:42] freezevee: is that what you said ?
[18:33:58] jhass: freezevee: almost ruby -Ilib bin/main.rb
[18:34:06] jhass: but don't name your executable main.rb
[18:34:23] phale: can u access the deep web with ruby
[18:34:26] phale: without tor
[18:34:27] jhass: that'll be awkward when your gem is installed and it's in the path
[18:34:34] jhass: phale: what's the deep web?
[18:34:36] freezevee: jhass: hmm something's happening
[18:34:41] phale: i have no idea but i can buy weed from it
[18:34:43] phale: so i need it
[18:34:58] freezevee: jhass: how do I call the class? simply Myclass.mymethod ?
[18:35:00] jhass: phale: find out, that'll answer your question
[18:35:20] jhass: freezevee: that seems to lack context :)
[18:35:38] jhass: remember, I do not see what you're doing/have any kind of access to your computer
[18:36:01] freezevee: I love solving problems, am I sick ?
[18:36:16] jhass: no, it's called "programming"
[18:36:29] freezevee: I mean the more problems I see the more I enjoy it
[18:36:56] freezevee: jhass: I got a message bin/main.rb:6:in `<main>': uninitialized constant Folderscan (NameError)
[18:37:09] jhass: do you require the file that defines it?
[18:37:10] freezevee: Folderscan is my class inside the /lib/folderscan.rb
[18:37:23] freezevee: yeap require 'folderscan'
[18:37:37] jhass: and the require is at the top?
[18:37:44] freezevee: jhass: but I am calling it with new_scan = Folderscan.new("new scan", full_path)
[18:37:52] freezevee: yes on the top
[18:38:02] jhass: cat lib/folderscan.rb
[18:38:12] jhass: verify it relly defines that class
[18:38:17] jhass: at toplevel namespace
[18:39:01] freezevee: does it matter If it's a module or a class? I guess not
[18:39:34] jhass: for calling .new on it it does matter, but that should give a different error
[18:40:00] jhass: any chance of maybe committing your current state and pushing it to github or something like that?
[18:40:28] shevy: https://whathecode.wordpress.com/2011/02/10/camelcase-vs-underscores-scientific-showdown/
[18:40:33] shevy: we must use CamelCase
[18:40:46] jhass: shevy: 2011 is so old...
[18:40:56] freezevee: jhass: I am not so fluent with github
[18:41:39] freezevee: but I'll try
[18:42:07] shevy: good science lasts forever!
[18:42:07] shevy: actually we are already using camelcase
[18:42:09] shevy: class WaterContainer
[19:09:53] patrick99e99: hi ruby buddies... this may be a really dumbo quesiton, but I was wondering-- is there any kind of magical ruby method to override the presence of an object? Kind of like I can say module Foo; def self.nil?; true; end; end; ... Foo.nil? ==> true ... I would also like a way I can do: Foo and get nil.. so I can just do x = Foo; unless x; puts "I want to see this even though x is defined as the Foo module"; end ....
[19:10:34] Godd2: I want to believe he typed that without taking a breath
[19:10:36] jhass: Foo = nil
[19:11:21] patrick99e99: jhass no... ? I don't want Foo to be nil...
[19:11:27] patrick99e99: I am trying to implement a null object pattern...
[19:11:45] jhass: so the answer is no ;)
[19:11:48] patrick99e99: and I want an object that can represent a black hole...
[19:12:04] patrick99e99: I have to do Foo.nil? then... bummer
[19:15:16] Godd2: patrick99e99 null object pattern is for a particular object, not any in general
[19:17:03] Godd2: So like for a NullUser where you return sensible nullish things for methods. like NullUser#email would return 'no email' or something
[19:20:41] shevy: a black hole object
[19:20:41] shevy: now you are challenging ruby's object system
[19:20:41] shevy: it can't quite yet simulate the universe
[19:22:33] freezevee: jhass: I made it https://github.com/chrisvel/folderscan
[19:23:02] jhass: class FolderScan
[19:23:21] jhass: new_scan = Folderscan.new
[19:23:32] jhass: FolderScan != Folderscan
[19:23:38] freezevee: yes I am idiot in case you're going to ask
[19:23:42] freezevee: simply like that
[19:24:12] freezevee: I keep the legend of wrong-case errors alive
[19:24:38] freezevee: thanks a lot
[19:28:10] mistergibson: is it wise to do byte-pattern matching with Regex? If so, anyone got a cheetsheet, I suck at regex
[19:28:22] jhass: mistergibson: what do you mean?
[19:28:45] mistergibson: jhass, I was wondering about doing pattern matching to identify file headers
[19:28:54] patrick99e99: godd2: the idea was in a rails serializer I want to do: def service; @options[:service] || Nullbuddy; end... And then other methods can do: def name; if service; 'omg'; else; 'lol'; end... But I have to do if service.nil?; 'omg'; else 'lol'...
[19:29:07] mistergibson: I can get the bytes, but I was looking into using regex for quick pattern matching
[19:29:08] patrick99e99: Nullbuddy has def nil?; true; end...
[19:29:14] patrick99e99: err def self.nil? i mean
[19:29:44] jhass: mistergibson: hard to tell without knowing the possible values you want to match against
[19:30:09] mistergibson: jhass, I'd look those up prior of course
[19:30:30] Godd2: patrick99e99 perhaps in this case you should make a class called NullService that wraps nil-like functionality for non-existing services
[19:31:08] mistergibson: jhass, for instance: file that begins with FEFF0CB1
[19:31:14] Godd2: so that service.name will return 'omg' if it's a NullService and 'lol' if it's some genuine service or whatever you want
[19:31:32] jhass: mistergibson: so it's actually no pattern but a static value?
[19:32:22] jhass: .bytes[0, 4] == [0xfe, 0xff, 0x0c, 0xb1]
[19:32:24] mistergibson: jhass, ok - it is a byte pattern on the header of a file. I plan to sample the first 4K of the file and see if I can find the pattern that I already know for that file format - see?
[19:33:21] mistergibson: jhass, I just don't know how to do hex matching in regex
[19:35:43] mistergibson: jhass, well, I'd rather use regex because I may have to sift though some bytes
[19:37:59] jhass: mistergibson: still not entirely convinced but make sure to read as binary (ASCII-8bit) and just match against /\xFE\xFF\x0C\xB1/n
[19:47:08] meshugga: hey gals and guys
[19:47:26] meshugga: what's the best ruby learning ebook for people who can already program other languages?
[19:47:50] meshugga: something to read on a tablet, no fixed size pdfs preferred
[19:47:58] meshugga: ruby 2.0+ ideally
[19:54:20] a5i: Hi DerisiveLogic
[19:54:42] DerisiveLogic: a5i: Haha, figures.
[19:56:13] HOrangeJewce: Hi, I'm creating a gem but am having problems with my require path, I'm getting an error when attempting to use a file located under lib/[gemname]/ saying the file can't be found even though it's listed in the gemspec. I think I'm missing something obvious.
[19:56:16] HOrangeJewce: https://gist.github.com/bkett/f2f7f5c41ea7859ef576
[19:56:28] HOrangeJewce: any help would be much appreciated
[19:57:30] jhass: HOrangeJewce: verify the actually build gem includes the file
[19:57:45] HOrangeJewce: jhass: how can i verify that?
[19:58:05] jhass: .gem files are zip files
[19:58:12] jhass: or look at the installed location
[19:58:30] HOrangeJewce: ok i'm looking now
[19:59:10] HOrangeJewce: jhass: It is in the gem/data.tar.gz
[19:59:40] HOrangeJewce: under lib/sensu-plugins-aws/helpers.rb
[20:00:00] weaksauce: HOrangeJewce are you sure you want to have lib/sensu-plugins-aws/helpers as the require path
[20:00:08] weaksauce: should just be lib/sensu-plugins-aws
[20:00:21] HOrangeJewce: weaksauce: I don't, but I tried that and it didn't help
[20:00:27] HOrangeJewce: I will try again though
[20:00:40] Mon_Ouie: Well, it should really just be lib --- indeed, won't solve the issue though
[20:00:41] havenwood: HOrangeJewce: So if 'lib/sensu-plugins-aws', weaksauce beat me to it.
[20:01:20] HOrangeJewce: yeah having just lib
[20:01:23] HOrangeJewce: allows me to require '
[20:01:37] HOrangeJewce: 'sensu-plugins-aws', but not 'sensu-plugins-aws/helpers'
[20:02:02] Mon_Ouie: I'd also check the files installed in the gem installation directory
[20:03:04] Mon_Ouie: <installation dir printed out using gem env>/gems/your-gem-X.Y.Z/lib/
[20:03:15] jhass: HOrangeJewce: is the version you pushed to rubygems.org the one you're trying?
[20:03:25] HOrangeJewce: no I'm installing a localbuild
[20:03:29] HOrangeJewce: I haven't pushed anything to rubygems
[20:03:42] Mon_Ouie: Yes, and locally the files are installed in that directory
[20:03:52] jhass: since there's a https://rubygems.org/gems/sensu-plugins-aws
[20:03:55] Mon_Ouie: Oh, didn't read jhass's question, sorry
[20:04:32] Mon_Ouie: And in that case, make sure you installed your gem file and not the remote gem
[20:04:57] HOrangeJewce: I'm not just calling gem install on the gem name I'm explicitly calling it on the local file :)
[20:05:21] jhass: try removing all installed versions
[20:05:24] HOrangeJewce: the upstream gem was a first effort that is missing a lot of features I've been working on
[20:05:36] jhass: and then install the local file again
[20:06:11] HOrangeJewce: there's only the one version I've generated installed but I can try again
[20:07:10] HOrangeJewce: bumped the gem version # to be sure
[20:07:51] Mon_Ouie: Also possibly use --local to make sure it doesn't check the remote repository
[20:08:21] HOrangeJewce: ok ill reinstall with that but since I changed the gem version im quite sure I'm installing the right thing
[20:09:50] shevy: HOrangeJewce I often push new gem updates even just with minor changes
[20:09:52] shevy: you can always remove older gems too so essentially you could use rubygems as a weak version control system
[20:10:54] HOrangeJewce: shevy: Thanks for the tip. Not sure it helps with this problem though :'(
[20:11:02] HOrangeJewce: also the helpers file does exist in my local gem install
[20:13:24] jhass: HOrangeJewce: so, quick recap, require 'sensu-plugins-aws' works but require 'sensu-plugins-aws/helpers' throws?
[20:14:37] HOrangeJewce: jhass: looks like it actually doesn't work. I guess I misspoke
[20:14:41] HOrangeJewce: so neither are working
[20:15:17] HOrangeJewce: but sensu-plugins-aws/lib is in my LOAD_PATH
[20:15:56] jhass: gist the tree of the full path to it?
[20:16:01] HOrangeJewce: is rvm screwing me up?
[20:16:21] HOrangeJewce: jhass: Not following. full path to what
[20:16:57] jhass: yeah, tree /whatever/is/in/your/load/path/sensu-plugins/lib
[20:17:10] jhass: +-aws, you get it
[20:18:28] HOrangeJewce: jhass: https://gist.github.com/bkett/5ecb1c3f5a03d91088c1
[20:18:39] HOrangeJewce: I dont' really want to tree my homedir
[20:18:50] HOrangeJewce: is that what you wanted?
[20:19:19] jhass: that doesn't seem to be the install location of the gem
[20:19:27] HOrangeJewce: ill tree that
[20:20:23] HOrangeJewce: jhass: https://gist.github.com/bkett/1a4a5317757a9791f27b
[20:21:37] HOrangeJewce: commented with the output from rvm list
[20:23:13] jhass: HOrangeJewce: can you maybe upload the .gem somewhere?
[20:23:31] HOrangeJewce: jhass: sure it's opensource, where would you like me to upload it?
[20:23:47] jhass: uh, dunno, I have my ownCloud for such stuff
[20:24:19] HOrangeJewce: I can push it to my alpha branch of the github i suppose
[20:24:36] jhass: whatever works for you
[20:27:01] HOrangeJewce: looks like github tosses binaries
[20:27:28] HOrangeJewce: oh nvm im a scrub
[20:27:57] HOrangeJewce: jhass: https://github.com/bkett/sensu-plugins-aws/tree/alpha
[20:28:03] HOrangeJewce: you can get the .gem from there
[20:32:51] bodge: Just upgraded 2.2.0 to 2.2.1 and witnessed an avalanche of "Ignoring <gem> because its extensions are not built. Try: gem ....". Am I really going to have to go through all this every time I upgrade to a minor point release?
[20:41:27] jhass: HOrangeJewce: getting unitialized constant Timeout::Error when loading that file directly, but the require seems working here
[20:42:11] havenwood: bodge: You can rebuild all extensions with: gem pristine --extensions
[20:44:06] HOrangeJewce: jhass: did you just touch a ruby file and run the include?
[20:44:20] jhass: HOrangeJewce: just fired up pry
[20:44:21] HOrangeJewce: I wonder if my rvm is broke
[20:44:51] jhass: but ruby -r'sensu-plugins-aws/helpers' -e '' does the same
[20:45:06] HOrangeJewce: jhass: that's what happens to me too when I run the require in irb
[20:45:58] HOrangeJewce: ill check that out i guess
[20:46:18] jhass: HOrangeJewce: but in a script you get a LoadError?
[20:46:36] jhass: how exactly do you run that script?
[20:46:54] havenwood: bodge: Adding --env-shebang to your .gemrc also helps with being able to update without rebuilding. It look like it won't be a default option until RubyGems 2.5, see: https://github.com/rubygems/rubygems/issues/1049
[20:47:23] havenwood: bodge: You can add it to your .gemrc: gem: --env-shebang
[20:48:03] HOrangeJewce: jhass: I run one of the included binaries in the gem
[20:48:08] HOrangeJewce: check-vpc-vpn.rb
[20:48:13] bodge: havenwood: Thanks.
[20:48:57] ton31337: what does rb_call and rb_call0 ?
[20:49:26] jhass: HOrangeJewce: oh interesting
[20:49:34] jhass: I wonder if sensu messes somehting up there
[20:49:43] HOrangeJewce: its possible i guess
[20:50:03] jhass: HOrangeJewce: bah, we're both stupid :P
[20:50:08] HOrangeJewce: but if i do a relative require on the file I don't see the problem
[20:50:09] jhass: require 'sensu-pulgins-aws/helpers'
[20:50:22] HOrangeJewce: i hate myself
[20:50:36] HOrangeJewce: the rage is real
[20:50:46] jhass: I can understand
[20:53:44] HOrangeJewce: jhass: thank you so so so much for the help
[21:02:50] havenwood: ton31337: https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L595-L611
[21:03:04] havenwood: ton31337: https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L595-L611
[21:03:34] havenwood: ton31337: oops, meant to link this the second time: https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L334-L349
[21:04:06] havenwood: well, and the comments above it
[21:04:11] havenwood: anyways, you get the point
[21:05:43] rrrutr: why spree so slow
[21:06:01] havenwood: rrrutr: is it?
[21:06:16] jhass: rrrutr: because you no send PR to make it fast
[21:06:23] havenwood: rrrutr: in production?
[21:06:35] rrrutr: development
[21:06:47] rrrutr: what is PR?
[21:06:51] havenwood: Pull Request
[21:07:07] rrrutr: a lot of companies use one
[21:08:17] rrrutr: spree is not bit app but comare to nopcommerce , whery slow
[21:09:44] rrrutr: could you recommend some tools to investigate perfomance?
[21:10:01] havenwood: rrrutr: try running it in production mode.
[21:15:12] jen_: With the help of a developer, we implemented pry. Now, we are running in production and need to remove those binding.pry
[21:15:51] jen_: grep -r binding.py * isn???t helping.
[21:16:44] wasamasa: perhaps it helps to spell its name correctly "binding.pry"
[21:17:15] jen_: ya ya ya of course
[21:18:31] yatish27: I want to parse a simple string like "My name is **NAME**" to "My name is <strong>NAME</strong>"
[21:18:41] yatish27: Hoe can I go ahead with this
[21:19:02] jhass: yatish27: Please do not crosspost without at least telling so. Experience shows that people don't bother to inform the other channels of provided solutions, therefore it is considered rude.
[21:19:33] yatish27: jhass: Got it Thanks
[21:19:47] yatish27: Any heads up on how to go ahead with this ?
[21:20:04] jhass: yatish27: rubular.com if you want to go the regexp route
[21:20:33] yatish27: I tried but didnt get any
[21:20:42] jhass: note that markdown isn't well defined and quite a few edge case hard to handle with a regexp parser
[21:21:00] jhass: yatish27: maybe read through http://www.regular-expressions.info/ then
[21:22:35] yatish27: @jhass read didnt help
[21:22:42] yatish27: Still thanks for the info
[21:22:51] yatish27: if you get something tell em
[21:23:41] jhass: yatish27: there's no way you read through that comprehensive site in 2 minutes
[21:23:58] yatish27: I meant I read it before
[21:28:27] HOrangeJewce: yatish27: you could always shell it out to sed
[21:29:12] HOrangeJewce: ofc I'm not sure how a regex doesn't solve your problem
[21:29:26] jen_: Like python, is Ruby sensitive to indentation?
[21:51:21] apipkin: Would anyone here be willing to help me debug an issue. It's related to jekyll, but any knowledge of the problem would help tremendously https://gist.github.com/apipkin/17162d82bc677ccdf2e9
[21:52:12] jhass: apipkin: do you have a Gemfile in that directory or any of the parent directories?
[21:52:32] apipkin: jhass: Yes, I have a Gemfile in this directory
[21:52:34] shadoi: apipkin: looks like the latest version of jekyll doesn't have the file lib/jekyll/version.rb
[21:52:46] jhass: apipkin: try bundle exec jekyll
[21:53:41] apipkin: `bundle exec jekyll serve` works, no problem
[21:55:10] rrrutr: https://gist.github.com/anonymous/48c8ffde0ebd4f60e260
[21:56:24] ducklobster: is there a up-to-date resource anyone can recommend for deployment / using bundler for ruby apps (not necessarily rails)
[21:57:14] ducklobster: or is bundler basically the default and i should just read their documentation front to back
[22:02:59] havenwood: rrrutr: See their explanation here: https://github.com/pluginaweek/state_machine/blob/master/lib/state_machine/machine.rb#L348-L351
[22:04:46] havenwood: ducklobster: Bundler is indeed basically the default, so much so that its features are being incrementally merged into RubyGems, so sometime after Bundler 2 it'll theoretically be deprecated once RubyGems can entirely replace its functionality.
[22:05:05] havenwood: ducklobster: http://bundler.io/v1.8/deploying.html
[22:08:16] havenwood: ducklobster: http://www.mikeperham.com/2014/09/22/dont-daemonize-your-daemons/
[22:09:24] havenwood: a ducklobster isn't nearly as frightening sounding as a lobsterduck for some reason..
[22:11:12] havenwood: http://img01.taobaocdn.com/bao/uploaded/i1/11190589/T2UyN3Xn4aXXXXXXXX_!!11190589.jpg_310x310.jpg
[22:11:54] ducklobster: thanks for the links havenwood!
[22:11:59] ducklobster: and for the new avatar ;)
[22:12:06] havenwood: ducklobster: :)
[22:13:53] apipkin: Thanks jhass & shadoi! I needed to update my gulp task to run bundle exec instead of just jekyll :)
[22:18:28] GaryOak_: automating your automation, nice
[22:21:16] dandaman: I have an array variable I want to be able to add to in a class, I created this method "def standards<<(new_standard)"
[22:21:34] dandaman: is that the correct way to declare that method to add to my @standards array?
[22:21:49] jhass: dandaman: well, does it work like you expect? ;)
[22:22:13] dandaman: jhass: no, syntax error, unexpected <<, expecting ';' or '\n'
[22:23:00] jhass: dandaman: so, << is special method name, it's allowed in itself, but not combined with other stuff
[22:23:20] jhass: object << "foo" is syntax sugar for object.<<("foo")
[22:23:47] jhass: there for object.accessor << "foo" is syntax sugar for object.accessor.<<("foo")
[22:23:54] dandaman: I just want to be able to go myClass.standards << my_standard_class
[22:24:04] dandaman: where myClass.standards is an array of standards :\
[22:24:26] jhass: I got that
[22:24:48] jhass: I was trying to explain what's happening you understand it
[22:24:59] jhass: does anything I said make any sense to you?
[22:25:41] dandaman: sorry, I'm doing a coding exercise which i need to have done in an hour, syntax isn't really an important thing for me to get right now
[22:25:57] dandaman: if i had unlimited time i'd take the time to understand it :\
[22:26:10] jhass: sorry, with that attitude you shall fail
[22:26:22] jhass: syntax is all there's to solve this
[22:26:38] bradland: i know you're not going to want to hear this, but the notion that you can learn programming by learning some incantations is a path to failure
[22:26:44] dandaman: no, syntax is not the programming exercise, i'm just doing it in ruby to appease them
[22:26:51] bradland: or rather, memorizing incantations
[22:26:59] dandaman: i know what you guys are talking about, i need to understand how ruby works, that is not my goal at the moment
[22:27:09] dandaman: when i have time i will learn that
[22:27:15] jhass: cool, then you didn't come to the right place
[22:27:33] havenwood: dandaman: to please who? if you don't want to understand, put parens around everything. >.>
[22:27:58] shevy: dandaman you need to try to look at things from the ruby parser
[22:28:18] havenwood: shevy: or be one
[22:28:43] shevy: yeah like in order to understand your enemy, you must become the enemy
[22:29:04] havenwood: a being with a human head and arms, but the body of a Ruby parser
[22:30:10] bradland: dandaman: i like to dig around in rubinius source code when trying to figure out how features like foo << bar are implemented
[22:30:13] bradland: https://github.com/rubinius/rubinius/blob/master/kernel/common/array.rb
[22:30:31] havenwood: dandaman: When you don't have time to listen or understand, i'd suggest pasting a Gist of the offending code for more concrete answers.
[22:32:52] havenwood: School assignment? Interview question? Curtsy while you're thinking. It saves time.
[22:36:08] havenwood: ACTION goes back to being feverish.
[22:53:29] Dolphi: If I define my own function, can I call it behind a string: puts "Like this".example
[22:53:56] bradland: if you monkey patch string
[22:54:04] jhass: Dolphi: only if you define your method (it's not a function) inside the String class
[22:54:27] jhass: you should have a good reason to do that for production code though
[22:54:31] Dolphi: Functions and methods arent the same? Lol pardon my ignorance...
[22:54:59] bradland: it's a language thing
[22:55:01] jhass: a method is a function that has an object as context, or in other words that's called on an object
[22:55:01] Dolphi: Well, I am using code to wrap the text in my text adventure game so that it looks nice and clean
[22:55:11] bradland: OOP languages use the term method because Objects have methods
[22:55:25] Dolphi: I will have to use that method a lot throughout my program.
[22:55:58] jhass: Dolphi: as I said I would do it in the output method instead
[22:56:14] jhass: instead of puts "Foo".formatted, do formatted_puts "Foo"
[22:56:34] jhass: and define formatted_puts
[22:56:57] Dolphi: jhass: Thanks buddy. :)
[22:57:27] Dolphi: bradland: You never got around to teaching me Linux man!
[22:58:00] bradland: did you end up learning it anyway?
[23:00:11] Dolphi: I haven't even got around to touching it actually :P I've been learning a bit of web dev but mostly just working. Six day weeks for the passed month or so.
[23:00:41] Dolphi: I'm still very interested in learning though, and I have Ubuntu Linux installed on VirtualBox. :)
[23:12:09] fox_mulder_cp: does anybody help me with RoR select_tag multiselect helper?
[23:14:06] fox_mulder_cp: i try to pass select_tag collection, which i need select when page render, but it don't selected items, when rendered page, i must select it manually
[23:16:55] apeiros_: fox_mulder_cp: #rubyonrails
[23:37:10] blahwoop: i wrote a simple guess who game and i'm looking to refactor my code. it's over 200 lines. would anybody mine taking a quick look at it and give some advice? u can leave a comment on it. https://gist.github.com/iRichLau/5143bd87db385cbe5ad0
[23:37:37] bradland: blahwoop, eh?
[23:38:49] bradland: i feel like i recognize the name blahwoop from hitchhiker's guide to the galaxy
[23:39:21] jhass: blahwoop: that extra line numbers are kind of distracting :P
[23:39:22] blahwoop: it's something i made up. been my nick for the past 20 years
[23:40:47] blahwoop: jhass: ill remove them lol
[23:41:55] jhass: blahwoop: overall structure seems fine though
[23:43:05] blahwoop: anyway to make the ask methods less repetitive
[23:43:08] jhass: https://gist.github.com/iRichLau/5143bd87db385cbe5ad0#file-guess_who-rb-L107 isn't doing anything, reject is not self-modifying
[23:43:25] jhass: .reject! would be
[23:44:12] jhass: yeah, I do wonder if there's a smart way to factor out the game logic from the IO here
[23:45:46] Godd2: whoops! It worked!
[23:46:32] Godd2: http://dhh-soundboard.herokuapp.com/
[23:46:45] Godd2: Look at all the things I'm *not* doing
[23:48:18] wallerdev: haha oh geeze
[23:48:21] jhass: why did they left now?
[23:48:45] wallerdev: i miss the build a blog in 15 minutes rails video
[23:48:52] jhass: back to crystal-tetris then I guess
[23:53:46] a5i: is that written in rails
[23:53:59] jhass: no, crystal
[23:54:22] a5i: dhh-soundboard?
[23:58:34] pipework: lul, dhh-soundbard was funny two or three weeks ago.