« Back to channel list

#ruby - 30 March 2016

« Back 1 day Forward 1 day »
[00:00:52] rbennacer: has joined #ruby
[00:01:37] minimalism: has joined #ruby
[00:02:02] Rubie: has joined #ruby
[00:02:39] Chunlea: has joined #ruby
[00:03:47] workmad3: has joined #ruby
[00:04:41] wethu: has joined #ruby
[00:06:32] Dimik: is there a way to get around .to_i cutting off decimal points ?
[00:07:33] smathy: Dimik, the i stands for integer.
[00:07:39] Dimik: that's a very messed up solution
[00:07:55] Dimik: i'm aware
[00:07:56] Radar: Dimik: use .to_f
[00:08:08] Dimik: can i do calculations with to_f ?
[00:08:11] smathy: Dimik, so integers don't have decimal components.
[00:08:20] avenj: has joined #ruby
[00:08:26] ruby[bot]: it seems like you are asking for a specific solution to a problem, instead of asking about your problem. This often leads to bad solutions and increases frustration for you and those trying to help you. More: http://meta.stackexchange.com/a/66378
[00:08:28] smathy: Dimik, how are you going to make an integer without cutting off .... yeah ^ that actually.
[00:08:58] Radar: ?try Dimik
[00:08:59] ruby[bot]: Dimik: Why don't you try it and see for yourself?
[00:09:30] Dimik: thank you very much for your help
[00:12:38] kfpratt: has joined #ruby
[00:12:48] djbkd: has joined #ruby
[00:13:24] Ropeney: has joined #ruby
[00:15:42] baweaver: myntcake: ?
[00:16:29] ruralhack: has joined #ruby
[00:17:05] mustmodify_: has left #ruby: ()
[00:17:39] ruralhack: Hi ruby friends, please watch this video: https://www.youtube.com/watch?v=tyV-cAC9PKc
[00:17:45] ruralhack: has left #ruby: ("Leaving")
[00:17:57] znz_jp: has joined #ruby
[00:20:45] baweaver: !troll ruralhack
[00:20:45] ruby[bot]: +bb ruralhack!*@*$#ruby-banned *!*@unaffiliated/ruralhack$#ruby-banned
[00:22:57] GodFather: has joined #ruby
[00:23:41] sdwrage: has joined #ruby
[00:25:10] baweaver: !ban ruralhack
[00:26:11] Xeago: has joined #ruby
[00:26:33] Dimik: is that guy on meth or what
[00:26:55] ramfjord: has joined #ruby
[00:30:16] Ebok: has joined #ruby
[00:31:39] _whitelogger: has joined #ruby
[00:34:51] shevy: Dimik probably just an auto-bot
[00:34:58] Aswebb_: has joined #ruby
[00:38:58] Suntzu: has joined #ruby
[00:41:00] jenrzzz: has joined #ruby
[00:41:44] freerobby: has joined #ruby
[00:42:50] makenoise: has joined #ruby
[00:45:54] cpup: has joined #ruby
[00:46:25] johnny`: has joined #ruby
[00:47:11] johnny`: has left #ruby: ()
[00:47:43] johnny`: has joined #ruby
[00:47:52] johnny`: has left #ruby: ()
[00:47:54] baweaver: has joined #ruby
[00:48:45] Maletor: has joined #ruby
[00:49:49] wpww88: has joined #ruby
[00:50:36] wool: has joined #ruby
[00:51:25] sgambino: has joined #ruby
[00:52:07] goodroot: has joined #ruby
[00:54:14] trosborn: has joined #ruby
[00:56:16] havenwood: i need to release a new version of this pure Ruby SHA3 gem since someone contributed a FIPS 202 compliance patch. how could it be improved?: https://github.com/havenwood/sha3-pure-ruby/blob/master/lib/sha3-pure-ruby.rb
[00:56:44] havenwood: i'm curious if there are any substantial performance improvements to be had
[00:57:05] havenwood: i suppose setting up benchmarks would help
[00:57:18] baweaver: eam or xshay would be the best to ask
[00:57:25] havenwood: or other improvements
[00:57:27] baweaver: though xshay is rarely on
[00:57:38] baweaver: tenderlove as well
[00:58:25] havenwood: this gem needs FIPS 202 ported over from the Node version's C ext: https://github.com/phusion/digest-sha3-ruby
[00:58:33] havenwood: it's a nicely done gem too!
[00:58:42] irick: has joined #ruby
[00:59:01] hahuang61: has joined #ruby
[00:59:08] baweaver: probably best to avoid each with object and similar methods
[00:59:11] tatsuo: has joined #ruby
[00:59:19] havenwood: baweaver: good point
[00:59:23] baweaver: they tend to be slower than a for loop, but that'd be at the point of shaving hairs
[00:59:33] baweaver: same with times I'd guess
[00:59:36] sp4rrow: has joined #ruby
[01:00:24] baweaver: pretty much pretend you're writing C if you _really_ need performance
[01:00:34] bkxd: has joined #ruby
[01:00:41] baweaver: better yet, make an extension if there's not a stipulation of pure ruby
[01:00:48] Radar: Rewrite in Elixir for maximum speed.
[01:00:58] havenwood: it'd be nice to bring the digest-sha3-ruby up to spec and propose it for Ruby stdlib
[01:02:16] vdamewood: has joined #ruby
[01:03:13] havenwood: Radar: Err, is there a FIPS 202 compliant Erlang/Elixir implementation? :O
[01:04:04] havenwood: With a quick search I just found early Erlang reference implementations.
[01:07:39] havenwood: It must exist. Might be fun to write.
[01:08:13] baweaver: also the buffer = @buffer is going to be slow
[01:08:23] rodfersou: has joined #ruby
[01:08:32] baweaver: ivars are faster
[01:08:56] baweaver: http://greyblake.com/blog/2012/09/02/ruby-perfomance-tricks/
[01:08:58] havenwood: baweaver: locals are faster yet
[01:09:16] baweaver: not by that
[01:09:28] havenwood: (it's a local)
[01:10:36] baweaver: user system total real
[01:10:36] baweaver: @var 4.780000 0.000000 4.780000 ( 4.778361)
[01:10:36] baweaver: var 5.190000 0.000000 5.190000 ( 5.197689)
[01:10:38] baweaver: @var = 4.740000 0.000000 4.740000 ( 4.742167)
[01:10:38] havenwood: hence speed tricks like: https://github.com/puma/puma/blob/master/lib/puma/thread_pool.rb#L68-L72
[01:10:40] baweaver: self.var = 5.650000 0.010000 5.660000 ( 5.663195)
[01:10:50] baweaver: run on a 2.1.2
[01:11:06] havenwood: baweaver: that... doesn't seem right :O
[01:11:18] havenwood: benchmark ips?
[01:11:25] baweaver: see that link above
[01:11:30] baweaver: copied the code directly
[01:12:06] baweaver: installing / testing on 2.3, give me a bit
[01:12:17] chipotle: has joined #ruby
[01:12:43] mistermocha: has joined #ruby
[01:13:31] baweaver: If it is true, should probably patch Puma for it.
[01:17:38] dc2: has joined #ruby
[01:19:07] lemur: has joined #ruby
[01:21:19] goodroot: has joined #ruby
[01:22:06] shevy: @ivars are faster?
[01:23:26] mistermocha: has joined #ruby
[01:23:35] Inside: has joined #ruby
[01:23:54] cdg: has joined #ruby
[01:23:58] drewo: has joined #ruby
[01:24:00] skweek: has joined #ruby
[01:25:05] mistermo_: has joined #ruby
[01:26:30] havenwood: conflating getting and setting on this particular machine it doesn't seem so: https://gist.github.com/havenwood/da706eeb1a3b80aaac980743cb21a0b2
[01:27:05] mistermocha: has joined #ruby
[01:27:30] shevy: lol the title
[01:28:06] edwinvdg_: has joined #ruby
[01:28:09] blackmesa: has joined #ruby
[01:28:23] shevy: I always get ips wrong... the higher the faster right?
[01:28:37] havenwood: shevy: more iterations
[01:28:44] havenwood: shevy: per second
[01:28:52] shevy: now I get the name :D
[01:28:56] baweaver: https://gist.github.com/baweaver/fb8fc2c50af7ba0c8e288963e8d3e41d
[01:29:13] shevy: omg it's a speed war!
[01:29:37] baweaver: I'd have to play with it a lot more honestly
[01:29:49] donnoc: has joined #ruby
[01:29:51] moredhel: has joined #ruby
[01:30:11] havenwood: Method calls are slow for sure.
[01:30:45] baweaver: I wonder what'd happen with lambda vs method
[01:31:01] Beladona: has joined #ruby
[01:31:01] havenwood: lambdas in methods versus methods in lambdas
[01:31:05] havenwood: Beladona: hi
[01:31:17] shevy: I assume that lambdas would be slower than regular methods
[01:31:35] Beladona: My new redmine installation is just showing directory files and not redmine page. I think I have old ruby. How to check havenwood ?
[01:31:52] jamo: has joined #ruby
[01:32:07] Maletor: has joined #ruby
[01:32:09] baweaver: lambda is about twice as slow
[01:32:31] havenwood: baweaver: i wonder how long the method chain has to be to hit the point of inflection :)
[01:32:39] Beladona: gem install rails -v=2.3.5 - rails's executable "rails" conflicts with railties Overwrite the executable? [yN] nERROR: Error installing rails: "rails" from rails conflicts with installed executable from railties
[01:32:41] uglybandersnatch: has joined #ruby
[01:32:48] perry: has joined #ruby
[01:32:48] perry: has joined #ruby
[01:32:57] baweaver: we must poke it
[01:32:57] jtdowney: has joined #ruby
[01:32:57] jtdowney: has joined #ruby
[01:33:00] oz: has joined #ruby
[01:33:01] Log1x: has joined #ruby
[01:33:08] baweaver: wait, redmine runs on 2.x?
[01:33:11] julieeharshaw: has joined #ruby
[01:33:12] codex: has joined #ruby
[01:33:13] valeri_ufo: has joined #ruby
[01:33:22] apeiros: has joined #ruby
[01:33:31] C0deMaver1ck: has joined #ruby
[01:33:49] slackR: has joined #ruby
[01:33:50] PaulePanter: has joined #ruby
[01:33:50] Esya: has joined #ruby
[01:34:06] aep: has joined #ruby
[01:34:19] Beladona: baweaver, how can I be sure?
[01:34:35] baweaver: gem install rails -v=2.3.5
[01:34:37] Beladona: http://www.redmine.org/boards/2/topics/15491?r=15498#message-15498
[01:34:47] Beladona: gem install rails -v=2.3.5 - rails's executable "rails" conflicts with railties Overwrite the executable? [yN] nERROR: Error installing rails: "rails" from rails conflicts with installed executable from railties
[01:34:55] baweaver: that's 5 years ago
[01:34:59] wool: has joined #ruby
[01:35:08] benzrf: railties royalties
[01:35:12] vdamewood: has joined #ruby
[01:35:14] baweaver: a ton has changed since then
[01:35:20] Beladona: ok a) how to check current version b) whcih version to install?
[01:35:34] baweaver: what have you looked at to install it?
[01:35:51] dextertzu: has joined #ruby
[01:35:59] Beladona: I dont know honestly
[01:36:02] havenwood: Beladona: a) ruby -v b) 2.3.0
[01:36:06] darix: the latest redmine uses 4.2
[01:36:29] Beladona: ruby 2.3.0p0 (2015-12-25) [x86_64-linux-gnu]
[01:36:34] baweaver: http://www.redmine.org/projects/redmine/wiki/RedmineInstall
[01:36:47] havenwood: Beladona: oh, current Rails version you mean
[01:36:48] rcs: has joined #ruby
[01:36:53] darix: Beladona: which redmine version do you try to install?
[01:37:25] lyoshajapan: has joined #ruby
[01:38:42] darix: Beladona: unpack the tarball and then bundle install
[01:38:52] hotpancakes: has joined #ruby
[01:39:09] Beladona: I just did gem install rails -v=4.2.0
[01:39:20] darix: Beladona: no
[01:39:27] darix: Beladona: bundle install in the unpacked dir
[01:40:01] darix: http://www.redmine.org/projects/redmine/repository/entry/branches/3.2-stable/Gemfile
[01:40:11] darix: bundle install will pick up all the things mentioned in that file
[01:40:23] darix: oh you need to configure your database before
[01:41:25] bronson: has joined #ruby
[01:41:44] Radar: better than the alternative
[01:41:58] darix: Beladona: better than you typing all the gem install manually ;)
[01:42:00] sorbo_: has joined #ruby
[01:42:00] Beladona: I mean the gem install is slow
[01:42:06] darix: especially when you use wrong arguments :p
[01:42:20] Beladona: I have no idea what ruby and ror is
[01:42:26] darix: Beladona: you dont need 4.2.0 (which has security bugs)
[01:43:11] havenwood: Beladona: Ruby is a language.
[01:43:54] Beladona: and ror is fw
[01:43:59] Beladona: that I know
[01:44:05] Beladona: nothing else
[01:44:08] havenwood: Beladona: Rails is one of many Ruby gems, which are Ruby code as distributable packages.
[01:44:22] Beladona: I think its an issue of passanger. Thats what I got last time
[01:44:31] darkf: has joined #ruby
[01:44:34] Beladona: havenwood, hm
[01:45:19] Beladona: maybe the apache .conf file?
[01:46:02] Beladona: I better come tomorrow.
[01:46:54] Marsupermammal: has joined #ruby
[01:48:02] Beladona: thanks guys
[01:48:03] leon_e: has joined #ruby
[01:51:16] diegoaguilar: has joined #ruby
[01:51:16] agent_white: has joined #ruby
[01:51:55] dtzuzu: has joined #ruby
[01:52:05] |gwep: has joined #ruby
[01:52:36] juria_roberts: has joined #ruby
[01:54:05] idletask: has joined #ruby
[01:57:18] jdawgaz: has joined #ruby
[01:58:00] DLSteve: has joined #ruby
[01:58:03] tatsuo: has joined #ruby
[02:01:05] brt: has joined #ruby
[02:03:46] B1n4r10: has joined #ruby
[02:07:51] babblebre: has joined #ruby
[02:09:06] uglybandersnatch: has joined #ruby
[02:10:53] leon_e: has joined #ruby
[02:12:40] sudoubuntu: has joined #ruby
[02:14:58] Musashi007: has joined #ruby
[02:16:23] bkxd: has joined #ruby
[02:16:43] spuk: has joined #ruby
[02:17:06] htmldrum: has joined #ruby
[02:17:06] htmldrum_: has joined #ruby
[02:17:42] sudoubuntu: has joined #ruby
[02:20:38] hotpancakes: has joined #ruby
[02:24:17] nikger: has joined #ruby
[02:28:51] blackmesa: has joined #ruby
[02:29:24] Rubie: has joined #ruby
[02:31:32] sdwrage: has joined #ruby
[02:32:12] hxegon: has joined #ruby
[02:33:58] amclain_: has joined #ruby
[02:35:07] chagel: has joined #ruby
[02:35:46] Aswebb_: has joined #ruby
[02:39:12] krobzaur_: has joined #ruby
[02:39:14] djbkd: has joined #ruby
[02:39:47] decoponio: has joined #ruby
[02:39:51] lyoshajapan: has joined #ruby
[02:42:44] Devalo: has joined #ruby
[02:42:54] shevy: I just found https://github.com/ko1/pretty_backtrace
[02:43:06] shevy: but I can't decide if it is prettier
[02:43:09] shevy: it definitely is more verbose
[02:43:59] bronson: has joined #ruby
[02:45:21] Es0teric: has joined #ruby
[02:46:41] sgambino: has joined #ruby
[02:48:41] arescorpio: has joined #ruby
[02:50:59] sorbo_: has joined #ruby
[02:52:24] jtoy: has joined #ruby
[02:52:44] moeabdol2: has joined #ruby
[02:54:32] tomatoes: has joined #ruby
[02:59:46] hahuang61: has joined #ruby
[02:59:59] barajasfab: has joined #ruby
[03:03:44] Rubie: has joined #ruby
[03:05:02] uglybandersnatch: has joined #ruby
[03:11:38] nanoz: has joined #ruby
[03:11:54] torandu: has joined #ruby
[03:13:46] jdawgaz: has joined #ruby
[03:15:35] tatsuo: has joined #ruby
[03:15:41] braincrash: has joined #ruby
[03:16:38] Nawn: has joined #ruby
[03:17:48] duncannz: has joined #ruby
[03:19:52] baweaver: has joined #ruby
[03:21:40] zast: has joined #ruby
[03:21:59] uglybandersnatch: has joined #ruby
[03:22:03] merida: has joined #ruby
[03:24:17] TheGreatGudsby: has joined #ruby
[03:24:28] darkf: has joined #ruby
[03:24:43] Nawn: has joined #ruby
[03:25:03] phredus: has joined #ruby
[03:27:11] helpa: has joined #ruby
[03:29:42] blackmesa: has joined #ruby
[03:31:18] helpa: has joined #ruby
[03:31:55] gregf: has joined #ruby
[03:32:04] baweaver: has joined #ruby
[03:32:07] bkxd: has joined #ruby
[03:33:20] hotpancakes: has joined #ruby
[03:33:54] merida: has joined #ruby
[03:34:05] sudoubuntu: has joined #ruby
[03:34:10] hxegon: has joined #ruby
[03:37:28] gwep|: has joined #ruby
[03:39:44] tatsuo: has joined #ruby
[03:40:22] Rubie: has joined #ruby
[03:41:14] gix: has joined #ruby
[03:42:02] RegulationD: has joined #ruby
[03:42:39] sgambino: has joined #ruby
[03:43:23] davee_: has joined #ruby
[03:45:36] Eiam_: has joined #ruby
[03:47:36] BTRE: has joined #ruby
[03:47:51] hk238: has joined #ruby
[03:49:25] jdawgaz: has joined #ruby
[03:52:52] shevy: does anyone happen to know if one can selectively enable only individual problems for rubocop to check? e. g. "only auto-indent" for the autocorrect option
[03:53:33] benlieb: has joined #ruby
[03:56:15] GitGud: has joined #ruby
[03:58:59] agent_white: has joined #ruby
[03:59:24] chagel: has joined #ruby
[03:59:47] sudoubuntu: has joined #ruby
[04:00:42] hotpancakes: has joined #ruby
[04:00:46] codecop_: has joined #ruby
[04:00:51] torandu: has joined #ruby
[04:01:59] merida_: has joined #ruby
[04:03:46] pawnbox: has joined #ruby
[04:04:11] Es0teric: has joined #ruby
[04:04:16] lyoshajapan: has joined #ruby
[04:04:37] chipotle: has joined #ruby
[04:08:27] sneakerhax: has joined #ruby
[04:09:53] djbkd: has joined #ruby
[04:10:52] trosborn: has joined #ruby
[04:14:50] brentw: any specific reason why ruby doesn't throw an error or return extra nil values for when you specify a range beyond an array?
[04:15:19] brentw: like arr = [0, 1] arr[0..4] => [0, 1]
[04:16:18] ivanskie: has joined #ruby
[04:16:56] shevy: returning extra elements would probably be incorrect
[04:16:58] r1nuz: has joined #ruby
[04:17:40] N1GG3R54R3G4Y: has joined #ruby
[04:17:40] ChanServ: +b *N1GG3R*!*@*
[04:17:40] ChanServ: ChanServ kicked N1GG3R54R3G4Y: Unacceptable nick - http://ruby-community.com/pages/user_rules#rule_2_10
[04:17:42] ruby[bot]: -b+b *N1GG3R*!*@* *N1GG3R*!*@*$#ruby-banned
[04:18:13] havenwood: !badnick N1GG3R54R3G4Y
[04:18:14] ruby[bot]: +b *!*@gateway/web/cgi-irc/kiwiirc.com/ip.162.243.38.194$#ruby-banned
[04:19:05] brentw: but when you call arr[5] => nil, why wouldn't arr[0..3] => [0, 1, nil, nil]?
[04:19:16] merida: has joined #ruby
[04:19:22] trosborn: has joined #ruby
[04:20:24] shevy: arr[5] returns nil but there never was a nil there
[04:21:19] mahlon: Because if you call arr[1,10000000], vs calling arr[12123345] -- that's a million Nil objects instead of 1.
[04:21:59] Rubie: has joined #ruby
[04:22:09] mahlon: (arr[1..10000000] rather)
[04:22:24] shevy: http://ruby-doc.org/core-2.3.0/Array.html#method-i-5B-5D
[04:22:56] sgambino: has joined #ruby
[04:23:19] theRealAlexz: has joined #ruby
[04:23:19] theRealAlexz: has joined #ruby
[04:23:38] shevy: I don't think it can add more nil elements since they were never part of its collection. it's like you have a glass of 5 strawberries, you try to take out 6 but you'll only get five
[04:23:55] merida: has joined #ruby
[04:23:59] solocshaw: has joined #ruby
[04:24:57] Ox0dea: brent_: The observed behavior is the "do what I mean" that the majority of users would expect.
[04:25:05] hxegon: has joined #ruby
[04:25:22] Ox0dea: It certainly shouldn't throw an error (not very conducive to programmer happiness), and explicitly filling in the `nil`s is wasteful.
[04:26:03] brentw: ruby is merciful
[04:26:30] sorbo_: has joined #ruby
[04:28:14] merida: has joined #ruby
[04:28:40] d0nn1e: has joined #ruby
[04:31:41] blackmesa: has joined #ruby
[04:33:29] chagel: has joined #ruby
[04:35:16] ruby[bot]: -b backintheoven!*@*$#ruby-banned
[04:36:14] mdw: has joined #ruby
[04:36:38] Aswebb_: has joined #ruby
[04:37:02] blackgoat: has joined #ruby
[04:37:25] brentw: Ox0dea: is there a way to find index of element in a 2d-array
[04:39:02] Ox0dea: brent_: y,x-wise, you mean?
[04:39:20] brentw: not finding anything specific
[04:39:45] brentw: sounds like i just need to iterate through the 2d and call .index on each sub array
[04:39:51] Ox0dea: There's nothing tailor-made, but you've got all the bricks you need. :)
[04:40:26] merida_: has joined #ruby
[04:40:50] wanker: has joined #ruby
[04:40:56] wool: has joined #ruby
[04:41:06] baweaver: !ban wanker
[04:41:06] ruby[bot]: +bb wanker!*@*$#ruby-banned *!*@gateway/web/cgi-irc/kiwiirc.com/ip.139.162.222.232$#ruby-banned
[04:41:07] ruby[bot]: ruby[bot] kicked wanker: offense, see http://ruby-community.com/pages/user_rules
[04:41:26] Ox0dea: Egregious?
[04:41:26] ruby[bot]: -b senayar!*@*$#ruby-fix-your-connection
[04:41:50] Devalo: has joined #ruby
[04:42:12] hotpancakes: has joined #ruby
[04:42:29] Radar: Ox0dea: it's a kiwiirc user, on a name that we haven't seen before.
[04:42:33] Radar: Ox0dea: Most likely a trol
[04:42:40] Radar: they can plead their case in #ruby-banned.
[04:42:45] wool: isn't it dangerous to have a bot ban/kick people on request?
[04:42:50] wool: !kick wool
[04:43:17] baweaver: was warning ##javascript
[04:43:47] havenwood: there's usually a backstory
[04:44:31] bronson: has joined #ruby
[04:46:09] hays: has joined #ruby
[04:47:26] havenwood: wool: The bot knows best.
[04:48:31] lyoshajapan: has joined #ruby
[04:49:01] jenrzzz: has joined #ruby
[04:49:06] Ox0dea: brent_: This seems to be the cleanest way to do it without "checking it twice": https://eval.in/544683
[04:49:51] Ox0dea: As soon as you find the sub-array that contains the target element, you've got both coordinates, but there's no way to get both of 'em back out from an #index call without introducing some state. :/
[04:51:27] brentw: this is what i came up with https://eval.in/544684
[04:51:58] havenwood: A few days shy of a year, but here's another RVM release for your Travis!: https://rvm.io/blog/2016/03/rvm-1-27-0
[04:55:22] havenwood: (There are plans for more frequent version-only releases since it's in maintenance mode.)
[04:56:29] adam12: What ever happened to RVM2?
[04:56:51] havenwood: adam12: It's in the works.
[04:57:19] havenwood: adam12: It may even use chruby for Ruby version switching, you'd have to ask mpapis.
[04:57:30] adam12: I was just curious. I have no skin in the game
[04:57:38] adam12: I just remember a $50k bountysource and was wondering status.
[04:58:03] havenwood: adam12: I think mpapis has more than earned what he was paid on that but I know he's still working on it.
[04:59:05] Guest32: has joined #ruby
[04:59:40] havenwood: adam12: <3 ruby-install + chruby
[05:00:10] helpa: has joined #ruby
[05:00:23] adam12: havenwood: That's what I run currently ;)
[05:00:31] havenwood: adam12: nice
[05:00:32] hahuang61: has joined #ruby
[05:00:35] havenwood: adam12: simple made easy :)
[05:00:38] adam12: I was more curious than anything.
[05:00:54] radarislame: has joined #ruby
[05:01:44] bronson: has joined #ruby
[05:03:33] uglybandersnatch: has joined #ruby
[05:04:01] skade: has joined #ruby
[05:04:23] brentw: Ox0dea: here's my start for the maze https://github.com/brentgsw/appAcademy/blob/master/prep/maze.rb
[05:06:30] radar_and_baweav: has joined #ruby
[05:07:36] sauvin: has joined #ruby
[05:08:51] x77686d: has joined #ruby
[05:11:10] niceperl: has joined #ruby
[05:11:48] wool: I was wondering
[05:12:21] baweaver: ACTION stares intently
[05:12:25] wool: wait I don't want to start a war
[05:13:00] wool: can I mention a certain competitor scripting language?
[05:13:09] Radar: competitor
[05:13:27] havenwood: I don't accept the premise of your question.
[05:13:38] baweaver: It's a trap!
[05:13:42] Ox0dea: brent_: Strings essentially behave like character arrays, so that could really just be `@maze = File.readlines(@file)`.
[05:13:49] astrobunny: has joined #ruby
[05:14:28] wool: anyway I was thinking
[05:14:50] wool: I noticed that ruby is.. well.. superior, to python
[05:14:53] wool: ACTION takes cover
[05:15:10] wool: why is python then way more mainstream?
[05:15:16] benlieb: has joined #ruby
[05:15:23] baweaver: Probably Google
[05:15:27] brentw: Ox0dea: yeah, i thought about that, can you make those []/[]= methods though?
[05:15:29] Radar: SciPy, NumPy, taught in universities more, etc.
[05:15:41] Ox0dea: brent_: Oui.
[05:15:50] baweaver: Anything Google does is programming law
[05:15:54] wool: Radar: oh yes that makes sense
[05:16:00] havenwood: Again, I don't accept the premise of your question.
[05:16:02] wool: google uses python?
[05:16:07] wool: I thought they'd use Go
[05:16:15] baweaver: they use both
[05:16:50] havenwood: wool: Ruby is roughly as popular as Python. Pick your metric.
[05:17:20] howdoi: has joined #ruby
[05:17:20] wool: well.. I've met dozens of people who know python but have just heard about ruby
[05:17:42] Ox0dea: And you can't fathom that the inverse might also be true?
[05:17:55] wool: sure, I just haven't met them
[05:18:37] baweaver: Go to San Francisco
[05:18:41] baweaver: they're everywhere.
[05:18:49] wool: oh I see
[05:18:57] wool: of course.. rails
[05:19:04] wool: rails and SV
[05:19:59] baweaver: That and Chef
[05:22:02] astrobunny: has joined #ruby
[05:22:06] brentw: Ox0dea, if i saved every position that CPU touched a cpu instance variable, does it make sense to have Maze check player.touched_pos or does it make more sense to mark touched positions and have Maze check if it's been marked?
[05:22:15] baweaver: In the SysAdmin / DevOps world it's the most widely used tool for deploying and provisioning servers
[05:22:49] brentw: so, pass the player object to Maze methods or just have Maze check itself for marked spots?
[05:23:01] baweaver: well, one of if not the largest rather
[05:23:30] Ox0dea: brent_: It certainly makes more sense for the Maze to know that about itself.
[05:26:19] mistermocha: has joined #ruby
[05:26:26] brentw: okay, so for valid_pos? have it check if it's been marked
[05:26:37] brentw: and for cpu moving logic, have it use it's touched positions
[05:33:34] User458764: has joined #ruby
[05:35:12] chagel: has joined #ruby
[05:37:38] Suntzu: has joined #ruby
[05:38:23] LoneHerm_: has joined #ruby
[05:39:48] uglybandersnatch: has joined #ruby
[05:40:15] krz: has joined #ruby
[05:40:35] tenderlove: has joined #ruby
[05:41:54] jkahn: has joined #ruby
[05:44:02] hotpancakes: has joined #ruby
[05:45:41] merida: has joined #ruby
[05:47:02] bronson: has joined #ruby
[05:48:11] avenj: has joined #ruby
[05:49:53] merida_: has joined #ruby
[05:52:21] sp4rrow: has joined #ruby
[05:52:39] Macaveli: has joined #ruby
[05:52:42] Jameser: has joined #ruby
[05:52:58] agent_white: has joined #ruby
[05:54:04] hinbody: has joined #ruby
[05:55:27] julieeharshaw: has joined #ruby
[05:56:19] y2mq37: has joined #ruby
[05:58:56] ramfjord: has joined #ruby
[06:01:50] jorum: has joined #ruby
[06:04:52] uglybandersnatch: has joined #ruby
[06:06:02] merida: has joined #ruby
[06:06:16] chagel: has joined #ruby
[06:10:36] blackmesa: has joined #ruby
[06:10:38] the_drow: has joined #ruby
[06:12:17] clyster: has joined #ruby
[06:13:50] f4cl3y: has joined #ruby
[06:18:29] jaruga: has joined #ruby
[06:18:52] scepticulous: has joined #ruby
[06:23:20] benlieb: has joined #ruby
[06:23:48] merida__: has joined #ruby
[06:25:08] LoneHerm_: has joined #ruby
[06:25:10] hotpancakes: has joined #ruby
[06:26:28] LaT0rtue: has joined #ruby
[06:27:10] Cohedrin: has joined #ruby
[06:29:48] lyoshajapan: has joined #ruby
[06:31:40] pawnbox: has joined #ruby
[06:32:40] Timba-as_: has joined #ruby
[06:34:13] minimalism: has joined #ruby
[06:34:57] yfeldblum: has joined #ruby
[06:36:25] aufi: has joined #ruby
[06:36:35] symm-: has joined #ruby
[06:37:50] Aswebb_: has joined #ruby
[06:38:51] User458764: has joined #ruby
[06:38:57] andikr: has joined #ruby
[06:39:11] solars: has joined #ruby
[06:41:06] skade: has joined #ruby
[06:41:34] aganov: has joined #ruby
[06:44:35] edwinvdgraaf: has joined #ruby
[06:45:42] haraoka: has joined #ruby
[06:46:03] vale_tudo: has joined #ruby
[06:46:51] the_drow: has joined #ruby
[06:47:19] futilegames: has joined #ruby
[06:47:32] AlexJakeGreen: has joined #ruby
[06:49:47] Domaldel: has joined #ruby
[06:50:27] sandstrom: has joined #ruby
[06:50:30] pawnbox: has joined #ruby
[06:51:36] merida: has joined #ruby
[06:52:16] IvanSuftin: has joined #ruby
[06:53:46] ur5us: has joined #ruby
[06:54:05] astrobunny: has joined #ruby
[06:56:38] hotpancakes: has joined #ruby
[06:57:47] mrgrieves: has joined #ruby
[06:58:27] Xeago: has joined #ruby
[06:58:33] dede: has joined #ruby
[07:00:16] DoubleMalt: has joined #ruby
[07:02:23] pawnbox: has joined #ruby
[07:04:01] bkxd: has joined #ruby
[07:05:56] anisha: has joined #ruby
[07:06:48] davee_: has joined #ruby
[07:07:15] pawnbox: has joined #ruby
[07:07:23] biberu: has joined #ruby
[07:08:33] jtoy: has joined #ruby
[07:08:50] David27: has joined #ruby
[07:15:36] chagel: has joined #ruby
[07:15:45] neanderslob: has joined #ruby
[07:15:59] LaT0rtue: has joined #ruby
[07:16:32] ur5us: has joined #ruby
[07:17:55] drewo: has joined #ruby
[07:19:39] sandstrom: has joined #ruby
[07:20:37] quazimodo: has joined #ruby
[07:22:45] Xeago: has joined #ruby
[07:24:43] Couch: has joined #ruby
[07:25:12] Xeago_: has joined #ruby
[07:25:46] hotpancakes: has joined #ruby
[07:27:36] Dimik: has joined #ruby
[07:27:37] agit0: has joined #ruby
[07:28:38] araujo__: has joined #ruby
[07:30:30] merida_: has joined #ruby
[07:30:56] chagel: has joined #ruby
[07:34:23] robbyoconnor: has joined #ruby
[07:35:41] Guest32: has joined #ruby
[07:37:23] AnoHito: has joined #ruby
[07:38:52] monoprotic: has joined #ruby
[07:39:43] moeabdol2: has joined #ruby
[07:40:09] SenpaiSilver: has joined #ruby
[07:40:32] CustosLimen: has joined #ruby
[07:41:14] snowy: has joined #ruby
[07:42:13] bronson: has joined #ruby
[07:42:24] SenpaiSilver: has joined #ruby
[07:42:43] futilegames: has left #ruby: ()
[07:43:27] RegulationD: has joined #ruby
[07:44:40] SenpaiSilver: has joined #ruby
[07:47:00] SenpaiSilver: has joined #ruby
[07:47:06] jtoy: has joined #ruby
[07:47:41] User458764: has joined #ruby
[07:47:52] mikecmpbll: has joined #ruby
[07:48:10] M-mistake: has joined #ruby
[07:49:36] mark2: has joined #ruby
[07:50:14] lyoshajapan: has joined #ruby
[07:51:40] merida: has joined #ruby
[07:53:27] pawnbox: has joined #ruby
[07:54:27] LaT0rtue: has joined #ruby
[07:57:07] hotpancakes: has joined #ruby
[07:58:51] kam270: has joined #ruby
[08:01:12] kam270: has joined #ruby
[08:02:58] kam270: has joined #ruby
[08:03:23] Xeago: has joined #ruby
[08:03:31] blackmesa: has joined #ruby
[08:03:47] marr: has joined #ruby
[08:04:17] Moosashi: has joined #ruby
[08:05:38] kam270: has joined #ruby
[08:06:43] dc2: has joined #ruby
[08:10:49] Ishido: has joined #ruby
[08:14:31] harryk: has joined #ruby
[08:15:30] TheHodge: has joined #ruby
[08:15:43] mikecmpbll: has joined #ruby
[08:15:51] chagel: has joined #ruby
[08:16:51] vikas027: has joined #ruby
[08:17:10] vikas027: has left #ruby: ()
[08:17:33] harryk: Hello! I have a strange issue for me. I have some module which I include to different classes, and when I include it more than once in one application - the self.included(subclass) method of module receives wrong (first) including class as an argument. Can anyone tell me what's wrong?
[08:18:42] joonty: has joined #ruby
[08:19:00] skade: has joined #ruby
[08:19:30] binaryplease1: has joined #ruby
[08:21:40] pawnbox_: has joined #ruby
[08:24:12] apeiros: ?code harryk
[08:24:12] ruby[bot]: harryk: We can't help you without your code, please post it to https://gist.github.com
[08:24:20] ferr: has joined #ruby
[08:24:37] harryk: oh, looks I've found the problem, I use self.module_eval method inside this module and methods created by first inclusion remain unchanged during next inclusions
[08:24:37] apeiros: specifically - try to create a minimal reproducible example.
[08:24:57] the_drow: has joined #ruby
[08:25:04] dionysus69: has joined #ruby
[08:25:21] ferr: has joined #ruby
[08:25:26] harryk: apeiros: ok, thanks ;)
[08:27:31] tvw: has joined #ruby
[08:28:13] hotpancakes: has joined #ruby
[08:30:55] benlovell: has joined #ruby
[08:31:44] Moosashi: has joined #ruby
[08:32:59] al2o3-cr: has joined #ruby
[08:33:46] baweaver: has joined #ruby
[08:36:24] pawnbox: has joined #ruby
[08:38:22] Aswebb_: has joined #ruby
[08:39:34] pawnbox: has joined #ruby
[08:41:30] Vircung: has joined #ruby
[08:41:58] krz: has joined #ruby
[08:46:19] ferr: has joined #ruby
[08:47:30] blackgoat: has joined #ruby
[08:47:39] zeroDivisible: has joined #ruby
[08:48:18] Ropeney: has joined #ruby
[08:50:47] pawnbox: has joined #ruby
[08:53:55] blackgoat: has joined #ruby
[08:55:20] kbni: has joined #ruby
[08:56:51] pawnbox: has joined #ruby
[08:57:47] kbni: Can anyone here recommend libraries similar to her that offer the ability to make working with REST APIs simpler?
[08:58:44] weckl: has joined #ruby
[09:00:37] evidex: has joined #ruby
[09:00:38] lxsameer: has joined #ruby
[09:01:21] kariolis: has joined #ruby
[09:01:29] gregf_: kbni: as in clients?
[09:01:43] kbni: Yes, sorry.
[09:01:46] hotpancakes: has joined #ruby
[09:02:37] gregf_: well, theres plenty :)
[09:02:38] kbni: Similiar to http://www.her-rb.org/
[09:02:47] gregf_: oh - her.... hmmm
[09:03:15] apeiros: aaahaha, User.new(fullname: "Tobias Fünke")
[09:03:22] apeiros: somebody watched arrested development :D
[09:03:29] CloCkWeRX: has joined #ruby
[09:04:07] apeiros: ?toolbox kbni
[09:04:07] ruby[bot]: kbni: https://www.ruby-toolbox.com is a website which lists lots of gems, topically organized
[09:04:08] gregf_: kbni: thats something new... to me... but something like a wrapper i would imagine?
[09:04:19] n008f4g_: has joined #ruby
[09:04:23] apeiros: but out of curiosity - something not good about her-rb that you look for others?
[09:04:26] karioleez: /msg NickServ VERIFY REGISTER karioleez tonatnhbmqbv
[09:04:45] bkxd: has joined #ruby
[09:04:55] kbni: apeiros, well, mainly hoping for feedback about this or similar libraries - I can't seem to find anything similar
[09:05:08] apeiros: boy are you lucky that irc filters passwords and all we saw was "/msg NickServ VERIFY REGISTER karioleez *****"
[09:05:09] kbni: figured asking migth result in finding something possibly better
[09:05:22] karioleez: apeiros: lol
[09:05:27] gregf_: apeiros: haha
[09:05:40] karioleez: shit happens
[09:05:46] kbni: -NickServ- Invalid password for karioleez.
[09:05:48] gregf_: humans...
[09:05:59] kbni: I must commend you on quick reaction to that..
[09:06:01] drewo: has joined #ruby
[09:06:15] karioleez: what 's the worst that could happen ?
[09:06:27] karioleez: I made me laugh sometimes
[09:06:33] apeiros: somebody taking over your identity, I'd guess
[09:06:46] gregf_: identity theft is so widespread
[09:06:46] apeiros: irc-identity only if you use different passwords on different services
[09:06:48] kbni: A cheeky GHOST would have been amusing. :P
[09:06:59] moeabdol: has joined #ruby
[09:07:16] karioleez: kbni: kbni!~kbni@192.184.95.245 failed to login to karioleez. There has been 1 failed login attempt since your last successful login.
[09:07:21] karioleez: one already
[09:07:29] gregf_: karioleez: we now know your bank login password as well.... is it ********?
[09:07:34] kbni: Nah, I only tried to GHOST.
[09:07:42] karioleez: good to know
[09:07:59] kbni: Because I'd need to remove you before assuming your identity.
[09:08:08] apeiros: kbni: I see :) (your answer to my question)
[09:08:16] karioleez: yep I was quick
[09:08:54] karioleez: well the bank account's password doesn't need the same kind of security
[09:09:06] gregf_: karioleez: btw, you were registering, not identifying yourself :P
[09:09:08] karioleez: no I haven't entered 12341234 as a password to irc
[09:09:45] karioleez: it's good to know that I've burnt out myself
[09:09:56] karioleez: but I am not married to my nick
[09:10:05] gregf_: karioleez: no need to worry, i've accidentally chatted my password too... i've lost count :|
[09:10:47] karioleez: btw are the connections encrypted ?
[09:10:55] karioleez: I mean "can" they be ?
[09:11:00] kbni: for IRC? sure
[09:11:01] karioleez: ssl maybe ? freenode
[09:11:12] kbni: it's not forced, and you may not be using it yourself
[09:11:23] kbni: You are not.
[09:11:28] canton7: freenode has some ssl ports, and some non-ssl ports
[09:11:36] karioleez: I could try I guess
[09:11:39] canton7: make sure you're connecting to an ssl port, and tell your client to use ssl
[09:11:55] canton7: ... also look at sasl to identify with servies, rather than typing your nickserv password manually
[09:11:59] canton7: saves telling it to everyone :)
[09:12:40] apeiros: iirc all ports of freenode are ssl capable
[09:12:52] apeiros: but iirc 7000 requires ssl (i.e. is not non-ssl capable)
[09:13:02] apeiros: not sure, though. check with freenode docs :)
[09:13:02] bkxd: has joined #ruby
[09:13:20] karioleez: has joined #ruby
[09:13:27] djellemah: has joined #ruby
[09:13:29] apeiros: sasl auth also has the benefit of being guaranteed to be before channel join
[09:13:33] apeiros: which has benefits
[09:13:40] karioleez: I am in my SSLed version
[09:14:01] canton7: I thought irc didn't support something STARTSSL-like - a connection was either initiated as ssl, or not? Could be wrong.
[09:14:07] apeiros: ACTION remembers railsconf where you could see everybody's irc passwords in plaintext
[09:14:32] djbkd: has joined #ruby
[09:14:48] lyoshajapan: has joined #ruby
[09:14:52] apeiros: canton7: could be. but I think you don't need to have the ports separate. fuzzy on that :)
[09:16:23] al2o3-cr: has joined #ruby
[09:18:39] A124: Heya! I would like to do range expansion of expressions, example: Number [1:9] goes into box [1:20]. Which way would be good to implement this? Given there might be more then one expansion and range could be up to million. Recursion does not seem to me feasible.
[09:18:43] kbni: canton7, it might also be a non-standard add-on to the irc daemon
[09:20:16] Spami: has joined #ruby
[09:21:56] apeiros: A124: I don't follow
[09:23:52] workmad3: has joined #ruby
[09:25:56] hotpancakes: has joined #ruby
[09:31:34] Olipro: has joined #ruby
[09:32:38] wethu: has joined #ruby
[09:34:13] pandaant: has joined #ruby
[09:37:40] Begi: has joined #ruby
[09:39:56] Ebok: has joined #ruby
[09:42:34] bronson: has joined #ruby
[09:47:20] sgambino: has joined #ruby
[09:50:02] Begi1: has joined #ruby
[09:51:04] LaT0rtue: has joined #ruby
[09:51:10] Ebok: has joined #ruby
[09:52:28] quazimodo: has joined #ruby
[09:52:54] svisjm: has joined #ruby
[09:55:01] benlovell: has joined #ruby
[09:57:15] hotpancakes: has joined #ruby
[09:57:39] A124: apeiros Ups, late reaction it should expand into multiple lines, with those ranges.
[09:58:21] nanoz]: has joined #ruby
[09:58:55] A124: Number 1 goes into box 1.
[09:59:11] A124: Number 1 goes into box 2. ... etcetera
[10:00:30] dtzuzu: has joined #ruby
[10:01:39] djellemah: A124: do you mean a cross-product?
[10:01:52] apeiros: A124: what's a box? why does no. 1 go into box 1 AND 2?
[10:02:15] blackmesa: has joined #ruby
[10:02:25] apeiros: A124: you probably should make a (small) complete example and put it on gist.github.com
[10:02:37] benlovell: has joined #ruby
[10:03:01] Xeago: has joined #ruby
[10:04:03] skade: has joined #ruby
[10:04:21] A124: Yeah, well its a generic text, its a string input from user.
[10:05:05] A124: I need to make the expansion, and there may be 0 to n expansions in the string. In real life just a few max usually, though.
[10:05:07] Chagel_: has joined #ruby
[10:05:31] MrSamuel: has joined #ruby
[10:05:32] A124: I am sorry to not describe the problem well, I hope its clear now.
[10:05:48] apeiros: not really, no. you're still leaving out massive amounts of context.
[10:05:59] apeiros: ping me when you've got a proper example on gist.
[10:06:34] apeiros: the example should include at least one input with a complete output/result.
[10:06:35] A124: That's impossible as I am not sure what example I shuld make.
[10:06:37] Ropeney: has joined #ruby
[10:06:45] apeiros: ok. can't help you then.
[10:06:47] A124: Ok, not gist but will do.
[10:11:02] Moosashi: has joined #ruby
[10:11:11] lyoshajapan: has joined #ruby
[10:11:46] FooMunki: has joined #ruby
[10:17:44] devyn: has joined #ruby
[10:18:52] Begi: has joined #ruby
[10:19:02] A124: apeiros http://hastebin.com/lefehirufe.vhdl
[10:19:33] apeiros: interesting language choice
[10:20:25] uglybandersnatch: has joined #ruby
[10:20:30] apeiros: A124: so you indeed want the cartesian product.
[10:20:33] A124: Well, it autoselects.
[10:20:50] apeiros: >> [*1..2].product([*1..3])
[10:20:51] ruby[bot]: apeiros: # => [[1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3]] (https://eval.in/544973)
[10:22:02] apeiros: seems the autoselect was in a haste
[10:25:06] LHdez: has joined #ruby
[10:25:10] hotpancakes: has joined #ruby
[10:25:47] A124: Thank you, that is excellent to know about.
[10:26:17] FooMunki: has joined #ruby
[10:26:18] A124: It eats a lot of memory though, as it does first make the result then iterates.
[10:27:20] apeiros: define "lot of memory". but even if you happen to have large ranges - if you care to read the documentation of Array#product, you'll see that it takes a block.
[10:27:28] dvinciguerra__: has joined #ruby
[10:28:29] A124: 800MB for few millions. Also have no idea how to use that in case I have more then two ranges.
[10:28:56] A124: Actually, I did use a block, but maybe in wrong way, will read on.
[10:29:24] pawnbox: has joined #ruby
[10:31:16] apeiros: for numeric cartesian products, you can also simply use a nested loop:
[10:31:41] apeiros: >> result = []; 1.upto(2) do |x| 1.upto(3) do |y| result << [x, y] end; end; result
[10:31:42] ruby[bot]: apeiros: # => [[1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3]] (https://eval.in/544981)
[10:32:37] joonty: has joined #ruby
[10:32:39] SCHAAP137: has joined #ruby
[10:33:44] mrmortondk: has joined #ruby
[10:33:56] lxsameer: has joined #ruby
[10:34:03] last_staff: has joined #ruby
[10:34:15] Polysics: has joined #ruby
[10:34:27] sepp2k: has joined #ruby
[10:34:44] baweaver: has joined #ruby
[10:34:57] Hanmac: apeiros: or maybe with flat_map and map? works for non-arrays too
[10:34:58] Hanmac: >> (1..2).flat_map {|i| (1..3).map {|j| [i, j] } }
[10:34:59] ruby[bot]: hanmac: # => [[1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3]] (https://eval.in/544982)
[10:35:14] pawnbox_: has joined #ruby
[10:35:55] apeiros: hanmac: that gives you the large result array A124 wants to avoid
[10:36:18] A124: Thank you very much. I did use the block wrong way. It does work, and seems to work in manner I need.
[10:36:42] apeiros: but having to enumerate millions of those smells
[10:36:43] A124: Only caveat is it cannot, or do not know how to make steps, if the range is not continuous.
[10:36:49] apeiros: reeks of xy problem
[10:37:10] apeiros: A124: the quality of the help you get hinges on the quality of information you give.
[10:37:35] kbni: Does anyone here use Cloud9 or similar? I am using Cloud9 and I love it. I'm slightly keen for a hosted solution, though.
[10:37:40] kbni: self-hosted*
[10:37:46] A124: Well, millions was to strech it. Currently 600k is what I will use. .. Yes I am aware of XY, I am helper in another channel.
[10:38:40] al2o3-cr: >> [*1.step(10, 2)].product([*1..3]) # though not sure that is what you want
[10:38:41] ruby[bot]: al2o3-cr: # => [[1, 1], [1, 2], [1, 3], [3, 1], [3, 2], [3, 3], [5, 1], [5, 2], [5, 3], [7, 1], [7, 2], [7, 3], [9, ...check link for more (https://eval.in/544983)
[10:38:59] A124: apeiros My goal is both to be able iterate web links, pages, and at the same time generate arbitrary lists for simple input to other sequential programs. So millions was a strech. When I use the block correctly it works grat.
[10:39:21] Aswebb_: has joined #ruby
[10:40:00] A124: al2o3-cr It is! I missed the notation, I think I use other, which did work, but took again a lot of memory as I had to convert to array.
[10:40:43] A124: I was using (1..10).step(2)
[10:41:09] lxsameer: has joined #ruby
[10:41:20] al2o3-cr: easy mistake to make
[10:41:56] A124: But it still converts to array, doesn't? by using [] parenteses
[10:42:00] apeiros: (1..10).step(2) does the same as 1.step(10, 2)
[10:42:18] apeiros: and neither of those uses an array
[10:42:21] Moosashi: has joined #ruby
[10:42:44] A124: No, its does not, but product expects array.
[10:43:08] apeiros: you can create an array from both by appending .to_a
[10:43:46] apeiros: if you want to avoid even the input arrays, then you'll have to implement your own logic to build the product. it's not that difficult.
[10:43:59] A124: Which leads to the memory growth. ... Anyway I think I can live by that for now. .. I still have problems of GCing the unused stuff sometimes.
[10:44:55] A124: Yes, logic. Which is back to original question, how would I implement such logic efficiently?
[10:44:56] solars: has joined #ruby
[10:45:14] siaW: has left #ruby: ()
[10:45:22] A124: And efficiency in this case refers to memory, not speed.
[10:45:31] apeiros: either have a single integer from 0 to max-combinations and calculate from it
[10:45:55] apeiros: or have an Enumerator for each "digit" of your product and handle overflow
[10:46:06] sandstrom: has joined #ruby
[10:46:37] sdothum: has joined #ruby
[10:46:43] uglybandersnatch: has joined #ruby
[10:47:04] apeiros: i.e. digits = [(1..10).step(2), (5..15).step(3)]; in your loop: digits[0].next on each iteration
[10:47:26] pawnbox: has joined #ruby
[10:47:44] apeiros: if it raises a StopIteration, rewind it and call .next on the next digit
[10:47:46] Azure: has joined #ruby
[10:48:09] A124: Love you. Not a way I imagined, but a way to go. Very much appreciated.
[10:48:53] djellemah: A124: lazy enumerators are good for memory efficiency when you have large sets
[10:49:06] impi0us: has joined #ruby
[10:49:35] millerti: has joined #ruby
[10:49:40] apeiros: as for the single integer solution: it works the same as you count and get the individual digits of a number
[10:50:22] vasilakisFiL: has joined #ruby
[10:50:54] apeiros: i.e. 000-999 is the cartesian product of the digits 0-9 on 3 positions. and you get all numbers by counting from 0 to 999, and the individual digits by `a,b,c = num/10*2 % 10, num/10*1 % 10, num/10*0 % 10`
[10:50:56] vasilakisFiL: is it possible to create another object and behave like Proc ? for instance f = Foobar.new{ puts 'hey!' };
[10:51:12] wedgwood: has joined #ruby
[10:51:28] apeiros: vasilakisfil: any method can take a block and you can store it. so can initialize.
[10:51:50] apeiros: class Foobar; def initialize(&block); @block = block; end; end # then call the block whenever you want.
[10:52:23] apeiros: for ruby to treat it like a proc, you should implement to_proc, call and []
[10:54:05] A124: apeiros Oh, yes. I got the modulo idea. But that would first mean having to exctract that somhow, and enumerators should be efficient enough. Thank you for examples.
[10:54:07] A124: Yeah, I am kind of noob. Started with Ruby 1.8, but since I had life difficulties that had effect on my brain and memory. So everything is hard for me now. Trying to live by.
[10:54:19] drewo: has joined #ruby
[10:55:30] roelof: has joined #ruby
[10:55:38] skade: has joined #ruby
[10:56:14] yaewa: has joined #ruby
[10:56:20] roelof: Hello, for learning to programm I have to sort a array but I m not allowed to use sort. Must I then write my own sort method ?
[10:56:22] lxsameer: has joined #ruby
[10:56:35] apeiros: roelof: that's probably the idea, yes
[10:56:38] hotpancakes: has joined #ruby
[10:57:16] roelof: apeiros: Oke I always thought that writing sorting algoritmes is hard to do
[10:57:33] adaedra: depends which ones.
[10:57:37] blackmesa: has joined #ruby
[10:58:15] adaedra: Let's start with some theory: https://youtu.be/lyZQPjUT5B4
[10:58:35] apeiros: roelof: many sorting algorithms are trivial
[10:58:46] apeiros: roelof: the hard things is to come up yourself with a good one
[11:00:13] djellemah: vasilakisfil: looks like you want to have your initialize method work with a block argument. There are several other ways to make object instances behave like procs.
[11:00:28] A124: roelof Wikipedia has a lot of theory. Some sorts are expensive on reads and some on writes. https://www.youtube.com/watch?v=ZZuD6iUe3Pc
[11:02:06] vasilakisFiL: basically what I want is something else: I want a proc to always set as the referencing environment, the environment that is called from (using some magic + instance_exec) and not the environment that was defined. But I doubt I can do it.
[11:02:25] vale_tudo: has joined #ruby
[11:02:56] spiman: has joined #ruby
[11:04:39] platzhirsch: has joined #ruby
[11:05:01] djellemah: vasilakisfil: Not sure I understand what you're after, but you might be able to call binding, and pass the result of that to a method. OTOH, there's probably a better way to do what you want.
[11:05:12] GodFather: has joined #ruby
[11:05:27] ferr: How would I make this line of code work? array << obj.empty? ? '' : "#{object},"
[11:05:43] andywojo: has joined #ruby
[11:06:53] vasilakisFiL: djellemah I want to define a proc in point A: proc{ return params[:foo]} and use it in point B where params variable has changed and be able to return the new params value
[11:06:57] vasilakisFiL: how would you do that ?
[11:07:12] djellemah: ferr: try Array#select and Array#join
[11:07:50] yfeldblum: has joined #ruby
[11:08:14] mtkd: has joined #ruby
[11:10:40] Moosashi: has joined #ruby
[11:11:06] ferr: thanks djellemah
[11:11:35] bkxd: has joined #ruby
[11:12:51] djellemah: >> a = 1; l = ->{a}; a = 2; l.call # vasilakisfil
[11:12:53] ruby[bot]: djellemah: # => 2 (https://eval.in/544994)
[11:14:27] myntcake: has joined #ruby
[11:15:00] djellemah: vasilakisfil: in other words, a proc/lambda binds the variable, not the value of the variable. Unless A and B are in different methods/classes where you could define params as a method differently for A and B
[11:17:05] Xeago: has joined #ruby
[11:17:18] rodfersou: has joined #ruby
[11:17:38] apeiros: s/binds/closes over/
[11:18:18] siaW: has joined #ruby
[11:18:55] araujo: has joined #ruby
[11:20:08] djellemah: ACTION can rely on apeiros to tighten up imprecision ;-)
[11:20:20] araujo: has joined #ruby
[11:20:28] apeiros: ACTION has "master pedant" on his business card
[11:20:58] apeiros: not sure people spot it besides all the other titles, though.
[11:22:16] rickmasta: has joined #ruby
[11:23:31] benlovell: has joined #ruby
[11:23:42] sgambino: has joined #ruby
[11:23:46] johnmilton: has joined #ruby
[11:25:10] hotpancakes: has joined #ruby
[11:25:19] adaedra: You're trying to over-pedant Ox0dea?
[11:25:30] djellemah: collective nouns: school of fish, pod of whales, giggle of teenage girls, wunch of bankers, actually of pedants.
[11:25:52] skade: has joined #ruby
[11:26:15] jhass: Ox0dea: yup, you remembered right about playpen
[11:28:30] stannard: has joined #ruby
[11:29:45] GodFather: has joined #ruby
[11:30:34] m8: has joined #ruby
[11:33:30] blackjid: has joined #ruby
[11:36:57] benlovell: has joined #ruby
[11:37:26] Aswebb_: has joined #ruby
[11:43:04] madgen_: has joined #ruby
[11:43:12] al2o3-cr: has joined #ruby
[11:43:32] benlovell: has joined #ruby
[11:43:56] sdothum: has joined #ruby
[11:44:22] bronson: has joined #ruby
[11:45:04] LaT0rtue: has joined #ruby
[11:45:04] RegulationD: has joined #ruby
[11:45:15] ldnunes: has joined #ruby
[11:45:24] skade: has joined #ruby
[11:48:10] vikas027: has joined #ruby
[11:48:30] drewo: has joined #ruby
[11:49:10] rodferso1: has joined #ruby
[11:50:02] rodferso1: has joined #ruby
[11:50:44] Xeago: has joined #ruby
[11:53:12] spiman: has joined #ruby
[11:56:39] hotpancakes: has joined #ruby
[11:57:10] benlovel1: has joined #ruby
[11:57:26] but3k4: has joined #ruby
[11:58:15] Vile`: has joined #ruby
[12:00:21] jdawgaz: has joined #ruby
[12:00:37] roelof: has joined #ruby
[12:02:28] FooMunki: has joined #ruby
[12:02:41] roelof: somone who can help me with this problem :https://gist.github.com/rwobben/7149ccb9a0a0da9e24edf3b1e0a3d3ea
[12:04:41] freerobby: has joined #ruby
[12:04:46] scepticulous: is there a way to get the number of currently allocated objects in jruby ?
[12:05:06] scepticulous: just interactively and without starting sample code with the profiler
[12:08:55] guardian: hello, I added require 'pry' ; binding.pry inside an "it" block in rspec, but when I execute bundle exec rspec then it doesn't stop
[12:09:02] guardian: how can I debug rspec tests?
[12:09:17] apeiros: scepticulous: check ObjectSpace docs
[12:10:10] apeiros: roelof: please set the filename to anything with .rb as suffix for proper highlight. you can gist the plaintext explanation in a separate file in the same gist.
[12:10:30] itgoner: has joined #ruby
[12:10:46] apeiros: roelof: also since line 25 in your gist (which the exception refers to) is an empty line, please provide information for how to map the line number.
[12:10:58] roelof: sorry, I will repaste it again
[12:11:04] apeiros: you can update the gist
[12:11:05] sgambino: has joined #ruby
[12:11:07] apeiros: no need to make a new one
[12:12:37] roelof: apeiros: gists updated
[12:12:41] getbrandao: has joined #ruby
[12:13:12] roelof: I think there is a bug on the code in the book. Also when I copy the original I see a error message
[12:13:31] apeiros: roelof: add a `p hundreds: hundreds`, I'm pretty sure it's nil
[12:13:50] apeiros: ah, and I see why
[12:14:05] bollullera: has joined #ruby
[12:14:13] apeiros: your method does `puts numString` in the end. i.e. your englishNumber method always returns nil
[12:14:20] apeiros: (because puts returns nil)
[12:14:21] roelof: I do not see it. I just copied the code from the learning programming book
[12:14:50] apeiros: hard copy or ebook?
[12:14:51] tvw: has joined #ruby
[12:15:09] apeiros: though, I'd check for errata in both cases
[12:17:10] hotpancakes: has joined #ruby
[12:17:59] apeiros: roelof: you understood what you have to change?
[12:18:27] roelof: yep. the code is working , thanks
[12:24:32] vasilakisFiL: has joined #ruby
[12:25:24] aryaching: has joined #ruby
[12:25:30] j3r0: has joined #ruby
[12:26:05] Dysp: has joined #ruby
[12:26:10] joonty: has joined #ruby
[12:26:53] aupadhye: has joined #ruby
[12:27:03] hotpancakes: has joined #ruby
[12:28:17] Stan: has joined #ruby
[12:28:21] Dysp: I have a hard time understanding array creation. I am creating a hash with an already existing array (volt-array). It should be "time" => "volt-array". I therefore need to create the time-array based on the size of the existing array. I cannot wrap my head around how to do this.
[12:28:28] Dysp: hash = Array.new(volt.size){|x| x * 1}.zip(volt).to_h
[12:28:31] Dysp: This is what I have so far.
[12:28:59] Dysp: I creates the array alright; it just starts at the array.size and counts up from there.
[12:29:10] sandelius: has joined #ruby
[12:31:05] SCHAAP137: has joined #ruby
[12:33:03] LaT0rtue: has joined #ruby
[12:35:30] baweaver: has joined #ruby
[12:37:00] senayar: has joined #ruby
[12:37:00] ruby[bot]: +b senayar!*@*$#ruby-fix-your-connection
[12:37:01] ruby[bot]: ruby[bot] kicked senayar: banned before
[12:37:26] Dysp: Actually, that is not true. It counts up from zero, but it always adds one. Should only add 0.001:
[12:37:26] ruby[bot]: -b senayar!*@*$#ruby-fix-your-connection
[12:37:40] Dysp: hash = Array.new(volt.size){|x| x + 0.001}.zip(volt).to_h
[12:40:29] Dysp: apeiros: My savior. My mentor. The legend.
[12:42:38] drewo: has joined #ruby
[12:43:19] rodfersou: has joined #ruby
[12:43:44] dvinciguerra__: has joined #ruby
[12:44:48] zzzak: has joined #ruby
[12:45:07] Dysp: Anyone? :( Im so stuck.
[12:47:07] shevy: I did not even understand the problem description but from the code above, I am absolutely sure there is a simpler way!
[12:47:40] jmgxgc: has joined #ruby
[12:47:51] rbennacer: has joined #ruby
[12:48:33] dubek: has left #ruby: ("Leaving")
[12:48:47] Dysp: shevy: Probably. This is the first time ever I am coding in anything. So help is appreciated.
[12:49:14] chagel: has joined #ruby
[12:49:15] jorum: has joined #ruby
[12:50:45] Dysp: Basicly, what I wanna do is take predefined array (volt) and turn it into a hash that says "time" => "volt". Time should be 0.001, 0.002 and so forth. Basicly adding 0.001 each count. The size of the "time" array should be equal to the size of "volt".
[12:51:13] guardian: I'm a rspec/ruby beginner. Rspec tells me I can't use allow() in a describe group. I would like to have allow(Digest::SHA1).to_receive(:file).with(foo).and_return('xxx') for all "it" blocks
[12:51:15] guardian: is this possible?
[12:51:54] benlovell: has joined #ruby
[12:53:22] shevy: Dysp well build up the two arrays first, then merge/zip them into the hash? if you have them as: [1,2,3] and [0.001,0.002,0.003] that's proper right?
[12:53:48] Dysp: Yes. But the volt array changes size
[12:54:05] BTRE: has joined #ruby
[12:54:41] Dysp: So I cannot predefine what it should contain, only that it should count from 0 to whatever size the other array is, adding 0.001 pr step.
[12:54:58] Dysp: It's easy to do I am sure. I just can't wrap my head around how :P
[12:55:10] quazimodo: has joined #ruby
[12:55:56] Dysp: hash = Array.new(volt.size){|x| x + 0.001}.zip(volt).to_h - And this works. It just doesn't count properly. It says 1.001, 2.001 etc.
[12:57:31] hiyosi: has joined #ruby
[12:57:46] shevy: I have no idea why you must do this all in one line
[12:58:03] shevy: if the sole problem is that 1.001 should be 0.001 then simply apply a .map or .map! on the Array before .zipping
[12:58:18] jdawgaz: has joined #ruby
[12:58:39] canton7: how do you turn 0 into 0.001, 1 into 0.002, 2 into 0.003, etc? ;)
[12:58:51] canton7: (simple primary-school-style series stuff)
[12:59:06] sudoubuntu: has joined #ruby
[12:59:50] vondruch: has joined #ruby
[13:01:10] benlovell: has joined #ruby
[13:01:10] sdothum: has joined #ruby
[13:01:56] nfk|laptop: has joined #ruby
[13:02:25] pawnbox: has joined #ruby
[13:02:55] Dysp: canton7: Sure it is. But I am a medical professional working with research about statins. I haven't worked with basic maths/calculations for many years ;)
[13:03:18] fexilal: has joined #ruby
[13:03:35] canton7: you know how to turn 0 into 1 though, and you know how to turn 1 into 0.001
[13:03:45] canton7: likewise you know how to turn 1 into 2, and you know how to turn 2 into 0.002
[13:04:39] f3ttX]: has joined #ruby
[13:05:20] Dysp: I do. But it doesnt seem to work.
[13:05:39] Dysp: hash = Array.new(volt.size){|x| (x + 1)/1000}.zip(volt).to_h
[13:05:43] adaedra: What do you mean by "doesn't work"
[13:05:51] Dysp: This only gives me 3 elements
[13:06:41] Moosashi: has joined #ruby
[13:07:00] CausaMortis: has joined #ruby
[13:07:11] nando293921: has joined #ruby
[13:09:00] swills: has joined #ruby
[13:09:14] Dysp: If I go back to hash = Array.new(volt.size){|x| (x}.zip(volt).to_h, then it gives me them all (3000+)
[13:09:19] pawnbox: has joined #ruby
[13:09:28] Dysp: without the parentesis
[13:09:36] djellemah: Dysp: time = 0.0; volt.map{|v| rv = [time,v]; time += 0.001; rv}.to_h
[13:10:07] adaedra: Be careful with floats if you need precision.
[13:10:17] madgen_: has joined #ruby
[13:11:36] Dysp: djellemah: Hmm. Du er dansk, ikke?
[13:11:38] jorum: has joined #ruby
[13:12:05] djellemah: Yes, although I'm guessing the data will end up in a chart of some kind.
[13:12:23] GodFather: has joined #ruby
[13:12:40] Dysp: Oh it will.
[13:13:00] Suntzu: has joined #ruby
[13:13:06] Dysp: Checking for the kicking speed in elderly statin users
[13:13:08] Aswebb_: has joined #ruby
[13:13:38] djellemah: Dysp: Not dansk.
[13:13:52] Dysp: djellemah: It works for the first few elements, then it begins to fuck it up
[13:14:08] ssiris: has joined #ruby
[13:14:15] djellemah: That's the precision problem.
[13:14:24] Dysp: https://gist.github.com/anonymous/46870d7c20897ef5c3292e76b4b0190b
[13:14:27] Dysp: Probably.
[13:14:39] adaedra: >> 0.1 + 0.2
[13:14:40] ruby[bot]: adaedra: # => 0.30000000000000004 (https://eval.in/545092)
[13:14:41] benlovell: has joined #ruby
[13:14:49] adaedra: If you need absolute precision, use rationals.
[13:14:56] adaedra: >> 0.1r + 0.2r
[13:14:57] ruby[bot]: adaedra: # => (3/10) (https://eval.in/545093)
[13:15:03] blackmesa: has joined #ruby
[13:15:20] djellemah: volt.each_with_index.map{|v,i| [i/1000.0,v]}.to_h
[13:16:04] canton7: Dysp, I meant...
[13:16:06] ssiris: has joined #ruby
[13:16:09] canton7: >> Arran.new(5){ |x| (x + 1) / 100 }
[13:16:10] ruby[bot]: canton7: # => uninitialized constant Arran ...check link for more (https://eval.in/545094)
[13:16:20] _stu_: has joined #ruby
[13:16:24] canton7: >> Array.new(5){ |x| (x + 1) / 1000.0 }
[13:16:25] ruby[bot]: canton7: # => [0.001, 0.002, 0.003, 0.004, 0.005] (https://eval.in/545095)
[13:16:29] canton7: wrong thing in my clipboard ><
[13:19:03] madgen__: has joined #ruby
[13:19:04] Dysp: canton7: That actually works perfectly. Hm.
[13:19:04] Dysp: I thought I already tried that
[13:19:04] andywojo_: has joined #ruby
[13:19:04] oz`: has joined #ruby
[13:19:08] plonk: has joined #ruby
[13:19:08] plonk: has joined #ruby
[13:19:15] Dysp: canton7: Thank you. And also thx to anyone else who helped.
[13:19:17] shadoi1: has joined #ruby
[13:19:20] canton7: like I said... turn 0 into 1, turn 1 into 0.0001. primary school stuff :P
[13:19:37] Dysp: If you work every day with codes and math, then yes.
[13:19:47] Dysp: But I guess you don't know how to draw blood? ;)
[13:20:02] Dysp: Or take muscle biopsies
[13:20:16] kies: has joined #ruby
[13:20:26] adaedra: What does it have to do with current discussion?
[13:20:46] rolha: has joined #ruby
[13:20:49] duoi: has joined #ruby
[13:20:56] canton7: no, but I write the software which controls the machine which analyses the blood sample in the lab :P
[13:21:23] adgtl: has joined #ruby
[13:21:42] Ikri: has joined #ruby
[13:21:45] Dysp: canton7: And that is so cool :D
[13:22:00] redondos: has joined #ruby
[13:22:00] sgambino: has joined #ruby
[13:22:03] _blizzy_: has joined #ruby
[13:22:06] atmosx: has joined #ruby
[13:22:15] Dysp: adaedra: It's conversation. He implied I couldn't do simple math and I agreed; because my focus is elsewhere.
[13:22:20] felltir: has joined #ruby
[13:22:24] edev: has joined #ruby
[13:22:28] djellemah: Dysp is less interested in learning to code and more interested in getting the data into the shape needed.
[13:22:38] canton7: I'm saying that I think you're overcomplicating it in your head
[13:22:42] myntcake: has joined #ruby
[13:23:01] roshanavand: has joined #ruby
[13:23:20] Dysp: canton7: I probably am. There are many new things to learn when beginning to code. Especially if you start from scratch.
[13:23:43] adaedra: First one is that very often, most simple solution is the best.
[13:24:05] vcoinminer: has joined #ruby
[13:24:09] ChiefAlexander: has joined #ruby
[13:24:14] Dysp: djellemah: Yes and no. It's a learning experience. I have learned tonnes already; but when I get really stuck, I like getting help. Because I also have a boss to answer to. I were to do the data calculations manually with copy/pasting in Excel.
[13:24:20] c355E3B: has joined #ruby
[13:24:57] gix: has joined #ruby
[13:24:58] Dysp: And I thought.. Well, that's an opportunity to learn how to code! But if it takes waaaaaaaaaaay longer than it would have doing it manually, then it's harder for me to defend spending the time on it.
[13:25:51] codepete: has joined #ruby
[13:25:52] jimeh: has joined #ruby
[13:25:54] quinnie: has joined #ruby
[13:26:05] workmad3: Dysp: how often do you do similar calculations?
[13:26:12] astrobunny: has joined #ruby
[13:26:19] Dysp: What do you exactly mean?
[13:26:25] Dysp: How often the same calculations should be done?
[13:26:45] workmad3: Dysp: yeah... how often do you run the same (or similar) calculations by copy-pasting data into excel
[13:27:25] Dysp: A lot. A very much lot. But I am assessing a problem they do not consider a problem. It is simply how it is done.
[13:28:04] workmad3: Dysp: yeah, it's always 'simply how it is done' until someone automates it :)
[13:28:08] Dysp: I am slowly trying to introduce optimizations. But you must understand that I work with doctors and professors in exercise physiology; they don't know anything of this world.
[13:28:11] benlovell: has joined #ruby
[13:28:36] workmad3: Dysp: but if you're doing it a lot, that means you can also timebox a certain amount of time with automation for each time you have to do this task
[13:28:42] Dysp: Exactly. But if I spend a year learning basic Ruby before I can produce anything that can prove that it is a better solution, then I'll probably not be able to do it.
[13:28:47] quazimodo: has joined #ruby
[13:29:00] IrishGringo: has joined #ruby
[13:29:18] djellemah: It's fairly common in research environments. Researchers need the data, but they're not programmers. Sometimes researchers learn a little coding to help their job. But it's a different focus from learning to be a developer.
[13:29:20] adaedra: But look at all the things you'll be able to automate!
[13:29:44] Dysp: There are tonnes of different calculations that could so easily be done with code, but I kinda need to show them and convince them to let me learn it.
[13:29:54] Ropeney: has joined #ruby
[13:30:08] Dysp: And that is what I am doing with this problem. And I am still learning a lot, I just must also focus a bit on getting shit done too ;) My actual job.
[13:30:56] Dysp: djellemah: Indeed it is. And that is actually also one of the reasons why I wanna learn how to code - so I can become a developer that can help research labs optimize their data handling. There is a huge marked for it, I believe. Problem is, though..
[13:31:00] adaedra: If I may, it may be something you want to experiment for yourself for a while, if it's not your primary job.
[13:31:12] workmad3: ^ kinda what I was hinting at
[13:31:35] Dysp: Developers don't no shit about health science and health science professionals don't no shit about developing. So there is a connection that must be done first; and that connection is me - knowing both worlds (in the future)
[13:32:27] Dysp: For an example..
[13:32:32] rkazak: has joined #ruby
[13:32:59] hostess: has joined #ruby
[13:33:12] benlovell: has joined #ruby
[13:33:16] Dysp: In my lab, there has been maaaaaaaaany projects throughout the decades. Basicly they are doing the same tests on different subjects. But ALL the data is put into individual excel sheets for their individual projects.
[13:33:22] skade: has joined #ruby
[13:33:49] Dysp: But because it is the same test, then it would be absolutely wonderful to compare test results between different projects.
[13:34:16] sudoubuntu: has joined #ruby
[13:34:25] Dysp: And there is no way of doing that, unless you wanna go all manual on even more excel sheets. And every project does their own excel sheets - the data handling is not standardized.
[13:34:43] Dysp: And that is just my lab.
[13:34:59] adaedra: I'm not denying your goal or anything; just, maybe not try to merge it right now if you're starting development. Do it for yourself, as an extra activity, then, once you're good enough, you can try bring it with way better efficiency
[13:35:31] Dysp: Oh yes indeed. This little project is simply to teach me how to code.
[13:35:36] Dysp: And teach me how to handle data.
[13:35:49] Dysp: I am not bringing out the big guns when I have absolutely nothing to show and no skills to back it up.
[13:36:24] adaedra: You have many places online with exercices to help you grasp on things, if you want.
[13:36:28] hotpancakes: has joined #ruby
[13:36:47] drewo: has joined #ruby
[13:36:59] shakes: has joined #ruby
[13:37:30] Dysp: I've tried several resources and learned basic stuff from them. But in the end I just sit there staring at the screen, because I am not motivated to create a "text editor". I need a specific goal and teach my way through it.
[13:37:43] cdg: has joined #ruby
[13:38:03] Dysp: And getting help from skilled programmers when I get stuck is sufficient. It has worked so far.
[13:38:08] kp666: has joined #ruby
[13:38:50] adaedra: Becoming a skilled developer is way better. 😉
[13:39:12] Dysp: I mean. I have created a tool that automatically searched the directory for excel files, pulls data out and creates a graph and outputs it as an excel sheet. I have figured pretty much everything out on my own and have required help twice, I believe.
[13:39:23] Dysp: So it's not like I just come here asking for help for every step :P
[13:39:36] Dysp: outputs as PDF. my bad.
[13:40:04] Dysp: It's just when I can't get it right after several tries that I seek out help.
[13:40:14] Dysp: And google doesn't help me.
[13:40:19] whippythellama: has joined #ruby
[13:42:53] freerobby: has joined #ruby
[13:45:20] kobain: has joined #ruby
[13:45:23] floatingpoint: has joined #ruby
[13:45:38] krz: has joined #ruby
[13:46:31] bronson: has joined #ruby
[13:47:00] stannard: has joined #ruby
[13:47:29] freerobby: has joined #ruby
[13:47:41] stannard: has joined #ruby
[13:50:35] jdawgaz: has joined #ruby
[13:50:46] gevans: has joined #ruby
[13:51:11] stannard: has joined #ruby
[13:51:19] synthroid: has joined #ruby
[13:52:16] TvL2386: has joined #ruby
[13:52:33] vasilakisFiL: has joined #ruby
[13:53:19] malconis: has joined #ruby
[13:57:02] bkxd: has joined #ruby
[13:58:50] roshanavand: has joined #ruby
[13:59:28] AckZ: has joined #ruby
[13:59:37] axl_: has joined #ruby
[14:01:06] tvw: has joined #ruby
[14:01:54] myntcake: what exactly is enum/enumerator? does it do something? is it useful? ._.
[14:02:27] User458764: has joined #ruby
[14:02:44] havenwood: myntcake: Enumerable and Enumerator both do things!
[14:03:22] LoneHerm_: has joined #ruby
[14:03:50] schemanic: has joined #ruby
[14:04:03] myntcake: havenwood: like i've kind of skimmed through the Enum method in Ruby doc, but i'm unsure of what it does
[14:04:04] gevans: myntcake: Enumerator/Enumerable is what lets you iterate (loop) over collections like Hash and Array.
[14:04:46] myntcake: Like, yesterday i was looking through arrays i think, and somewhere in there( I forgot..) it said that if i don't specify the default will be an Enum.
[14:05:20] havenwood: myntcake: Enumerable is mixed into a bunch of Classes, like Array, Range, Hash, Struct and even Enumerator. See this object model: https://www.gliffy.com/go/publish/5152080
[14:05:27] voodo: has joined #ruby
[14:05:45] LaT0rtue: has joined #ruby
[14:05:55] havenwood: myntcake: So the Enumerable methods are available from all these classes.
[14:06:11] havenwood: myntcake: Here're a handful of examples of using Enumerator: https://github.com/havenwood/elixir.rb/blob/master/lib/elixir/stream.rb
[14:06:21] edwinvdgraaf: has joined #ruby
[14:06:41] hotpancakes: has joined #ruby
[14:07:41] gevans: havenwood: That Stream#interval method is pretty awesome.
[14:07:45] frozen3: has joined #ruby
[14:07:49] myntcake: hmm, so it's a class?
[14:08:44] havenwood: myntcake: Enumerator is a class like Hash or Array. Enumerable is a module that's mixed into some widely-used core classes and you can mix-it-in yourself.
[14:09:36] myntcake: havenwood: i don't know what a module is yet :D, I guess my program will teach me about it sooner or later haha
[14:09:53] shevy: a module is: module Foo; end
[14:10:19] solocshaw: has joined #ruby
[14:10:37] shevy: so Enumerable is: module Enumerable; end
[14:11:59] malconis: has joined #ruby
[14:12:11] myntcake: shevy: that just looks like a method but just changing def with module haha
[14:13:50] djellemah: 23>> enum = (3..11).map; loop{ enum.feed(enum.next * 2) }
[14:13:51] ruby[bot]: djellemah: # => [6, 8, 10, 12, 14, 16, 18, 20, 22] (https://eval.in/545122)
[14:14:22] hxegon: has joined #ruby
[14:14:36] snowy: has joined #ruby
[14:14:44] Dysp: def mean(array) array.inject(array.inject(0) { |sum, x| sum += x } / array.size.to_f) end
[14:14:53] Dysp: Why does that produce a type error?
[14:15:33] apeiros: why the double inject?
[14:15:56] shevy: myntcake yeah you can add methods to a module
[14:15:57] djellemah: Dysp: ^ that, and what's in array?
[14:16:03] Dysp: I thought about that too, but I followed an example.
[14:16:16] symm-: has joined #ruby
[14:16:27] apeiros: bad example it seems.
[14:16:44] apeiros: Dysp: break your code up into more lines, see which line it breaks, add a binding.pry there and inspect the values
[14:16:48] Dysp: It sure does seem!
[14:17:06] apeiros: also check again whether that double inject is really there.
[14:18:27] Dysp: Double inject was the problem indeed.
[14:18:35] Dysp: Example was from Ruby Cookbook
[14:18:53] apeiros: does it really do `sum += x`?
[14:19:44] freerobby: has joined #ruby
[14:19:52] apeiros: anyway, bad things about that solution:
[14:20:22] shevy: Dysp see now even apeiros tells you to break up things into more lines!
[14:20:35] apeiros: a) inject with += is bad, it's just +, and then it can be shortened to just .inject(0, :+)
[14:20:40] sdwrage: has joined #ruby
[14:20:40] Dysp: And he is, indeed, my mentor. Even if he doesn't like it.
[14:20:42] russt: has joined #ruby
[14:20:53] djellemah: array.reduce(:+) / array.size.to_f :-p
[14:20:57] vasilakisfil_: has joined #ruby
[14:21:01] apeiros: b) / array.size.to_f -> .quo(array.size), gets you proper Rational instead of Float in case of all integers
[14:21:08] Dysp: Maybe the book I was using is from old verisons of Ruby.
[14:21:23] hotpancakes: has joined #ruby
[14:21:29] apeiros: c) depending on your point of view, NaN as value of mean for the empty set may be less preferable over nil
[14:21:40] Dysp: Array consists of floats and integers I believe.
[14:21:41] Xeago: has joined #ruby
[14:22:00] apeiros: quo existed in old versions of ruby too
[14:22:05] Dysp: What do I know ;D
[14:22:07] apeiros: inject(:+) is newer
[14:22:28] Rubie: has joined #ruby
[14:22:35] apeiros: 19>> [1,2].inject(:+)
[14:22:36] ruby[bot]: apeiros: # => 3 (https://eval.in/545128)
[14:22:48] apeiros: well, 1.9 already supported inject(:+), and 1.9 is *old*
[14:22:59] Dysp: So ultimately, what do you suggest me doing?
[14:23:04] davedev24: has joined #ruby
[14:23:08] Dysp: Currently doing this. array.inject(0) { |sum, x| sum += x } / array.size.to_f
[14:23:17] mtkd: has joined #ruby
[14:23:28] apeiros: depends. what do you want for `mean([])`? nil or Float::NaN?
[14:23:46] Dysp: Not of much relevance, as the array is never gonna be empty.
[14:23:59] apeiros: haha, spoken like a true newbie ;-p
[14:24:24] Dysp: But I sure do get that it would be optimal to provide solution that wouldn't break the program if that would be the case.
[14:24:44] Dysp: Haha, indeed. But I am the one making all the input files, so I know they won't be empty ^^
[14:24:45] apeiros: IME, if your method expects a non-empty array of integers or floats, you'll get an empty array, an array of strings, a hash, nil, anything else
[14:25:01] apeiros: in my experience
[14:25:21] bogn: has joined #ruby
[14:25:21] apeiros: but there's something to be said for not actively asserting correctness
[14:25:35] fmcgeough: has joined #ruby
[14:25:35] apeiros: well, in that case: array.inject(:+).quo(array.size)
[14:25:50] haylon: has joined #ruby
[14:25:53] haylon: ruby-offtopic
[14:26:00] apeiros: aaaactually since "array" is a horrible variable name:
[14:26:10] apeiros: numbers.inject(:+).quo(numbers.size) # slightly better
[14:26:21] Dysp: I will follow your example!
[14:26:30] blackmesa: has joined #ruby
[14:26:50] Dysp: And now you are forcing me to look up .quo
[14:26:55] Dysp: You know what you are doing!
[14:27:39] jmignault: has joined #ruby
[14:28:35] apeiros: if you know how to look up .quo, you're already ahead of so many people visiting this channel
[14:28:53] Dysp: Now, apeiros - if I were to only find the mean of the first, say, 100 elements in the Array, could I still use the same method as you just described? I'll do with a yes or no and then figure it out myself.
[14:28:59] Dysp: I just did ^_^
[14:28:59] benlovell: has joined #ruby
[14:29:08] Dysp: And added at comment to the code explaining it
[14:29:30] apeiros: yes, with a piece of code added either when calling the method, or in the method
[14:30:07] apeiros: the first 100 elements in an array are an array themselves ;-)
[14:30:14] Dysp: Okay, Ill have a go at it tomorrow! Time to go home. Thank you so much for your help. I sincerely appreciate it.
[14:30:18] Dysp: Oh the hints!
[14:31:14] drewo: has joined #ruby
[14:31:16] stunder: has joined #ruby
[14:31:31] Emmanuel_Chanel: has joined #ruby
[14:35:59] lyoshajapan: has joined #ruby
[14:36:00] Cyrus: has joined #ruby
[14:36:30] Frem: has joined #ruby
[14:36:55] jdawgaz: has joined #ruby
[14:37:25] wldcordeiro: has joined #ruby
[14:37:26] baweaver: has joined #ruby
[14:37:57] madgen_: has joined #ruby
[14:39:19] bry4n_: has joined #ruby
[14:41:31] madgen_: has joined #ruby
[14:44:47] dopamean_: has joined #ruby
[14:45:41] zast: has joined #ruby
[14:46:01] Rubie: has joined #ruby
[14:49:55] solocshaw: has joined #ruby
[14:50:43] roelof: has joined #ruby
[14:51:36] ChiefAlexander: has joined #ruby
[14:51:44] roelof: how can I change the output so I can see the age in years not some big number ? Code ; https://gist.github.com/rwobben/6e2dc2dd6d2b2c8cfa292591c6e83732
[14:52:52] roelof: I now see something like ; 1552315789.689355
[14:53:08] rippa: has joined #ruby
[14:54:42] apeiros: roelof: a) use Time.now, not Time.new (even if it works now), Time#- returns seconds, so the question is - how many seconds are in a year? :)
[14:55:19] RegulationD: has joined #ruby
[14:55:41] roelof: apeiros: oke, so the answer is in seconds
[14:55:48] roelof: that problem I can solve
[14:56:41] gregf_: roelof: what about validations and exceptions?
[14:56:59] sgambino: has joined #ruby
[14:57:38] kfpratt: has joined #ruby
[14:57:39] pbruna: There is a gem for that as well btw. https://github.com/tmlee/time_difference
[14:57:50] roelof: gregf_: I did not know that validations are needed on learning programming book ?
[14:58:38] fedexo: has joined #ruby
[14:59:08] gregf_: ah - sorry about that :|
[14:59:59] antranigv: has joined #ruby
[15:00:42] Vitor: has joined #ruby
[15:01:03] snowy: has joined #ruby
[15:01:31] davee_: has joined #ruby
[15:02:11] GodFodder: has joined #ruby
[15:02:41] GodFodder: has joined #ruby
[15:03:49] madgen: has joined #ruby
[15:04:00] blackmesa: has joined #ruby
[15:05:01] GodFodder: has joined #ruby
[15:06:43] schemanic: has joined #ruby
[15:06:44] roelof: gregf_: NP , you could not known that
[15:07:23] timeout: has joined #ruby
[15:08:28] timeout: When I print something using cups, it spawns a process-- how do I wait for the process to end?
[15:08:59] timeout: from inside a ruby script, of course.
[15:09:14] gregf_: >> (Time.now.to_i - Time.new(2000, 03, 30).to_i)/(365*24*60*60) # roelof
[15:09:15] ruby[bot]: gregf_: # => 16 (https://eval.in/545147)
[15:09:33] dhollinger: has joined #ruby
[15:09:36] uglybandersnatch: has joined #ruby
[15:09:57] whippythellama: has joined #ruby
[15:10:17] gregf_: bah , no wonder i has to type h(ie)(sr) name :/
[15:10:45] gregf_: would've been better writing er/sie/es :(
[15:11:08] timeout: has joined #ruby
[15:11:16] Rubie: has joined #ruby
[15:12:38] x77686d: has joined #ruby
[15:13:50] n008f4g_: has joined #ruby
[15:14:02] bdilly: has joined #ruby
[15:15:19] Rubie: has joined #ruby
[15:15:23] machinewar: has joined #ruby
[15:17:18] Xeago: has joined #ruby
[15:18:36] djellemah: timeout: Process.waitpid and friends, but I've only used that for child processes and I'm not sure that applies in your situation.
[15:18:40] droidburgundy: has joined #ruby
[15:18:57] angrywombat: has joined #ruby
[15:18:57] ruby[bot]: +q angrywombat!*@*
[15:19:10] bdilly: has left #ruby: ()
[15:19:22] machinewar: How to require all ruby files nested under two directories w/ possible subdirectories This works for every ruby file starting in current directory Dir["**", "*.rb"]. but i want to start from something like Dir["directory1**", "directory2**", "*.rb"]
[15:19:34] angrywombat: has left #ruby: ()
[15:19:37] angrywombat: has joined #ruby
[15:19:43] angrywombat: has left #ruby: ()
[15:19:46] angrywombat: has joined #ruby
[15:20:04] eam: machinewar: call it twice
[15:20:17] angrywombat: has left #ruby: ()
[15:20:18] angrywombat: has joined #ruby
[15:20:31] adaedra: Dir["directory{1,2}/**/*.rb"] may work
[15:20:32] dc2: has joined #ruby
[15:20:57] bkxd: has joined #ruby
[15:21:20] machinewar: Dir["{dir_1,dir_2}/**/*.rb"]
[15:21:24] machinewar: seems to work!
[15:21:39] angrywombat: has left #ruby: ()
[15:21:53] puddy1: has joined #ruby
[15:22:36] elifoster: has joined #ruby
[15:24:47] skweek: has joined #ruby
[15:26:09] benlovell: has joined #ruby
[15:28:16] diegoaguilar: has joined #ruby
[15:28:59] bkxd: has joined #ruby
[15:29:02] kies: has joined #ruby
[15:29:38] apeiros: gregf_: that's only an approximation, though (that's what I wanted to get at, but had to go afk, and now roelof is offline)
[15:33:04] cwenner: has joined #ruby
[15:33:34] poguez_: has joined #ruby
[15:34:37] Guest32: has joined #ruby
[15:34:41] davedev24: has joined #ruby
[15:39:21] kt2: has joined #ruby
[15:40:20] elifoster: has joined #ruby
[15:40:41] monoprotic: has joined #ruby
[15:40:47] brendan-: has joined #ruby
[15:40:53] nugit: has joined #ruby
[15:41:10] pietr0: has joined #ruby
[15:41:18] _stu_: has joined #ruby
[15:41:32] dc2: has joined #ruby
[15:42:11] solocshaw: has joined #ruby
[15:43:17] x77686d: has joined #ruby
[15:43:21] pandaant: has joined #ruby
[15:43:22] KensoDev: has joined #ruby
[15:44:07] fmcgeough: has joined #ruby
[15:44:15] hays_: has joined #ruby
[15:44:32] Maletor: has joined #ruby
[15:44:48] skade: has joined #ruby
[15:45:25] merida: has joined #ruby
[15:46:53] zast: has joined #ruby
[15:47:41] ChiefAlexander: has joined #ruby
[15:48:42] GnuYawk: has joined #ruby
[15:48:42] GnuYawk: has joined #ruby
[15:48:45] bronson: has joined #ruby
[15:49:20] manveru: what do you guys use for domain validation these days?
[15:50:03] manveru: addressable still says 'something,co|uk' is a valid url, and URI.parse is fine with 'something,co,uk'
[15:50:22] puddy1: has left #ruby: ()
[15:50:33] mtkd: has joined #ruby
[15:51:32] apeiros: simpleidn (iirc) + a custom expression if I don't want to perform a dns lookup
[15:51:41] apeiros: I can gist the relevant code
[15:51:50] LoneHermit: has joined #ruby
[15:52:34] manveru: ah, that's a good idea :)
[15:52:37] nando293921: has joined #ruby
[15:52:45] manveru: at least for serverside validation
[15:53:08] benlovell: has joined #ruby
[15:53:30] manveru: we already depend on addressable indirectly, so i wanted to use that for the IDN transformations
[15:54:13] User458764: has joined #ruby
[15:54:39] StyXman: has joined #ruby
[15:55:31] apeiros: haha, ok, it does look awkward when a window "unslurps" from the dock on your rightmost screen onto your leftmost screen
[15:55:48] Peteykun: has joined #ruby
[15:56:17] StyXman: I'm thinking of extending rdoc to handle chef repositories, so it recognizes roles, recipies and other stuff. does noybody know any docs about extending rdoc?
[15:58:39] amclain: has joined #ruby
[15:58:43] mistermocha: has joined #ruby
[15:58:52] apeiros: manveru: https://gist.github.com/apeiros/1282959a5b3754f9a53ad4183540e371 - this part isn't yet in production, though. so if I'm doing something wrong, please tell :) Idn.to_ascii is just a wrapper around simpleidn which performs some additional checks related to encoding.
[15:59:09] agent_white: has joined #ruby
[15:59:18] agit0: has joined #ruby
[15:59:19] sorbo_: has joined #ruby
[15:59:20] s00pcan: has joined #ruby
[15:59:58] Spami: has joined #ruby
[16:00:09] marxarelli: has joined #ruby
[16:00:13] darix: StyXman: drbrain could give you some pointers, but he isnt here atm.
[16:00:31] brentw: has joined #ruby
[16:00:46] wilbert: has joined #ruby
[16:01:02] manveru: apeiros: thanks, gonna see how it goes :)
[16:01:22] manveru: we shouldn't get too wild domains, but i'd love to have not to fix this every month
[16:01:47] darix: manveru: dont worry. you will. wait until people just allow more crazy things
[16:02:04] apeiros: manveru: I want to add stuff like multi-plane detection for idn
[16:02:12] darix: people still sometimes think you can validate a TLD with [A-Z]{2,3} :p
[16:02:17] apeiros: errr, rather multi-script
[16:02:26] apeiros: i.e. mixing of greek and latin letters to deceive people
[16:02:32] apeiros: s/i.e./e.g./
[16:02:56] manveru: awesome.みんな
[16:03:08] darix: ACTION thinks apeiros could just roll his code into a gem
[16:03:18] apeiros: darix: it is
[16:03:27] apeiros: just not released yet since there's still some kinks and I didn't have time
[16:03:31] davedev24: has joined #ruby
[16:03:37] symm-: has joined #ruby
[16:03:39] B1n4r10: has joined #ruby
[16:03:45] apeiros: it's a complete value validation and adaptation gem
[16:03:59] manveru: doing your job title full justice
[16:04:21] apeiros: how is that related to my master pedant title? :-O
[16:04:36] pawnbox: has joined #ruby
[16:05:07] pawnbox: has joined #ruby
[16:05:19] guardian: hello, I added require 'pry' then binding.pry inside a spec test. Then when I run bundle exec rspec it doesn't stop to let me debug
[16:05:26] guardian: any idea please?
[16:05:36] crazydiamond: has joined #ruby
[16:05:58] Jardayn: has joined #ruby
[16:06:03] apeiros: guardian: probably just means that the code isn't executed
[16:06:31] dikaio: has joined #ruby
[16:08:55] benlovell: has joined #ruby
[16:10:36] stunder: has joined #ruby
[16:10:55] baweaver: has joined #ruby
[16:11:47] guardian: hmm looking more into it
[16:12:47] agit0: has joined #ruby
[16:13:41] s00pcan: has joined #ruby
[16:15:58] alvin_: has joined #ruby
[16:16:43] sp4rrow: has joined #ruby
[16:17:20] Cohedrin: has joined #ruby
[16:17:47] syner2: has joined #ruby
[16:20:31] infernix: has joined #ruby
[16:21:56] weemsledeux: has joined #ruby
[16:22:11] drewo: has joined #ruby
[16:28:09] mistermo_: has joined #ruby
[16:28:51] blackmesa: has joined #ruby
[16:28:57] sandstrom: has joined #ruby
[16:30:32] Spami_: has joined #ruby
[16:31:04] Alayde: has joined #ruby
[16:32:39] BSaboia: has joined #ruby
[16:33:02] dionysus69: has joined #ruby
[16:33:47] hightower3: has joined #ruby
[16:34:34] agit0: has joined #ruby
[16:35:20] weemsledeux: has joined #ruby
[16:36:28] benlieb: has joined #ruby
[16:37:20] jorum: has joined #ruby
[16:37:44] GnuYawk: has joined #ruby
[16:40:46] syner2: has joined #ruby
[16:41:39] Tisho: has joined #ruby
[16:41:43] Tisho: has left #ruby: ()
[16:43:08] roshanavand: has joined #ruby
[16:43:42] freerobby: has joined #ruby
[16:45:17] mistermocha: has joined #ruby
[16:45:30] BSaboia: has joined #ruby
[16:47:23] codecop: has joined #ruby
[16:47:24] polyidus: has joined #ruby
[16:48:59] mistermo_: has joined #ruby
[16:51:38] Devalo: has joined #ruby
[16:54:33] skade: has joined #ruby
[16:55:23] sgambino: has joined #ruby
[16:55:52] CausaMortis: has joined #ruby
[16:57:40] syner2: has joined #ruby
[16:57:48] shinnya: has joined #ruby
[16:58:27] chouhoulis: has joined #ruby
[16:59:25] TheMoonMaster: has joined #ruby
[16:59:56] SCHAAP137: has joined #ruby
[17:00:08] frozen3_: has joined #ruby
[17:00:18] Balzrael: has joined #ruby
[17:02:04] mikecmpbll: has joined #ruby
[17:03:48] LaT0rtue: has joined #ruby
[17:03:50] sneakerhax: has joined #ruby
[17:04:10] frozen3: has joined #ruby
[17:05:21] IrishGringo: has joined #ruby
[17:06:58] jdawgaz: has joined #ruby
[17:08:05] y2mq37: has joined #ruby
[17:08:13] symm-: has joined #ruby
[17:08:31] holmser: has joined #ruby
[17:08:53] holmser: I'm working on a script that needs unique filenames
[17:08:55] cpup: has joined #ruby
[17:08:56] binaryplease: has joined #ruby
[17:09:01] sandelius: has joined #ruby
[17:09:06] choke: has joined #ruby
[17:09:47] Es0teric: has joined #ruby
[17:09:49] holmser: Basically I'm checking against a hash of existing filenames, and if it exists I'm incrementing a serial value in the filename
[17:10:42] holmser: I have a sneaking suspicion that there is a much more "rubyish" way to accomplish what I'm doing, but I can't quite figure it out
[17:11:25] workmad3: holmser: you could try `Dir["prefix*"].sort[-1].succ` if there's no extension on the filename
[17:11:27] pfg: has joined #ruby
[17:12:05] holmser: workmad3: I'm actually pulling the filenames (actually object names) from Swift in openstack, so it's just a hash
[17:12:27] holmser: I'm going to sanitize the code and throw it in a gist
[17:12:27] workmad3: holmser: ok, so hsh.values.sort[-1].succ then :)
[17:12:29] frozen3: has joined #ruby
[17:13:51] workmad3: holmser: essentially, I'm pointing you at String#succ, which will take a string like "foobar1" and turn it into "foobar2" (although it can have some issues at "foobar9", so maybe it's no good for your situation)
[17:14:11] bronson: has joined #ruby
[17:15:11] merida: has joined #ruby
[17:16:21] holmser: https://gist.github.com/Holmser/919b51a393d26b3489e6cdcdbbfb8e6b
[17:16:37] holmser: this is what I've got... it just bugs me that I have to use that name line 2x
[17:17:00] frozen3: has joined #ruby
[17:17:37] Maletor: has joined #ruby
[17:17:38] spider-mario: has joined #ruby
[17:17:46] apeiros: holmser: nowadays I just append a SecureRandom.uuid
[17:17:53] apeiros: why bother with a complex algorithm
[17:17:57] Es0teric: has joined #ruby
[17:18:01] polyidus: has joined #ruby
[17:19:32] holmser: apeiros: I just want it to be clear when the backup was taken by the filename
[17:19:53] jdawgaz: has joined #ruby
[17:20:20] apeiros: if your OS is decent, a file can have 255 chars
[17:20:32] apeiros: so that shouldn't stop you
[17:22:50] blandflakes: has joined #ruby
[17:25:42] Emmanuel_Chanel: has joined #ruby
[17:27:28] Dimik: has joined #ruby
[17:27:38] wilbert: has joined #ruby
[17:28:17] dfockler: has joined #ruby
[17:28:57] yuung: has joined #ruby
[17:29:00] d0nn1e: has joined #ruby
[17:31:11] duckpuppy: has joined #ruby
[17:31:51] schemanic: Hi everyone
[17:32:29] schemanic: has joined #ruby
[17:32:59] djbkd: has joined #ruby
[17:34:22] schemanic: Can anyone tell me why in irb Date/Time/DateTime gives me NameError: uninitialized constant DateTime
[17:34:35] platzhirsch: has left #ruby: ()
[17:35:01] apeiros: schemanic: because you forgot to require 'date'?
[17:35:06] SCHAAP137: has joined #ruby
[17:35:19] apeiros: though, Time in that list won't give you a NameError
[17:36:09] schemanic: sigh. Okay. I'm sorry - the Ruby doc code example didn't have the requirement statement so I didn't understand that it wasn't standard
[17:36:51] jackjackdripper: has joined #ruby
[17:37:27] apeiros: it is standard, but not core ;-)
[17:37:51] apeiros: (core = loaded with the interpreter, standard = comes with ruby but must be required to use)
[17:38:14] stannard: has joined #ruby
[17:39:54] GodFather: has joined #ruby
[17:40:09] GnuYawk: has joined #ruby
[17:40:14] GodFather: has joined #ruby
[17:41:13] vF3hNGxc47h8: has joined #ruby
[17:41:56] vF3hNGxc47h8: has joined #ruby
[17:43:15] GodFather: has joined #ruby
[17:43:25] sandelius: has joined #ruby
[17:44:41] bkxd: has joined #ruby
[17:44:58] hahuang61: has joined #ruby
[17:45:39] dmr8: has joined #ruby
[17:46:10] blackmesa: has joined #ruby
[17:46:22] bronson: has joined #ruby
[17:48:48] shevy: schemanic huh you are right ruby-doc.org/stdlib/libdoc/date/rdoc/DateTime.html
[17:48:52] shevy: I'll file an issue request
[17:49:03] sepp2k: has joined #ruby
[17:49:19] Devalo: has joined #ruby
[17:50:24] GnuYawk`: has joined #ruby
[17:51:25] jtoy: has joined #ruby
[17:52:29] schemanic: thanks for the confirm shevy
[17:52:31] ChiefAlexander: has joined #ruby
[17:52:41] GodFoddar: has joined #ruby
[17:53:22] GodFather: has joined #ruby
[17:53:25] moei: has joined #ruby
[17:53:28] Zarthus: i never knew the differences between datetime/time
[17:53:39] Zarthus: ACTION has been using Time successfully without knowing \o/!
[17:53:41] shevy: I still don't know it either!
[17:53:53] baweaver: has joined #ruby
[17:53:53] duckpuppy: has joined #ruby
[17:53:53] shevy: I know I can't rely on the docs so I must tinker :D
[17:53:54] edwinvdgraaf: has joined #ruby
[17:54:02] apeiros: it's less relevant now
[17:54:09] Zarthus: the docs for datetime paint a funny picture regardless
[17:54:12] Zarthus: the introduction at least
[17:54:18] Zarthus: the rest of it was nerdy programmer talk
[17:54:53] GnuYawk: has joined #ruby
[17:54:57] shevy: I just skip the part above and look for examples
[17:55:23] Zarthus: i read the first line and was interested enough to keep reading
[17:55:55] Zarthus: i like how they're basically saying "you're in need of timezones? well good luck!"
[17:55:59] shevy: but it's indeed not always trivial... I have a namespace DateTime... but I pull it in via requiring 'date' ... or optionparser... OptionParser but you need to require 'optparse' ... well at least optionparser page shows the require line http://ruby-doc.org/stdlib-2.3.0/libdoc/optparse/rdoc/OptionParser.html
[17:56:31] Zarthus: yeah i have no idea why some requires differ from their class names
[17:56:38] Zarthus: openstruct is ostruct as well, really annoying
[17:57:09] moos3: has joined #ruby
[17:57:19] shevy: I think there even used to be or still are ways to require with capitalized letters... but I can't remember right now
[17:57:26] User458764: has joined #ruby
[17:57:27] tubuliferous_: has joined #ruby
[17:58:21] DroidBur_: has joined #ruby
[17:58:31] apeiros: require does not care about the case, only the FS does
[17:59:16] smathy: has joined #ruby
[18:00:25] moos3: has joined #ruby
[18:01:14] aldodelgado: has joined #ruby
[18:01:20] madgen: has joined #ruby
[18:01:25] iceden: has joined #ruby
[18:01:33] bkxd: has joined #ruby
[18:01:53] lyoshajapan: has joined #ruby
[18:03:43] dopie: has joined #ruby
[18:04:13] GnuYawk: has joined #ruby
[18:05:02] GnuYawk: has joined #ruby
[18:06:58] bkxd_: has joined #ruby
[18:07:33] yeticry: has joined #ruby
[18:08:07] mistermocha: has joined #ruby
[18:08:41] chouhoulis: has joined #ruby
[18:09:02] LHdez: has joined #ruby
[18:09:38] roshanavand: has joined #ruby
[18:09:42] chouhoulis: has joined #ruby
[18:10:17] yuung: has joined #ruby
[18:11:34] itaipu: has joined #ruby
[18:12:06] bkxd: has joined #ruby
[18:13:19] postmodern: has joined #ruby
[18:14:37] duckpuppy: has joined #ruby
[18:15:09] rmulligan: has joined #ruby
[18:15:26] roshanavand: has joined #ruby
[18:16:57] jero_: has joined #ruby
[18:17:01] mistermocha: has joined #ruby
[18:17:10] User458764: has joined #ruby
[18:17:31] eljimmy: has joined #ruby
[18:17:44] B1n4r10: has joined #ruby
[18:18:24] baweaver: has joined #ruby
[18:18:32] tubuliferous_: has joined #ruby
[18:19:17] maxxe: has joined #ruby
[18:20:26] agit0: has joined #ruby
[18:20:58] freerobby: has joined #ruby
[18:21:26] bb010g: has joined #ruby
[18:21:50] GnuYawk: has joined #ruby
[18:22:25] acerna: has joined #ruby
[18:22:50] Jeff_D: has joined #ruby
[18:23:21] Gasher: has joined #ruby
[18:25:50] merida_: has joined #ruby
[18:26:12] symm-: has joined #ruby
[18:27:09] hunter42: has joined #ruby
[18:27:13] hunter42: i'm trying to use "flash" and am getting this error: undefined local variable or method `flash' for SessionsController:Class ---- anyone know why?
[18:27:28] apeiros: ?rails hunter42
[18:27:29] ruby[bot]: hunter42: Please join #RubyOnRails for Rails questions. You need to be identified with NickServ, see /msg NickServ HELP
[18:27:46] Jeff_D: Regexp question: say I have content like `<p>This is <a id="note-27-begin"></a><a id="note-9-begin"></a>sample<a id="note-27-end"></a> content.<a id="note-9-end"></a></p>`; is it possible to craft a Regexp that will correctly match/extract the overlapping “node” pairs, or do I have to break out Nokogiri or equivalent?
[18:28:48] apeiros: hm, what was the factoid again?
[18:28:51] ruby[bot]: apeiros: I don't know anything about regexxml
[18:29:11] apeiros: ?regex_xml
[18:29:11] ruby[bot]: Don't use Regexp to parse XML or HTML. Use an XML parser like nokogiri or oga. See also: http://stackoverflow.com/a/1732454/2199687
[18:29:15] apeiros: sooo close
[18:29:18] Jeff_D: I’ve tried /<a id="note-(\d+)-begin"><\/a>(.+)<a id="note-\1-end"><\/a>/ — which picks up only the first item
[18:29:37] Jeff_D: OK; thanks; that makes perfect sense
[18:30:18] Jeff_D: sorry, my eyes aren’t as young as I used to be; hard to read and type at the same time. Thanks, all, and calling it a night at 0230 here :P
[18:30:19] apeiros: you can extract it with a regex, but it'll break for all kinds of changes which don't change anything semantically about the xml
[18:30:58] GnuYawk: has joined #ruby
[18:32:16] polyidus: has joined #ruby
[18:34:51] skade: has joined #ruby
[18:35:53] tomchapin: has joined #ruby
[18:36:02] skade: has joined #ruby
[18:36:10] mistermocha: has joined #ruby
[18:37:00] _djbkd: has joined #ruby
[18:38:23] Xeago: has joined #ruby
[18:39:19] LoneHermit: has joined #ruby
[18:40:12] dhollinger: has joined #ruby
[18:40:57] mistermo_: has joined #ruby
[18:41:31] the_drow: has joined #ruby
[18:43:06] solars: has joined #ruby
[18:43:07] dionysus69: has joined #ruby
[18:45:13] kloeri: has joined #ruby
[18:45:21] atmosx: Hello! Do we have any ruby-ML moderator hanging out here? My email apparently was "too long" and went to moderation queue :-/
[18:46:20] mistermocha: has joined #ruby
[18:47:00] sandelius: has joined #ruby
[18:47:28] jackjackdripper: has joined #ruby
[18:49:13] shevy: you must use short words!
[18:49:26] shevy: "money ??? profit"
[18:49:39] agit0: has joined #ruby
[18:50:02] Eiam_: has joined #ruby
[18:50:22] zens: has joined #ruby
[18:50:34] atmosx: adaedra: ... lol ... I thought my problem understood but apparently wasn't, so I had to write a paragraph or two :-P
[18:50:36] infernix: has joined #ruby
[18:50:54] blackmesa: has joined #ruby
[18:51:09] zens: has left #ruby: ()
[18:51:18] ramfjord: has joined #ruby
[18:52:06] mjuszczak: has joined #ruby
[18:52:33] nachoman: has joined #ruby
[18:52:43] ramfjord: What's up guys? Does anyone know a clean way of converting a Date to a Time at midnight in UTC regardless of the system time? I'm messing around with using a ActiveSupport::TimeZone.parse and converting the date to a String, but it looks pretty ugly
[18:53:27] shevy: most active* gem users are on #rubyonrails, in the event that nobody here can answer the question (I know I can't because I know next to nothing about the various active* gems)
[18:53:56] ramfjord: I'm not wedded to ActiveSupport/rails, but I don't know of any other gems that handle timezones well
[18:54:22] atmosx: Date.parse('2015-01-01').to_time ?
[18:54:41] apeiros: ramfjord: you're talking of code in rails?
[18:54:42] shevy: hmm there were some other gems... can't recall right now... chronos or something
[18:54:50] ramfjord: I'm not using rails, I'm just using activesupport
[18:55:09] apeiros: ok, I'd still go to #rubyonrails then, since those additions come from there
[18:55:19] atmosx: shevy: tbh there are more time related-rails gems (some do very trivial staff) than I can count
[18:55:25] ramfjord: ok, I'll give it a shot
[18:55:36] shevy: atmosx yeah
[18:55:52] ramfjord: atmosx: I'm pretty sure that uses the system timezone, which is exactly what I'm trying to avoid
[18:56:21] Ox0dea: atmosx: Chronic is pretty nifty, though.
[18:56:24] atmosx: ramfjord: I used tzinfo in the past to avoid the system's timezone.
[18:56:41] dstarh: has joined #ruby
[18:57:34] atmosx: ramfjord: http://www.rubydoc.info/gems/tzinfo/1.2.2
[18:58:12] atmosx: Ox0dea: good to know
[18:59:45] shadoi: has joined #ruby
[19:00:23] GnuYawk: has joined #ruby
[19:00:37] GnuYawk: has joined #ruby
[19:01:07] duckpuppy: Well, that didn't work.
[19:02:07] sp4rrow: has joined #ruby
[19:08:39] centrx: has joined #ruby
[19:11:34] uglybandersnatch: has joined #ruby
[19:12:33] jdawgaz: has joined #ruby
[19:13:29] SCHAAP137: has joined #ruby
[19:14:42] sp4rrow: has joined #ruby
[19:14:49] IntoTheWild27: has joined #ruby
[19:15:00] IntoTheWild27: has left #ruby: ()
[19:16:01] p0wn3d: has joined #ruby
[19:16:48] skade: has joined #ruby
[19:17:03] polyidus: has joined #ruby
[19:17:05] adaedra: ...of course?
[19:17:23] dionysus69: has joined #ruby
[19:17:49] ChiefAlexander: has joined #ruby
[19:18:01] karioleez: has joined #ruby
[19:20:23] _stu_: has joined #ruby
[19:21:28] Macaveli: has joined #ruby
[19:21:38] centrx: has joined #ruby
[19:25:03] theery: has joined #ruby
[19:25:40] GodFather: has joined #ruby
[19:27:13] ixti: has joined #ruby
[19:27:32] baweaver: has joined #ruby
[19:28:29] ur5us: has joined #ruby
[19:28:51] mistermocha: has joined #ruby
[19:29:09] jenrzzz: has joined #ruby
[19:29:22] stannard: has joined #ruby
[19:31:34] ur5us_: has joined #ruby
[19:32:49] bkxd: has joined #ruby
[19:34:18] tvw: has joined #ruby
[19:34:24] sandstrom: has joined #ruby
[19:36:58] polyidus: has joined #ruby
[19:37:13] Gooer: has joined #ruby
[19:37:42] ekinmur: has joined #ruby
[19:38:56] jdawgaz: has joined #ruby
[19:40:13] baweaver: has joined #ruby
[19:41:40] hostess: has joined #ruby
[19:42:26] pawnbox: has joined #ruby
[19:42:50] Sonja: has joined #ruby
[19:43:11] ChiefAlexander: has joined #ruby
[19:44:29] uglybandersnatch: has joined #ruby
[19:45:03] uglybandersnatch: has joined #ruby
[19:50:55] skade: has joined #ruby
[19:50:58] yfeldblum: has joined #ruby
[19:51:13] itaipu: how to force a gem to be installed ? I'm trying to install sup (gem install sup) but it failed to install ruby-xapian, but I installed xapian (gem install xapian) and I don't want to install ruby-xapian because is somehow broken in debian sid
[19:52:41] apeiros: itaipu: -y, or --no-dependencies iirc
[19:52:46] apeiros: see `gem help install`
[19:53:00] itaipu: apeiros: thks
[19:53:29] fexilal: what is rubinius trying to accomplish? good idea but poor execution?
[19:53:52] apeiros: fexilal: what are you referring to?
[19:53:54] shevy: itaipu http://guides.rubygems.org/command-reference/#gem-install should be -f possibly
[19:54:22] fexilal: apeiros : most benchmarks show mri performing better than rubinius.
[19:54:41] apeiros: fexilal: so?
[19:54:57] lemur: has joined #ruby
[19:55:13] shevy: fexilal the goals changed several times as did maintainers/contributors
[19:55:29] Dimik: how can i list all table names and params from sqlite3 db
[19:56:38] shevy: Dimik have you tried on #sqlite
[19:57:01] fexilal: apeiros : I thought rubinius:mri::pypy:cpython
[19:57:30] ramfjord_: has joined #ruby
[19:57:51] apeiros: I don't know the aims of neither pypy nor cpython.
[19:57:51] baweaver: has joined #ruby
[19:58:56] havenwood: fexilal: Actually Topaz is quite literally written in RPython so it'd be the PyPy. :P
[19:59:00] jkahn: has joined #ruby
[19:59:53] CausaMortis: has joined #ruby
[19:59:58] polyidus: has joined #ruby
[20:00:09] havenwood: fexilal: http://docs.topazruby.com/
[20:01:15] chrisseaton: fexilal: PyPy is written almost entirely in Python (actually RPython, but it's almost the same), Rubinius' JIT and VM internals and things like that are mostly C++, so it's not quite the same thing as what PyPy are trying
[20:02:09] frozen3: has joined #ruby
[20:02:11] itaipu: gem install sup -f didn't work as expected: https://gist.github.com/marcoarthur/2281bc7c3f0438c337654a717f0096e1
[20:02:12] DoubleMalt: has joined #ruby
[20:02:26] itaipu: it can't be forced ?
[20:02:44] sandelius: has joined #ruby
[20:03:02] shevy: itaipu you must compile something
[20:03:26] shevy: itaipu if it would be pure ruby you could just install it and put it into the right places; but for compiling something, on linux at least you need some generated .so file
[20:03:50] ceej: has joined #ruby
[20:03:51] Apocalypse: has joined #ruby
[20:03:58] shevy: you need to find out what failed exactly, usually it is some missing .h header file
[20:04:40] jenrzzz_: has joined #ruby
[20:04:47] cout: has joined #ruby
[20:06:49] tao_: has joined #ruby
[20:07:12] frozen3_: has joined #ruby
[20:09:48] yatish27: has joined #ruby
[20:09:52] Ikri: has joined #ruby
[20:10:00] itaipu: shevy: that is a bit odd, since I successfuly installed the xapian 1.2.18 and the dependencie described is for at least 1.2.15
[20:10:26] vikaton: has joined #ruby
[20:10:28] cdg: has joined #ruby
[20:10:31] itaipu: I'm not ruby dev, but I could read the rake file
[20:11:23] itaipu: https://gist.github.com/marcoarthur/92ce24179fd9671b7c0c5b9923043069
[20:11:24] shevy: itaipu there is no other possibility than to find out what exactly failed
[20:11:40] shevy: this does not say the compile error
[20:11:59] itaipu: yeah it doesn't, but that was wall that was logged in .log file
[20:12:30] nfk|laptop: has joined #ruby
[20:12:54] blackmesa: has joined #ruby
[20:13:06] shevy: the .log file is often useless, I always extract the gem, then work in the directory itself
[20:13:16] StyXman: darix: ack
[20:13:17] shevy: you can extract via "gem unpack"
[20:13:33] abyx: has joined #ruby
[20:13:40] shevy: inside there, should be a file called extconf.rb usually which you can run; sometimes rake is used but it never works for me
[20:13:46] abyx: Does anyone have recommendations for upgrading from Ruby 1.9.3 to Ruby 2.3?
[20:13:59] shevy: once you compile, you will quickly see the specific error
[20:14:51] shevy: abyx depends on how much you must change. do you have legacy code? the biggest problems I had was with encoding; smaller issues were psych, and some syntax changes like the : notation for hash
[20:14:52] frozen3: has joined #ruby
[20:16:39] ur5us: has joined #ruby
[20:17:13] abyx: oh i'm not doing any ruby dev myself, i just need to upgrade to make use of compass
[20:17:34] Aswebb_: has joined #ruby
[20:18:35] Ikri: has joined #ruby
[20:18:37] abyx: also do you guys recommend installing RVM?
[20:19:52] rideh: has joined #ruby
[20:19:56] havenwood: ACTION beats the chruby war drums
[20:19:58] adaedra: favorited by both guys and gals!
[20:20:22] apeiros: apeirae still use rvm
[20:20:42] apeiros: but then again, apeirae are older than time itself
[20:21:02] havenwood: apeiros: A new release! https://rvm.io/blog/2016/03/rvm-1-27-0
[20:21:28] apeiros: havenwood: great! and it's only -14 months until rvm2 comes out!
[20:21:36] DarkBushido: has joined #ruby
[20:21:36] DarkBushido: has joined #ruby
[20:24:46] LHdez: has joined #ruby
[20:24:49] skade: has joined #ruby
[20:25:30] havenwood: abyx: Which distro/os? Do you need more than one Ruby?
[20:27:06] elifoster: has joined #ruby
[20:27:26] LoneHerm_: has joined #ruby
[20:27:41] madgen: rbenv is out of fashion now, is it?
[20:27:59] mistermocha: has joined #ruby
[20:28:30] ruby[bot]: Missing command under rbenv? Did you try `rbenv rehash`?
[20:28:42] Don_John: has joined #ruby
[20:28:44] adaedra: joke aside, I don't think it is.
[20:30:04] abyx: havenwood, i'm running Ubuntu 14.04.3 LTS in a vagrant VM
[20:30:14] abyx: i'm not sure if i'll need multiple rubies though.... probably not
[20:30:17] tvon: has joined #ruby
[20:30:48] havenwood: abyx: Brightbox maintains up-to-date Ruby packages for Ubuntu: https://www.brightbox.com/docs/ruby/ubuntu/
[20:33:22] mistermocha: has joined #ruby
[20:33:41] abyx: havenwood, oh sweet! thanks
[20:33:45] bkxd: has joined #ruby
[20:34:01] havenwood: abyx: A single Ruby 2.3.0 package ^ is the simplest thing. If you want more Rubies there's ruby-install/chruby--here's an Ubuntu guide: http://ryanbigg.com/2014/10/ubuntu-ruby-ruby-install-chruby-and-you/
[20:35:04] benlieb: can anyone help me with a strange issue involving a byte sequence error during a paypal post back? http://stackoverflow.com/questions/36319174/ruby-2-3-0-paypal-ipn-invalid-byte-sequence-in-utf-8
[20:36:21] benlovell: has joined #ruby
[20:36:56] FooMunki: has joined #ruby
[20:37:15] shevy: abyx always the source - wget ftp://ftp.ruby-lang.org/pub/ruby/2.3/ruby-2.3.0.tar.xz
[20:37:24] shadoi: has joined #ruby
[20:38:37] smathy: benlieb, looks like you have some extended latin where you're expecting utf8
[20:39:45] tvon: has joined #ruby
[20:40:13] adaedra: shevy: why so?
[20:40:22] kobain: has joined #ruby
[20:40:47] benlieb: smathy: yeah, just not sure what to do
[20:41:01] shevy: adaedra because it is superior in every way
[20:41:11] havenwood: benlieb: https://github.com/whitequark/rack-utf8_sanitizer
[20:41:11] adaedra: shevy: why so?
[20:41:16] shevy: adaedra use gobolinux then you understand
[20:41:31] adaedra: ah it's just light trolling, gotcha.
[20:41:57] benlieb: havenwood: that looks like exactly what I need. Have you used it?
[20:42:07] havenwood: benlieb: nope
[20:42:18] havenwood: benlieb: or there's: https://github.com/singlebrook/utf8-cleaner
[20:43:47] yqt: has joined #ruby
[20:44:00] benlieb: havenwood: both look to be used the same amount by the community.
[20:44:37] blackgoat: has joined #ruby
[20:45:11] Maletor: has joined #ruby
[20:45:16] benlieb: havenwood: I'm always nervous to add a gem that will affect EVERYTHING
[20:45:24] GitGud: has joined #ruby
[20:46:09] havenwood: benlieb: the former uses `&&=` so it's got that in it's favor!
[20:46:17] havenwood: a nice treat ;)
[20:46:29] apeiros: the unicorn operator!
[20:46:42] benlieb: havenwood: haha, I just installed the latter one
[20:46:54] apeiros: benlieb: y u hate unicorns?!?
[20:47:22] benlieb: It just required not extra config
[20:48:11] adaedra: unicorn operator?
[20:48:40] apeiros: adaedra: because it's just as rarely seen in the wild ;-)
[20:50:58] choke: has joined #ruby
[20:51:44] finisherr: has joined #ruby
[20:52:25] drewo: has joined #ruby
[20:54:09] benlieb: havenwood: from gem install to happy customer in 5 mins :)
[20:54:34] benlieb: now lunch bye
[20:58:00] benlieb: havenwood: thanks for the recommendations
[20:58:08] havenwood: benlieb: you're welcome
[20:58:36] hahuang61: has joined #ruby
[20:58:38] agit0: has joined #ruby
[21:01:07] barajasfab: has joined #ruby
[21:02:15] vdamewood: has joined #ruby
[21:04:48] ixti: has joined #ruby
[21:07:24] ChiefAlexander: has joined #ruby
[21:07:37] zzz: has joined #ruby
[21:08:26] malconis: has joined #ruby
[21:10:38] floatingpoint: what is the easiest way to copy the contents of a directory into another directory wholesale (same permissions, same ownership, etc.)?
[21:10:54] apeiros: probably FileUtils.cp_r
[21:10:55] smathy: benlieb, I put my answer in your SO post, essentially: str.force_encoding("iso-8859-1").encode("utf-8")
[21:11:19] apeiros: almost always people who use iso-8859-1 want windows-1252 instead (strict superset)
[21:11:25] hiyosi: has joined #ruby
[21:11:55] apeiros: that is, if you're converting *from*. when converting *to* it depends of course on the target system.
[21:12:23] floatingpoint: apeiros perhaps, but the documentation isn't clear on how to do it properly
[21:14:29] baweaver: has joined #ruby
[21:14:48] x77686d: has joined #ruby
[21:15:43] Azure: has joined #ruby
[21:17:07] smathy: benlieb, apeiros is right, there's no downside to using "windows-1252" (instead if "iso-8859-1") and it might catch some extra chars.
[21:17:56] benlieb: smathy: I just used the https://github.com/singlebrook/utf8-cleaner gem
[21:18:14] smathy: benlieb, ok, and that doesn't just remove the characters?
[21:18:39] apeiros: smathy: why do it correctly when you can do it quickly
[21:18:41] apeiros: ACTION sobs
[21:19:05] smathy: benlieb, oh hey, look at that, there's an ActiveSupport method: http://devdocs.io/rails/activesupport/multibyte/chars#method-i-tidy_bytes
[21:19:39] benlieb: it looks like it cleaned the chars instead of removedthem
[21:20:01] lxsameer: has joined #ruby
[21:20:13] slash_nick: what a cute method name
[21:20:18] smathy: apeiros, yeah, I misread it initially. All good.
[21:20:19] ssiris: has joined #ruby
[21:20:39] apeiros: smathy: hm, what? I think you misunderstood me :)
[21:20:44] benlieb: Or actually no, the city went from G\xF6teborg to Gteborg
[21:20:59] apeiros: I view using utf8-cleaner as doing it quickly (and wrong)
[21:20:59] smathy: apeiros, sorry, meant for benlieb
[21:21:11] apeiros: whereas I view your approach as correct
[21:21:22] smathy: Looks like I didn't misread afterall :)
[21:21:25] bollullera: has joined #ruby
[21:21:28] benlieb: Street from to Kung\xE4lvsgatan Kunglvsgatan
[21:21:28] smathy: benlieb, right, it's just stripping them.
[21:21:41] apeiros: of course. it's not magic.
[21:21:44] smathy: Should have gone to Kungälvsgatan
[21:21:46] apeiros: welcome to the world of encodings.
[21:21:48] benlieb: yeah, well it's better than choking
[21:21:54] apeiros: if you don't know the source encoding, you're fucked.
[21:21:59] smathy: apeiros, no, if it used tidy_bytes on everything then it would ahve worked.
[21:22:20] jdawgaz: has joined #ruby
[21:23:21] apeiros: smathy: haha, yeah, because it *guesses windows-1252*
[21:23:31] benlieb: paypal actually provides the encoding in the params,
[21:23:32] apeiros: how very western-euro-centric
[21:23:55] apeiros: def tidy_bytes(string, force = false); return string if string.empty?; return recode_windows1252_chars(string) if force; string.scrub { |bad| recode_windows1252_chars(bad) }; end
[21:24:07] smathy: apeiros, right, but if you know that's what your incoming strings are, then it would have worked.
[21:24:10] apeiros: ACTION goes barf in a corner
[21:24:26] benlieb: maybe the https://github.com/whitequark/rack-utf8_sanitizer is better since it tries to coerce the bad data into good data
[21:24:33] yfeldblum: has joined #ruby
[21:24:48] apeiros: if you know your incoming encoding, you can just straight do the right thing and set the e/i encoding of the IO
[21:25:07] Aviio: has joined #ruby
[21:25:18] apeiros: I'm amazed how many programmers cling to guess-working solutions over solid solutions. makes me kinda sad.
[21:25:20] benlieb: but if this is choking inside of rails while trying to parse params, it's not easy to clean it myself
[21:25:21] smathy: benlieb, yep, that's using basically the same code I showed you.
[21:26:03] smathy: benlieb, just be aware, it's middleware, so it's going to process everything.
[21:26:14] bollullera: has left #ruby: ()
[21:26:16] RIK: i had to def (Sequel::Model.db).connection_pragmas the other day. I don't understand the brackets there. Can anyone help me with the language part of that? why did I need those brackets, and how should I fugure out next time that I do?
[21:26:25] symm-: has joined #ruby
[21:26:44] benlieb: smathy: I know, scary, but it's either that or write the middleware myself.
[21:27:07] smathy: apeiros, the "IO" is just arriving in a http callback, can't set it on the IO object itself.
[21:27:59] smathy: benlieb, umm, no, just put the code I showed you in your model.
[21:28:23] benlieb: smathy: but that only solves the problem for that model...
[21:28:34] smathy: ...or controller might be better.
[21:28:44] sp4rrow: has joined #ruby
[21:28:45] apeiros: smathy: if your IO is used for multiple encodings, the proper source encoding is binary, using .force_encoding on substrings of a known encoding.
[21:28:55] smathy: benlieb, how many callbacks from Paypal are you processing?
[21:29:04] apeiros: scrubbing is a fallback for scenarios where specifications are bad
[21:29:24] apeiros: or for actually invalid input - though then I prefer using a bat on the supplier.
[21:29:26] benlieb: smathy: just that one, but the problem is that any user can submit funky encodings
[21:29:40] smathy: apeiros, the supplier is PayPal, good luck with that.
[21:29:46] benlieb: I'm not an encoding expert by any means
[21:29:49] smathy: benlieb, how?
[21:30:11] smathy: benlieb, where else are you getting input strings from?
[21:30:15] lxsameer: has joined #ruby
[21:30:16] apeiros: smathy: it's not unlikely that they give the proper encoding. http has an encoding header after all.
[21:30:35] benlieb: smathy: various services (stripe etc)
[21:34:19] bkxd: has joined #ruby
[21:35:08] smathy: apeiros, not a request header (AFAIK), servers just infer the type from the accept-encoding or accept-charset, whatever it is, AFAIK.
[21:35:19] skweek: has joined #ruby
[21:35:22] lxsameer: has joined #ruby
[21:35:24] smathy: benlieb, and they're sending non-UTF8 as well?
[21:35:41] apeiros: smathy: content-type usually contains the encoding
[21:35:55] smathy: apeiros, that's a response header, not a request header.
[21:36:01] smathy: These are callbacks coming into the server.
[21:36:53] apeiros: smathy: um, yes, if you have a body, there's content-type
[21:36:57] apeiros: in the request too
[21:37:07] apeiros: because - surprise - you can have different types of content in a body
[21:37:11] smathy: apeiros, oh cool, TIL.
[21:37:21] apeiros: it *might* be differently named
[21:37:32] apeiros: but iirc it was just content-type too
[21:37:43] smathy: Seems sensible.
[21:37:57] apeiros: without a body it makes no sense of course and therefore isn't present. so good luck on url params :-/
[21:38:23] smathy: Well, they should be URI encoded right?
[21:38:26] apeiros: again, iirc. it's been a while since I worked through that swamp
[21:38:30] smathy: ...oh, but to what :)
[21:38:32] apeiros: yes, but that means it's just bytes
[21:38:45] apeiros: and you don't know how those bytes are supposed to be mapped to characters
[21:38:50] apeiros: which is what an encoding does :)
[21:39:08] smathy: Unless URI encoding has a set charset.
[21:39:13] apeiros: ask me again in ~6 months
[21:39:33] apeiros: in the hopes that I've written those parts of my webframework until then. because I'll have to get up to speed with the current situation for that.
[21:40:51] apeiros: smathy: re content-type in requests - the most fun I have so far is multipart with xml+pdf :) (part of a soap api we use)
[21:41:26] kobain: has joined #ruby
[21:41:45] smathy: apeiros, heh, I'm sure.
[21:42:55] andywojo: has joined #ruby
[21:42:59] Madplatypus: has joined #ruby
[21:43:07] apeiros: the most common is probably www-url-form-encoded or whatever the precise spelling was
[21:43:09] dangeranger: has joined #ruby
[21:43:16] apeiros: second most common is probably either json or xml
[21:43:52] Madplatypus: Hello everyone
[21:45:15] jenrzzz: has joined #ruby
[21:45:15] jenrzzz: has joined #ruby
[21:45:47] Polysics: has joined #ruby
[21:47:14] frozen3_: has joined #ruby
[21:49:49] mrmortondk: has joined #ruby
[21:50:45] n008f4g_: has joined #ruby
[21:55:21] ur5us: has joined #ruby
[21:55:41] lemur: has joined #ruby
[21:56:06] prodigel: has joined #ruby
[21:57:09] f3ttX]: has joined #ruby
[21:57:43] prodigel: Hey all. Ruby noob here, trying to use mina to make a deploy and I get an error I'm not sure I understand: Errno::ENOENT: No such file or directory @ rb_sysopen - /usr/lib/ruby/data/deploy.sh.erb. Am I missing an app/gem/etc? Is the deploy task broken? So many questions ... :D
[21:58:06] uglybandersnatch: has joined #ruby
[21:58:23] lkba: has joined #ruby
[21:58:33] marxarelli: has joined #ruby
[21:59:52] f3ttX]: has joined #ruby
[22:02:28] PaulCape_: has joined #ruby
[22:02:30] baweaver: has joined #ruby
[22:02:55] abyx: has joined #ruby
[22:04:45] chrisja: has joined #ruby
[22:05:17] chrisja: has joined #ruby
[22:05:58] benlieb: has joined #ruby
[22:06:08] spk: has joined #ruby
[22:08:34] apeiros: has joined #ruby
[22:08:35] rkazak: has joined #ruby
[22:09:13] wethu: has joined #ruby
[22:11:20] blackjid: has joined #ruby
[22:12:14] havenwood: has joined #ruby
[22:13:19] choke: has joined #ruby
[22:13:36] ledestin: has joined #ruby
[22:14:30] Radar: has joined #ruby
[22:14:50] smathy: prodigel, how did you install mina?
[22:14:52] shevy: it tries to find a file at that path but there is no file there
[22:15:33] LoneHerm_: has joined #ruby
[22:16:44] mistermocha: has joined #ruby
[22:17:17] mistermocha: has joined #ruby
[22:18:40] itaipu: has joined #ruby
[22:20:13] Moosashi: has joined #ruby
[22:22:05] aeterne: has joined #ruby
[22:23:17] darkf: has joined #ruby
[22:23:22] ruby-lang930: has joined #ruby
[22:24:04] ruby-lang930: Is there a way to setup common test data across minitest tests? ie. I want to use the same object for testing in several of my tests.
[22:24:36] tzhuang: has joined #ruby
[22:25:37] prodigel: smathy, I finally run bundle install and that fixed the issue
[22:25:48] prodigel: I guess it generated that missing file
[22:25:59] smathy: Well, it installed the gem, yes :)
[22:26:50] Maletor: has joined #ruby
[22:27:52] ruby[bot]: has joined #ruby
[22:28:33] lkba_: has joined #ruby
[22:29:41] ur5us: has joined #ruby
[22:30:11] phpwebdev: has joined #ruby
[22:32:26] Aviio: has joined #ruby
[22:33:24] radar_is_gey: has joined #ruby
[22:33:34] Es0teric: has joined #ruby
[22:34:18] n008f4g_: has joined #ruby
[22:35:51] myntcake: has joined #ruby
[22:36:10] tvon: has joined #ruby
[22:36:47] stantona: has joined #ruby
[22:37:23] duoi: has joined #ruby
[22:37:23] duoi: has joined #ruby
[22:37:37] dtzuzu: has joined #ruby
[22:37:38] stantona: What is ruby-timer-thr?
[22:37:46] Cohedrin_: has joined #ruby
[22:38:42] Ox0dea: stantona: The currently executing thread of your Ruby process.
[22:39:26] zenlot6: has joined #ruby
[22:40:17] Ox0dea: Sure thing.
[22:40:22] quazimodo: has joined #ruby
[22:41:05] helpa: has joined #ruby
[22:42:58] helpa: has joined #ruby
[22:45:29] sp4rrow: has joined #ruby
[22:45:55] roshanavand: has joined #ruby
[22:46:23] wilbert: has joined #ruby
[22:47:24] madgen: has joined #ruby
[22:47:25] Cohedrin: has joined #ruby
[22:50:24] baweaver: has joined #ruby
[22:50:28] bkxd: has joined #ruby
[22:51:41] uglybandersnatch: has joined #ruby
[22:53:33] ruby-lang930: Is there a way to setup common test data across minitest tests? ie. I want to use the same object for testing in several of my tests.
[22:55:44] FooMunki: has joined #ruby
[22:56:28] Inside: has joined #ruby
[22:56:28] Inside: has joined #ruby
[22:56:54] Ox0dea: ruby-lang930: You want a "subject".
[22:56:56] mistermocha: has joined #ruby
[22:58:39] uglybandersnatc-: has joined #ruby
[22:58:57] _blizzy_: has joined #ruby
[23:00:09] freerobby: has joined #ruby
[23:03:21] Cohedrin_: has joined #ruby
[23:04:38] DarthGandalf: has joined #ruby
[23:04:50] mistermocha: has joined #ruby
[23:05:04] smathy: has joined #ruby
[23:05:36] frozen3: has joined #ruby
[23:06:38] uglybandersnatch: has joined #ruby
[23:09:34] mikecmpbll: has joined #ruby
[23:14:33] CloCkWeRX: has joined #ruby
[23:14:44] Xeago: has joined #ruby
[23:15:16] sysodaff: has joined #ruby
[23:17:33] roshanavand: has joined #ruby
[23:19:51] ruby-lang930: Is there a way to setup common test data across minitest tests? ie. I want to use the same object for testing in several of my tests.
[23:20:15] baweaver: ruby-lang930: read up, Ox0dea answered you a while back
[23:20:36] mistermocha: has joined #ruby
[23:20:54] gregf: has joined #ruby
[23:21:40] ccc999: has joined #ruby
[23:22:07] ruby-lang930: Hmm, seems that subjects only apply to rspec (BDD). Is there something similar for TDD unit tests?
[23:22:26] benlieb: has joined #ruby
[23:22:43] ruby-lang930: baweaver: Hmm, seems that subjects only apply to rspec (BDD). Is there something similar for TDD unit tests?
[23:22:49] dfockler: has joined #ruby
[23:23:11] baweaver: remember that having shared state is generally bad
[23:23:46] baweaver: you could always look into helpers (not incredibly familiar with minitest admittedly)
[23:24:14] baweaver: http://tutorials.jumpstartlab.com/academy/workshops/minitest_techniques.html
[23:24:19] baweaver: that looks to cover some of it.
[23:28:28] IrishGringo: has joined #ruby
[23:29:46] russt: has joined #ruby
[23:30:36] whippythellama: has joined #ruby
[23:34:40] smathy: ruby-lang930, a subject in rspec doesn't maintain state between `it` blocks you know.
[23:35:03] tzhuang: has joined #ruby
[23:35:09] smathy: ruby-lang930, ie. it's really just the same as: def setup; @subject = something; end in xunit.
[23:35:11] bronson: has joined #ruby
[23:35:27] xlegoman: has joined #ruby
[23:37:09] ruby-lang930: smathy: I dont think that's really what I'm looking for then. I think what I need is something akin to fixtures in Rails (but in my case I don't need to deal with a database).
[23:37:31] bodgix: hey everyone. this question has been bothering me for some time now. are there any reasons for using polymorphism in ruby or more generally dynamically typed languages? I mean unless there's common functionality which can be extracted into the base class, I don't see many reasons to create class hierarchies, duck typing could be used instead? Anyone has any ideas why class hierarchies would be better besides the organization of code?
[23:38:07] baweaver: no? Ah well
[23:38:10] smathy: ruby-lang930, so just write it.
[23:38:20] baweaver: Practical Object Oriented Design in Ruby is a good read on that bodgix
[23:38:43] bodgix: I've read it iirc. There's an example with bicycles?
[23:39:08] baweaver: normally ruby uses module inclusion though
[23:39:26] ruby-lang930: smathy: I mean that I don't want to write the same setup for several tests.
[23:39:28] baweaver: kinda akin to interfaces in other languages.
[23:39:32] bodgix: I think I'll read this chapter again
[23:40:01] bodgix: the thing is that technically it's not needed in ruby as opposed to java for example
[23:40:07] smathy: ruby-lang930, right, of course not. Write it in one place and use it wherever you need to.
[23:41:03] ruby-lang930: smathy: Sorry I'm not sure I understand. You mean write a module and include the require the code into my tests?
[23:42:49] idletask: has joined #ruby
[23:43:15] Ox0dea: ruby-lang930: Sounds like you want a before block.
[23:43:34] goglosh: has joined #ruby
[23:43:42] smathy: ruby-lang930, yes, could be a module that you include, some methods in your test_helper.rb, or a class you call from your tests. Whatever you want.
[23:44:41] smathy: You could write a base class for all your tests with the methods in it if you wanted. This is ruby, there are many ways of using the same functionality in multiple places.
[23:45:01] gix: has joined #ruby
[23:45:33] skade: has joined #ruby
[23:45:55] cdg: has joined #ruby
[23:48:39] Aswebb_: has joined #ruby
[23:50:27] Maletor: has joined #ruby
[23:54:30] DLSteve: has joined #ruby
[23:55:01] teej: has joined #ruby
[23:56:09] russt: has joined #ruby
[23:56:21] chouhoulis: has joined #ruby
[23:56:26] lemur: has joined #ruby
[23:56:30] riceandbeans: what's a safe way to check if a variable exists?
[23:56:42] spuk: has joined #ruby
[23:57:40] millerti: has joined #ruby
[23:57:56] apeiros: read your code. and if that's not sufficient, you probably are doing something wrong.
[23:57:58] QualityAddict: has joined #ruby
[23:58:09] riceandbeans: no that ain't it
[23:58:22] riceandbeans: I think I want if defined?(foo)
[23:58:32] ruby[bot]: it seems like you are asking for a specific solution to a problem, instead of asking about your problem. This often leads to bad solutions and increases frustration for you and those trying to help you. More: http://meta.stackexchange.com/a/66378
[23:58:39] apeiros: and I think if you want that, you do indeed something quite wrong
[23:58:49] Ox0dea: Is `defined?` never justified?
[23:58:52] apeiros: baweaver: all factoids are ? prefixed
[23:59:02] baweaver: ACTION keeps forgetting
[23:59:03] apeiros: Ox0dea: IMO exceedingly rarely justified
[23:59:15] Radar: baweaver: apeiros and I conspired to ensure maximum factoid prefix confusion
[23:59:21] riceandbeans: well, basically I have an ERB file, I just want some chunks of template to exist if a variable is set, if the variable isn't set to anything I don't care and it doesn't need to go in the template
[23:59:50] baweaver: >> v = nil; if v then 'foo' else 'bar' end
[23:59:51] ruby[bot]: baweaver: # => "bar" (https://eval.in/545287)
[23:59:52] apeiros: riceandbeans: use a proper control variable which states that intent