« Back to channel list

#ruby - 03 January 2015

« Back 1 day Forward 1 day »
[00:00:09] zenspider: eam: http://www.zenspider.com/~ryan/library/books/ for other nerd (and cook) books
[00:00:16] zenspider: wish it did a better job of grouping by collections
[00:01:20] Yzguy: maybe I'll do an erb template instead of markdown
[00:01:35] patsourakos: http://i.imgur.com/NjHplmm.gifv [NSFW] thank you and sorry
[00:01:50] zenspider: Yzguy: you could do an erb template of markdown :)
[00:02:09] sevenseacat: patsourakos: wat
[00:02:11] Yzguy: totally not clicking that link
[00:02:24] zenspider: patsourakos: douche. you've done that before. you're not sorry. you're juvenile
[00:02:53] patsourakos: i put a warning...
[00:02:56] Yzguy: ooo markerb is markdown and erb
[00:03:24] waxjar: apeiros: ping
[00:03:30] zenspider: patsourakos: your mom must be so proud
[00:03:48] zenspider: I guess you could call down the hall and ask
[00:03:59] apeiros_: waxjar: what's up?
[00:04:13] waxjar: apeiros: read up about 10 lines :/
[00:04:31] waxjar: if you don't wanna click the link, it's definitely not suited for this channel
[00:04:36] ChanServ: +o apeiros_
[00:04:44] ChanServ: +o zenspider
[00:05:08] zenspider: apeiros: you'd rather I have the honor? :D
[00:05:17] apeiros_: I'm a bit busy
[00:05:42] apeiros_: and IME he sometimes comes back a couple of minutes later
[00:05:56] Yzguy: wait no, thats not what I wanted
[00:06:13] apeiros_: apeiros_ kicked patsourakos: thanks
[00:06:30] apeiros_: +q patsourakos!*@*
[00:06:42] zenspider: +b *!~asdd@*
[00:07:28] zenspider: zenspider kicked patsourakos: by zenspider
[00:10:15] GreatDanton: he was double kicked?
[00:11:35] zenspider: kicked, muted, then kicked
[00:11:42] zenspider: kicked, muted, tarred, feathered, then kicked
[00:33:16] shevy: well two kicks hurt more than one alone, that's for sure
[00:35:22] ReinH: sweet sweet justice
[00:41:49] icedragon: ACTION waves to shevy
[00:42:00] icedragon: Huh, who got the foot twice?
[00:42:09] icedragon: one for each cheek?
[00:43:01] icedragon: or does the kicker practice Taekwondo :P
[00:45:08] shevy: hey IceDragon
[00:45:13] shevy: * apeiros_ has kicked patsourakos from #ruby
[00:45:17] shevy: * zenspider has kicked patsourakos from #ruby
[00:45:33] icedragon: Ah, so it was a tag team effort
[00:45:39] icedragon: What did he get kicked for?
[00:45:44] icedragon: my backlog got cleared >:
[00:45:45] shevy: IceDragon one kicked like from the left, the other from the right. patsourakos went down
[00:45:58] icedragon: SO IT WAS TAEKWONDO
[00:46:14] shevy: IceDragon dunno. some link posting. thankfully I never click on these so I have no idea what it was about (and actually, would not even want to know either)
[00:46:31] icedragon: lets keep it that way then ;x
[00:46:34] icedragon: scary links are scary
[00:47:18] icedragon: ah, the glorious waiting period for travis to do its thing
[00:54:32] Fire-Dragon-DoL: lol I needed to debug, while in console, a method of a badly written api
[00:54:40] Fire-Dragon-DoL: I replaced the method, thank god ruby exists
[00:54:49] Fire-Dragon-DoL: and HI my dear nemesis
[01:21:06] eam: zenspider: fantastic, thank you
[01:21:28] zenspider: eam: you're very welcome
[01:21:39] zenspider: I gotta run. but feel free to PM me w/ q's on books
[02:02:26] pawprint: i'd like to use a gem that requires ruby 1.9.1, even though i have ruby 2.1.5 installed
[02:02:29] pawprint: is that possible?
[02:02:43] pawprint: can i install a private ruby version just for this gem while keeping my deafult ruby version as is?
[02:59:38] leafybasil: pawprint: you can have multiple versions of ruby installed, but you can't have one project that uses multiple versions at the same time
[02:59:47] leafybasil: pawprint: you would need to run the whole project in 1.9.1
[03:00:04] pawprint: one ruby per project is fine
[03:00:05] leafybasil: pawprint: what OS are you using?
[03:00:23] pawprint: but i may need to do this on linux at some point in the future too
[03:00:40] leafybasil: Well I use rbenv, which lets me install and manage multiple versions of ruby
[03:00:51] leafybasil: pawprint: it's here https://github.com/sstephenson/rbenv
[03:01:01] leafybasil: pawprint: do you use homebrew?
[03:01:06] pawprint: i'm already using rvm
[03:01:15] leafybasil: ah then you can just install 1.9.1
[03:01:27] leafybasil: and then in the project dir, i think do a `rvm use 1.9.1`
[03:01:50] pawprint: so that won't affect my default ruby in other directories?
[03:03:04] leafybasil: pawprint: no 'use' should just update it for that directory
[03:03:19] leafybasil: i think `rvm default xyz` sets the global version
[03:03:52] pawprint: thank you so much!
[03:05:10] leafybasil: pawprint: no problem :)
[03:15:52] ponga: is bradland here?
[03:51:20] basichash: mozzarella: how do I create a scaffold for a controller if the model is already created?
[03:51:28] basichash: with --skip-migration?
[03:51:55] mozzarella: I don't know, I never use scaffolding
[03:52:08] mozzarella: and you might want to ask in #RubyOnRails instead
[04:02:51] Blizzy: what would be the best way of changing a certain line in a csv file.
[04:08:25] sevenseacat: open csv file, change line, save file, close file?
[04:14:57] Blizzy: thanks, sevenseacat.
[04:59:34] basichash: how do I enable Rails.logger.debug?
[05:03:35] pontiki: enable it? do you mean set the logging level to debug?
[05:04:11] pontiki: in development/test, the level is already set to debug
[05:04:15] basichash: pontiki: yeah i've created a after_save method in my model, and then Rails.logger.debug "test" it, but it's not showing
[05:04:38] pontiki: are you over in #rubyonrails?
[08:08:00] mahtennek: hi quick question. i am building a registration mechanism with ruby and redis. i need a userid that increases after each registration. but I have no idea what is the best solution to it. currently i am using hsetnx to store and set my keyvalue. please advise where should userid be and autoincr without collisions
[08:27:31] jidar: mahtennek: http://stackoverflow.com/questions/5328863/autoincrement-in-redis might help?
[08:27:36] jidar: not sure that's much of a ruby issue
[08:39:22] shevy: hey ponga - you coding anything?
[09:20:59] shevy: interesting
[09:21:11] shevy: http://www.ruby-doc.org/core/classes/Thread.html seems to redirect to http://www.ruby-doc.org/core-2.2.0/Thread.html
[09:33:39] mahtennek: jidar: right. incr but does that work with hsetnx. i was prob wondering if theres a algorithm to do it.
[09:58:04] tejas-manohar: yo anyone here tried volt? http://voltframework.com/
[10:09:10] shevy: not heard of that before, I think
[10:18:40] shevy: "We use these "{{ }}" mustache looking things to run Ruby in your view."
[10:18:44] shevy: a moustache?
[11:35:52] ponga: hey shevy
[12:53:23] shevy: IceDragon the Fire-Dragon was here
[15:50:51] crome: ACTION slaps xenomorph with a lettuce
[16:51:44] brixen: apeiros: hah, interesting who you run into on Twitter replying to jcoglan's tweets :p
[16:54:12] apeiros_: brixen: I ran into you? :)
[16:54:18] apeiros_: hope I didn't run you over :-p
[17:00:06] zkay11: How can I run a test against an external AngularJS app? I'm trying to write tests against grafana to see if it's rendering a dashboard properly, but I'm not sure how to go about it because rspec/capybara aren't able to see anything but the angularJS models etc in the source (eg, '<div ng-repeat='alert in dashAlerts.list' class="alert-{{alert.severity}} alert">')
[17:03:07] hrrz: hey, i have an interesting problem. I want to transform spoken text of numbers (ONE TWO POINT FOUTRY SEVEN etc..) to digits. i.e: 12.47.
[17:03:17] hrrz: It is part of a voice recognition system
[17:04:17] hrrz: this becomes a little complicated to support all formats, for exmaple: TWO HUNDRED == 200 and not 2100 etc
[17:05:00] Godd2: hrrz voice recognition is considered a "hard problem" in computer science
[17:05:26] Godd2: and generally requires solutions in machine learning and advanced algorithm study
[17:05:43] hrrz: godd2:the voice recognition part is done
[17:06:14] hrrz: but once i have the text extracted . I need to transform it into readable format. especially with numbers
[17:08:24] apeiros_: hrrz: there was a ruby quiz once, not sure whether it was in both directions, but even if it was only from 212 -> two hundred and twelve, it should be helpful
[17:15:41] ponga: is Jruby+Truffle THAT fast
[17:21:34] hrrz: apeiros: yea there's a gem humanize that does that. But I am looking for the other way around
[18:04:39] p8952: Is there a way to loop through an array in chunks? I want to get items in groups of 3.
[18:05:18] apeiros_: p8952: see Enumerable#each_slice
[18:06:34] p8952: apeiros, perfect. Thanks
[18:08:18] ziyadb: Hey guys.
[18:10:29] arup_r: how better can I write this constant assignment ? https://gist.github.com/aruprakshit/64520cd3bacbb6ce762d I am getting warnings due to this? How to handle this?
[18:10:38] arup_r: jhass: Happy new year
[18:12:09] jhass: arup_r: do a const_remove before the const_set
[18:12:52] arup_r: jhass: But is not a smell?
[18:13:32] jhass: probably, you can make those paramters and use the constants as default values for them
[18:16:26] arup_r: didn't get you
[18:16:46] jhass: def foo(connection=CONNECTION)
[18:22:33] shevy: jhass is back!
[18:22:40] shevy: that means the congress must be finished ;-)
[18:23:00] jhass: it finished on 30th ;)
[18:23:02] shevy: jhass any memorable video you can remember?
[18:23:12] ponga: did you call me
[18:23:17] shevy: ponga but hours ago
[18:23:23] shevy: ponga are you coding something interesting finally?
[18:23:25] jhass: shevy: they showed citizen four
[18:23:29] shevy: I am reading up on opal
[18:23:40] ponga: shevy: yes but its only in pseudo at the moment
[18:23:42] jhass: shevy: you don't really go to congress for the talks though ;)
[18:23:49] Godd2: shevy opal is awesome!
[18:23:49] ponga: the thing is beyond my capacity
[18:24:12] ponga: i read articles about Jruby+Truffle
[18:24:18] ponga: is it really that fast
[18:24:32] jhass: shevy: but there you go http://media.ccc.de/browse/congress/2014/index.html
[18:26:41] ponga: im struggling to step beyond the theory
[18:27:31] Godd2: ponga Chris Seaton also gave a talk at RubyConf this year on it: https://www.youtube.com/watch?v=z-YVygbDHLE
[18:27:58] ponga: godd2: already watched it
[18:28:14] ponga: as far as what i read/watch , Jruby+Truffle seems to be a future dream of fast ruby
[18:29:46] arup_r: ponga: You name is really... :) hehehe what's your full name ? :)
[18:30:08] ponga: arup_r: im asian, my nick's got nothing to do with my name sir
[18:30:17] ponga: i just picked it up from no where
[18:30:34] ponga: anyway, what would ponga really mean? :P i know panga is a fish
[18:30:39] ponga: but nothing more than that
[18:30:56] arup_r: ponga: I'm also Asian,,, But.... never heard the idea of ponga anywhere
[18:31:24] ponga: arup_r: its more like i typed in random letters
[18:31:27] Godd2: arup_r by that logic, I'm God
[18:31:29] ponga: just random letters
[18:32:21] shevy: jhass thanks
[18:32:23] arup_r: ponga: One festive is there in India - http://en.wikipedia.org/wiki/Thai_Pongal
[18:32:30] arup_r: which is close to ur name
[18:32:41] arup_r: heheheheh
[18:33:09] arup_r: godd2: Yes you are......... :)
[18:33:13] shevy: festive... always parties in india
[18:33:30] shevy: arup_r imagine if you were to live in a small country, how boring it would be!
[18:33:57] ponga: shevy im trying to break down natural language into more machine-friendly language
[18:34:07] ponga: and im making up this language
[18:34:11] rpag: shevy, isnt ww2 enough for a lifetime
[18:34:23] ponga: so im sorry im still on theory stage
[18:34:24] chrisseaton: ponga: you can benchmark it for yourself - we only run a couple of gems at the moment, but we're implementing more of the library very quickly
[18:34:26] ponga: i did code a bit
[18:34:43] ponga: omg chrisseaton?
[18:34:49] ponga: i read all your blog articles
[18:35:08] shevy: rpag eh germany is huge man!
[18:35:16] chrisseaton: thanks - what would you like to see an article on next?
[18:35:44] arup_r: chrisseaton: link please.. I'd like to see also........
[18:36:23] chrisseaton: arup_r: http://www.chrisseaton.com/rubytruffle/
[18:36:53] arup_r: ACTION doing *pranam* to godd2 (http://www.oxforddictionaries.com/definition/english/pranam)
[18:37:22] shevy: what is pranam
[18:37:25] ponga: chrisseaton: im a big noob in world of programming, im a linguist, anything is fine
[18:37:35] ponga: im just really shocked that ruby performed that good
[18:37:53] shevy: wait until mruby is finished!!!
[18:38:03] ponga: i hope when this Jruby+truffle is mature, ruby no longer needs to hear "its so slower than python haha"
[18:38:20] shevy: oh not python
[18:38:27] shevy: but "ruby is so much slower than javascript"
[18:39:01] ponga: shevy why not python
[18:39:09] arup_r: chrisseaton: "what would you like to see an article on next?" --- I'm interested in Fiber... Never understood it and where to use it.. I don't have basics
[18:39:19] arup_r: ponga: Try something new
[18:39:27] shevy: ponga because javascript will be more important
[18:39:43] arup_r: shevy: Gave the link of _pranam_
[18:40:09] ponga: https://camo.githubusercontent.com/cb665d81819fd46d10cf2b17934d783bb42cb229/687474703a2f2f692e696d6775722e636f6d2f504a48305845592e706e67
[18:40:11] shevy: chrisseaton Threads, mutex, fibers - I think these things can be super confusing to both newcomers and semi-experienced ruby guys
[18:40:15] ponga: this graph was totally unbelievable to me
[18:40:20] arup_r: shevy: +1
[18:40:26] ponga: good enough to compare to V8?
[18:40:42] shevy: threads are ok, I don't quite get mutex and fibers yet, but especially much so how thse three interplay
[18:40:59] arup_r: shevy: +1
[18:41:08] chrisseaton: we also have a JS using the same technology implementation that's competitive in terms of speed with V8
[18:41:20] chrisseaton: we're looking at things like programs written in both Ruby and JS working together
[18:41:54] shevy: yeah, it is mentioned often... see ponga, people will say "ruby is better than javascript but javascript is faster and available in every browser without a user having to do much in addition to that"
[18:41:59] ponga: chrisseaton: that just sounds like magic to me
[18:42:30] ponga: hey shevy
[18:42:45] ponga: http://benchmarksgame.alioth.debian.org/u64q/ruby.html i looked at this ruby vs python 3 and found something curious
[18:42:57] ponga: ruby seems to perform better in 64x than 86x
[18:43:57] shevy: dunno... 64 bit can hold more operational power?
[18:44:43] shevy: ponga https://answers.yahoo.com/question/index?qid=20110508200521AA77UdN
[18:45:30] ponga: oh no sorry my question was bad
[18:45:46] ponga: what i found weird is that in 64x bench , ruby seems to perform better than python
[18:45:58] ponga: at least in that benchmark website
[18:46:15] ponga: in x86 ruby is slower but faster in x64
[18:46:29] shevy: yeah ruby is quite fast
[18:46:41] shevy: compared to past results
[18:46:46] shevy: where python was faster than 1.8.x
[18:47:17] ponga: will i ever understand programming
[18:47:38] ponga: im just a linguist, and self taught code noob
[18:48:15] ponga: anyway chrisseaton i really love ruby and am a person who's trying to do some NLP in ruby and looking forward to see that fast combination
[18:48:27] ponga: admire you
[18:50:37] sandelius: I've been working with Ruby for many years now and I still get a smile on my face when I read Ruby code :) What a great life :D
[18:51:47] chrisseaton: ponga: if you have any open source research projects I could take a look at for benchmarks, that would be cool
[18:51:47] ponga: my first language was java and it wasn't pleasant at all
[18:51:56] ponga: im very happy when writing in ruby
[18:53:05] ponga: chrisseaton: no sorry im really really noob in this field you know.. i come from linguistics/philosophy degree, im also self taught to write code
[18:53:15] ponga: haha im still learning
[18:55:10] ponga: one day i was trying to do array.push(array.shift) , didn't know that i could do it this way, so i wrote down this
[18:55:12] ponga: http://pastie.org/9811316
[18:55:12] shevy: ponga I guess java is ok if you can live with is verbosity
[18:55:18] ponga: see? im big noob lol
[18:55:37] shevy: array << array.shift should work too or?
[18:55:40] ponga: shevy: did you see this? i didn't know i could array.push(array.shift)
[18:55:51] shevy: well you invoke two methods there
[18:55:59] shevy: the element that gets returned by array.shift
[18:56:05] shevy: and you pass it as argument to array.push method
[18:56:08] ponga: so that if statement is what i originally did
[18:56:11] shevy: << is also a method invocation by the way
[18:56:23] ponga: and some guy in ##ruby told me that i can simply push shift
[18:56:36] shevy: oh yeah that was good
[18:56:44] shevy: if you could eliminate an if-condition then that is often really great
[18:56:48] ponga: that if statement came out terribly slower
[18:57:27] ponga: and shevy i really really hate verbosity
[18:57:52] ponga: i had to write many many lines to simply "gets"
[18:57:56] ponga: in java i mean
[18:58:15] shevy: in ruby it is just gets!
[18:58:28] shevy: that's pretty short
[18:58:43] shevy: you could also write $stdin.gets
[18:58:44] ponga: yeah and more readable
[18:59:35] ponga: shevy:well i was kinda proud that my if method was not twice as slower
[19:04:58] ponga: oh and shevy i liked the concept that everything is object
[19:05:02] ponga: it makes me very happy
[19:05:31] Godd2: ponga then you may also like Lisp, where everything is a list
[19:09:51] shevy: but (there (are (drawbacks (in (lisp (ponga
[19:10:48] ponga: will i like lisp? i like lambda in ruby
[19:11:22] shevy: many like it
[19:11:29] shevy: I did not like the ((((
[19:12:22] ponga: i looked at it
[19:12:27] ponga: i don't like brackets either
[19:12:35] ponga: niether the semicolon
[19:14:20] ponga: shevy: in ruby i have both proc /lambda to choose from, will i get something similar in python
[19:14:28] MrSparkle: then do and end are your friend
[19:14:42] ponga: yeah i always do end over {}
[19:14:47] ponga: love do and end
[19:14:52] ponga: much more readable to me
[19:15:17] MrSparkle: I'll use the {} if I really want a single line of code etc
[19:15:34] MrSparkle: hashes can be weird without em though
[19:15:50] ponga: many reasons i still stick to ruby even tho im doing natural language processing
[19:16:03] shevy: ponga no real idea how python handles procs
[19:16:06] shevy: python uses strange things
[19:16:08] shevy: like decorators
[19:16:21] ponga: what? you decorate?
[19:16:24] ponga: ACTION is confused
[19:16:25] shevy: in python
[19:16:29] shevy: def bla():
[19:16:51] ponga: i'd stick to ruby
[19:16:51] shevy: I forgot what it does; I knew what it did about 2 years ago hehehe
[19:17:27] ponga: what im trying to do has not much to do with which language and performance
[19:17:39] ponga: it's ok to be slower
[19:18:04] MrSparkle: just look at android!
[19:19:23] ponga: sorry MrSparkle i don't quite get your joke
[19:19:29] ponga: haven't they dumped dalvik yet
[19:20:11] ponga: shevy: but i think the reason i chose ruby over python was that i couldn't n.times do your code end in python
[19:20:36] ponga: that seemed very huge to me back then..
[19:29:01] shevy: ponga for me it was the matz interview, the philosophy of ruby
[19:34:52] MrSparkle: hash = {} vs hash = Hash.new
[19:35:07] MrSparkle: is this hottly debated amongst nerds
[19:37:01] MrSparkle: how do you even define a default value without Hash.new
[19:37:07] ponga: MrSparkle: aren't those two for different usages anyway?
[19:37:24] ponga: i find {} more convinent in some cases over .new and vice-versa
[19:38:52] ponga: what's easiest way to do single key, multiple value dictionary in ruby
[19:39:21] waxjar: let the value be an Array?
[19:39:25] Godd2: ponga probably to have a hash whose values are arrays
[19:41:24] MrSparkle: hasher = {0}/hop
[19:41:58] havenwood: ponga: Hash.new { |hash, key| hash[key] = [] }
[19:42:11] ponga: hi havenwood
[19:42:16] havenwood: ponga: hiya
[19:42:16] ponga: long time no see
[19:42:26] havenwood: through the ages
[19:42:58] havenwood: ponga: if you use that ^ as your Hash, you can just shovel onto it
[19:43:07] MrSparkle: and then I figure it out after that derp
[19:44:21] havenwood: >> @hash = Hash.new { |hash, key| hash[key] = [] }; @hash[:cats] << 'Mr. Fluffles' << 'Dr. Meow'; @hash
[19:44:21] eval-in__: havenwood => {:cats=>["Mr. Fluffles", "Dr. Meow"]} (https://eval.in/239300)
[19:45:03] apeiros_: MrSparkle: not debated, no. if {} or [] or "" is sufficient, you use the literals.
[19:46:09] Godd2: Of course, don't forget Array()
[19:46:20] Godd2: >> Array(nil)
[19:46:20] eval-in__: godd2 => [] (https://eval.in/239301)
[19:46:33] ponga: thanks havenwood
[19:46:37] apeiros_: ACTION has yet to see a proper use of Array()
[19:46:39] ponga: that would work smooth
[19:46:59] waxjar: those methods always confuse me, wish they weren't there
[19:47:34] havenwood: apeiros_: undef Array
[19:47:49] havenwood: i guess that's not proper either ;P
[19:48:01] ponga: i think it was you havenwood who told me to use array.shift(array.push)
[19:48:17] cats: funny how I always get pinged here, while I never get pinged on any other channels for programming languages :P
[19:48:32] apeiros_: ponga: aren't you confusing shift and push there?
[19:48:32] crome: ::[] on Hash is the one I just can't get used to seeing
[19:48:32] havenwood: cats: i have lots of cats in my code, just happens
[19:48:46] Godd2: dont look at me, I always use dogs for my examples
[19:48:47] havenwood: cats: cats and ruby overlap
[19:48:59] ponga: apeiros_: yeah lol i am
[19:49:06] apeiros_: crome: lucky you, that 2.1+ have #to_h
[19:49:32] shevy: MrSparkle you can still use .default= of course lateron; {} should be a bit faster than Hash.new, and much shorter in characters
[19:50:00] ponga: what the hell.. to_hash?
[19:50:13] shevy: I think just to_h
[19:50:30] ponga: when would someone ever want to to_h
[19:50:44] waxjar: >> [:hi, "ponga"].to_h
[19:50:44] eval-in__: waxjar => wrong element type Symbol at 0 (expected array) (TypeError) ... (https://eval.in/239302)
[19:50:58] havenwood: ponga: I didn't say?: a.rotate!
[19:51:11] waxjar: >> [[:hi, "ponga"]].to_h
[19:51:11] eval-in__: waxjar => {:hi=>"ponga"} (https://eval.in/239303)
[19:51:15] waxjar: that's the one
[19:51:34] ponga: interesting
[19:52:02] waxjar: it's especially handy if you do ary.zip(other_ary).to_h
[19:52:06] ponga: interesting indeed
[19:52:19] apeiros_: or somethingsomething.map { ??? }.to_h
[19:53:51] ponga: im looking at #zip for array in doc
[19:53:57] ponga: can't understand it at all
[19:54:01] ponga: what does array.zip do
[19:54:04] shevy: yeah it is not easy to understand
[19:54:07] shevy: an example is best ponga
[19:54:28] ponga: i think i should use .zip myself several times
[19:54:33] ponga: then it'd help me understand
[19:54:34] shevy: ["a","b","c","d"].zip ["1","2"] # => [["a", "1"], ["b", "2"], ["c", nil], ["d", nil]]
[19:54:41] shevy: you see, two arrays were zipped together
[19:54:49] shevy: nil values were added when the second array was too short
[19:54:53] crome: just like when you put on your coat!
[19:55:02] Godd2: ponga think of a zipper like on your clothes. a zipper lines up each little tooth of the other side of the zipper
[19:55:03] shevy: crome I always have to think of UNZIPPING MY PANTS there
[19:55:22] shevy: ponga yeah zipper, but remember it - the ruby .zip means to zip and close it, not to open your pants!
[19:55:42] shevy: but I don't think .zip is oftenly used
[19:55:49] shevy: because how often do you have two arrays that must be zipped?
[19:55:54] shevy: and besides, isn't that like a use case for a Hash?
[19:56:16] shevy: though you can convert it into a hash too of course
[19:56:25] ponga: i'd love to use #unshift
[19:56:40] shevy: Hash[*[["a", "1"], ["b", "2"], ["c", nil], ["d", nil]].flatten] # => {"a"=>"1", "b"=>"2", "c"=>nil, "d"=>nil}
[19:56:43] shevy: now it is a hash
[19:56:58] crome: since I see it quite oftenly, I feel like making a remark on it. there is no such word
[19:57:11] shevy: I am sure you have weird codebases!
[19:57:31] waxjar: the * and flatten aren't necessary shevy
[19:57:48] ponga: what's * doing anyway
[19:58:01] Godd2: >> ["do","a",1].zip(["re","b",2],["mi","c",3]) << ["baby you and me"]
[19:58:01] eval-in__: godd2 => [["do", "re", "mi"], ["a", "b", "c"], [1, 2, 3], ["baby you and me"]] (https://eval.in/239304)
[19:58:17] lampd1: what about #map ?
[19:58:42] crome: ponga: it is called the "splat" operator. it tells ruby to treat an array as a list of arguments, rather than one object
[19:58:54] Godd2: >> [*1..5]
[19:58:55] eval-in__: godd2 => [1, 2, 3, 4, 5] (https://eval.in/239305)
[19:59:17] crome: but dependong on the context it doens a bunch of other things as well...
[19:59:17] ponga: >> [1..5]
[19:59:18] eval-in__: ponga => [1..5] (https://eval.in/239306)
[19:59:18] lampd1: >> [1..5]
[19:59:18] eval-in__: lampd1 => [1..5] (https://eval.in/239307)
[19:59:25] waxjar: it calls #to_a / #to_ary (i always forget) under the hood, to get an array
[19:59:42] shevy: waxjar cool
[20:00:04] ponga: i need soda
[20:00:18] shevy: truthfully I did not even look at it, I just typed in irb until the outcome was ok, then I copy pasted into the channel :)
[20:00:59] Godd2: >> [*1..5, 6, 7, *"a".."e"]
[20:00:59] eval-in__: godd2 => [1, 2, 3, 4, 5, 6, 7, "a", "b", "c", "d", "e"] (https://eval.in/239308)
[20:01:03] lampd1: >> Array(1..5)
[20:01:04] eval-in__: lampd1 => [1, 2, 3, 4, 5] (https://eval.in/239309)
[20:01:55] ponga: Array(*1..5)
[20:01:58] ponga: >> Array(*1..5)
[20:01:58] eval-in__: ponga => wrong number of arguments (5 for 1) (ArgumentError) ... (https://eval.in/239310)
[20:02:09] lampd1: >> a = Array.new; a << [1..5];a
[20:02:09] eval-in__: lampd1 => [[1..5]] (https://eval.in/239311)
[20:02:18] lampd1: >> a = Array.new; a << 1..5;a
[20:02:18] eval-in__: lampd1 => [1] (https://eval.in/239312)
[20:02:34] sandelius: is there any one using sinatra for a large app?
[20:02:47] waxjar: let's all start up our irb / pry / ripl to do experiments :)
[20:02:54] lampd1: haha 2 lazy atm
[20:03:15] lampd1: you guys ever check out omniref?
[20:04:59] waxjar: i boycot them. they filtered all e-mail addresses from the gemspecs on rubygems, then send out emails asking if i'd like to claim my projects or something
[20:05:09] waxjar: aka promoting their website
[20:05:41] lampd1: >> a = [*1..5];a.flatten_splat!
[20:05:42] eval-in__: lampd1 => undefined method `flatten_splat!' for [1, 2, 3, 4, 5]:Array (NoMethodError) ... (https://eval.in/239313)
[20:06:38] lampd1: i just like their layout waxjar
[20:06:55] lampd1: much more readable than ruby-doc
[20:07:28] waxjar: i've been using devdocs the last few weeks
[20:09:22] havenwood: sandelius: sure, there are. why do you ask?
[20:10:50] Godd2: sandelius when you say large, do you mean lots of users or lots of features?
[20:11:11] havenwood: 10,000 routes
[20:11:25] sandelius: havenwood I'm considering taking a modular sinatra approach on our next inhouse SaaS application. It's mostly just an API serving JSOn with a few exceptions. It's a CMS
[20:12:33] sandelius: We've been using Rails for most stuff before.
[20:13:59] havenwood: sandelius: There was a RubyRogues episode discussing making modular Sinatra/Padrino apps a while back, if you haven't listened to it yet: http://devchat.tv/ruby-rogues/170-rr-padrino-with-dario-cravero-nathan-esquenazi-arthur-chiu
[20:14:33] sandelius: havenwood yeah I have. That's actuallt when I started to think about it.
[20:14:46] havenwood: sandelius: Lotus and Roda are other very nice looking tools to consider.
[20:15:17] waxjar: there's a nice talk on roda on confreaks
[20:15:33] havenwood: Roda actually can handle 10k routes, doesn't choke on mass-regexping like the others. :)
[20:16:12] havenwood: http://www.confreaks.com/videos/4833-RubyConf2014-roda-the-routing-tree-web-framework
[20:16:19] havenwood: there's a #roda channel as well
[20:18:08] cjm_: Hi Folks, I'm trying to get a Ruby on Rails application running with nearly zero Ruby on Rails experience. Needless to say, it is not without its challenges. I have done "gem install rake", which gave me 10.4.2, but the command "rake time:zones:local" fails with ...
[20:18:21] cjm_: You have already activated rake 10.4.2, but your Gemfile requires rake 10.3.2.
[20:18:31] cjm_: Can anybody advise me?
[20:18:51] sandelius: cjm_ bundle exec rake time:zones:local
[20:18:59] jhass: cjm_: is that the full message? iirc the solution is in it
[20:20:09] sniperh4x0r: should i stick with ruby 2.1?
[20:20:35] sniperh4x0r: i got this version a while ago but they have 2.2 now
[20:20:40] sniperh4x0r: any major difference?
[20:20:42] cjm_: sandelius, jhass It is a summary of the message. I also tried "bundle exec rake time:zones:local" and it also failed. I see now that it is telling me something different: "LoadError: cannot load such file -- mysql2/mysql2"
[20:21:20] sandelius: sniperh4x0r symbol GC
[20:21:45] jhass: cjm_: try ensuring gem 'mysql2' is in your Gemfile. Run bundle install again if you had to add it
[20:21:53] sniperh4x0r: that's what they added/
[20:21:56] sniperh4x0r: is it worth upgrading?
[20:22:00] lampd1: waxjar++ devdocs is dope
[20:22:02] havenwood: sniperh4x0r: Here're a list of notable changes: https://www.ruby-lang.org/en/news/2014/12/25/ruby-2-2-0-released/
[20:22:07] havenwood: sniperh4x0r: Always use latest stable.
[20:22:15] sandelius: sniperh4x0r Ahh you mean breaking changes?
[20:22:24] cjm_: jhass, O.K., stand by....
[20:23:12] havenwood: sniperh4x0r: Question is, 2.2.0 or 2.3.0-dev? :P
[20:28:22] cjm_: jhass, "gem install mysql2"... Success. "bundle exec rake time:zones:local" same failure. "bundle install --without development test" produces about 50 lines of output, among "Using mysql2 0.3.16" Any advice?
[20:31:14] jhass: cjm_: sounds like the native extension wasn't compiled fro some strange reason
[20:31:44] jhass: cjm_: what does bundle show mysql2 give?
[20:32:48] cjm_: jhass, "bundle show mysql2" ==> /usr/local/share/gems/gems/mysql2-0.3.16
[20:34:11] jhass: try sudo gem pristine mysql2 -v 0.3.16 --extensions
[20:35:03] cjm_: jhass, Stand by...
[20:35:46] cjm_: jhass, Same problem... "LoadError: cannot load such file -- mysql2/mysql2"
[20:36:35] jhass: what was the output of the last command I gave?
[20:36:48] rag1ngGerba1: can someone explain why when using regex in ruby you need to use #$1 instead of $1. i understand that normally it would just be $1 printed in a string for example but, doesnt # normally start a comment
[20:36:51] jhass: make a gist if it's > 3 lines
[20:37:23] jhass: rag1ngGerba1: this is not specific to regex, it's specific to string interpolation
[20:37:28] cjm_: jhass, gem pristine mysql2 -v 0.3.16 --extensions
[20:37:28] cjm_: Restoring gems to pristine condition...
[20:37:29] cjm_: Building native extensions with: ''
[20:37:29] cjm_: This could take a while...
[20:37:29] cjm_: Restored mysql2-0.3.16
[20:37:31] waxjar: rag1ngGerba1: #$1 is short for #{$1}, it's just string interpolation
[20:37:42] rag1ngGerba1: ahh ok thanks man
[20:39:24] jhass: cjm_: so does /usr/local/share/gems/gems/mysql2-0.3.16/lib/mysql2/mysql2.so exist?
[20:40:31] cjm_: jhass, "/usr/local/share/gems/gems/mysql2-0.3.16/lib/mysql2/mysql2.so" does not exist, but the directory does.
[20:41:03] jhass: so something seems to skip compilation of the native extension on your system
[20:41:09] jhass: you need to investigate why is that
[20:41:24] jhass: as I've never seen that before, I can't help you in doing so
[20:42:07] jhass: "Building native extensions with: ''" seems strange, so that might be a starting point
[20:43:29] cjm_: jhass, Thanks very much for the help you've given me. I have nearly zero experience with Ruby, so it is going to take me *forever* sort this out.
[20:44:07] cjm_: jhass, Does this make any sence to you: http://www.42.mach7x.com/2013/08/26/rails-require-cannot-load-such-file-mysql2mysql2-loaderror/
[20:44:18] jhass: I suspect it's less of a Ruby issue but more of a $distro or $build_system issue
[20:45:09] jhass: cjm_: well, there's not much to make sense out of it
[20:45:30] jhass: you try the suggested solution, it either works or it doesn't
[20:45:43] jhass: note that 0.3.16 is not the most recent version
[20:46:05] jhass: 0.3.17 is, so you might want a -v 0.3.16 to the commands
[20:46:13] cjm_: rvm is unrecognized. "bash: rvm: command not found"
[20:46:14] jhass: or update your bundle
[20:46:21] jhass: then you don't use rvm
[20:46:31] jhass: which usually means you can just skip it
[20:51:26] cjm_: jhass, gem uninstall mysql2 Success. "bundle exec rake time:zones:local" => "Could not find mysql2-0.3.16 in any of the sources" -- which is to be expected. "Run 'bundle install' to install missing gems"
[20:52:03] jhass: "uninstall" explain me that term
[20:52:12] cjm_: Apparently, I will get 0.3.17, but everybody seesm to want 0.3.16. How to I tell this to 'bundle install'?
[20:53:03] jhass: I have the feeling you didn't read everything I wrote
[20:53:18] cjm_: jhass, "this" : Please use version .0.3.16, instead of the version 0.3.17 you are giving me."
[20:53:31] jhass: I can't follow
[20:53:34] cjm_: Oh! Sorry...
[20:53:45] cjm_: I see what you mean. I hadn't read it.
[20:54:35] jhass: also I have the feeling you blindly execute commands without trying to understand what they do
[20:56:05] cjm_: jhass, Not blindly, but I have quite limited understanding of how Ruby on Rails works and where everything is. So, there is a greate deal of faith that you are telling me the truth.
[20:57:52] jhass: I mean you can get quite far with applying english
[20:58:02] jhass: read them out loud, it's quite revealing
[21:00:14] cjm_: jhass, I believe I have version 0.3.16 installed. I tried "gem list mysql2" and I see: mysql2 (0.3.16, 0.3.13), which make me think there are two versions there? I have no idea what this means.
[21:00:30] jhass: yes that means it
[21:00:45] jhass: I think the link you found is worth trying
[21:00:50] jhass: I think you didn't fully try it
[21:03:22] cjm_: I tried two instructions: gem uninstall mysql2
[21:03:22] cjm_: gem install mysql2 --platform=ruby
[21:03:34] cjm_: jhass, Is there more to it?
[21:03:43] jhass: 21:45 <jhass> note that 0.3.16 is not the most recent version
[21:03:45] jhass: 21:46 <jhass> 0.3.17 is, so you might want a -v 0.3.16 to the commands
[21:04:27] havenwood: or: bundle update mysql2
[21:05:03] jhass: also I'm still unclear with what permissions you run what, so maybe you're actually utilizing different $GEM_HOME's
[21:14:17] cjm_: jhass, I've read and completed those instructions. $GEM_HOME is unset, and Gemfile is in .
[21:15:18] jhass: The default for it might be different depending on a /etc/gemrc ~/.gemrc and the user you run it under
[21:16:34] cjm_: jhass, I have no .gemrc anywhere on the system, and I know that if I cd someplce else, I get "Can't fine gemfile".
[21:17:18] cjm_: Is there a way to uninstall the bundle and start over?
[21:17:34] jhass: not really if you installed it to the system
[21:17:37] cjm_: There were no errors, but apparently I messed something.
[21:17:51] cjm_: How about re-install?
[21:18:06] jhass: and in my experience starting over doesn't help, because the issue is in the system or the mistake will be repeated
[21:18:43] jhass: maybe something strange in the gem install output you neglected
[21:19:08] jhass: there's still the strange with: '' in the pristine output (which is basically a reinstall)
[21:26:28] cjm_: jhass, I find: /usr/local/share/gems/gems/mysql2-0.3.17/ext/mysql2/mysql2.so It this correct? Should it exist "/usr/local/share/gems/gems/mysql2-0.3.16/lib/mysql2/"
[21:26:54] jhass: I'm actually not sure
[21:27:07] cjm_: jhass, Yeah,... me, too.
[21:27:22] jhass: I got it in both places
[21:27:37] jhass: what's your rubygems version?: gem --version
[21:31:12] reactormonk: Why does File.open("~/test", "w").write("foo") fail with No such file or directory @ rb_sysopen ?
[21:31:32] jhass: because File.open doesn't do path expansions
[21:31:54] jhass: also don't do that, use the block form of File.open or the helper method File.write
[21:32:09] reactormonk: just faster to write that example in here
[21:33:25] jhass: File.write is even shorter
[22:12:50] TrOuBleStArTeR: searching for someone to help me
[22:12:54] TrOuBleStArTeR: il a few commands
[22:13:02] TrOuBleStArTeR: in a few commands
[22:13:37] TrOuBleStArTeR: i'm actually learning ruby to adapt/rewrite some code for metasploit ( for vulerability test purpose )
[22:13:45] TrOuBleStArTeR: i need some help on a C code
[22:13:50] TrOuBleStArTeR: to rewrite in ruby
[22:13:57] TrOuBleStArTeR: it's about FTP session
[22:14:04] crome: I like the euphemism "vulnerability test"
[22:14:54] TrOuBleStArTeR: crome no euphemism
[22:15:01] TrOuBleStArTeR: i'm in IT actually
[22:15:08] TrOuBleStArTeR: i do vulerability test
[22:15:22] TrOuBleStArTeR: but to learn ruby and adapt code in this framework
[22:15:31] TrOuBleStArTeR: i'm trying to rewrite some code
[22:15:39] TrOuBleStArTeR: a very simple exploit actually
[22:15:58] TrOuBleStArTeR: but well, because i'm learning ruby, not very easy to write it at the moment
[22:17:09] jhass: go to #metasploit
[22:17:31] TrOuBleStArTeR: jhass i'm already in
[22:17:49] TrOuBleStArTeR: jhass but actually i've takl with personn that use the framework, but not develop for it
[22:18:03] TrOuBleStArTeR: but developp for etasploit is not like developp in ruby for noob
[22:18:33] TrOuBleStArTeR: it's a framework, and before understand write ruby for this framework, i'm learning ruby core commands :)
[22:20:29] TrOuBleStArTeR: i've just a STAT command in FTP
[22:20:37] TrOuBleStArTeR: but in the original C code
[22:21:12] TrOuBleStArTeR: snprintf(buffer,4096,"STAT {{*},{{*},{{*},{{*},{{*},{{*},
[22:21:30] TrOuBleStArTeR: just wondering how to have a STAT command in ruby and send this kind of thing
[22:22:42] apeiros_: buffer << "STAT {???"
[22:23:11] TrOuBleStArTeR: il's like a puts but in a buffer if i understand
[22:23:22] TrOuBleStArTeR: il's like a "puts" but in a buffer if i understand
[22:23:32] apeiros_: maybe you should learn C before you try to translate C to ruby?
[22:23:54] TrOuBleStArTeR: apeiros lot's of work ...
[22:24:11] TrOuBleStArTeR: apeiros actually i'm trying to rewrite because the C code is not very hard to understand
[22:24:19] TrOuBleStArTeR: my goal is to :
[22:24:33] TrOuBleStArTeR: and direct rite to ruby the code next time
[22:24:38] TrOuBleStArTeR: and direct write to ruby the code next time
[22:25:17] TrOuBleStArTeR: metapsloit framework have already exploits
[22:25:40] TrOuBleStArTeR: because i would like to implement this vulerabilty in the framework
[22:26:12] TrOuBleStArTeR: ( but not implemente actually ) because this vulnerability don't interest actuall developers
[22:26:22] TrOuBleStArTeR: so i try it myself
[22:26:53] TrOuBleStArTeR: apeiros it would be great to learn C but lot's of work
[22:27:00] TrOuBleStArTeR: i used to develop in VB 6
[22:27:16] TrOuBleStArTeR: develop = code ( sorry for bas english )
[22:27:27] TrOuBleStArTeR: develop = code ( sorry for bad english )
[22:28:01] TrOuBleStArTeR: i atually work in IT systems and network
[22:28:07] TrOuBleStArTeR: also in security sometime
[22:29:57] TrOuBleStArTeR: apeiros with your exemple "buffer << "STAT {???"
[22:30:35] TrOuBleStArTeR: i will have a look at it
[22:30:42] apeiros_: the stuff you left out.
[22:31:02] apeiros_: since your C code is obviously incomplete, I saw no reason to completely reproduce it either.
[22:31:56] TrOuBleStArTeR: apeiros i can let you an url of this code. just a dos. not a real hack stuff
[22:32:14] apeiros_: and what should I do with that?
[22:32:16] TrOuBleStArTeR: not very useful to script kiddies
[22:32:22] apeiros_: I'm not interested in translating your C code for you.
[22:32:33] TrOuBleStArTeR: apeiros i'm not asking you so
[22:32:46] TrOuBleStArTeR: apeiros it's just to help my knwoledge in ruby, that's all
[22:33:10] TrOuBleStArTeR: you just tell me that the C code was obviously incomplete
[22:33:29] TrOuBleStArTeR: i understand that you said : i can't help more, because you just copy/paste me an incomplete code
[22:34:06] TrOuBleStArTeR: but don't want to let you loose your time if yon d'ont want help me
[22:34:22] apeiros_: that's not what I said.
[22:34:28] apeiros_: I help. but I don't do your work.
[22:34:34] TrOuBleStArTeR: i've not understood well sorry
[22:34:51] TrOuBleStArTeR: [11:31] <apeiros_> since your C code is obviously incomplete, I saw no reason to completely reproduce it either.
[22:35:29] apeiros_: do you have a question?
[22:36:09] TrOuBleStArTeR: buffer depends on stringio library ?
[22:36:51] apeiros_: you can use a StringIO to implement a buffer. you can also just use a String.
[22:37:46] TrOuBleStArTeR: with a string, you've got an exemple ?
[22:37:55] TrOuBleStArTeR: but maybe you will tell me it's better to use stringio
[22:38:09] apeiros_: I just showed you how you concatenate strings in ruby.
[22:38:23] TrOuBleStArTeR: yes ok, that's was the example so
[22:38:44] apeiros_: and to be frank, that's a quite basic thing. you can learn those things easily yourself using resources on the net.
[22:39:34] TrOuBleStArTeR: im' ok, i'm starting maybe from much far as i think :)
[22:39:40] TrOuBleStArTeR: but i will investigate
[22:56:49] Yzguy: hello gain!
[22:57:39] Yzguy: anyone know of a ruby equivalent of pythons csv.DictReadeR?
[23:01:03] jhass: Yzguy: csv stdlib?
[23:01:30] Yzguy: well I'm trying to take the first row of the csv and those will be the hash keys
[23:01:41] jhass: csv stdlib does support that
[23:02:02] Yzguy: I'm new to ruby, trying to rewrite something I wrote in python as learning thing
[23:03:01] jhass: http://ruby-doc.org/stdlib-2.2.0/libdoc/csv/rdoc/CSV.html#method-c-new
[23:03:15] jhass: see the :headers option
[23:31:21] Yzguy: that works! thanks
[23:51:51] shevy: Yzguy is learning super fast
[23:52:44] kl: what does it mean when you do self.class.some_method_name ?
[23:52:53] kl: how does that differ to self.some_method_name ?
[23:54:17] shevy: you call the class
[23:54:22] shevy: class Foo
[23:54:30] shevy: self.class.bla -> Foo.bla()
[23:54:46] kl: What's self.bla then? :/
[23:54:51] shevy: a class method
[23:54:54] ddd: the self.class.foo calls the class. self.foo calls foo on whatever is occupying self atm
[23:54:55] shevy: look here kl
[23:55:11] shevy: >> class Foo; def self.bla; puts 'hi from bla'; end; end; Foo.bla
[23:55:11] eval-in__: shevy => hi from bla ... (https://eval.in/239318)
[23:55:36] shevy: it can be more readable
[23:55:38] shevy: for instance:
[23:55:42] shevy: User.login()
[23:56:41] ddd: shevy: thats right right? self.class.foo calls foo on the *class* itself (which is also an object). self.foo calls foo on the object currently occupying self. could be any object, not necessarily one of type class
[23:57:00] shevy: kl read ddd's explanation ^^^
[23:57:48] shevy: kl you can have methods for your object (instantiated from a class), or from the class object itself; you can also define @instance_variables for both though instance variables are much more common for the objects derived through className.new
[23:58:19] shevy: kl if it helps you, the moment you ask yourself in which "self" you are in, is the moment where it should be super simple
[23:58:47] ddd: hmm that one confused me
[23:58:58] kl: yeah i'm confused
[23:59:25] ddd: how would it be simple? (and how would you find out? calling self.class at that stage would only tell you what class that object was derived *from*, not which self it actually was.