« Back to channel list

#ruby - 17 July 2015

« Back 1 day Forward 1 day »
[00:00:10] ttilley: has joined #ruby
[00:00:15] zrowe007: their stail now anyway
[00:01:04] zrowe007: toretore: you said you wanted hardcoded values
[00:01:31] toretore: no, i said you should hardcode the values in the file you use to test with
[00:03:51] peeja: has joined #ruby
[00:03:59] speaking1ode: has joined #ruby
[00:05:27] slash_nick: has joined #ruby
[00:05:31] polyrob_: has joined #ruby
[00:07:34] leat3: has joined #ruby
[00:07:49] SaintMoriarty: shouldn't rails server -b 0.0.0.0 allow network computers to connect
[00:08:09] dimasg: has joined #ruby
[00:08:32] graydot: has joined #ruby
[00:08:57] SaintMoriarty: I don't have it
[00:10:53] howdoicomputer: has joined #ruby
[00:11:24] SaintMoriarty: when I do ps -x
[00:11:46] SaintMoriarty: i see only rails server not rails server -b 0.0.0.0
[00:11:50] SaintMoriarty: is that normal
[00:11:50] centrx: has joined #ruby
[00:13:06] dfinninger: has joined #ruby
[00:13:38] Zinja: SaintMoriarty: Try ps aux | grep rails
[00:14:02] SaintMoriarty: root 1 0.0 0.0 4320 648 ? Ss 00:05 0:00 /bin/sh -c rake db:create && rake db:schema:load && rake assets:precompile && perl -p -i -e 's/config.serve_static_assets .*/config.serve_static_assets = true/' config/environments/production.rb && rails server
[00:14:02] SaintMoriarty: root 31 1.1 0.3 300084 106300 ? Sl 00:06 0:04 /usr/local/bin/ruby bin/rails server
[00:14:03] SaintMoriarty: root 324 0.0 0.0 11112 708 ? S+ 00:13 0:00 grep rails
[00:15:01] toretore: are you running `rails server -b 0.0.0.0` directly from an interactive shell?
[00:15:14] SaintMoriarty: I'm running it through my dockerfile
[00:16:05] toretore: why did you leave out this information?
[00:16:55] toretore: now there's probably 10 complicating factors that could be causing the results you see
[00:17:17] wldcordeiro_: has joined #ruby
[00:17:21] Musashi007: has joined #ruby
[00:17:28] gamename: has joined #ruby
[00:17:49] toretore: * SaintMoriarty has ragequit
[00:17:49] leat3: has joined #ruby
[00:20:30] davejlong: has joined #ruby
[00:21:25] baweaver: has joined #ruby
[00:24:18] graydot: has joined #ruby
[00:24:25] symbol: has joined #ruby
[00:26:52] xkickflip: has joined #ruby
[00:27:33] crunk_bear: has joined #ruby
[00:27:58] casadei_: has joined #ruby
[00:30:08] Oog: has joined #ruby
[00:30:33] quazimodo: has joined #ruby
[00:30:34] quazimod1: has joined #ruby
[00:30:40] pengin: has joined #ruby
[00:33:52] Rubie: has joined #ruby
[00:36:46] howdoi: has joined #ruby
[00:36:58] choppington: has joined #ruby
[00:37:10] noethics: has joined #ruby
[00:37:26] swgillespie: has joined #ruby
[00:38:11] jgpawletko: has joined #ruby
[00:40:08] podman: has joined #ruby
[00:41:22] davejlong: has joined #ruby
[00:41:46] slash_nick: has joined #ruby
[00:44:07] davedev24: has joined #ruby
[00:45:54] zacstewart: has joined #ruby
[00:47:34] Rollabunna: has joined #ruby
[00:49:46] Rubie: has joined #ruby
[00:49:50] Oog: has joined #ruby
[00:52:24] paulcsmith: has joined #ruby
[00:54:28] devdazed: has joined #ruby
[00:54:47] _blizzy_: has joined #ruby
[00:55:09] jhn: has joined #ruby
[01:00:10] allomov: has joined #ruby
[01:00:26] _blizzy_: has joined #ruby
[01:00:52] m4rCsi: has joined #ruby
[01:02:25] ledestin: has joined #ruby
[01:02:48] TheNet: has joined #ruby
[01:02:49] PhantomSpank: has joined #ruby
[01:05:14] tkuchiki: has joined #ruby
[01:06:01] Oog: has joined #ruby
[01:10:23] jaequery: has joined #ruby
[01:11:11] gamename: has joined #ruby
[01:11:27] ddarkpassenger: has joined #ruby
[01:13:14] fabrice31: has joined #ruby
[01:14:40] mikeric: has joined #ruby
[01:14:49] TheNet: has joined #ruby
[01:15:31] CloCkWeRX1: has joined #ruby
[01:19:09] nateberkopec: has joined #ruby
[01:19:31] Igorshp: has joined #ruby
[01:19:53] Scripore: has joined #ruby
[01:21:36] charliesome: has joined #ruby
[01:23:08] mike___1234: has joined #ruby
[01:32:35] arescorpio: has joined #ruby
[01:33:56] fgo: has joined #ruby
[01:37:42] mary5030: has joined #ruby
[01:37:50] markholmes: has joined #ruby
[01:39:20] TheNet: has joined #ruby
[01:41:48] Igorshp: has joined #ruby
[01:42:11] Rollabunna: has joined #ruby
[01:42:49] sevenseacat: has joined #ruby
[01:43:05] athos_diddy: has joined #ruby
[01:43:22] athos_diddy: hey everyone i need to buy my first SSL cert for a blog then later a customer facing web appp
[01:43:50] athos_diddy: Comodo is selling EV SSL for 99 as a summer special. the banner on the site says it's a summer sale.. is that for real? is 99$ super cheap?
[01:44:14] athos_diddy: https://ssl.comodo.com/ it's spam right haha
[01:44:34] dogcan: has joined #ruby
[01:45:03] veduardo: has joined #ruby
[01:46:04] athos_diddy: omg multi domains is like 900$
[01:46:26] dogcan: Hi, can somebody explain what line 9 does https://gist.github.com/anonymous/07f4911c62e39520bfa9
[01:46:33] dogcan: I'm a tad confused
[01:46:54] MrJiks_: has joined #ruby
[01:46:56] centrx: dogcan, The last line of a method is what is returned
[01:47:00] centrx: dogcan, an explicit 'return' is not necessary
[01:47:41] centrx: s/is what is returned/is returned
[01:47:47] fgo: has joined #ruby
[01:49:35] Ox0dea: dogcan: For what it's worth, Lines 5-9 could be replaced with just `@logger ||= Logger.new STDOUT` without changing the functionality at all.
[01:49:45] atomi: has joined #ruby
[01:50:13] dogcan: centrx: Thanks so if I created a new instance of MyLog it would return the instance created on line 6?
[01:50:59] centrx: dogcan, That's if you executed MyLog.log
[01:51:17] centrx: dogcan, If you create a new instance with #new, it always returns the instance created
[01:51:21] zrowe007: has joined #ruby
[01:51:32] dfinninger: has joined #ruby
[01:52:04] dogcan: centrx so MyLog.log doesn't create a new instance it just uses the function already there
[01:52:16] Tamae: has joined #ruby
[01:52:54] centrx: dogcan, It does create a new instance, but it does so within the class method MyLog.log
[01:53:03] Stratege__: has joined #ruby
[01:53:07] GeissT: has joined #ruby
[01:53:23] dogcan: centrx: is it a new instance of logger or MyLog (since it's a class)
[01:53:27] centrx: dogcan, Actually, it creates a new instance of "Logger", not MyLog
[01:53:36] dogcan: I see, great
[01:53:40] dogcan: thanks so much
[01:54:14] dfockler: has joined #ruby
[01:54:40] dogcan: centrx: I have to say the looseness of ruby can be a tad much to get used to
[01:55:15] Oog: has joined #ruby
[01:55:32] unreal_: has joined #ruby
[01:55:56] centrx: dogcan, It makes development much smoother when you get used to it
[01:57:09] dogcan: oh ok, well that's good to know. One more question for def self.log, do we need the self
[01:57:17] graydot: has joined #ruby
[01:57:34] dogcan: Sounds promising
[01:57:52] centrx: dogcan, the self specifies that it's a class method
[01:58:00] centrx: dogcan, def log would make it an instance method
[01:58:15] centrx: dogcan, You can also do def MyLog.log (same as self.log), but self.log is the preferred style nowadays
[01:59:21] devbug: has joined #ruby
[02:02:11] dogcan: centrx: in this example wouldn't we want it to be a instance method though, like a singleton?
[02:02:21] dogcan: since we only ever want one logger
[02:02:24] yfeldblum: has joined #ruby
[02:03:30] centrx: dogcan, Sure, Singleton pattern is good (http://ruby-doc.org/stdlib-2.2.2/libdoc/singleton/rdoc/Singleton.html). Class methods works too
[02:04:12] datanoise: has joined #ruby
[02:04:19] Ox0dea: dogcan: A new Logger is only instantiated when @logger is nil.
[02:04:39] Ox0dea: It'll only be nil the first time MyLog.log is invoked.
[02:05:19] bungoman: has joined #ruby
[02:05:59] dogcan: Ox0dea: couldn't we make new instances of MyLog.log though? I think I understand the difference between class and instance methods.
[02:06:14] Ox0dea: dogcan: MyLog.log is not a class, so how could you make new instances of it?
[02:07:10] dogcan: instance-2 = MyLog.new; instance-2.log
[02:07:16] dogcan: something like that maybe
[02:07:40] Ox0dea: No, log is a class method here.
[02:07:48] Ox0dea: You won't be able to call it on instances.
[02:08:17] dogcan: so if it were an instance method we could
[02:09:07] Ox0dea: Well, yes, but then your class would be called MyLogger, and you'd start reinventing the wheel.
[02:09:12] dogcan: I guess I am confused since I am reading instance methods apply to the specific instance while class methods are like theblueprints for the class and don't apply to specific instances
[02:09:15] crwilcox: has joined #ruby
[02:09:23] SirFunk: So... MRI ruby.. threads or no?
[02:09:35] Ox0dea: SirFunk: Switch to Elixir.
[02:09:50] SirFunk: Ox0dea: I've been tempted
[02:10:02] Ox0dea: There's much good to be said of it.
[02:10:10] nateberkopec: has joined #ruby
[02:10:17] Domon: has joined #ruby
[02:10:25] SirFunk: I thought MRI had real threads but they are crippled by the GIL. Someone I work with was asserting MRI has no threading
[02:10:45] SirFunk: a few minutes of googling didn't yield much information
[02:10:51] Lucky_: has joined #ruby
[02:12:12] Oog: has joined #ruby
[02:12:26] centrx: SirFunk, I thought they were real threads but they are locked by the GIL to maintain consistency
[02:13:04] centrx: SirFunk, The GIL isn't a big problem for most applications because of I/O
[02:14:06] SirFunk: centrx: IO happens concurrently.. but only 1 thread of ruby executes at a time?
[02:14:23] SirFunk: what is the advantage to having native threads if only one executes at a time vs green threads?
[02:14:46] SirFunk: And how do Puma and Sidekiq get any advantage on MRI... or do they not?
[02:16:44] ZeeNoodleyGamer: has joined #ruby
[02:19:40] centrx: SirFunk, Most apps are waiting on I/O such as the Database, Disk, or Network
[02:19:48] baweaver: has joined #ruby
[02:20:20] atomi: has joined #ruby
[02:20:32] malcolmva: has joined #ruby
[02:20:44] SirFunk: centrx: right. I'm just trying to better understand what Threading does or doesn't do in MRI
[02:21:20] centrx: Yeah I don't that much about it. Try again later (or earlier)
[02:22:15] dseitz: has joined #ruby
[02:24:24] nofxx: has joined #ruby
[02:24:35] mikeric: has joined #ruby
[02:24:50] junegunn: has joined #ruby
[02:30:50] NeverDie: has joined #ruby
[02:31:19] symm-: has joined #ruby
[02:36:01] eam: SirFunk: with green threads, two threads can't do disk i/o at the same time
[02:36:10] Rollabunna: has joined #ruby
[02:36:26] bungoman: has joined #ruby
[02:37:07] eam: a green thread system might multiplex socket i/o and make it concurrent, but disk interaction will suffer
[02:37:53] havenwood: has joined #ruby
[02:38:56] eam: and with real threads you don't have to deal with the somewhat-broken edge cases in a multiplexed fake-thread engine, you can use a real thread and get precise interactions with your sockets
[02:39:05] TheNet: has joined #ruby
[02:39:10] eam: eg a read() really is a read()
[02:40:14] peeja: has joined #ruby
[02:40:18] choke: has joined #ruby
[02:42:47] Igorshp: has joined #ruby
[02:43:07] leat3: has joined #ruby
[02:43:46] davedev24: has joined #ruby
[02:44:22] choke: has joined #ruby
[02:44:53] haraoka: has joined #ruby
[02:46:07] hahuang65: has joined #ruby
[02:48:17] charliesome: has joined #ruby
[02:48:34] dogcan: In python there's pyflakes. What's a good lexical analyzer for ruby
[02:50:59] Ox0dea: dogcan: Rubocop sees fairly widespread use.
[02:51:27] dogcan: neat thanks
[02:51:36] Ox0dea: It's not quite the same thing, of course, but analyzing Ruby is quite a tall task.
[02:53:08] symbol: has joined #ruby
[02:53:43] Santana: has joined #ruby
[02:54:45] tmtwd: has joined #ruby
[02:56:48] Pupeno_: has joined #ruby
[02:57:20] atomi: has joined #ruby
[02:57:34] Azure: has joined #ruby
[02:57:53] eggoez: has joined #ruby
[03:00:11] tmtwd_: has joined #ruby
[03:00:53] allomov: has joined #ruby
[03:04:20] dseitz: has joined #ruby
[03:05:40] Channel6: has joined #ruby
[03:07:43] desigx: has joined #ruby
[03:07:50] cpruitt: has joined #ruby
[03:08:57] braincrash: has joined #ruby
[03:11:21] cpruitt: has joined #ruby
[03:12:42] m4rCsi: has joined #ruby
[03:13:42] j4cknewt: has joined #ruby
[03:14:01] fabrice31: has joined #ruby
[03:15:10] willywos: has joined #ruby
[03:17:04] m4rCsi: has joined #ruby
[03:20:07] davedev24: has joined #ruby
[03:23:25] jenrzzz: has joined #ruby
[03:23:59] leat3: has joined #ruby
[03:24:24] desigx: has joined #ruby
[03:27:22] darkf: has joined #ruby
[03:27:47] Oog: has joined #ruby
[03:27:52] Domon: has joined #ruby
[03:28:16] Oka: has joined #ruby
[03:28:45] m4rCsi: has joined #ruby
[03:29:21] devbug: has joined #ruby
[03:30:25] Rollabunna: has joined #ruby
[03:38:31] Rubie: has joined #ruby
[03:43:40] Oog: has joined #ruby
[03:44:43] dellavg: has joined #ruby
[03:45:03] bruno-: has joined #ruby
[03:47:19] CloCkWeRX: has joined #ruby
[03:49:21] lessless: has joined #ruby
[03:49:35] CloCkWeRX: has left #ruby: ()
[03:51:14] peeja: has joined #ruby
[03:57:15] flaf: has joined #ruby
[03:57:30] gix: has joined #ruby
[03:59:33] flaf: Hi. Sorry I'm not a ruby expert. Is there a way to be sure in a class to have an instance variable which can't be modified?
[03:59:43] arup_r: has joined #ruby
[04:00:19] sevenseacat: I wouldn't think so.
[04:00:25] sevenseacat: but I'm no expert.
[04:01:24] Ox0dea: flaf: What's in the instance variable?
[04:01:53] Ox0dea: Eh, I suppose that doesn't actually matter.
[04:01:54] flaf: Ox0dea: the instance variable is a hash.
[04:02:12] Ox0dea: You could freeze it, but that would only prevent the hash being modified, not the instance variable.
[04:02:52] sevenseacat: it also might not freeze the individual elements in the hash from being modified :P
[04:03:03] sevenseacat: just the hash itself
[04:03:51] flaf: Ok, so just something like that => @var = my_hash; @var.freeze; Correct?
[04:04:43] Ox0dea: flaf: Yes, but note well the cautionary advice provided above.
[04:05:23] saadq: has joined #ruby
[04:05:46] Ox0dea: The hash's mutable elements are still susceptible to being modified, but the ice_nine gem could help with that.
[04:06:16] Ox0dea: >> foo = {a: 'bar'}.freeze; foo[:a][2] = 'd'; foo
[04:06:17] ruboto: Ox0dea # => {:a=>"bad"} (https://eval.in/400368)
[04:06:18] flaf: Ok, I see. At least, is it possible to ensure that the instance variable is unreachable outside of the object itself?
[04:06:25] Ox0dea: flaf: No, never.
[04:06:34] bungoman: has joined #ruby
[04:07:39] sevenseacat: Ruby's awesome like that :)
[04:08:02] flaf: Ok. Thx sevenseacat and Ox0dea for your (fast) help. ;)
[04:08:06] Ox0dea: Sure thing.
[04:08:50] bronson: has joined #ruby
[04:08:58] Ox0dea: flaf: Just as a bit of evidence for our claim, there is a secret class in Ruby called FrozenCore that has purposely been made very difficult to access, but ObjectSpace nevertheless lets us get to it if we really want to.
[04:09:29] sevenseacat: oh yes I've seen some odd things be done with FrozenCore *looks in charliesome's direction*
[04:09:35] sevenseacat: who isnt here anymore but anyway
[04:11:07] yfeldblum: has joined #ruby
[04:11:17] flaf: Ok, *on this point*, Ruby is like Python if I understand well.
[04:11:29] Ox0dea: On which point?
[04:11:57] flaf: The protection of a instance variable.
[04:12:23] Ox0dea: Both languages give you a great deal of access to their internal mechanisms.
[04:12:23] sevenseacat: no idea about Python.
[04:13:49] flaf: Ah, sorry, just a last question: how can I get a class variable (@@var) via an instance?
[04:14:15] Ox0dea: instance.class.class_variable_get(:@@var)
[04:15:16] haraoka: has joined #ruby
[04:15:46] flaf: Ah ok, thx. ;)
[04:17:00] Hanmac: Ox0dea: isnt class variables already accessable inside the instance itself?
[04:17:53] Hanmac: PS : with much hacking its even possible to unfreeze objects but that is very dark coding ,P
[04:18:59] Ox0dea: hanmac: "much hacking" was a stretch; Fiddle makes it a breeze. :)
[04:19:38] Ox0dea: And no, class variables aren't accessible directly from instances.
[04:21:17] Ox0dea: >> class Foo; @@bar = 42 end; [(Foo.new.class_variables rescue ':('), Foo.new.class.class_variables]
[04:21:18] ruboto: Ox0dea # => [":(", [:@@bar]] (https://eval.in/400379)
[04:22:30] Hanmac: Ox0dea: oh ok i thought it would have been possible with instance_eval { @@bar } or some of its friends
[04:24:42] Rollabunna: has joined #ruby
[04:24:44] Ox0dea: >> require 'fiddle'; class Object; def thaw; Fiddle::Pointer.new(__id__ * 2)[1] &= -9 end end; s = 'foo'.freeze; [s.frozen?, s.thaw, s.frozen?]
[04:24:46] ruboto: Ox0dea # => [true, -64, false] (https://eval.in/400387)
[04:24:50] Ox0dea: hanmac: There's Object#thaw. :)
[04:27:25] sevenseacat: you people are crazy :P
[04:27:43] Ox0dea: Guilty as charged.
[04:28:20] towski_: has joined #ruby
[04:28:29] Hanmac: i am not crazy! i have been tested! ;P
[04:29:13] duderonomy: has joined #ruby
[04:29:36] tjbiddle: has joined #ruby
[04:29:46] revath: has joined #ruby
[04:34:18] doctorly: has joined #ruby
[04:39:33] arooni-mobile: has joined #ruby
[04:39:47] revath: has joined #ruby
[04:41:29] arooni-mobile: has joined #ruby
[04:43:03] mikepack: has joined #ruby
[04:46:32] skade: has joined #ruby
[04:50:39] Oog: has joined #ruby
[04:50:57] AndroUser466: has joined #ruby
[04:52:43] crdpink: has joined #ruby
[04:55:11] tmtwd: has joined #ruby
[04:56:05] icebourg: has joined #ruby
[04:56:12] fgo: has joined #ruby
[05:00:43] [k-: has joined #ruby
[05:01:13] jackjackdripper: has joined #ruby
[05:01:34] peter_paule: has joined #ruby
[05:02:40] Ox0dea: You're up early, no?
[05:03:07] mleung: has joined #ruby
[05:03:07] Ox0dea: Yeah, I derped there.
[05:03:08] tkuchiki: has joined #ruby
[05:03:29] Ox0dea: UTC+6, right?
[05:03:59] Ox0dea: Stupid DST.
[05:04:20] jack_rabbit: has joined #ruby
[05:04:38] [k-: but it saves the day!
[05:05:02] pontiki: GET THE FUCK OUT
[05:05:18] Ox0dea: [k-: I'm trying to write a completely non-alphanumeric C program for IOCCC this year. ^_^
[05:05:23] Ox0dea: It's hard.
[05:05:27] pontiki: no, it's ok, puns are important to share
[05:07:11] [k-: I have faith in you!
[05:08:21] Ox0dea: Clang and GCC both seem to put argv in a weird place in memory if you don't declare it to be char **, so that's nice.
[05:08:39] dubkoidragon: has joined #ruby
[05:09:13] towski_: has joined #ruby
[05:13:39] dhjondoh: has joined #ruby
[05:14:02] haxrbyte: has joined #ruby
[05:14:50] fabrice31: has joined #ruby
[05:16:13] markholmes: has joined #ruby
[05:16:21] SaintMoriarty: has joined #ruby
[05:17:16] [k-: professor Moriarty!
[05:17:25] SaintMoriarty: Homes there you are
[05:17:36] xcesariox: has joined #ruby
[05:17:59] SaintMoriarty: Maybe I can get some help
[05:18:02] pontiki: you're just holmies...
[05:18:06] [k-: I'm not Holmes :(
[05:18:58] Rollabunna: has joined #ruby
[05:19:24] Silent__: has joined #ruby
[05:19:43] SaintMoriarty: I am running a docker container and for some reason I cannot access it from my network. I have my ports assigned.
[05:19:53] bmurt: has joined #ruby
[05:20:14] sp1rs: has joined #ruby
[05:20:22] SaintMoriarty: I'm using rails server -b 0.0.0.0
[05:20:24] howdoi: has joined #ruby
[05:20:32] oz`: has joined #ruby
[05:20:59] tkuchiki: has joined #ruby
[05:21:10] kiriappeee: has joined #ruby
[05:21:49] jmhmccr_: has joined #ruby
[05:22:09] [k-: how is this related to Ruby :(
[05:22:16] PaulePan1er: has joined #ruby
[05:22:17] contradictioned_: has joined #ruby
[05:22:19] bttf_: has joined #ruby
[05:22:21] Rixius|Alt: has joined #ruby
[05:22:26] bmurt: has joined #ruby
[05:22:31] prasselpikachu_: has joined #ruby
[05:22:31] warreng_: has joined #ruby
[05:22:32] n1ftyn8__: has joined #ruby
[05:22:33] artmann: has joined #ruby
[05:22:58] Cybergeek_: has joined #ruby
[05:23:02] drzel_: has joined #ruby
[05:23:06] coffeeju1: has joined #ruby
[05:23:07] phrozen7-: has joined #ruby
[05:23:07] Darkwater_: has joined #ruby
[05:23:17] kalleth_: has joined #ruby
[05:23:23] AdamMeghji_: has joined #ruby
[05:23:27] Centrixx: has joined #ruby
[05:23:27] tonini: has joined #ruby
[05:23:27] jpinnix______: has joined #ruby
[05:23:27] neektza_: has joined #ruby
[05:23:27] Centrixx: has joined #ruby
[05:23:28] jpinnix______: has joined #ruby
[05:23:28] tonini: has joined #ruby
[05:23:29] lnx_: has joined #ruby
[05:23:29] warreng: has joined #ruby
[05:23:30] heftig_: has joined #ruby
[05:23:34] troter___: has joined #ruby
[05:23:34] mozzarella: has joined #ruby
[05:23:37] soahccc^: has joined #ruby
[05:23:43] dbussink: has joined #ruby
[05:23:45] bascht: has joined #ruby
[05:23:45] Trieste: has joined #ruby
[05:23:45] sevvie: has joined #ruby
[05:23:48] rfv_: has joined #ruby
[05:24:03] camilasan: has joined #ruby
[05:24:09] [k-: I don't see any ruby in your question
[05:24:16] JaTochNietDan: has joined #ruby
[05:24:18] Miron: has joined #ruby
[05:24:52] x3cion: has joined #ruby
[05:24:57] ckrailo: has joined #ruby
[05:25:09] hfp: has joined #ruby
[05:25:26] akitada: has joined #ruby
[05:25:42] fella5s: has joined #ruby
[05:25:44] Vile`: has joined #ruby
[05:25:51] swgillespie: has joined #ruby
[05:26:02] cstrahan: has joined #ruby
[05:26:13] manveru: has joined #ruby
[05:26:14] htmldrum: has joined #ruby
[05:26:23] casadei_: has joined #ruby
[05:26:56] chrisseaton: has joined #ruby
[05:27:33] maZtah: has joined #ruby
[05:27:36] lacrosse: has joined #ruby
[05:28:01] joaomdmoura: has joined #ruby
[05:28:38] CloCkWeRX: has joined #ruby
[05:28:39] hashrocket: has joined #ruby
[05:29:06] jobewan: has joined #ruby
[05:29:08] bmurt: has joined #ruby
[05:29:13] lkba: has joined #ruby
[05:29:31] bove: has joined #ruby
[05:29:45] nahtnam: has joined #ruby
[05:33:15] kalz: has joined #ruby
[05:33:29] baweaver: has joined #ruby
[05:34:19] tmtwd: has joined #ruby
[05:34:54] aganov: has joined #ruby
[05:37:16] t0rrieri: has joined #ruby
[05:38:22] nofxx: has joined #ruby
[05:38:32] tmtwd: has joined #ruby
[05:38:51] DoubleMalt: has joined #ruby
[05:39:31] Polysics: has joined #ruby
[05:42:15] baweaver_: has joined #ruby
[05:45:34] leat3: has joined #ruby
[05:49:23] JohnBat26: has joined #ruby
[05:49:59] pepperbreath: has left #ruby: ()
[05:51:48] arup_r: has joined #ruby
[05:52:32] djbkd: has joined #ruby
[05:54:55] malconis: has joined #ruby
[05:55:22] swgillespie: has joined #ruby
[05:55:50] leat3: has joined #ruby
[05:56:06] andikr: has joined #ruby
[05:56:29] revath: has joined #ruby
[05:56:35] tkuchiki: has joined #ruby
[05:57:36] fgo_: has joined #ruby
[05:58:52] tagrudev: has joined #ruby
[05:58:53] djbkd: has joined #ruby
[06:01:43] schaerli: has joined #ruby
[06:03:25] MagePsycho: has joined #ruby
[06:03:50] arturaz: has joined #ruby
[06:05:36] dubkoidragon: has joined #ruby
[06:06:48] bluOxigen: has joined #ruby
[06:08:36] skade: has joined #ruby
[06:11:16] ixti: has joined #ruby
[06:12:00] eGGsha: has joined #ruby
[06:12:29] rht: has joined #ruby
[06:13:17] Rollabunna: has joined #ruby
[06:14:20] devbug: has joined #ruby
[06:15:49] schaerli: has joined #ruby
[06:15:56] [k-: morning
[06:17:20] fantazo: has joined #ruby
[06:17:45] jesterfraud: has joined #ruby
[06:18:09] roolo: has joined #ruby
[06:19:55] finisherr: has joined #ruby
[06:22:04] brianpWins: has joined #ruby
[06:22:44] zenspider: who's the crystal (the language, you dorks) freak here?
[06:23:05] konsolebox: has joined #ruby
[06:23:49] apeiros: ACTION points fingers at jhass
[06:24:03] apeiros: anybody is
[06:25:06] tkuchiki: has joined #ruby
[06:25:32] sindork: has joined #ruby
[06:25:56] Karpah: has joined #ruby
[06:26:45] jackjackdripper: has joined #ruby
[06:28:47] Violentr: has joined #ruby
[06:29:11] arup_r: has joined #ruby
[06:29:15] Timba-as: has joined #ruby
[06:30:33] redlegion: has joined #ruby
[06:30:58] darkf: has joined #ruby
[06:32:51] joonty: has joined #ruby
[06:37:08] st0mar: has joined #ruby
[06:40:46] bmurt: has joined #ruby
[06:41:02] Rollabunna: has joined #ruby
[06:42:12] Rubie: has joined #ruby
[06:44:32] dubkoidragon: hey, so I've just downlaoded the ruby installer, and so i still dont know how to run one of my block fo code
[06:45:00] tjbiddle: has joined #ruby
[06:46:23] sevenseacat: did you run the ruby installer?
[06:46:54] leat3: has joined #ruby
[06:47:14] casadei_: has joined #ruby
[06:48:28] dubkoidragon: what do you mean
[06:48:55] dubkoidragon: theres nothing to run other than the uninstall exe
[06:48:55] codecop: has joined #ruby
[06:49:30] sevenseacat: you said you downloaded the installer, did you use it to install ruby?
[06:50:13] dubkoidragon: like I installed yes, and saved my file to .rb, and went to the ruby 21 folder and wrote ruby x.rb
[06:50:31] dubkoidragon: and it tells me it doesnt recognize ruby
[06:51:17] rickmasta: has joined #ruby
[06:51:28] kham: has joined #ruby
[06:51:30] Oog: has joined #ruby
[06:51:48] rdark: has joined #ruby
[06:52:22] krz: has joined #ruby
[06:52:33] rdark: has joined #ruby
[06:53:09] fgo_: has joined #ruby
[06:53:34] dubkoidragon: i have no idea why its not working
[06:54:16] sevenseacat: you likely didn't check the checkbox that said "add Ruby executables to your path" when you installed Ruby
[06:54:17] moshee: has joined #ruby
[06:54:23] sevenseacat: try installing it again, and make sure to check that box? :)
[06:54:37] dubkoidragon: ok ill try that but how do i start over now uninstall??
[06:54:53] digifiv5e: has joined #ruby
[06:55:57] revath: has joined #ruby
[06:57:16] allomov: has joined #ruby
[06:57:53] bosma: has joined #ruby
[06:58:00] schaerli: has joined #ruby
[06:58:05] dubkoidragon: ok I fuigured it out after install, you also have to open cmd with ruby to use
[06:58:10] dubkoidragon: like much harder than python
[06:58:23] dubkoidragon: yo I wanted to say thanks for the help man
[06:58:49] Ox0dea: dubkoidragon: sevenseacat is a woman.
[06:58:59] acke: has joined #ruby
[06:59:09] dubkoidragon: I didnt mean man as what it means lol, just slang
[06:59:09] [k-: flughafen!
[06:59:10] sevenseacat: I'm not sure what 'you have to open cmd with ruby' means, but okay.
[06:59:16] sevenseacat: glad I could help.
[07:00:08] sevenseacat: 'I didnt mean man as what it means' :/
[07:00:42] Rollabunna: has joined #ruby
[07:03:18] kp666: has joined #ruby
[07:04:23] flughafen: flughafen: you!
[07:04:43] dubkoidragon: sry wrong window
[07:05:03] awk: blah, i'm really struggling to find a way to use rsync (incremental) pulls from a remote ssh server and doing this the 'right' way in ruby.. i'm a ruby noob.. I wrote the script using scp, however I have a problem because scp doesn't have incremental options
[07:06:03] dubkoidragon: if I may, could someone explain why sometimes I have to end my loops with $end instead of end. It seems to be when i run var.each loops and use {} instead of 'do'
[07:06:34] sevenseacat: you never have to use $end.
[07:06:51] dubkoidragon: I have to use it right now on this very small bit of code i have
[07:06:56] Ox0dea: dubkoidragon: Please post it.
[07:07:00] dubkoidragon: in fact if i dont use the $ it tells me too
[07:07:07] dubkoidragon: odds = [1,3,5,7,9]
[07:07:07] dubkoidragon: odds.each { |x|
[07:07:26] Ox0dea: Remove the $end and see what happens.
[07:07:26] [k-: how do you implement a sort :(
[07:07:34] Ox0dea: [k-: Quicksort is super-easy.
[07:07:50] dubkoidragon: it tells me that i need to put an $end or it wont work in cmd
[07:07:52] i-blis: has joined #ruby
[07:07:52] i-blis: has joined #ruby
[07:08:04] dubkoidragon: and when i do it owrks
[07:08:09] [k-: but I have to pivot and my head goes spinning
[07:08:17] Ox0dea: [k-: Any element can be the pivot.
[07:08:27] Ox0dea: Median-of-three is statistically best, though.
[07:08:32] [k-: I wonder if a bubblesort is easy to implement
[07:08:46] sevenseacat: dubkoidragon: thats not the whole code.
[07:08:56] sevenseacat: please gist the whole code.
[07:09:26] dubkoidragon: yea it is lol
[07:09:32] dubkoidragon: its from a syntax tutorial im doing
[07:09:37] dubkoidragon: thats the whole code
[07:09:55] [k-: you don't need the $end?
[07:10:00] tejasmanohar: has joined #ruby
[07:10:07] tejasmanohar: how do i get sinatra to remove the default http headers
[07:10:09] dubkoidragon: if i dont have the $ then itt ells me that it wont work til i do
[07:10:11] tejasmanohar: like web server thin etc etc
[07:10:16] tejasmanohar: i need to test something w/o them ;)
[07:10:20] [k-: you don't need the end!
[07:10:33] [k-: since you start the block with {
[07:10:41] [k-: you end the block with }
[07:10:53] dubkoidragon: it was driving me mad
[07:11:14] dubkoidragon: pardon my excitment
[07:11:20] eGGsha: has joined #ruby
[07:11:28] fabrice31: has joined #ruby
[07:11:33] dubkoidragon: that was not explained to me at all
[07:11:44] dubkoidragon: and i really prefer to use the {} over do
[07:11:48] sevenseacat: that your code was fine and didn't need the end?
[07:11:50] dubkoidragon: that the $ was like acomment
[07:11:52] joonty: has joined #ruby
[07:11:58] sevenseacat: # is for comments
[07:12:02] dubkoidragon: ok then what is it
[07:12:03] Ox0dea: It's a global variable.
[07:12:18] tejasmanohar: strange that i can't find something online for this, i'd guess it'd be something standard
[07:12:24] leat3: has joined #ruby
[07:12:29] sevenseacat: $end typically means end-of-file in error messages.
[07:12:38] demoph01n: has joined #ruby
[07:12:39] sevenseacat: you'll sometimes see unexpected $end, or expecting $end
[07:12:54] [k-: keyword_end means Ruby expected "end"
[07:12:59] Ox0dea: dubkoidragon: You can't combine {} with end; it's either {} or do/end. You were inadvertently fixing your syntax error by referring to (but not doing anything with) a global variable called $end.
[07:13:19] dubkoidragon: sry for the newbie question, I'm from a python backround(not a pro yet at that either) and this is day 3 of ruby
[07:13:27] TomyWork: has joined #ruby
[07:13:42] dubkoidragon: i see ox0dea, hownetly thats a grea explanation i get it now
[07:14:20] dubkoidragon: [k- : thanks for explanation on keyword_end
[07:14:41] [k-: let me draft out a plan for quicksort in this pseudo java like language
[07:15:11] idiocrash: has joined #ruby
[07:15:15] bmurt: has joined #ruby
[07:15:18] allomov: has joined #ruby
[07:15:30] [k-: I only have a few methods for manipulating lists :(
[07:15:33] Ox0dea: [k-: Note well that Quicksort is technically supposed to be done in-place.
[07:16:45] SebastianThorn: Hi, I made a program that run manually from time to time, and I userd "$stderr.puts" for progress-info to the console and "puts" for the results, so I can run it like this: program.rb > results.txt good/bad?
[07:16:52] [k-: but immutability makes it easier!
[07:17:03] leat3: has joined #ruby
[07:17:40] skade: has joined #ruby
[07:18:21] _ixti_: has joined #ruby
[07:18:39] fabrice31: has joined #ruby
[07:19:16] schaerli: has joined #ruby
[07:19:45] haxrbyte: has joined #ruby
[07:20:23] [k-: now I will need to be able to turn a recursive function into a loop!
[07:20:26] [k-: what fun!
[07:20:37] pwnz0r: has joined #ruby
[07:20:40] dfockler: has joined #ruby
[07:20:44] Ox0dea: [k-: You can't recur?
[07:21:17] [k-: nope, I can't create functions
[07:21:30] [k-: (not yet)
[07:21:36] Ox0dea: Have you learned nothing from my executable madnesses?
[07:22:05] [k-: executable?
[07:22:13] Ox0dea: They say Perl is "executable line noise".
[07:22:44] dubkoidragon: would anyone know the diff between "#{x}\n" and "#{x}"
[07:22:50] [k-: https://play.google.com/store/apps/details?id=com.hackedapp
[07:22:50] dubkoidragon: seems to print the same
[07:23:09] [k-: it's not for Ruby!
[07:23:17] Ox0dea: dubkoidragon: Aye, Kernel.puts special-cases a single trailing newline.
[07:23:20] sevenseacat: dubkoidragon: the \n is a newline character
[07:23:35] dubkoidragon: awsome thanks
[07:23:36] [k-: try Kernel.print
[07:23:41] [k-: they will be different
[07:24:33] Ox0dea: [k-: Oh, I see. Well, implementing Quicksort without recursion will be painful.
[07:25:00] [k-: I will be a better programmer after this!
[07:25:29] dubkoidragon: hey guys i have an off topic question in that chat room regarding a computer issue
[07:25:38] sp1rs: has joined #ruby
[07:26:00] [k-: your very sentence is off topic :p
[07:26:13] Iskarlar: has joined #ruby
[07:26:28] sevenseacat: if you know, why do it?
[07:26:57] decoponio: has joined #ruby
[07:28:02] Ox0dea: "It's easier to ask forgiveness than it is to get permission." -- Rear Admiral Grace Hopper, arguably the first compiler writer
[07:28:18] leat3: has joined #ruby
[07:28:24] dubkoidragon: no i just wanted anyone who could help to go over there and help me
[07:28:40] dubkoidragon: i thought it was being done the right way
[07:28:44] keen__________23: has joined #ruby
[07:28:48] Maletor: has joined #ruby
[07:29:16] sevenseacat: Ox0dea: yeah I can get behind that, in small doses
[07:29:21] [k-: the right way is to find a channel that is dedicated to helping people with this sort of problems!
[07:29:30] Ox0dea: [k-: Too reasonable.
[07:29:52] bronson: has joined #ruby
[07:30:10] sevenseacat: and when there's actually a reason to flout rules, that isnt just 'i want attention'
[07:30:15] [k-: do you have a hidden meaning?
[07:30:28] Ox0dea: Don't we all?
[07:31:06] [k-: what's the hidden meaning?
[07:31:30] bruno-: has joined #ruby
[07:31:40] Ox0dea: I didn't think the sarcasm was particularly veiled. :)
[07:32:08] symm-: has joined #ruby
[07:32:26] [k-: you were implying that it was the best solution?
[07:33:13] Ox0dea: No, I meant your suggestion was the best solution.
[07:34:10] [k-: 'it' wasn't referring to sarcasm :p
[07:34:18] schaerli: has joined #ruby
[07:34:43] bayed: has joined #ruby
[07:35:02] Ox0dea: I suppose I ought to've gone with "nah, that makes too much sense".
[07:36:10] [k-: it would be less confusing, yes, but you are an Oracle!
[07:36:23] dubkoidragon: is this still about that thing I did? I'm sorry for causing this
[07:36:29] ramfjord: has joined #ruby
[07:36:35] niemcu: has joined #ruby
[07:36:46] Ox0dea: dubkoidragon: Girl, you pretty much ruined our whole relationship.
[07:36:51] Ox0dea: You shall not be forgiven.
[07:37:38] felixr: has joined #ruby
[07:37:47] lkba_: has joined #ruby
[07:38:03] leat3: has joined #ruby
[07:38:13] [k-: :o you are a woman!
[07:38:15] [k-: welcome!
[07:38:40] Iskarlar: has joined #ruby
[07:38:54] Ox0dea: "One of us!"
[07:39:05] sp1rs: has joined #ruby
[07:40:35] dubkoidragon: oh, I thought Ox was being sarcastically funny with me
[07:41:09] dubkoidragon: oh man I feel like my gender has let everyone down now :(
[07:41:12] Oog: has joined #ruby
[07:41:14] Ox0dea: Slight correction: I was being funny at you.
[07:41:29] fabrice31: has joined #ruby
[07:41:52] jenrzzz: has joined #ruby
[07:41:53] [k-: I genuinely thought you were a woman :(
[07:41:57] schaerli: has joined #ruby
[07:42:04] Ox0dea: Erm... really?
[07:43:32] dubkoidragon: I'm sorry for being a guy :( if it help I get along with women pretty well :)
[07:44:27] [k-: it's ox
[07:44:37] [k-: Ox0dea*'s fault
[07:45:14] dubkoidragon: ACTION points
[07:47:55] white_bear: has joined #ruby
[07:48:32] Hounddog: has joined #ruby
[07:50:06] last_staff: has joined #ruby
[07:50:51] livathinos: has joined #ruby
[07:51:50] gagrio: has joined #ruby
[07:53:29] Hounddog: has joined #ruby
[07:53:32] chussenot: has joined #ruby
[07:54:38] [k-: I can't even append to arrays!!!
[07:54:38] DoubleMalt: has joined #ruby
[07:55:17] dubkoidragon: what do you mean
[07:55:18] schaerli: has joined #ruby
[07:55:45] [k-: that game
[07:57:48] Iskarlar: has joined #ruby
[07:58:41] _ixti_: has joined #ruby
[07:58:46] Igorshp: has joined #ruby
[07:59:21] tsvenson: has joined #ruby
[08:02:55] tkuchiki: has joined #ruby
[08:03:29] [k-: I managed to implement quicksort!
[08:03:35] felixrsmith: has joined #ruby
[08:03:41] [k-: I cheated a little though
[08:03:53] sevenseacat: it only works on a list thats already sorted? >_>
[08:04:24] [k-: they don't give you sorted arrays >.>
[08:04:26] mikecmpbll: has joined #ruby
[08:04:36] axl_: has joined #ruby
[08:04:39] sevenseacat: you shelled out to something else to do the sorting? <_<
[08:05:00] [k-: how could you ;-;
[08:05:48] [k-: Instead of checking if the list is already sorted, I sort the list 9 times to guarantee it is sorted
[08:06:27] tejasmanohar: what is this for? [k-
[08:06:31] [k-: I shall write code that checks for that now...
[08:06:39] [k-: https://play.google.com/store/apps/details?id=com.hackedapp
[08:06:49] [k-: it's pretty restrictive
[08:07:39] Shoutsid: has joined #ruby
[08:07:39] slash_nick: has joined #ruby
[08:07:41] leat3: has joined #ruby
[08:08:01] valkyrka: has joined #ruby
[08:08:48] skade: has joined #ruby
[08:09:21] astrobun_: has joined #ruby
[08:09:58] slash_nick: has joined #ruby
[08:10:42] [k-: there is no break!
[08:10:56] aspiers: has joined #ruby
[08:11:30] slash_nick: has joined #ruby
[08:11:37] Maletor: has joined #ruby
[08:11:53] fabrice31_: has joined #ruby
[08:12:45] [k-: yay they gave me a score! -2629!
[08:12:47] finisherr: has joined #ruby
[08:13:01] [k-: I'm so good at this
[08:13:02] choke: has joined #ruby
[08:14:06] [k-: I don't know how to copy the code >.>
[08:14:07] sevenseacat: its like golf, lowest score wins right?
[08:14:12] shevy: should the score not be positive rather than negative
[08:14:32] krz: has joined #ruby
[08:14:42] [k-: the higher the score, the better...
[08:15:22] [k-: I took so much time, was unconcise, made too many edits, and was too complicated
[08:15:40] Ox0dea: [k-: Please install Vim Touch.
[08:15:52] Ox0dea: And SL4A, of course.
[08:17:11] [k-: the game has keys to help me type faster!
[08:17:27] schaerli: has joined #ruby
[08:17:40] [k-: there is this while key that inserts while _ { }
[08:18:23] Ox0dea: Vim has :iabbrev for that.
[08:18:56] [k-: they only allow me to use var_a, ... var_o for variables to
[08:19:32] [k-: I'll redo the challenge again on textedit :(
[08:20:42] dumdedum: has joined #ruby
[08:20:59] [k-: there will be no comments, because the game doesn't allow comments
[08:21:20] ruurd: has joined #ruby
[08:21:30] allomov: has joined #ruby
[08:22:40] bzf: has joined #ruby
[08:22:51] marr: has joined #ruby
[08:23:00] shevy: you should write projects!
[08:24:18] slash_nick: has joined #ruby
[08:24:28] jenrzzz: has joined #ruby
[08:26:13] emilkarl: has joined #ruby
[08:26:23] eGGsha: has joined #ruby
[08:26:53] Zai00: has joined #ruby
[08:27:14] Ox0dea: [k-: https://gist.github.com/0x0dea/29ab268e0a4e11ef714e
[08:27:49] Ox0dea: That's an implementation of Shellsort in an extremely restrictive pseudo-assembly language.
[08:28:49] abuzze: has joined #ruby
[08:30:03] rthbound: has joined #ruby
[08:30:46] [k-: https://gist.github.com/anonymous/899d913373c480027253
[08:31:16] rthbound: has joined #ruby
[08:31:33] anisha: has joined #ruby
[08:31:54] sofija: has joined #ruby
[08:32:18] slash_nick: has joined #ruby
[08:32:32] stamina: has joined #ruby
[08:32:40] [k-: did you cry while writing it :(
[08:33:09] revath: has joined #ruby
[08:33:19] senayar: has joined #ruby
[08:33:40] einarj: has joined #ruby
[08:33:44] senayar: has joined #ruby
[08:34:15] Ox0dea: [k-: I vaguely remember being 0x5adface that I couldn't get Quicksort working quite right; the last few values weren't always in order.
[08:34:23] tomaz_b: has joined #ruby
[08:35:37] Ox0dea: The environment provided a stack and a key-value store, but the instruction set was quite limited, so I ended up settling for Shellsort.
[08:36:09] Ox0dea: What's the expected format of `input`?
[08:36:17] [k-: an array
[08:36:27] iateadonut: has joined #ruby
[08:36:34] Oog: has joined #ruby
[08:36:35] seal: has joined #ruby
[08:37:55] Stan: has joined #ruby
[08:38:10] [k-: morning
[08:38:17] dubkoidragon: morning somewhere :p
[08:38:19] jimeh: has joined #ruby
[08:38:37] shevy: isn't it evening in Singapore [k-
[08:39:04] dubkoidragon: omg you're from Singapore. I want to go there so bad, such a beautiful country
[08:39:26] [k-: ?ugt shevy
[08:39:26] ruboto: shevy, it's morning, see http://www.total-knowledge.com/~ilya/mips/ugt.html
[08:39:53] TheHodge: has joined #ruby
[08:40:20] adaedra: good morning shevy
[08:40:26] shevy: I never sleep
[08:40:36] adaedra: you must be so tired then
[08:40:44] shevy: I actually am tired :(
[08:41:02] Ox0dea: [k-: I converted it to Ruby, but it doesn't terminate. :/
[08:41:04] shevy: woke up 2 hours ago, fell asleep again for almost 2 hours
[08:42:36] [k-: Ox0dea fix it then :)
[08:43:00] [k-: I wrote it in a text editor, I won't know what went wrong!
[08:43:55] shevy: Team Oxfuscate is in da house
[08:43:59] Ox0dea: I like that.
[08:44:17] Ox0dea: Oxfus[k-te is a little better, though.
[08:44:44] gregf_: a = true; while a; puts "Foo";end *cries*
[08:45:02] Ox0dea: gregf_: What's sad about eternity?
[08:45:08] adaedra: puts "Foo"; exec $0
[08:45:15] gregf_: s/eternity/obfuscation/
[08:45:34] chussenot: has joined #ruby
[08:46:32] [k-: it's not my fault it restricts names!
[08:46:35] Ox0dea: gregf_: That code you posted is supposed to be obfuscated? :P
[08:48:08] arup_r: has joined #ruby
[08:48:40] Oog: has joined #ruby
[08:49:51] arup_r1: has joined #ruby
[08:52:53] Soda: has joined #ruby
[08:53:42] Ox0dea: I secretly wish Ruby let us do this: https://gist.github.com/0x0dea/628de90e12acc1874a9a
[08:54:07] Ox0dea: Method chains where a block would otherwise be expected.
[08:56:03] jimeh: has joined #ruby
[08:56:17] iooner: has joined #ruby
[08:57:01] shevy: adaedra joined the Oxfus[k-te club
[08:57:29] quimrstorres: has joined #ruby
[08:57:55] zacstewart: has joined #ruby
[09:00:49] yorickpeterse: Can't seem to find this in the rdoc, but is Queue a FIFO, or is the order not guaranteed?
[09:01:04] [k-: I also want that
[09:01:37] timonv: has joined #ruby
[09:02:11] quimrstorres: has joined #ruby
[09:02:19] ljarvis: yorickpeterse: isn't that the whole point?
[09:02:26] yorickpeterse: isn't what the whole point?
[09:02:43] ljarvis: that it's FIFO
[09:03:00] canton7: looking at the source, it's a fifo
[09:03:06] arup_r: has joined #ruby
[09:03:07] Ox0dea: Or a LILO.
[09:03:10] ruby-lang078: has joined #ruby
[09:03:18] yorickpeterse: ljarvis: It would be, but there's no mention of it in the rdoc, though behaviour seems to indicate FIFO
[09:03:32] canton7: in fact it's based on Array#shift and Array#push, which is far dumber than I would have anticipated :P
[09:03:36] yorickpeterse: >> require 'thread'; q = Queue.new; q << 10; q << 20; q.pop
[09:03:37] ruboto: yorickpeterse # => 10 (https://eval.in/400456)
[09:03:50] Ox0dea: yorickpeterse: A queue is the opposite of a stack.
[09:03:53] ljarvis: canton7: why? that's exactly what I would have expected
[09:03:56] lkba: has joined #ruby
[09:04:11] ChanServ: -b Mafious!*@*
[09:04:33] canton7: because Array#shift presumably requires a re-allocation?
[09:04:34] htmldrum: has joined #ruby
[09:04:41] ljarvis: but yeah surprised the rdoc doesn't mention it
[09:05:03] schaerli: has joined #ruby
[09:05:13] canton7: most Queue implementations I've seen are based on a ring buffer, so you only have to re-allocate when the size changes, not on every single dequeue
[09:05:23] canton7: (or use a linked list, for the same reason)
[09:05:36] Ox0dea: canton7: Ruby is smart about it. It uses as much shared state as is feasible.
[09:05:59] yorickpeterse: Ox0dea: I'm aware of what a Queue is
[09:06:08] yorickpeterse: But Ruby in the past has had more cases of "we say it's X but we do Y"
[09:06:21] Ox0dea: A queue is a pretty fundamental data structure to get wrong.
[09:06:28] canton7: Ox0dea, interesting. For example, if you push 100 elements onto an array, shift 50, then push another 50, how many allocations occur?
[09:06:52] Ox0dea: canton7: I see a macro named ARY_SHARED_OCCUPIED(). :P
[09:07:15] yorickpeterse: canton7: actually Array#shift is a pretty cheap operation in my experience
[09:07:22] yorickpeterse: that was unshift
[09:07:36] canton7: always get those 2 mixed up
[09:07:46] ndrei: has joined #ruby
[09:07:55] ndrei_: has joined #ruby
[09:08:01] krz: whats a good way to check if some elements in array 1 are not in array 2?
[09:08:30] yorickpeterse: krz: is order important?
[09:08:35] krz: few approaches at https://www.ruby-forum.com/topic/185741 but wondering if theres some builtin method to facilitate this
[09:08:36] krz: yorickpeterse: nah
[09:08:44] yorickpeterse: krz: Array#& is your friend then
[09:08:53] [k-: someone fix this https://ideone.com/sM3Dwr
[09:08:54] yorickpeterse: >> [10, 20, 30] & [10, 20]
[09:08:55] ruboto: yorickpeterse # => [10, 20] (https://eval.in/400458)
[09:09:08] ljarvis: why not just use -
[09:09:18] canton7: >> [1, 2, 3] - [1, 2]
[09:09:19] ruboto: canton7 # => [3] (https://eval.in/400459)
[09:09:29] xkef: has joined #ruby
[09:09:36] Jutoms: has joined #ruby
[09:09:36] yorickpeterse: ljarvis: that also works, depends a bit on if you want the difference or what's the same
[09:09:56] krz: yea - shows the difference
[09:10:08] Ox0dea: krz: Is that not what you need?
[09:10:53] Ox0dea: unless (a1 - a2).empty? ...
[09:11:40] krz: yeap sure is
[09:11:57] Ox0dea: ++ljarvis
[09:12:44] Ox0dea: Some twisted combination of YARV and JIT?
[09:13:21] [k-: >> "ljarvis". succ
[09:13:21] Ox0dea: You're right; that would be Jravity.
[09:13:22] ruboto: [k- # => "ljarvit" (https://eval.in/400463)
[09:13:36] Ox0dea: >> 'z'.succ
[09:13:37] ruboto: Ox0dea # => "aa" (https://eval.in/400464)
[09:13:49] [k-: oooooo you can have . succ
[09:14:08] Ox0dea: You can even continue on the next line.
[09:14:29] [k-: have you not seen my multiline code
[09:14:29] ruby-lang078: has left #ruby: ()
[09:15:02] Ox0dea: >> eval "1.\nto_s"
[09:15:03] ruboto: Ox0dea # => "1" (https://eval.in/400465)
[09:15:06] Ox0dea: [k-: I meant that.
[09:15:46] [k-: I did that too!
[09:16:13] yfeldblum: has joined #ruby
[09:17:31] Iskarlar: has joined #ruby
[09:17:33] Ox0dea: >> class Symbol;def`;42;end end.`
[09:17:33] Ropeney: has joined #ruby
[09:17:33] ruboto: Ox0dea # => 42 (https://eval.in/400466)
[09:17:37] Ox0dea: Those are backticks.
[09:18:36] Ox0dea: You can't use ` as a unary operator, though. :/
[09:20:01] [k-: Kernel#` has it too :o
[09:20:05] senayar: has joined #ruby
[09:20:06] senayar: has joined #ruby
[09:20:40] Ox0dea: Kernel's is special.
[09:20:40] bodzio: has joined #ruby
[09:20:51] Ox0dea: Without an explicit receiver, you have to terminate it like a string.
[09:23:14] [k-: I give up trying to run that java(script) thing
[09:23:31] eGGsha: has joined #ruby
[09:23:38] Jutoms: has left #ruby: ()
[09:24:05] yfeldblum: has joined #ruby
[09:25:10] ljarvis: in which i call object_id on everything and store it in a huge hash table and refer to all objects via integers
[09:26:03] [k-: wrong channel?
[09:26:33] jenrzzz: has joined #ruby
[09:27:02] bronson: has joined #ruby
[09:27:04] quazimodo: has joined #ruby
[09:27:11] quazimodo: how do I run a post install hook on my ruby gem?
[09:27:21] ruurd: has joined #ruby
[09:28:38] ljarvis: quazimodo: you can only print a message; post_install_message iirc
[09:28:57] ljarvis: or you mean Gem.post_install
[09:29:19] [k-: I don't know what the game wants!
[09:29:37] [k-: [1,0,1] => 5
[09:29:55] [k-: [0,1,0] => 2
[09:30:05] Ox0dea: [k-: It's binary.
[09:30:15] [k-: but I don't know binary!
[09:30:25] Ox0dea: But it's just like base 10 except with 2 instead.
[09:30:30] Ox0dea: Positional number systems are all the rage.
[09:30:33] tkuchiki: has joined #ruby
[09:30:37] chussenot: has joined #ruby
[09:30:52] schaerli: has joined #ruby
[09:31:00] Ox0dea: [k-: Since each bit can only have two states, it's easiest to think of them like "switches".
[09:31:15] jimeh: quazimodo: this might help: http://stackoverflow.com/a/27998791/42146
[09:31:22] Ox0dea: For 5, the switches for 4 and 1 are on, and 2's is off.
[09:31:54] Tratos: has joined #ruby
[09:32:12] [k-: where does 4 and 1 come from?!
[09:33:16] Ox0dea: [k-: In the decimal number 123, the 3 is in the "ones" place, the 2 in the "tens", and the 1 in the "hundreds".
[09:33:33] ljarvis: https://gist.github.com/leejarvis/e99d9b4b18f47785078a :|
[09:33:40] ljarvis: ok back to work
[09:33:43] apeiros: [k-: digits.with_position.inject(0) { |(digit, position), value| value + digit*base**position } ;-)
[09:34:00] Ox0dea: Yes, that.
[09:34:11] [k-: https://upload.wikimedia.org/wikipedia/commons/7/75/Binary_counter.gif
[09:34:40] Ox0dea: [k-: That's a fantastic visualization of the thing.
[09:34:42] [k-: I'm on this pseudo java language!
[09:35:15] apeiros: i.e. 0b1011 -> 1*2**3 + 0*2**2 + 1*2**1 + 1*2**0 = 11
[09:35:35] apeiros: (position is 0 based, least significant digit is position 0)
[09:36:16] n008f4g_: has joined #ruby
[09:36:38] Ox0dea: >> n = 11; n.bit_length.pred.downto(0).map { |i| n[i] }
[09:36:39] ruboto: Ox0dea # => [1, 0, 1, 1] (https://eval.in/400473)
[09:37:01] apeiros: example in another base: 0xa2 (remember: a = 10) -> 10*16**1 + 2*16**0 = 162
[09:37:15] Ox0dea: Do me, do me!
[09:37:35] [k-: err what?
[09:37:42] Ox0dea: Because I'm in hexadecimal?
[09:37:43] apeiros: I'll not read anything into it :-D
[09:38:04] [k-: I think I found a pattern in the gif
[09:38:17] [k-: it's much simpler to understand than text!
[09:38:39] shevy: you are insane
[09:38:57] Ox0dea: quazimodo: Adding your Rakefile to your gem's extensions causes the default task to run after installation.
[09:39:01] apeiros: 0x0dea (a = 10, d=13, e = 14) -> 0*16**3 + 13*16**2 + 14*16**1 + 10*16**0 = 3562
[09:39:13] Ox0dea: Y'did meh.
[09:39:30] r_rails: has joined #ruby
[09:39:43] chussenot: has joined #ruby
[09:40:03] apeiros: Ox0dea: is that your password?
[09:40:20] Ox0dea: It used to be my PIN.
[09:40:39] apeiros: 0xabad1dea
[09:41:02] awk: Hi, please assist, ruby noob... http://pastebin.com/As5Ws89x When I run it, it still asks for blah@temp2.local's password:
[09:41:03] ruboto: awk, we in #ruby do not like pastebin.com, I reposted your paste to gist for you: https://gist.github.com/62422ddae704bca49575
[09:41:04] ruboto: pastebin.com loads slowly for most, has ads which are distracting and has terrible formatting.
[09:41:49] awk: I even have ssh keys so it shouldn't ask for a password. but if it does i'm not sure what i'm doing wrong
[09:41:56] shevy: where do you pass the password
[09:42:29] tkuchiki_: has joined #ruby
[09:43:02] [k-: basically the value in decimal is .to_s.length.times.to_a.reverse(0){|acc, l| acc + 2**l*str[-l].to_i }
[09:43:10] [k-: somewhere around there ??
[09:43:31] awk: shevy: well I'm not sure how to pass the password with rsync, and the session is already open with a password
[09:44:01] shevy: no idea how rsync is used but in your ruby code I don't know where you pass the password either
[09:44:03] sce_: has joined #ruby
[09:44:16] Ox0dea: awk: You're starting a new session.
[09:44:44] awk: shevy: sorry I removed it because I setup ssh keys and I can ssh without a pass
[09:45:03] awk: after $user, I can have $pass
[09:45:22] konsolebox: has joined #ruby
[09:45:27] dubkoidragon: im off to bed gnight and thx for the help
[09:45:56] awk: Net::SSH.start($host, $user, :password => 'blah', :verbose => :debug) do |ssh|
[09:46:01] awk: Still asks for a password
[09:46:30] chussenot: has joined #ruby
[09:46:33] awk: Ox0dea: ok, any suggestions to point me in the right track
[09:47:00] Ox0dea: awk: Does everything work fine from the command line?
[09:47:04] [k-: you do not have to prefix your questions with Ruby noob
[09:47:14] [k-: people will still scold you even so :)
[09:47:27] yardenbar: has joined #ruby
[09:47:28] Ox0dea: awk: You're certain your keys are configured properly?
[09:48:21] konsolebox: has joined #ruby
[09:48:25] Igorshp: has joined #ruby
[09:49:38] awk: Ox0dea: if I ssh blah@temp2.local I get on the box ye
[09:50:00] jottr: has joined #ruby
[09:50:33] kham: has joined #ruby
[09:50:35] htmldrum: has joined #ruby
[09:50:36] Ox0dea: awk: The password for #start is just a regular parameter, not part of the options hash.
[09:52:13] konsolebox: has joined #ruby
[09:52:31] schaerli: has joined #ruby
[09:56:08] lxsameer: has joined #ruby
[09:58:08] fabrice31: has joined #ruby
[09:58:14] Oog: has joined #ruby
[10:03:44] [k-: http://www.reddit.com/r/shittyprogramming/comments/3d9cd3/whats_recursion/
[10:04:26] i-blis: has joined #ruby
[10:04:27] i-blis: has joined #ruby
[10:05:10] eGGsha: has joined #ruby
[10:07:35] r_rails: is there any gem to convert pdf to csv ?
[10:08:43] [k-: shevy: ^
[10:08:48] Ox0dea: r_rails: So, PDF to text?
[10:08:52] Oog: has joined #ruby
[10:09:38] jottr_: has joined #ruby
[10:09:39] fabrice31_: has joined #ruby
[10:09:43] Ox0dea: Is the PDF constructed from well-formed tabular data, or are you going to need to do some OCR?
[10:10:07] chussenot_: has joined #ruby
[10:10:37] [k-: I think JavaScript is good for code golfing and obfuscating, no?
[10:10:59] Ox0dea: It's in the middle for both.
[10:11:06] shevy: [k- you summoned me!
[10:11:47] shevy: please write useful projects [k-
[10:11:49] iooner: has joined #ruby
[10:11:53] Ox0dea: [k-: Array.prototype is rather wordy, and the dominant obfuscation method results in, like, 95% square brackets.
[10:12:05] sdothum: has joined #ruby
[10:12:33] [k-: isn't that what my code looks like :o
[10:13:10] Ox0dea: I did not choose that percentage hyperbolically.
[10:13:43] sp1rs: has joined #ruby
[10:14:15] st0mar: has joined #ruby
[10:16:29] r_rails: <Ox0dea> yes, i need to get selected fields from the pdf not entire pdf.
[10:17:01] Oog: has joined #ruby
[10:18:22] leat3: has joined #ruby
[10:18:53] Ox0dea: r_rails: Seems like Tabula (http://tabula.technology/) is just what you need.
[10:20:06] [k-: .technology >.>
[10:20:26] AviShastry: has joined #ruby
[10:21:31] ndrei: has joined #ruby
[10:22:29] sgambino: has joined #ruby
[10:23:23] allcentury: has joined #ruby
[10:23:49] hemanth: has joined #ruby
[10:24:19] cochise: has joined #ruby
[10:24:28] bruno-: has joined #ruby
[10:24:52] chussenot: has joined #ruby
[10:25:01] serivich: has joined #ruby
[10:25:27] desigx: has joined #ruby
[10:26:33] ndrei_: has joined #ruby
[10:28:06] dhjondoh: has joined #ruby
[10:28:55] [k-: Ox0dea you should be on #ruby-offtopic
[10:29:05] Ox0dea: Is it happening?
[10:29:42] dANO-: has joined #ruby
[10:30:10] fabrice31: has joined #ruby
[10:30:14] shevy: unicode hangman is happening there
[10:30:23] st0mar: has joined #ruby
[10:30:24] ruurd: has joined #ruby
[10:30:29] shevy: I was witness!
[10:30:38] [k-: you were dead!
[10:30:46] meph: has joined #ruby
[10:30:59] [k-: also, you haven't been on ot since 1954
[10:31:28] [k-: it only happens at night
[10:31:47] f4cl3y: has joined #ruby
[10:33:51] intinig: has joined #ruby
[10:34:33] [k-: I swear it's not happening!
[10:38:40] [k-: we must go on a united front to bring these people there!
[10:39:43] [k-: >> 'food???' == 'food'
[10:39:44] ruboto: [k- # => false (https://eval.in/400487)
[10:40:12] Papierkorb: has joined #ruby
[10:40:16] lsmola: has joined #ruby
[10:40:21] Iskarlar: has joined #ruby
[10:41:02] chussenot: has joined #ruby
[10:41:25] Papierkorb: has joined #ruby
[10:42:22] [k-: >> '???food???' == '???food???'
[10:42:24] ruboto: [k- # => true (https://eval.in/400491)
[10:42:43] [k-: hello obfuscatiob
[10:43:31] phutchins: has joined #ruby
[10:44:06] Musashi007: has joined #ruby
[10:44:47] [k-: anyone knows the magic?
[10:44:55] Igorshp: has joined #ruby
[10:46:22] Oog: has joined #ruby
[10:46:44] wldcordeiro: has joined #ruby
[10:47:30] [k-: >> ?? = "hello" # more goodness
[10:47:31] ruboto: [k- # => "hello" (https://eval.in/400493)
[10:47:56] Silex: the second 'o' of food different
[10:48:23] Silex: s/food/of the first 'food' is/
[10:48:56] codecop: has joined #ruby
[10:49:13] [k-: actually there is a zero width character
[10:49:28] Silex: funny it displays weirdly for the 2nd o here
[10:50:01] Silex: or maybe not and my brain tricks me
[10:50:08] troulouliou_dev: has joined #ruby
[10:50:11] apeiros: I could copy & paste it, but I'd bet it's LTR/RTL magic
[10:50:20] [k-: http://www.drlongghost.com/wordpress/food-food/
[10:50:41] [k-: apeiros: correct!
[10:50:59] Silex: the ; one is a different char
[10:51:11] Silex: and thus it's like a 1-char variable name
[10:52:11] sdothum: has joined #ruby
[10:53:33] Silex: I'm sure the LTR zero-width char trick can be used to drive dev crazy
[10:53:39] Silex: e.g fill an online form with this char
[10:53:44] Silex: then complain that you can't log in
[10:57:23] MEATCHICKEN: has joined #ruby
[10:57:28] [k-: logic tricks us :(
[10:57:42] [k-: Ox0dea went to sleep?
[10:58:06] Ox0dea: I'm here-ish.
[10:58:40] [k-: but its like 20hrs already!
[10:59:54] MagePsycho: has joined #ruby
[11:01:17] quimrstorres: has joined #ruby
[11:03:56] edwinvdgraaf: has joined #ruby
[11:05:46] Limezacore: has joined #ruby
[11:05:49] [k-: shevy: no
[11:07:07] DaniG2k: has joined #ruby
[11:07:37] [k-: my turn!
[11:07:41] ruboto: we're not all guys - while you probably don't meant to be exclusive, not everybody feels that way. Maybe consider using "folks", "y'all" or "everyone" instead?
[11:07:56] DaniG2k: that's so dumb
[11:08:00] DaniG2k: I'm actually offended
[11:08:30] DaniG2k: I'm just being friendly
[11:08:30] sevenseacat: no seriously, wow
[11:08:51] DaniG2k: what does sexism have to do with it
[11:08:55] sevenseacat: 'perhaps you want to include everyone?' 'nah, thats dumb'
[11:09:09] DaniG2k: i cant make everyone in the world happy
[11:09:18] sevenseacat: feel free to ask the guys for help then, and I hope one of them can help you.
[11:09:24] sevenseacat: as for me, I will sit here and call *you* dumb.
[11:09:32] sevenseacat: and laugh at your misfortune.
[11:09:44] DaniG2k: you're a troll
[11:09:49] rdark: anyone used datamapper with postgres running under SSL?
[11:09:56] DaniG2k: has left #ruby: ()
[11:10:03] jds: has joined #ruby
[11:10:13] sevenseacat: all the months I've spent helping you in these channels and you want to bite the hand that feeds you
[11:10:22] nateberkopec: has joined #ruby
[11:10:28] sevenseacat: thats what I call dumb.
[11:11:01] [k-: I am totally upset
[11:11:09] apeiros: oh, they're gone
[11:11:43] Ox0dea: Does that mean "of or exhibiting the characteristics of a goose"?
[11:11:44] [k-: my brain has autocorrect module installed
[11:11:48] [k-: don't worry
[11:12:11] rdark: I'm using a connection with ?sslmode=verify-full. I don't have the CA cert installed for the database, but it connects fine anyway?
[11:12:24] sevenseacat: sorry bout that.
[11:12:57] arup_r: has joined #ruby
[11:12:58] sevenseacat: but ffs its just asking for some consideration
[11:14:38] adaedra: it's ok sevenseacat
[11:14:42] Iskarlar: has joined #ruby
[11:14:51] hoov: has joined #ruby
[11:15:17] shevy: he wrote "gusy"!
[11:15:46] Ox0dea: What's bad for the gusy is bad for the gander.
[11:15:49] mikecmpbll: tbf i use guys all the time to refer to mixed sex groups or wholly female groups.
[11:16:06] shevy: ruboto is a gender-aware bot
[11:16:23] emilkarl: has joined #ruby
[11:16:31] shevy: what gender is ruboto?
[11:16:54] adaedra: mikecmpbll: yeah, other people do, but it's not because of that that it's right. There are so many other options available that are not ambigous
[11:17:02] apeiros: ?guys2 mikecmpbll
[11:17:03] ruboto: mikecmpbll, it doesn???t matter if it???s ???normal???/gender neutral to say "guys" in your idiolect. ???you guys??? to refer to a mixed group is erasure. all we ask from you is to be a decent channel member and respect that. If you want to further discuss this, join #ruby-offtopic.
[11:17:37] st0mar: has joined #ruby
[11:17:42] ruurd: has joined #ruby
[11:17:52] [k-: idiolect...
[11:18:08] apeiros: shamelessly stolen from https://twitter.com/0xabad1dea/status/621023976219910145
[11:18:48] shevy: ?guys3 ruboto
[11:18:48] ruboto: ruboto, I don't know anything about guys3
[11:18:51] eGGsha: has joined #ruby
[11:19:05] shevy: just curious about the numbering scheme used there ... :>
[11:19:08] Oog: has joined #ruby
[11:19:10] sevenseacat: people just need to realize that 'my interpretation of a word' != 'everyones interpretation of a word'
[11:19:10] [k-: I thought there was only 1 dea :c
[11:19:23] sevenseacat: and then we'll be all good.
[11:19:39] shevy: [k- well, the dea here is the Ox, the dead there is the 0x
[11:19:44] shevy: erm, *dea
[11:19:56] shevy: IRC nicks should be simple!
[11:20:07] [k-: 0xabad1dea
[11:20:27] gregf_: funny but sad, how some people get offended at anything :/. true programmers 'should' get mad at bad code. but.. ego's can decimate
[11:20:41] shevy: I get mad at my own bugs
[11:21:03] gregf_: 'guys' can be used as a superset afaik :/.. but
[11:21:14] sevenseacat: gregf_: yes, to *you*. not to everyone.
[11:21:18] Ox0dea: gregf_: Can "gals" be used as a superset?
[11:21:23] pwnz0r: has joined #ruby
[11:21:26] sevenseacat: if you're a man, of course that makes perfect sense to you.
[11:22:05] gregf_: sevenseacat: if you could just keep it to programming.. i dont honestly care why someone could get offended for something i did not mean to. theres better ways to respond?
[11:22:17] Ox0dea: gregf_: Go on, answer my question.
[11:22:41] shevy: hey girls!
[11:22:46] [k-: I started this :(
[11:23:07] yardenbar: has joined #ruby
[11:23:11] sevenseacat: [k-: no, the people that wont admit that anyone else's opinions or feelings matter, started this.
[11:23:19] sevenseacat: [k-: not you.
[11:23:48] shevy: it will get better - tomorrow is caturday again
[11:24:04] sevenseacat: and I have a week off work. rejoice!
[11:24:10] Hobogrammer: has joined #ruby
[11:24:26] desigx: has joined #ruby
[11:26:36] sinkensabe: has joined #ruby
[11:26:43] Oog: has joined #ruby
[11:29:27] cochise: has joined #ruby
[11:31:44] apeiros: sevenseacat: enjoy! :D
[11:32:27] zacstewart: has joined #ruby
[11:32:34] [k-: Ox0dea are you having a 24h marathon? :o
[11:33:32] diegoviola: has joined #ruby
[11:33:44] Ox0dea: [k-: Kinda just happens now and again.
[11:34:13] Iskarlar: has joined #ruby
[11:34:49] jimeh: has joined #ruby
[11:35:24] ldnunes: has joined #ruby
[11:36:23] qiukun: has joined #ruby
[11:36:40] Musashi007: has joined #ruby
[11:36:41] koos303: has joined #ruby
[11:38:31] bnagy: did I just see a 0xabad1dea quote in the bot o_0
[11:39:25] apeiros: she phrased that excellently IMO
[11:39:54] _solomon: has joined #ruby
[11:40:07] schaerli: has joined #ruby
[11:42:56] dgutierrez1287: has joined #ruby
[11:45:18] saadq: has joined #ruby
[11:48:12] Narzew: has joined #ruby
[11:49:17] jimeh: has joined #ruby
[11:49:33] nveselinov: has joined #ruby
[11:50:16] pawz: has joined #ruby
[11:50:25] st0mar: has joined #ruby
[11:52:04] ttilley: has joined #ruby
[11:52:46] rdark_: has joined #ruby
[11:52:53] xkef: has joined #ruby
[11:55:27] OrbitalKitten: has joined #ruby
[11:57:01] mikecmpbll: has joined #ruby
[11:57:21] schaerli: has joined #ruby
[11:57:56] intinig: has joined #ruby
[11:58:06] jaequery: has joined #ruby
[11:59:06] DEA7TH_: has joined #ruby
[11:59:57] DEA7TH_: If I declare a variable before Thread.new { }, is it ok to treat the variable as shared between the thread and the ongoing process?
[12:01:03] s00pcan: has joined #ruby
[12:01:03] DEA7TH_: I write to the variable in order to pass information to the Thread.new
[12:01:47] Ox0dea: DEA7TH_: Better to use Thread#[].
[12:02:20] Ox0dea: >> t = Thread.new{}; t[:foo] = :bar; t[:foo]
[12:02:21] ruboto: Ox0dea # => (https://eval.in/400542)
[12:03:59] DEA7TH_: I think I resolved my problem by using my_thread.kill to stop it instead
[12:04:33] nateberkopec: has joined #ruby
[12:04:36] ruurd: has joined #ruby
[12:05:20] Violentr: has joined #ruby
[12:05:32] Ox0dea: DEA7TH_: Well, it seems like we can reward today's XY problem award early. :P
[12:05:38] apeiros: DEA7TH_: the mechanic you use to share data between two threads doesn't matter much
[12:05:48] apeiros: DEA7TH_: what matters is that you properly synchronize access to shared data
[12:06:14] apeiros: (also on a sidenote: you don't really declare variables in ruby - you only assign to them)
[12:06:20] konsolebox: has joined #ruby
[12:06:25] DEA7TH_: my actual problem is pretty complicated that's why I didn't want to describe it
[12:06:27] Rubie: has joined #ruby
[12:06:47] DEA7TH_: apeiros: I was asking because I never used Thread before and was unsure whether it worked
[12:06:52] apeiros: DEA7TH_: well, the worse your description, the worse the answers
[12:06:53] DEA7TH_: it seemed to work on the REPL but who knows
[12:06:55] adaedra: if there's no problem, there's no solution
[12:07:10] Ox0dea: DEA7TH_: You... don't want help, or you don't like typing, or--?
[12:07:43] arup_r: what does it mean? ^^
[12:07:57] arup_r: I mean this -> o0
[12:08:23] Ox0dea: arup_r: It's balls of eye.
[12:08:43] DEA7TH_: Anyway, does this work as expected https://gist.github.com/VelizarHristov/7cb189438099f914da1b
[12:09:12] DEA7TH_: the thread should do fifo_file.puts 'timeout' if it isn't killed within 55 seconds
[12:09:39] rideh: has joined #ruby
[12:09:51] apeiros: arup_r: 0o would be http://img13.deviantart.net/0608/i/2003/42/9/4/smiley___raised_eyebrow.jpg
[12:10:01] sgambino: has joined #ruby
[12:10:17] Ox0dea: DEA7TH_: Yes, it'll do that, but Line 7 could still potentially block forever.
[12:10:42] DEA7TH_: Ox0dea: you mean it could, unless the thread was there?
[12:10:49] Ox0dea: No, even with the Thread.
[12:11:04] Ox0dea: Because it's a blocking operation?
[12:11:12] jaequery: has joined #ruby
[12:11:38] DEA7TH_: so it would stop the thread from executing?
[12:11:43] sp1rs: has joined #ruby
[12:11:43] symm-: has joined #ruby
[12:11:51] DEA7TH_: it's supposed to block, just not forever
[12:12:04] Ox0dea: Ah, sorry, I'm derping. I realize now that you're writing and reading the same FIFO.
[12:13:00] jhass: DEA7TH_: the proper variant would be to use a ConditionVariable and a flag, .wait(timeout) on it and check via the flag if you came back early or ran into the timeout
[12:13:20] DEA7TH_: nice, I'll do that
[12:13:37] jhass: and forget Thread#kill is a thing
[12:13:54] ruurd: has joined #ruby
[12:14:06] DEA7TH_: ConditionVariable is in Ruby 2.0 documents but not in Ruby 2.2.2?
[12:14:20] jhass: I think it moved to core or something
[12:14:27] eggoez: has joined #ruby
[12:14:37] jhass: http://ruby-doc.org/core-2.2.2/ConditionVariable.html
[12:14:56] DEA7TH_: yeah. search engines always lead to outdated documentation :(
[12:15:04] yuuvee: has joined #ruby
[12:15:28] eGGsha: has joined #ruby
[12:15:38] quazimodo: has joined #ruby
[12:16:00] rdark: has joined #ruby
[12:16:33] aspiers: has joined #ruby
[12:18:05] stantonnet: has joined #ruby
[12:18:27] GeissT: has joined #ruby
[12:18:44] DEA7TH_: Like this? https://gist.github.com/VelizarHristov/ae8521892f316c471825
[12:18:52] but3k4: has joined #ruby
[12:18:57] vivekananda: has joined #ruby
[12:19:01] Zai00: has joined #ruby
[12:19:21] DEA7TH_: I suspect the code in Thread.new is wrong
[12:20:02] cochise: has joined #ruby
[12:20:20] yqt: has joined #ruby
[12:21:11] Musashi007: has joined #ruby
[12:23:00] lsmola: has joined #ruby
[12:23:05] [k-: Ox0dea does your brain perform consistently over the 24hrs?
[12:23:14] [k-: mine stops working after a few hours
[12:23:56] gamename: has joined #ruby
[12:24:18] Ox0dea: [k-: I tend to derp more often down the stretch, but I usually only get going if I'm intensely focused on something, so somewhere in the middle.
[12:24:36] jhass: DEA7TH_: not quite, you're missing the flag to signalize whether .wait returned from the timeout or from the wakeup, I'd wrap the whole thing up in a class
[12:24:43] [k-: that means I'm the only one :(
[12:25:04] [k-: honestly my brain hurts after a while
[12:25:23] fabrice31: has joined #ruby
[12:25:48] Iskarlar: has joined #ruby
[12:26:04] Ox0dea: [k-: Do you keep sufficiently hydrated?
[12:26:21] [k-: well....
[12:26:36] [k-_: has joined #ruby
[12:26:44] nateberkopec: has joined #ruby
[12:26:49] [k-: I'll get some water
[12:26:57] adaedra: Ox0dea: thanks for reminding me this
[12:27:20] joonty: has joined #ruby
[12:28:43] fabrice31_: has joined #ruby
[12:29:07] mikecmpbll: i moved desks closer to the water cooler recently and have consequently been drinking more .. fewer headaches ????
[12:29:39] kham1: has joined #ruby
[12:30:14] DEA7TH_: jhass: where can I put that flag? I don't see any properties on SharedVariable or Mutex
[12:30:47] DEA7TH_: ConditionVariable*
[12:30:49] felixr: has joined #ruby
[12:30:49] jhass: just closure over it or as said use a class
[12:31:10] jhass: something like this http://paste.mrzyx.de/psxqxcwbm (untested)
[12:31:10] livathinos: has joined #ruby
[12:32:15] duggiefresh: has joined #ruby
[12:32:46] axl_: has joined #ruby
[12:32:50] DEA7TH_: just a global variable? ok
[12:33:02] victortyau: has joined #ruby
[12:33:26] jhass: it's not a $global
[12:34:02] schaerli: has joined #ruby
[12:34:32] DEA7TH_: yeah I mean accessed both within the thread and outside of it
[12:36:03] bubbys: has joined #ruby
[12:36:19] Kully3xf: has joined #ruby
[12:37:24] zacstewart: has joined #ruby
[12:37:29] tmtwd: has joined #ruby
[12:38:10] sankaber: has joined #ruby
[12:38:17] LoBoGoL: has joined #ruby
[12:38:21] LoBoGoL_: has joined #ruby
[12:38:23] michael_mbp: has joined #ruby
[12:38:46] ndrei: has joined #ruby
[12:38:59] ndrei_: has joined #ruby
[12:39:18] Iskarlar: has joined #ruby
[12:39:51] Kully3xf_: has joined #ruby
[12:39:58] casadei_: has joined #ruby
[12:40:21] kidoz: has joined #ruby
[12:40:47] LoBoGoL: has joined #ruby
[12:41:18] Kully3xf: has joined #ruby
[12:41:53] malconis: has joined #ruby
[12:47:30] jenrzzz: has joined #ruby
[12:47:40] dfockler: has joined #ruby
[12:48:29] davejlong: has joined #ruby
[12:48:42] Kully3xf_: has joined #ruby
[12:48:45] wmoxam: has joined #ruby
[12:49:55] edwinvdgraaf: has joined #ruby
[12:50:17] AviShastry: has joined #ruby
[12:50:34] Kully3xf: has joined #ruby
[12:51:25] lkba_: has joined #ruby
[12:51:40] Santana: has joined #ruby
[12:52:03] havenwood: has joined #ruby
[12:52:33] jhn: has joined #ruby
[12:52:37] CoreData: has joined #ruby
[12:52:49] symm-: has joined #ruby
[12:52:56] i-blis: has joined #ruby
[12:52:56] i-blis: has joined #ruby
[12:53:09] CoreData: has joined #ruby
[12:53:12] sce_: has joined #ruby
[12:53:31] [k-_: Ox0dea: remember my %25 :>
[12:54:16] davejlong: has joined #ruby
[12:54:25] davejlong: has joined #ruby
[12:54:56] ndrei: has joined #ruby
[12:54:58] plashchynski: has joined #ruby
[12:56:44] edwinvdg_: has joined #ruby
[12:57:59] gregf: has joined #ruby
[12:58:50] [k-_: i shall implement play_pass in haskell :D
[12:59:06] dimasg: has joined #ruby
[12:59:29] ndrei_: has joined #ruby
[13:01:19] devdazed: has joined #ruby
[13:02:47] tkuchiki: has joined #ruby
[13:03:45] arup_r: has joined #ruby
[13:04:42] Guest66988: has joined #ruby
[13:05:12] bruno-: has joined #ruby
[13:05:40] dagda1: has joined #ruby
[13:07:13] zrowe007: has joined #ruby
[13:07:24] ndrei: has joined #ruby
[13:07:39] ndrei_: has joined #ruby
[13:08:16] Scripore: has joined #ruby
[13:09:12] kobain: has joined #ruby
[13:10:00] hj2007: has joined #ruby
[13:10:25] whippythellama: has joined #ruby
[13:10:31] DoubleMalt: has joined #ruby
[13:11:28] fabrice31: has joined #ruby
[13:12:28] bungoman: has joined #ruby
[13:14:29] hfp: has joined #ruby
[13:15:00] hfp_work: has joined #ruby
[13:16:24] intinig: has joined #ruby
[13:16:44] lala: has joined #ruby
[13:17:50] konsolebox: has joined #ruby
[13:20:00] malconis: has joined #ruby
[13:20:50] malconis: has joined #ruby
[13:21:43] Iskarlar: has joined #ruby
[13:21:43] allcentury: has joined #ruby
[13:22:45] desigx: has joined #ruby
[13:23:14] bigkevmcd: has joined #ruby
[13:24:03] bigkevmcd: has joined #ruby
[13:24:09] Iskarlar: has joined #ruby
[13:24:19] JoshL: has joined #ruby
[13:25:05] jerematic: has joined #ruby
[13:26:26] countryHick: has joined #ruby
[13:28:24] matcouto: has joined #ruby
[13:28:31] ruurd: has joined #ruby
[13:28:56] atomical: has joined #ruby
[13:29:13] quimrstorres: has joined #ruby
[13:30:34] polyrob_: has joined #ruby
[13:30:40] davedev24: has joined #ruby
[13:31:41] Encapsulation: has joined #ruby
[13:31:49] NeverDie: has joined #ruby
[13:32:39] matcouto: has joined #ruby
[13:32:46] quimrstorres: has joined #ruby
[13:32:52] Sembei: has joined #ruby
[13:33:38] Iskarlar: has joined #ruby
[13:34:52] dblessing: has joined #ruby
[13:35:24] [k-_: i did it
[13:35:28] [k-_: my solution is ugly tho
[13:35:42] _solomon: has joined #ruby
[13:35:50] mandarinkin: has joined #ruby
[13:35:52] fabrice31: has joined #ruby
[13:35:52] adaedra: there are no ugly solutions, only work in progress.
[13:35:58] [k-_: https://gist.github.com/SkyBirdSoar/6ee908d6ec0d245fc8e7
[13:37:32] fabrice31: has joined #ruby
[13:37:47] intinig: has joined #ruby
[13:38:54] [k-_: how other people did it: https://gist.github.com/SkyBirdSoar/6ee908d6ec0d245fc8e7#file-experts_solution-hs
[13:38:59] duggiefresh: has joined #ruby
[13:38:59] prefixed: has joined #ruby
[13:38:59] ruurd: has joined #ruby
[13:39:05] allcentury: has joined #ruby
[13:39:20] sp1rs: has joined #ruby
[13:39:30] riotjones: has joined #ruby
[13:39:59] desigx: has joined #ruby
[13:40:03] dblessing: has joined #ruby
[13:40:08] adaedra: It's funny, because in french, "hs" is abbreviation of "hors sujet" = "off-topic", like this code :>
[13:40:16] [k-_: i am amazed by their prowess
[13:40:45] fabrice31: has joined #ruby
[13:40:49] [k-_: Ox0dea and shevy should be there
[13:41:11] shevy: I thought the french do not use "h"
[13:41:33] shevy: just as in baguette - it's completely "h" free
[13:41:41] [k-_: i never thought there was a solution more ugly than mine
[13:41:47] [k-_: but there is ??\_(???)_/??
[13:41:48] shevy: me neither
[13:42:29] mary5030: has joined #ruby
[13:42:31] linuxboytoo: has joined #ruby
[13:42:46] adaedra: shevy: we do use it
[13:42:53] adaedra: it's a 4 at scrabble, iirc
[13:43:06] stbenjam: Anyone ever seen something like this with 1.8.7? https://gist.github.com/stbenjam/cb31ea06ab82430f79e8 -> Ruby is looking for a file named 'service-wait qpidd status' in /usr/sbin... Qutoing the arguments makes it execute correctly, however on later rubies the first one works and the second one doesn't
[13:43:29] [k-_: https://gist.github.com/SkyBirdSoar/6ee908d6ec0d245fc8e7#file-ugly_solution-hs
[13:43:30] tkuchiki: has joined #ruby
[13:43:59] shevy: stbenjam never seen such an error
[13:44:18] shevy: is there (a) a symlink, does (b) File.exist? "/usr/sbin/service-wait" return true?
[13:44:51] jimmythehat: How do I run a proc? I'm making a custom matcher in RSpec: | expect{ 42 }.to be_the_answer | however, when I print 'expected' in the matches? method I get <#:Proc...> How do I 'run' the proc so it changes to 42 ? Also I want my matcher to take a block, this is just the first step in learning :)
[13:45:07] stbenjam: shevy: not a symlink, File.exist? returns true
[13:45:16] adaedra: JimmytheHat: Proc#call?
[13:45:29] d10n-work: has joined #ruby
[13:45:38] [k-_: Proc#[] too
[13:45:43] [k-_: and proc.()
[13:46:08] shevy: stbenjam and you can invoke it from the commandline directly?
[13:46:25] shevy: because if you can, I don't think I have ever seen a difference between `` and direct invocations
[13:47:03] jimmythehat: adaedra thanks. just realized your name is an elder scrolls reference too :P
[13:47:07] rideh: has joined #ruby
[13:47:13] [k-_: in irb, when i did `clear`, it didnt work
[13:47:23] [k-_: when i did system "clear", it did
[13:47:53] [k-_: `clear` gave me => "\e[H\e[2J"
[13:48:02] stbenjam: shevy: sure can, works just fine. it's like ruby is treating the spaces as part of the command name, i've never seen anything like it, but very reproduceable even on a clean centos 6.6 install :-(
[13:48:45] adaedra: JimmytheHat: It isn't supposed to be.
[13:48:54] stbenjam: the particular code is https://github.com/Katello/katello/blob/master/deploy/script/katello-service, which works fine on el7 (ruby 2.x)
[13:49:22] xcesariox: has joined #ruby
[13:49:50] paulcsmith: has joined #ruby
[13:50:38] AviShastry: has joined #ruby
[13:50:56] shevy: yeah I have not seen such behaviour either, neither on 1.8.x
[13:51:15] mary5030: has joined #ruby
[13:52:02] stbenjam: yea, i know i've done similar before and it worked fine. maybe something with the latest centos' ruby
[13:52:25] intinig: has joined #ruby
[13:52:50] devdazed: has joined #ruby
[13:54:13] shevy: would be curious if they modified and broke ruby :)
[13:55:37] chouhoulis: has joined #ruby
[13:57:59] choppington: has joined #ruby
[13:58:25] schaerli: has joined #ruby
[13:58:52] jbw: has joined #ruby
[13:58:53] t0rrieri: has joined #ruby
[13:59:16] ruurd: has joined #ruby
[14:00:41] rbennacer: has joined #ruby
[14:01:54] shinnya: has joined #ruby
[14:03:44] bungoman: has joined #ruby
[14:03:48] mike___1234: has joined #ruby
[14:04:24] zacstewart: has joined #ruby
[14:04:30] tkuchiki: has joined #ruby
[14:06:42] DEA7TH_: has joined #ruby
[14:06:49] dopie: has joined #ruby
[14:07:30] rbennacer: has joined #ruby
[14:08:27] [k-_: Ox0dea: are you asleep yet? it's 24hrs!
[14:08:33] izzol: I need to do something with the file. But I don't want to save it on disk. I found the gem called mmap, which I can use for write the file to the memory.
[14:08:59] apeiros: "the file"?
[14:09:18] apeiros: mmap means you have a file saved on disk. so if you don't want to save a file on disk, mmap is not for you.
[14:09:31] jhass: "do something"?
[14:09:34] rideh: has joined #ruby
[14:09:51] chouhoulis: has joined #ruby
[14:09:52] Igorshp: has joined #ruby
[14:09:53] [k-_: there is Tempfile otherwise for temporary files
[14:09:56] adaedra: technically, you can mmap without files, it's what malloc does nowadays.
[14:10:16] sshuff: has joined #ruby
[14:10:18] apeiros: jhass: do something with the thing, but don't do that other thing, so just use that thing which does it
[14:10:34] apeiros: adaedra: for real?
[14:10:39] adaedra: apeiros: yes
[14:10:41] izzol: basically I'm reading mails from the STDIN but if the mail has an attachment I want to do few checks on it. Right now I'm saving each file to the disk. But this is slow :(
[14:10:44] [k-_: brilliant explanation apeiros
[14:10:44] apeiros: interesting
[14:10:54] jhass: "a few checks"?
[14:11:01] tvw: has joined #ruby
[14:11:20] DefV: izzol: Won't it take StringIO?
[14:11:20] izzol: jhass: like a type of the file, checking headers, size, name and so on
[14:11:33] gamename: has joined #ruby
[14:11:36] jhass: sounds like mime metadata
[14:11:42] Zamyatin: has joined #ruby
[14:11:43] izzol: jhass: yes
[14:11:49] DefV: and otherwise, mount a directory in your working dir with tmpfs
[14:11:58] DefV: and you have yourself a part of mem to read/write to
[14:11:58] jhass: so why would you need to save the contents of the file to disk anyway
[14:12:56] devdazed: has joined #ruby
[14:13:03] izzol: jhass: right now I'm checking the type of the file by: file -bi {file}
[14:13:23] jhass: why not read the mime metadata?
[14:13:41] stbenjam: shevy: in case you were curious, the problem was this service-wait script was lacking the shebang. who writes a script without that? *sigh*
[14:13:55] apeiros: izzol: ruby-filemagic gem
[14:14:02] apeiros: should be able to do that in-memory
[14:14:05] izzol: jhass: I don't know :-) I will try to do this :)
[14:14:13] apeiros: (name might slightly differ)
[14:14:25] DefV: izzol: you can use libmagic (which is what file uses)
[14:14:34] DefV: ah, what apeiros said
[14:14:41] jhass: yeah, search for a libmagic binding
[14:14:46] prefixed: has joined #ruby
[14:15:17] shevy: stbenjam interesting
[14:15:17] [H]unt3r: has joined #ruby
[14:16:05] izzol: ok thanks :-) Yes, I guess this is something for me.
[14:18:00] jhass: well and again, only if you don't trust the mime headers
[14:20:32] Iskarlar: has joined #ruby
[14:20:44] apeiros: note that filemagic can get it wrong???
[14:20:47] Igorshp: has joined #ruby
[14:21:36] adaedra: so many file formats based on zip.
[14:21:37] stantonnet: has joined #ruby
[14:21:54] bahar: has joined #ruby
[14:22:06] linuxboytoo: has joined #ruby
[14:22:57] Rubie: has joined #ruby
[14:23:05] fabrice31: has joined #ruby
[14:23:39] werelivinginthef: has joined #ruby
[14:25:01] penzur: has joined #ruby
[14:25:09] freerobby: has joined #ruby
[14:26:35] dudedudeman: sort of ruby question... how many of you guys are dev ops engineers, and use ruby rather often?
[14:26:40] momomomomo: has joined #ruby
[14:27:17] intinig: has joined #ruby
[14:27:54] juanpaucar: has joined #ruby
[14:28:05] bmurt: has joined #ruby
[14:28:54] penzur: has joined #ruby
[14:29:10] dgutierrez1287: has joined #ruby
[14:29:27] bungoman_: has joined #ruby
[14:29:40] penzur: has joined #ruby
[14:30:06] DaniG2k: has joined #ruby
[14:30:14] bmurt: has joined #ruby
[14:30:32] izzol: dudedudeman: there is nothing such as DevOps Engineers :P
[14:31:14] adaedra: use correct terminology and don't mix work classes.
[14:31:15] dudedudeman: wait. how many of you folks* sorry*
[14:31:44] downwithbender: has joined #ruby
[14:32:00] dudedudeman: we said i'd do it, didn't we. lol.
[14:32:13] dudedudeman: but i am curious.
[14:32:38] shelby: has joined #ruby
[14:32:54] kies^: has joined #ruby
[14:33:12] kobain: has joined #ruby
[14:33:24] Igorshp: has joined #ruby
[14:33:29] alexclark: has joined #ruby
[14:33:55] alexclark: does anyone know what the `!~` operator does?
[14:34:15] kfpratt: has joined #ruby
[14:34:40] dimasg: has joined #ruby
[14:34:52] Silex: logical not - bitwise not ?
[14:35:05] DoubleMalt: has joined #ruby
[14:35:35] Silex: e.g !~x is x = ~x; x = !x;
[14:35:42] alexclark: Silex: oi...
[14:35:46] Silex: forget the assignments
[14:35:56] alexclark: what does the tilde do?
[14:36:00] Silex: bitwise not
[14:36:49] ljarvis: you know that could be a regexp operator
[14:37:00] aryaching: has joined #ruby
[14:37:13] t0rrieri: has joined #ruby
[14:37:32] Silex: ah, yes apparently it is
[14:37:51] alexclark: ljarvis: youre probably on to something
[14:37:51] ljarvis: I think "!~" is defined as "pattern does not match" operator
[14:37:53] Silex: I guess it means "doesn't match"
[14:38:00] alexclark: ljarvis: if fn.nil? || fn !~ /\S/
[14:38:07] alexclark: thats the full statement
[14:38:18] ljarvis: yeah it's doing regexp not match, it's the opposite of =~
[14:39:22] ljarvis: that's an extremely ambiguous match
[14:39:34] atomical_: has joined #ruby
[14:39:49] alexclark: so its matching not not whitespace right?
[14:39:52] bigkevmcd: has joined #ruby
[14:40:00] ljarvis: yeah anything but " "
[14:40:14] Maletor: has joined #ruby
[14:40:14] alexclark: or better stated, not matching not whitespace
[14:40:22] ljarvis: see this is why we use =~
[14:40:38] ljarvis: so you dont have to burden your brain with those sentences
[14:40:46] Silex: funny, it seems "A ! ~ B" can have several meaning wether A is a function or a String
[14:41:07] ljarvis: yeah but that's parsed as A ! (~B)
[14:41:07] j4cknewt: has joined #ruby
[14:41:10] alexclark: ljarvis: i wish anyone here cared about not burdening my brain
[14:41:17] Silex: ljarvis: the space matters?
[14:41:24] ljarvis: Silex: ya I think so
[14:41:26] ljarvis: alexclark: :)
[14:42:00] ljarvis: actually it's a syntax error
[14:42:03] blue_deref: has joined #ruby
[14:42:17] Silex: ljarvis: you're right, the space matters
[14:42:26] ljarvis: space matters (tm)
[14:42:27] Silex: A ! ~ B works with def A(x); end
[14:42:35] Silex: and B = 3
[14:42:37] ljarvis: ah right yeah that makes sense
[14:42:50] marr: has joined #ruby
[14:43:06] alimiracle: has joined #ruby
[14:43:22] alimiracle: hi ruby users
[14:43:55] havenwood: has joined #ruby
[14:44:02] dudedudeman: greetings. we hate ruby here.
[14:44:21] dudedudeman: just kidding.
[14:44:46] jimmythehat: wait...rspec itself has test coverage provided by..rspec
[14:45:17] [k-: well it uses a previous version, no?
[14:45:35] jimmythehat: [k- ah that makes more sense..it's still a pretty weird concept
[14:45:40] sepp2k: has joined #ruby
[14:45:41] ljarvis: eh, it shouldn't
[14:45:48] ljarvis: that actually makes less sense to me
[14:46:07] [k-: why would you use the current version to test the current version
[14:46:08] f4cl3y: what's the correct way to you nested tags inside erb templats?
[14:46:10] sshuff: has joined #ruby
[14:46:10] alimiracle: dudedudeman: whi?
[14:46:18] ljarvis: [k-: because you can?
[14:46:20] Silex: JimmytheHat: gcc is typically compiled with gcc too :)
[14:46:20] [k-: if there is a bug in the current version, how would you know
[14:46:47] [k-: haskell is coded in Haskell too
[14:46:49] ljarvis: [k-: how would you know if you used the previous one, or what if there's a bug in that too?
[14:46:52] alimiracle: dudedudeman: I love ruby
[14:46:55] jimmythehat: ljarvis What if you were testing 'describe' and 'describe' had an error? x'D
[14:47:09] f4cl3y: e.g. <%= somthig_function(<%= another_function %>)%>
[14:47:09] ljarvis: JimmytheHat: then you add a test for it and fix it
[14:47:09] jimmythehat: describe 'describe' do ... it's mad
[14:47:10] [k-: ljarvis: you cry then
[14:47:11] dudedudeman: alimiracle: we love ruby, too.
[14:47:13] sofija: has joined #ruby
[14:47:34] jimmythehat: Silex : haha crazy :P
[14:47:37] ljarvis: f4cl3y: <%= .... #{...} %> -- remember, what's inside is just ruby
[14:47:50] alimiracle: dudedudeman: I use ruby and python and c/c++
[14:47:59] flaf: Hi, if I want to define a class variable @@var, where should I define this variable? Is it possible to define just after `class Foo` (and before `def initialize`)? Should I define the variable in the body of the initialize method?
[14:48:17] f4cl3y: ljarvis: Thanks!
[14:48:21] [k-: after class foo
[14:48:29] ljarvis: flaf: you'll want to define it at the top level and then mutate it (if you want) inside your initialize
[14:48:36] umgrosscol: has joined #ruby
[14:48:43] Silex: flaf: shouldn't we avoid @@ class variables when possible?
[14:48:45] ljarvis: otherwise it's never defined until you instantiate an instance
[14:49:02] ndrei: has joined #ruby
[14:49:03] ndrei_: has joined #ruby
[14:49:17] flaf: ljarvis: ah ok, thx.
[14:49:54] Silex: I mean, instead of using @@ class variable we'd use cattr_accessor etc
[14:49:59] davejlong: has joined #ruby
[14:50:27] Silex: err, not cattr_accessor... but something! :)
[14:50:30] ljarvis: that's an AS/Rails thing. You'd usually prefer to use class instance variables though, yes
[14:50:34] flaf: Silex: I don't know. Is it bad to have a class variables? If it's variable shared by all the instances, it's a good thing, no?
[14:50:47] ljarvis: flaf: it's fine for basic stuff, but they have their pitfalls
[14:50:50] bungoman: has joined #ruby
[14:50:57] Silex: flaf: see what ljarvis said, use class instance variables instead
[14:51:03] shevy: flaf it's a question whether you need them
[14:51:12] chouhoul_: has joined #ruby
[14:51:21] alimiracle: can I use qt gui in ruby?
[14:51:33] msnyon: has joined #ruby
[14:51:43] ljarvis: flaf: here's some reading if you're interested: http://blogs.relevancellc.com/articles/2006/11/16/use-class-instance-variables-not-class-variables (yes, 2006 and it's still relevant)
[14:51:43] shevy: yeah qtruby qt4ruby bindings
[14:52:35] gigetoo: has joined #ruby
[14:52:42] flaf: ljarvis: thx. Reading...
[14:52:44] krz: has joined #ruby
[14:52:59] ljarvis: flaf: actually that article doesn't give much background, this might be better: http://www.railstips.org/blog/archives/2006/11/18/class-and-instance-variables-in-ruby/
[14:53:23] flaf: ok, thx.
[14:53:46] [k-: shevy, I just wrote something in Ruby!
[14:54:08] shevy: it will be ugly
[14:54:16] dfockler: has joined #ruby
[14:54:30] [k-: it is 90% alphanum :(
[14:55:22] alimiracle: sherybe is so nise
[14:56:08] [k-: you discourage me to use Ruby
[14:56:18] [k-: off to Haskell land I go
[14:57:13] acke: has joined #ruby
[14:57:58] sharpmachine: has joined #ruby
[14:59:00] fabrice31_: has joined #ruby
[15:00:42] _ixti_: has joined #ruby
[15:02:11] blueOxigen: has joined #ruby
[15:04:30] acke_: has joined #ruby
[15:04:33] shevy: [k- come on man, write awesome projects that are useful!
[15:04:57] [k-: > assuming that I even have an idea
[15:05:03] paulcsmith: has joined #ruby
[15:05:10] [k-: > assuming I adopt good practices
[15:05:24] [k-: > assuming I can remain dedicated to fix bugs
[15:05:24] flaf: ljarvis: if I want to use a "class instance variable" in a method of my class, the right way to do that is self.class.instance_variable_get(:@var), correct? Is there more simple?
[15:05:32] AviShastry: has joined #ruby
[15:05:51] shevy: [k- well maintenance work is much easier than creation work
[15:06:10] [k-: flaf @var will do just fine
[15:06:44] gregf_: [k-: odd question: whats the learning curve for haskell like?
[15:07:11] [k-: very high
[15:07:25] gregf_: [k-: if you can write haskell i would image any other non-fp language to be quite easy :/
[15:07:38] flaf: [k-: I don't think so. @var is for a instance variable, here it's for a instance variable _of the class_.
[15:07:38] gregf_: well, its prolly high if you're in uni :/
[15:07:55] mleung: has joined #ruby
[15:08:08] kfpratt: has joined #ruby
[15:08:15] bffff_: has joined #ruby
[15:08:25] ljarvis: flaf: you need to use attr_reader just like normal instance variables
[15:08:51] gregf_: [k-: thanks anyways ;)
[15:09:01] ljarvis: flaf: https://eval.in/400649
[15:09:53] Silex: flaf: a method would then use Foo.thing = 123 or self.class.thing = 123
[15:09:59] r0nin: has joined #ruby
[15:10:08] [k-: what is even class instance variable vs instance variable
[15:10:09] ljarvis: you'd need a writer for that too, but yep
[15:10:19] atomical: has joined #ruby
[15:10:33] [k-: gregf_ I can write Haskell :(
[15:10:44] [k-: somewhat, at least
[15:10:51] ljarvis: [k-: it's an instance variable on the class instance (i.e the instance of class Class)
[15:10:53] gregf_: [k-: i know, so i asked :/
[15:10:56] adaedra: [k-: well, classes are object, so if you use @x in the scope of a class and not an instance, it's a class instance variable.
[15:11:21] [k-: but why would we do that!
[15:11:27] Luun: has joined #ruby
[15:11:30] ljarvis: because it's really useful
[15:11:38] yqt: has joined #ruby
[15:12:28] havenwood: [k-: @@class_variables are ugly to discourage use.
[15:12:31] [k-: shevy has you done this before
[15:12:35] Silex: [k-: for example to count the number of instances you have
[15:13:30] flaf: ljarvis: err... a class in class. I'm not sure to understand. What's the meaning of `class << self` in a class?
[15:13:49] paulcsmith: has joined #ruby
[15:14:09] [k-: it's the class of the class!
[15:14:14] r0nin_: has joined #ruby
[15:14:14] ljarvis: flaf: it opens the metaclass of the class. It's covered in that article I linked you. For some background, classes inherit from Class which is a Ruby class itself
[15:14:19] drewvanstone: has joined #ruby
[15:14:22] ljarvis: >> class Foo; end; Foo.class
[15:14:23] ruboto: ljarvis # => Class (https://eval.in/400650)
[15:14:25] Silex: I wish @@var notation never existed
[15:14:27] ljarvis: >> Class.class
[15:14:28] ruboto: ljarvis # => Class (https://eval.in/400651)
[15:14:37] havenwood: Silex: Pretend it doesn't!
[15:14:50] adaedra: >> class Foo; class << self; p self; end; end
[15:14:50] ljarvis: just like globals
[15:14:51] ruboto: adaedra # => #<Class:Foo> ...check link for more (https://eval.in/400652)
[15:15:15] havenwood: And please folk, stop showing beginners class variables right away in books... :(
[15:15:34] Silex: havenwood: that's exactly why I wish they never existed
[15:15:48] ljarvis: >> Class.singleton_class
[15:15:49] ruboto: ljarvis # => #<Class:Class> (https://eval.in/400653)
[15:16:33] tjohnson: has joined #ruby
[15:16:48] intinig: has joined #ruby
[15:17:10] Silex: oh right there's these eigenclasses thing I forgot about those
[15:17:17] flaf: ljarvis: understood. Thx.
[15:17:27] plashchynski: has joined #ruby
[15:17:30] willywos: has joined #ruby
[15:17:38] umgrosscol: has joined #ruby
[15:17:51] chouhoulis: has joined #ruby
[15:18:24] ljarvis: the eigenmetasingleton class
[15:19:03] dfinninger: has joined #ruby
[15:19:14] Papierkorb: has joined #ruby
[15:19:29] havenwood: I prefer to say I'm eigen rather than single.
[15:19:48] ljarvis: how very meta of you
[15:20:06] zacstewa_: has joined #ruby
[15:20:33] r0nin: has joined #ruby
[15:20:53] dfockler: I still haven't found an 'instance' where I needed a class level variable
[15:21:10] icebourg: has joined #ruby
[15:21:11] bronson: has joined #ruby
[15:21:34] Hounddog: has joined #ruby
[15:21:43] adaedra: does not mean it's useless
[15:23:42] dfockler: adaedra: although if you don't know when to use it, you probably shouldn't use it
[15:24:14] bungoman: has joined #ruby
[15:26:42] flaf: If we want to have a variable shared by all the instances (with the same value), it could be useful, no?
[15:28:06] r0nin_: has joined #ruby
[15:28:07] [k-: when would that happen
[15:29:38] gregf_: flaf: thats what a class variable is for
[15:30:11] bruno-: has joined #ruby
[15:30:20] Igorshp: has joined #ruby
[15:30:53] saadq: has joined #ruby
[15:31:10] dfockler: I feel like you can just set a default instance variable
[15:31:34] gregf_: flaf: class Foo; @@bar=10; def get_bar;@@bar;end;end;3.times { print Foo.new.get_bar } <== like that?
[15:31:51] danzilio: has joined #ruby
[15:32:06] Rollabunna: has joined #ruby
[15:32:13] [k-: just get a constant in that case ._.
[15:32:26] adaedra: what if you want it to be mutable?
[15:32:29] flaf: gregf_: yes but, if I have well understood, it's not a good practice to use @@bar.
[15:32:31] [k-: or initialise @bar = 3
[15:32:33] bubbys: has joined #ruby
[15:32:41] adaedra: what if you want it to be shared?
[15:33:03] adaedra: ACTION slaps [k- 
[15:33:41] [k-: ObjectSpace
[15:33:54] adaedra: class variables are a way to have shared, mutable data common to all instances of a class.
[15:34:07] adaedra: you can think of it to be kind of scoped globals.
[15:34:25] schaerli: has joined #ruby
[15:34:49] freerobby: has joined #ruby
[15:35:16] linuxboytoo: has joined #ruby
[15:35:22] dgbaley: has joined #ruby
[15:35:56] arup_r: has joined #ruby
[15:37:30] dgbaley: Hey, is this a good place to ask about erb? I have a template with lines like """<%- if @device %>DEVICE=$device<% end %>""" but the problem is it leaves a blank line when the conditional is false. If I change to <% end -%> then it doesn't add a newline. Is there a shortcut or some syntax to do a one-liner conditional like this?
[15:37:41] arup_r: I have defined my own Data class in a proper namespace.. why then I am getting error ? https://gist.github.com/aruprakshit/cb97787ad76622b899de
[15:38:44] rcvalle: has joined #ruby
[15:39:17] flaf: dgbaley: just => <%- if @device -%>
[15:39:24] flaf: DEVICE=$device
[15:39:32] flaf: <%- end -%>
[15:39:45] dgbaley: flaf: you're saying break it out onto multiple lines?
[15:39:45] flaf: (on 3 lines)
[15:40:06] flaf: and use <%- and -%>
[15:40:08] dgbaley: Yeah, I know that, was trying to keep it on one line because I have a long list of such lines
[15:40:53] flaf: Ah you want just one line.
[15:41:09] aphprentice: has joined #ruby
[15:41:13] dgbaley: Somewhat related: is -%> basically useless if there's non-whitespace that follows on the line?
[15:41:30] Channel6: has joined #ruby
[15:41:51] arup_r: I don't even understand what the error is saying.. :/
[15:41:56] dgbaley: Seems like the simplest thing for me then, is to use <% end -%> and add a \n inside the conditional
[15:41:59] choppington: has joined #ruby
[15:42:02] benlovell: has joined #ruby
[15:42:15] flaf: -%> remove withespace and the newline character (\n)
[15:43:05] sarkyniin: has joined #ruby
[15:43:08] zacstewart: has joined #ruby
[15:44:29] ljarvis: arup_r: Data is an existing Ruby class (one that cannot be allocated) for some reason it thinks you're referencing this class, which is also why you're getting a warning about it
[15:44:57] ljarvis: arup_r: basically, I would not use a class named Data, not just because of this clash but also because data is the worst possible name for anything in code
[15:46:02] r0nin: has joined #ruby
[15:46:46] joelataylor: has joined #ruby
[15:47:47] r0nin: has joined #ruby
[15:49:39] RobertBirnie: has joined #ruby
[15:50:29] linuxboytoo: has joined #ruby
[15:51:10] arup_r: Humm But it clashed while I have namespaced it
[15:51:46] flaf: dgbaley: if you want a one-line instruction, you can do this:
[15:51:54] flaf: <%- if @device -%>DEVICE=$device<%= "\n" %><%- end -%>
[15:52:02] arup_r: ljarvis, Actually I have one class making the URL and other part is making data to POST to the url..
[15:52:13] flaf: dgbaley: (it works for me)
[15:52:15] arup_r: now it seems I need to change the class name to `Body`
[15:52:20] [k-: curse you and one liners!
[15:52:40] ljarvis: arup_r: or query
[15:53:01] dgbaley: flaf: yeah, that's what I said I did, except I don't need <%= "\n" %> for the newline because in my context, \n is interpreted already.
[15:53:12] arup_r: ljarvis, hum,,. But is it a bug ..?
[15:53:23] dgbaley: flaf: so I have lots of these: <%- if @device %>DEVICE=$device\n<% end -%>
[15:53:27] Ilyas: has joined #ruby
[15:53:50] loc22: has joined #ruby
[15:53:56] arup_r: Should I make it small class and reproduce to submit..? what you say..?
[15:54:04] ljarvis: arup_r: probably: https://eval.in/400694
[15:54:04] bungoman: has joined #ruby
[15:54:17] flaf: dgbaley: ah ok, good.
[15:54:31] blaines: has joined #ruby
[15:54:35] dgbaley: flaf: thanks for your help =)
[15:54:45] mikecmpb_: has joined #ruby
[15:54:48] r0nin_: has joined #ruby
[15:55:22] arup_r: ljarvis, but you didn't get the error? Strange!
[15:55:58] jonee: has joined #ruby
[15:56:05] ljarvis: arup_r: I can't see the rest of your code so I don't know what the problem is, but I would rename the class regardless which will fix the problem anyway
[15:56:47] Hounddog: has joined #ruby
[15:57:48] rideh: has joined #ruby
[15:57:54] MrJiks: has joined #ruby
[15:58:16] zacstewart: has joined #ruby
[15:58:21] amclain: has joined #ruby
[15:59:18] allomov: has joined #ruby
[15:59:37] quimrstorres: has joined #ruby
[16:00:11] ank: has joined #ruby
[16:00:47] edwinvdgraaf: has joined #ruby
[16:01:42] towski_: has joined #ruby
[16:01:46] momomomomo: has joined #ruby
[16:01:56] MrJiks: has joined #ruby
[16:02:50] gizmore: has joined #ruby
[16:03:49] edwinvdg_: has joined #ruby
[16:04:05] abuzze: has joined #ruby
[16:04:31] abuzze: has joined #ruby
[16:06:08] edwinvdgraaf: has joined #ruby
[16:06:15] blaines: has joined #ruby
[16:06:55] r0nin: has joined #ruby
[16:07:15] zacstewart: has joined #ruby
[16:07:31] aryaching: has joined #ruby
[16:08:14] mleung: has joined #ruby
[16:08:25] linuxboytoo: has joined #ruby
[16:09:31] nateberkopec: How do I make a ruby process make the current thread wait, but still block other threads from executing? From what I can tell, sleep will cause the current thread to sleep, but other threads will still be able to execute. I want to stop all execution for a period of time.
[16:09:36] jerematic: has joined #ruby
[16:09:52] linuxboytoo: has joined #ruby
[16:13:32] galeido: has joined #ruby
[16:13:41] dfinninger: has joined #ruby
[16:15:17] [Butch]: has joined #ruby
[16:15:33] arup_r: you guys have to many names :p
[16:16:19] rideh: has joined #ruby
[16:17:18] jevs: nateberkopec: maybe Fibres are more what you???re looking for which give you more control over which process is running and when?
[16:18:32] sofija: has joined #ruby
[16:18:46] sofija: has joined #ruby
[16:18:53] r0nin: has joined #ruby
[16:20:13] edwinvdg_: has joined #ruby
[16:20:20] bricker: has joined #ruby
[16:20:44] jevs: Otherwise you???d have to have a way of telling all the other threads to pause as well. The multithreading paradigm might not be right if they depend on each other in some way
[16:20:59] Axy: has joined #ruby
[16:21:13] dgbaley: has left #ruby: ()
[16:21:37] djbkd: has joined #ruby
[16:22:02] DoubleMalt: has joined #ruby
[16:22:19] bronson: has joined #ruby
[16:23:09] Yiota: has joined #ruby
[16:24:01] havenwood: nateberkopec: +1 Fibers: http://ruby-doc.org/core/Fiber.html
[16:24:03] nateberkopec: jevs: This is just for some test benchmarking, so I think I might just try to lock up a thread with some meaninless work. like generating a lot of random data or whatever.
[16:24:10] hj2007: has joined #ruby
[16:24:28] nateberkopec: I basically want to simulate a web application that does X ms of work, but doesn't relinquish the thread.
[16:24:42] havenwood: nateberkopec: Sure, you can synchronize on a global mutex lock.
[16:24:52] poguez_: has joined #ruby
[16:24:53] quimrstorres: has joined #ruby
[16:25:02] havenwood: nateberkopec: But if you really want to do the scheduling, Fibers.
[16:25:05] nateberkopec: So basically sleep inside a mutex?
[16:25:14] nofxx: has joined #ruby
[16:25:26] kham1: has joined #ruby
[16:25:45] jevs: And side note: Fibers probably aren???t as complicated as you think they are :) They don???t get used often but it???s a good tool
[16:26:35] Exuma: has joined #ruby
[16:27:09] failshell: has joined #ruby
[16:28:35] heftig: was there a Hash method that stores a new value and returns the old one?
[16:29:15] yokel: has joined #ruby
[16:29:16] quimrstorres: has joined #ruby
[16:29:40] havenwood: nateberkopec: But you'd have to synchronize around everything. In this example the 0.1 seconds is just to give the Thread a chance to acquire the lock: @mutex = Mutex.new; Thread.new { @mutex.synchronize { sleep 10 } }; sleep 0.1; @mutex.synchronize { puts 'finally!' }
[16:29:44] Antiarc: nateberkopec: Are you trying to measure the imapct of the GVL?
[16:30:00] havenwood: nateberkopec: Yeah, say more about what you're doing! :)
[16:30:12] DEA7TH_: has joined #ruby
[16:30:35] havenwood: And Mutex isn't reentrant, Monitor if you need that.
[16:30:50] Antiarc: (monitor's also 2x slower than mutex, don't use it unless you absolutely have to)
[16:31:08] polyrob: has joined #ruby
[16:31:21] jhass: heftig: doesn't seems so, gotta foo[key].tap { foo[key] = value }
[16:31:21] nateberkopec: havenwood: ooooh yeah, that looks like more of what I'm thinking
[16:31:36] Mia: has joined #ruby
[16:31:50] benlieb: has joined #ruby
[16:31:55] Alayde: has joined #ruby
[16:32:12] havenwood: nateberkopec: I'm still suspicious you should be using Fibers but I'm totally unclear on what you're doing. ;)
[16:32:17] lostcuaz: has joined #ruby
[16:32:28] nateberkopec: I basically want to bench/show the differences between Rack servers in different situations. So I want a rack app thats basically simulating doing real work for 100ms or so. sleep() is valuable because it will simulate I/O (going to the db) or whatever, but most rack server responses also usually involve a lot of blocking work.
[16:33:24] Antiarc: Personally I'd just run a loop for X seconds ;)
[16:33:26] mikecmpbll: has joined #ruby
[16:33:40] nateberkopec: Antiarc: d'oh, yeah that's a lot easier.
[16:33:54] baweaver: has joined #ruby
[16:34:15] nateberkopec: while Time.now < time_100_ms_from_now
[16:34:33] lostcuaz: has joined #ruby
[16:34:35] whiteline: has joined #ruby
[16:34:43] Antiarc: I'd just write a little helper function that does it, then work_for(10) or whatever
[16:34:44] adaedra: isn't it what sleep is for?
[16:34:50] Antiarc: sleep yields the thread
[16:35:04] nateberkopec: yeah, I don't want to yield the thread.
[16:35:23] Antiarc: The scheduler will run other threads while that thread is slept; I think nateberkopec is trying to simulate performance during concurrent compute-heavy requests
[16:35:26] jpfuentes2: has joined #ruby
[16:35:33] nateberkopec: Antiarc: bingooo
[16:35:45] Antiarc: Which is particularly important given the GVL; sleep will produce better concurrency numbers than you could get under actual CPU load
[16:35:51] bahar: has joined #ruby
[16:36:33] rideh: has joined #ruby
[16:36:34] konsolebox: has joined #ruby
[16:37:29] yeticry: has joined #ruby
[16:37:38] AlexAltea: has joined #ruby
[16:37:58] werelivinginthef: has joined #ruby
[16:38:27] havenwood: nateberkopec: An aside: Thread.new { Thread.exclusive { sleep 10 } }; sleep 0.1; Thread.exclusive { puts 'finally!' }
[16:38:40] devbug: has joined #ruby
[16:39:12] havenwood: http://ruby-doc.org/core/Thread.html#method-c-exclusive
[16:40:04] r0nin: has joined #ruby
[16:40:07] vlad_starkov: has joined #ruby
[16:40:23] foureight84: has joined #ruby
[16:41:07] dfinninger: has joined #ruby
[16:41:24] vlad_starkov: Question: Hi! Could someone explain me in "a few words" why I'd need to use ConditionVariable with Mutex, and when I should apply Queue? Thanks.
[16:41:52] pengin: has joined #ruby
[16:42:04] gambl0re: has joined #ruby
[16:42:05] Antiarc: ConditionVariable objects augment class Mutex. Using condition variables, it is possible to suspend while in the middle of a critical section until a resource becomes available.
[16:42:26] jhass: vlad_starkov: no that's impossible. Both constructs have a wide range of applications and are not excluding each other
[16:42:31] Antiarc: Queue is basically a thread array-style data structure that is guaranteed to be synchronized across threads
[16:42:52] Antiarc: If you want to pass messages between threads without explicitly managing mutexes, Queue is a great way to do it
[16:42:52] jhass: note that Queue is implemented using Mutex and ConditionVariable even
[16:42:55] pietr0: has joined #ruby
[16:43:03] vlad_starkov: jhass: this is something, at least
[16:43:08] Rubie: has joined #ruby
[16:43:46] arturmartins: has joined #ruby
[16:43:47] havenwood: vlad_starkov: Queue is first-in, first-out.
[16:44:06] vlad_starkov: havenwood: right
[16:44:20] Antiarc: vlad_starkov: Once you understand Queue, ConditionVariable is pretty self-explanatory. CV is basically just a queue of things that want a resource, and #signal tells the caller at the head of the queue that they can have the resource
[16:44:31] chouhoul_: has joined #ruby
[16:44:47] vlad_starkov: Antiarc: do you know some real-world example where Queue would be useful?
[16:45:01] Antiarc: vlad_starkov: Resource pools
[16:45:12] havenwood: vlad_starkov: So a first-in, first-out queue to synch between Threads.
[16:45:23] Exuma: has joined #ruby
[16:45:38] Antiarc: conn_pool = Queue.new; conn_pool.push(new_connection); checked_out_connection = conn_pool.deq;
[16:46:01] Axy: has joined #ruby
[16:46:04] Antiarc: Once you're done with the connection, conn_pool.push(conn) to check it back into the queue so another thread could take it
[16:46:30] vlad_starkov: Do you guys use Threads in your daily programming? Is TDD doable when you use Threads?
[16:46:46] Antiarc: Queue is also nice if you're using the Actor pattern, since it gives you a trivial way to implement mailboxes
[16:46:46] jhass: havenwood: uh, Queue implements #shift, #pop, #unshift and #push, no?
[16:46:50] Antiarc: Yes and yes
[16:47:06] Antiarc: jhass: it "implements" pop but it's just an alias to shift/deq
[16:47:09] Antiarc: It's a true queue
[16:47:14] jhass: oh, no #unshift
[16:47:16] Antiarc: You can't pop off the tail of the queue
[16:47:21] havenwood: no unshift, yeah
[16:47:30] jhass: but #pop and #shift
[16:47:32] havenwood: << clear deq empty? enq length marshal_dump num_waiting pop push shift size
[16:47:35] jhass: so you can use it both ways
[16:47:42] Antiarc: You can't use it both ways, you just think you can :)
[16:47:46] Antiarc: It's always FILO
[16:47:49] ledestin: has joined #ruby
[16:47:56] endash: has joined #ruby
[16:48:23] benlovell: has joined #ruby
[16:48:40] havenwood: And you can't dup it. Grr.
[16:48:45] Maletor: has joined #ruby
[16:48:48] vlad_starkov: So to the Ruby 2.2.2 the threads a still not "native threads"? https://1-ps.googleusercontent.com/sk/bYSmB63yuhjL_l7bPRuu4R3ENi/www.igvita.com/posts/08/xruby-gil.png.pagespeed.ic.-dXoCiaooUx9G-iA68rM.png
[16:49:06] jhass: ugh, shift is aliased to pop
[16:49:09] jhass: how nasty
[16:49:13] Antiarc: >> q = Queue.new; 4.times {|i| q << i }; [q.pop, q.deq, q.shift]
[16:49:14] ruboto: Antiarc # => [0, 1, 2] (https://eval.in/400713)
[16:49:20] n008f4g_: has joined #ruby
[16:49:28] Antiarc: If any of those hit the tail of the queue there would be a 3 in there :)
[16:49:50] havenwood: Tail should be Infinity.
[16:49:54] jhass: yeah, I didn't think they'd make shift and pop aliases
[16:50:27] DoubleMalt: has joined #ruby
[16:50:32] Antiarc: It's certainly incorrect from a technical perspective. But it doesn't bother me too much
[16:50:41] Mia: has joined #ruby
[16:51:05] cytoskeletor: has joined #ruby
[16:51:08] havenwood: vlad_starkov: A native OS Thread
[16:51:39] Antiarc: Threads are native threads in 2.2.2, but there is still a GVL
[16:51:43] Jackneill: has joined #ruby
[16:51:54] Antiarc: We haven't had green threads since...the end of the 1.8 series?
[16:52:10] havenwood: native since 1.9, and Fibers introduced
[16:52:56] segfalt: has joined #ruby
[16:53:06] jhn: has joined #ruby
[16:53:13] havenwood: vlad_starkov: Here's the series of articles I usually link to about the GIL (or GVL as it's called now that there's a VM): http://www.jstorimer.com/blogs/workingwithcode/8085491-nobody-understands-the-gil
[16:53:57] benlovell: has joined #ruby
[16:54:30] goundamani: has joined #ruby
[16:54:31] havenwood: vlad_starkov: TDD is not easy with threading.
[16:54:34] Shidash: has joined #ruby
[16:54:49] jobewan: has joined #ruby
[16:54:56] havenwood: vlad_starkov: I like the JRuby concurrency basics rules :) https://github.com/jruby/jruby/wiki/Concurrency-in-jruby#concurrency-basics
[16:55:17] paulcsmith: has joined #ruby
[16:55:39] DEA7TH_: has joined #ruby
[16:56:29] vlad_starkov: havenwood: that's what I was talking about when asked about TDD
[16:56:41] edwinvdgraaf: has joined #ruby
[16:57:54] Polysics: has joined #ruby
[16:58:22] havenwood: vlad_starkov: We don't have something like Erlang's Concuerror: http://concuerror.com/
[16:58:32] havenwood: But which langs do?
[16:58:43] malconis: has joined #ruby
[16:58:50] Kalov: has joined #ruby
[17:00:04] fabrice31: has joined #ruby
[17:00:34] volsus: has joined #ruby
[17:00:39] havenwood: I guess JVM.
[17:00:53] havenwood: So JRuby does have it, I eat my words.
[17:01:38] havenwood: http://babelfish.arc.nasa.gov/trac/jpf/wiki/projects/start
[17:01:48] vlad_starkov: havenwood: Erlang is a bit OMG thing (I tried it in RabbitMQ console to setup RabbitMQ cluster)
[17:02:27] peter_paule: has joined #ruby
[17:02:42] relix: has joined #ruby
[17:02:56] havenwood: I want to try jpf-concurrent with ruby-concurrent on JRuby now...
[17:04:36] lala: has joined #ruby
[17:05:21] DEA7TH_: has joined #ruby
[17:05:46] Antiarc: havenwood: ooooooh
[17:06:37] cochise: has joined #ruby
[17:06:53] mikeric: has joined #ruby
[17:07:31] momomomomo: has joined #ruby
[17:08:35] pengin: has joined #ruby
[17:09:49] Antiarc: vlad_starkov: erlang's syntax is brainbending, but you might check out elixir - it's erlang with a rubyish syntax and it's nice :)
[17:10:10] Antiarc: (It's not *exactly* erlang but you can call erlang from it and it runs in the erlang VM)
[17:10:14] maletor_: has joined #ruby
[17:10:47] sofija: has joined #ruby
[17:11:55] htmldrum: has joined #ruby
[17:12:59] lotherk: has joined #ruby
[17:13:42] mike___1234: has joined #ruby
[17:14:34] tvw: has joined #ruby
[17:15:19] B1n4r10: has joined #ruby
[17:15:45] nofxx: return unless v.respond_to?(:/) it'll return unless v responds to bad humour?
[17:16:50] tAn: has joined #ruby
[17:17:02] havenwood: Speaking of Elixir and ruby-concurrent on JRuby, this second example on JRuby is a ThreadPoolExecutor sized to the number of cores plus two: https://github.com/havenwood/elixir.rb#examples
[17:17:31] havenwood: Antiarc: Implementing Elixir stdlib in Ruby is a good excuse to play with concurrent-ruby. ;)
[17:18:35] Antiarc: havenwood: why plus two?
[17:19:04] havenwood: Antiarc: Just copying Elixir/Erlang default async-threads.
[17:19:18] Antiarc: (also: Having direct access to executors in Ruby is easily one of my favorite JRuby perks)
[17:19:25] havenwood: Antiarc: \o/
[17:19:38] Antiarc: class Foo; include Callable; def call; ...
[17:19:41] Antiarc: That is just so frickin' nice
[17:19:52] davejlong: has joined #ruby
[17:20:16] vlad_starkov: Just found this high-level introduction to ruby threads https://www.igvita.com/2008/11/13/concurrency-is-a-myth-in-ruby/
[17:20:17] allomov: has joined #ruby
[17:21:22] vlad_starkov: Antiarc: So now I get the idea what was that magic book on PragProg )
[17:21:43] Antiarc: That diagram isn't correct AFAIK; 1.9+ and JRuby do not have green threads. The OS does the thread scheduling
[17:21:51] Antiarc: But otherwise it's a good article
[17:22:07] Centrixx: has joined #ruby
[17:22:21] vlad_starkov: Antiarc: but we still have GIL
[17:22:33] Antiarc: In MRI, yes. No GIL in JRuby or RBX
[17:22:52] Antiarc: (If you want to use all your cores in one Ruby process, JRuby FTW)
[17:22:58] umgrosscol: has joined #ruby
[17:23:15] radialneon: has joined #ruby
[17:23:32] psye: has joined #ruby
[17:24:42] psye: has joined #ruby
[17:24:51] ruby-lang206: has joined #ruby
[17:25:11] havenwood: ruby-lang206: hi
[17:25:28] ruby-lang206: any cool open source projects
[17:25:37] theery: has joined #ruby
[17:25:51] Antiarc: https://github.com/rails/rails looks kind of interesting
[17:25:55] Exuma: has joined #ruby
[17:25:55] djbkd: has joined #ruby
[17:26:50] havenwood: ruby-lang206: There are lots. What are you looking for.
[17:27:12] lotherk: has joined #ruby
[17:27:26] quimrstorres: has joined #ruby
[17:27:29] codecop: has joined #ruby
[17:27:36] ruby-lang206: im a biologist
[17:27:48] peter_paule: has joined #ruby
[17:27:53] ruby-lang206: so something not biology related
[17:27:54] havenwood: ruby-lang206: http://www.bioruby.org/
[17:28:12] havenwood: ruby-lang206: Here's what I have in open tabs: https://github.com/epitron/upm
[17:28:14] ruby-lang206: i like that project btw
[17:28:31] havenwood: i don't have any other tabs open, that wasn't much
[17:28:50] havenwood: ruby-lang206: So what other than not bio-related?
[17:29:48] bluOxigen: has joined #ruby
[17:29:52] havenwood: ruby-lang206: Here's a great codebase to read: https://github.com/jeremyevans/roda
[17:30:06] sarkyniin: has joined #ruby
[17:30:09] rbennacer: has joined #ruby
[17:30:21] BTRE: has joined #ruby
[17:30:59] shevy: ruby-lang206 have a look at #bioinformatics too; as for biology, bioruby exists but it is not of really great quality IMHO. go get into ruby and contribute \o/
[17:31:17] ironcamel: has joined #ruby
[17:31:18] ChasedSpade: has joined #ruby
[17:31:22] yokel: has joined #ruby
[17:31:30] shevy: oh epitron... wasn't he an IRC user too?
[17:31:52] ironcamel: i need to upgrade ruby system wide from 1.9 to the latest ruby. what is the recommended way to do that?
[17:31:59] ironcamel: this is an ubuntu box if that matters
[17:32:02] r0nin: has joined #ruby
[17:32:06] Antiarc: IMO the best way to find new projects to work on is to work on a project interesting to you, and as you start using libraries, fix/improve them, or write your own if the incumbents are insufficient :)
[17:32:09] ruby-lang206: thanks @Havenwood @shelly
[17:32:15] havenwood: ironcamel: https://www.brightbox.com/docs/ruby/ubuntu/
[17:32:47] Antiarc: I like http://www.codetriage.com/ if you're just looking for someone to do though
[17:32:53] diego85: has joined #ruby
[17:33:03] ironcamel: thanks havenwood
[17:33:04] postmodern: has joined #ruby
[17:33:12] havenwood: ironcamel: you're welcome
[17:33:14] Antiarc: Find projects with lots of outstanding tickets, browse tickets until you find one you can work on, try to fix it, sumit a PR, repeat!
[17:33:45] ruby-lang206: u guys are like developers for developers type open source
[17:34:05] r0nin: has joined #ruby
[17:34:38] havenwood: ruby-lang206: are open developers type u source for developers like guys
[17:35:17] ruby-lang206: @antiarc I really like that link you just sent
[17:35:22] bungoman: has joined #ruby
[17:35:23] ruby-lang206: very cool stuff there
[17:35:27] havenwood: I still don't understand after shuffling.
[17:35:43] Antiarc: Yeah, it's nice if you don't know where to start
[17:36:16] ruby-lang206: thats why i like it
[17:36:50] havenwood: shevy: yeah, still is just not here atm
[17:37:00] arup_r: ljarvis, Problem is with Rails autload feature.. something wrong is going on I asked ror channel that. Here just inform you, as my custom Data class didn't load, constant look up loaded the Ruby core Data and I got the earlier error.. Just to FYI
[17:37:04] hj2007: has joined #ruby
[17:37:06] howdoi: has joined #ruby
[17:37:07] bcavileer: has joined #ruby
[17:37:08] ruby-lang206: im a self taught developer. and very barely decent. I'm trying to build the mindset needed to win at what I'm doing
[17:37:12] lancetw: has joined #ruby
[17:37:13] dede: has joined #ruby
[17:37:14] im0b: has joined #ruby
[17:37:26] dmoe: has joined #ruby
[17:38:01] ruby-lang206: before i go even more hardcore and work on building package managers for open source.
[17:38:02] Antiarc: arup_r: autoload works on missing constants. If the constant is defined autoload won't kick in; explicitly load your files in those cases
[17:38:08] Antiarc: (IMO, always explicitly load anyhow)
[17:38:10] danzilio: has joined #ruby
[17:38:25] shevy: ruby-lang206 same description counts for me too btw, I also studied biology (or actually, molecular genetics to be more precise). I never was and never will be a "programmer", I just like ruby
[17:38:33] Kully3xf_: has joined #ruby
[17:38:35] havenwood: shevy: you're nto a programmer?
[17:38:52] Antiarc: ruby-lang206: contributing to a project is a great way to get better. I'd pick a project that interests you and really dig deep into that rather than just floating around between projects
[17:38:53] havenwood: shevy: if you program...
[17:39:10] jlyndon: has joined #ruby
[17:39:15] shevy: I write poetry
[17:39:21] havenwood: shevy: poet and programmer
[17:39:22] ruby-lang206: @Antiarc i appreciate that a lot
[17:39:29] Antiarc: shevy: it just happens to be executable poetry? :)
[17:39:44] baweaver: has joined #ruby
[17:39:50] shevy: well interpreted... I think the biggest I compile self-written was hello_world.c
[17:39:57] blaines: has joined #ruby
[17:40:03] ruby-lang206: i just recently had to mimic alchemy cms abstract content storage
[17:40:09] pizzaops: has joined #ruby
[17:40:17] shevy: what is alchemy cms
[17:40:23] yardenbar: has joined #ruby
[17:40:25] bluOxigen: has joined #ruby
[17:40:36] nofxx: Is there this joke in your language? In portuguese a programmer get paid for a 'program', hookers also get paid for a 'program'. So here if you say you do 'programs' for money it's a funny joke
[17:40:39] bronson: has joined #ruby
[17:41:04] Antiarc: nofxx: "program" doesn't really have any naughty connotation in English, no
[17:41:16] ruby-lang206: an open source CMS for you to allow non developers to update their sites on the fly
[17:42:53] nofxx: Antiarc, that confirms english. From my poor spanish I think thre's not either. Maybe another latin tongue, italian or french perhaps.
[17:43:04] goodcodeguy: has joined #ruby
[17:43:31] phat4life: has joined #ruby
[17:43:58] hj2007: has joined #ruby
[17:44:33] stczhc: has joined #ruby
[17:44:47] pengin: has joined #ruby
[17:45:11] stczhc: has left #ruby: ()
[17:45:36] nofxx: Antiarc, actually a bad old joke anyway, between programers one common reply was 'soft or firmware?' But 'firm' also has a naughy connotation here.
[17:45:48] nofxx: Yeah, we can find fun in a lot of words.
[17:45:49] Dreamer3: has joined #ruby
[17:46:03] hinbody: has joined #ruby
[17:46:06] Antiarc: nofxx: yeah, firm can have a naughty connotation in English. "Hard disk" and "floppy disk" in particular tend to be the source of many jokes.
[17:46:38] shevy: you naughty people you
[17:46:39] Antiarc: (granted, floppies aren't a thing anymore, but still)
[17:47:03] apt-get_: has joined #ruby
[17:47:03] hinbody: has joined #ruby
[17:47:08] stczhv: has joined #ruby
[17:47:12] volsus: ive heard of 'fsck' used in colorful ways
[17:47:40] Antiarc: the whole gnu toolchain can be naughty if you work hard enough
[17:48:03] shevy: "if you work hard enough"
[17:48:05] shevy: he never stops!
[17:48:20] GhettoCode: has joined #ruby
[17:48:26] stczhv: has joined #ruby
[17:48:46] nofxx: What would be of like w/o some fun and jokery. I'm 100% with epicurus
[17:48:53] dfinninger: has joined #ruby
[17:49:37] nofxx: well, we are here and not in java, so we share the same idea
[17:49:59] paulcsmith: has joined #ruby
[17:50:28] mikeric: has joined #ruby
[17:51:12] Antiarc: Hey now, I'm also in #jruby :)
[17:51:30] Kyhz: has joined #ruby
[17:54:04] devbug: has joined #ruby
[17:54:37] ramfjord: has joined #ruby
[17:54:58] r0nin_: has joined #ruby
[17:55:19] shevy: you have fallen to the dark side
[17:55:50] Antiarc: jruby's awesome! I like the JVM, and Java honestly isn't *horrible* as long as you have an IDE to do most of your typing for you :)
[17:55:50] graydot: has joined #ruby
[17:56:08] Antiarc: (though if I had my preferences I'd write in C# over Java anyday)
[17:56:47] prestorium: has joined #ruby
[17:56:53] [k-: has joined #ruby
[17:57:03] shevy: this page also thinks that java is great http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
[17:57:29] Antiarc: It's certainly prolific
[17:57:46] dfinninger: has joined #ruby
[17:58:10] eggoez: has joined #ruby
[17:58:54] quimrstorres: has joined #ruby
[18:00:42] theRoUS: markdown-to-html-as-generated-by-yard question: i want to show "(n)" with the 'n' being emphasised (italic), but '(*n*)' ends up getting treated as a literal. the only workaround i've found is to use '( *n*)' but that's ugly..
[18:01:09] momomomomo: has joined #ruby
[18:01:51] dfinninger: has joined #ruby
[18:02:01] neanderslob: has joined #ruby
[18:02:30] duderonomy: has joined #ruby
[18:05:45] danzilio: has joined #ruby
[18:05:48] benlieb: has joined #ruby
[18:06:20] lotherk: has joined #ruby
[18:06:25] cochise: has joined #ruby
[18:07:30] momomomomo: has joined #ruby
[18:07:58] freerobby: has joined #ruby
[18:08:04] prefixed: what do I use to parse arguments in ruby?
[18:08:15] NeverDie: has joined #ruby
[18:08:49] Exuma: has joined #ruby
[18:09:51] rbennacer: has joined #ruby
[18:10:06] swgillespie: has joined #ruby
[18:10:14] paulcsmith: has joined #ruby
[18:10:20] benlieb: has joined #ruby
[18:10:24] JoshL: has joined #ruby
[18:10:43] charliesome: has joined #ruby
[18:11:05] davejlong: has joined #ruby
[18:11:57] Agoldfish: has joined #ruby
[18:12:40] Spami: has joined #ruby
[18:13:07] woodruffw: has joined #ruby
[18:13:33] Antiarc: command-line arguments? OptionParser is the stdlib way to do it
[18:13:53] prefixed: yes. do you have a tutorial for it? the documentation is kinda bad
[18:15:24] Antiarc: http://ruby-doc.org/stdlib-2.2.2/libdoc/optparse/rdoc/OptionParser.html is pretty comprehensive. What are you having problems with?
[18:15:42] weaksauce: has joined #ruby
[18:15:54] prefixed: what are the arguments for .on
[18:16:13] prefixed: what is this ) do |lib|... nonsense?
[18:16:33] jhass: prefixed: a block. Which ruby tutorial do you follow?
[18:16:48] prefixed: the API notes that it is possible to set args as required or optional. I don't see anything about that in the API example
[18:17:13] prefixed: i see, short flag, long flag, description
[18:17:13] benlieb: has joined #ruby
[18:17:14] pietr0: has joined #ruby
[18:17:44] Antiarc: "see make_switch for an explanation of options"
[18:17:49] Antiarc: http://ruby-doc.org/stdlib-2.2.2/libdoc/optparse/rdoc/OptionParser.html#method-i-make_switch
[18:18:05] yfeldblum: has joined #ruby
[18:18:11] Antiarc: which enumerates that you can specify :REQUIRED or :OPTIONAL as an option to #on()
[18:18:11] Spami: has joined #ruby
[18:19:07] prefixed: ok. could you show an example?
[18:19:37] t0rrieri: has joined #ruby
[18:19:53] edwinvdgraaf: has joined #ruby
[18:20:29] Antiarc: Look for the strings "mandatory argument" and "optional argument; multi-line description" in that page
[18:20:32] Antiarc: They have examples of both
[18:21:07] prefixed: the required one does not have a required flag
[18:21:10] prefixed: i do not understand
[18:21:20] Antiarc: Because it's using the 'long form' enumerated in make_switch
[18:21:31] Antiarc: "--require LIBRARY"
[18:21:36] prefixed: http://pastebin.com/Q6trYdT9
[18:21:37] ruboto: prefixed, we in #ruby do not like pastebin.com, I reposted your paste to gist for you: https://gist.github.com/518b76ef7366cf3e4d57
[18:21:37] ruboto: pastebin.com loads slowly for most, has ads which are distracting and has terrible formatting.
[18:21:41] danzilio: has joined #ruby
[18:21:41] Kully3xf: has joined #ruby
[18:21:45] Antiarc: "--switch=MANDATORY" or "--switch MANDATORY"
[18:21:45] Antiarc: "--switch[=OPTIONAL]"
[18:22:12] Antiarc: Note the brackets
[18:22:20] prefixed: what do the brackets mean in ruby?
[18:22:33] Antiarc: In optparse they mean an optional argument.
[18:22:40] prefixed: or did someone seriously just think that brackets would be good enough to denote optional?
[18:22:48] Antiarc: It's conventional in many docuemntation forms, as well
[18:23:04] Antiarc: Well, that's how you conventionally denote optional arguments basically everywhere
[18:23:11] Antiarc: So yeah, someone thought it was good enough for Ruby too
[18:23:13] prefixed: i'm not saying you're wrong, but i've never seen it
[18:23:22] adaedra: it's used by man pages
[18:23:52] Antiarc: man [-C file] [-d] [-D] [--warnings[=warnings]] [-R encoding] [-L locale] [-m system[,...]]
[18:24:05] Antiarc: Which tells you things like --warnings is an optional flag, which takes an optional argument
[18:24:16] Antiarc: -R is an optional flag which takes a required argument
[18:24:39] adaedra: So yeah, someone seriously just think that.
[18:25:56] TOAA: has joined #ruby
[18:26:08] prefixed: options.library << lib
[18:26:16] prefixed: what is this ^
[18:26:31] Antiarc: the argument passed to the block, lib, is going to be the value of the argument for that flag
[18:26:40] Antiarc: Then you handle it however you see fit inside the block
[18:27:59] Antiarc: So if you have a switch on("--flag=ARG") {|flag| ... }, and then you parse the call "./foo.rb --flag=bar", then in the block, the value of flag will be "bar"
[18:28:16] cochise: has joined #ruby
[18:28:29] Antiarc: It's just a method named <<. In an Array context, it's the push operator.
[18:28:32] r0nin: has joined #ruby
[18:28:44] Antiarc: Without knowing what options.library is though it's not possible to answer conclusively though
[18:29:00] adaedra: it's the same as options.library.<<(lib)
[18:29:13] adaedra: so it depends on how library defines <<
[18:29:28] adaedra: Array uses it as push, String as append
[18:30:12] pengin: has joined #ruby
[18:30:17] jackjackdripper: has joined #ruby
[18:30:36] baweaver: has joined #ruby
[18:30:50] Antiarc: >> class Foo; def <<(arg); puts "#{arg}: TO DA LEFT"; end; end; Foo.new << "prefixed"
[18:30:51] ruboto: Antiarc # => prefixed: TO DA LEFT ...check link for more (https://eval.in/400728)
[18:33:17] baweaver: has joined #ruby
[18:34:19] BTRE: has joined #ruby
[18:34:51] jhass: prefixed: I recommend you read a ruby tutorial, blocks and the push operator are basics covered by every single one I've seen
[18:34:55] thiagovsk: has joined #ruby
[18:37:15] ruby-lang841: has joined #ruby
[18:37:31] ruby-lang841: some ruby questions here
[18:37:35] TOAA: has joined #ruby
[18:38:09] ruby-lang841: what are the projects that i should keep on to learn fuby
[18:38:25] ngscheurich: has joined #ruby
[18:38:36] yqt: has joined #ruby
[18:38:43] ruby-lang841: what are the projects that i should keep on to learn ruby
[18:39:46] hololeap: has joined #ruby
[18:39:51] Ox0dea: ruby-lang841: What is your self-diagnosed proficiency in Ruby, 1 to 10?
[18:40:11] miwood: has joined #ruby
[18:40:46] jhass: valid answers include pi and tau
[18:41:00] rideh: has joined #ruby
[18:41:02] Ox0dea: There are in fact, doubly infinitely many potential answers.
[18:42:09] jhass: ruby-lang841: my go to advice is to reflect on your daily life and find things you do regulary (daily to weekly) that you could (partially) automate with Ruby
[18:42:18] jhass: solve a problem you actually have
[18:43:14] SaintMoriarty: has joined #ruby
[18:43:21] Ox0dea: Ya scared him.
[18:43:29] SaintMoriarty: Hi I am having an issue trying to access my assets and getting a 404
[18:43:30] jhass: not possible, count the seconds
[18:43:35] jhass: ?rails SaintMoriarty
[18:43:35] ruboto: SaintMoriarty, Please join #RubyOnRails for Rails questions. You need to be identified with NickServ, see /msg NickServ HELP
[18:44:21] bougyman: anyone know of a higher level elasticsearch lib that's not railsy?
[18:44:35] bougyman: was hoping something like Sequel had an adapter, but nay.
[18:44:42] Antiarc: I just use the elasticsearch gem with jbuilder
[18:44:49] bougyman: er hoping there was something like a sequel library for it.
[18:44:56] bougyman: yeah, i'm using jbuilder now.
[18:45:53] momomomomo: has joined #ruby
[18:46:32] Antiarc: I've taken a stab at building one a few times and keep finding that it's just a complex enough query langauge that an abstraction layer can't abstract too much
[18:46:59] bougyman: i feel like that's what i'm doing, here.
[18:47:02] _solomon: has joined #ruby
[18:47:13] bougyman: but i'm leaving out 90% of the stuff people won't use (in our use-case)
[18:47:14] krz: has joined #ruby
[18:47:18] brianpWins: has joined #ruby
[18:47:43] stczhc: has joined #ruby
[18:48:30] quimrstorres: has joined #ruby
[18:48:49] stczhc: has left #ruby: ()
[18:48:58] krzkrz: has joined #ruby
[18:49:33] jhack: has joined #ruby
[18:49:33] jhack: has joined #ruby
[18:50:43] serivich: has joined #ruby
[18:52:22] reset: has joined #ruby
[18:52:59] lyonsb: has joined #ruby
[18:53:13] lyonsb: has left #ruby: ("Konversation terminated!")
[18:56:20] Sheperson: has joined #ruby
[18:57:00] krzkrz: has joined #ruby
[18:57:38] baweaver: has joined #ruby
[18:58:02] ValicekB: has joined #ruby
[18:58:32] Fezzler: has joined #ruby
[18:58:43] pl1ght: has joined #ruby
[18:59:32] danzilio: has joined #ruby
[19:00:28] danzilio_: has joined #ruby
[19:00:35] last_staff: has joined #ruby
[19:00:37] bruno-: has joined #ruby
[19:00:53] fabrice31: has joined #ruby
[19:01:38] bungoman: has joined #ruby
[19:02:13] bricker: has joined #ruby
[19:02:14] allomov: has joined #ruby
[19:02:15] xkef: has joined #ruby
[19:02:45] krzkrz: has joined #ruby
[19:05:16] pengin: has joined #ruby
[19:05:33] toretore: bougyman: i too am mostly just building json manually and find that it's usually the right level of abstraction already
[19:05:57] toretore: i use tire, but find it limiting
[19:06:00] bougyman: toretore: I was hoping to not have to teach everyone the ES query dsl.
[19:06:05] ndrei: has joined #ruby
[19:06:11] ndrei_: has joined #ruby
[19:06:12] bougyman: at least for the basics.
[19:06:21] toretore: you kind of have to know it i think
[19:06:39] bougyman: bah, such a skeptic.
[19:07:08] prefixed: is it ok if i make my arguments globals?
[19:07:45] toretore: you can abstract away simple things like "search products for these attributes", but for generic abstractions the underlying structure will always bleed through
[19:07:53] prefixed: or is that a "bad, bad, no good" practice?
[19:07:55] toretore: prefixed: elaborate
[19:07:58] Zai00: has joined #ruby
[19:08:16] toretore: usually, anything that has to do with global state is automatically bad
[19:08:27] prefixed: my program takes some arguments. I want them to be accessable globally so I don't have to pass them into every method.
[19:09:05] toretore: google.com?q=global+state
[19:09:22] prefixed: why is it bad for arguments to be global?
[19:09:51] toretore: i guess you will just have to try it and learn the hard way
[19:09:57] jhass: prefixed: because they don't change. They're Constant
[19:10:55] kirun: has joined #ruby
[19:11:05] jhass: $globals are for global changing state, which is very very bad
[19:11:12] momomomomo: has joined #ruby
[19:11:32] jamesaxl: has joined #ruby
[19:11:34] toretore: as a general rule, you should never reach out of your current scope more than is absolutely necessary
[19:11:43] shevy: prefixed if you use many different .rb files written by many different authors, it may be quite likely that these global variables may clash with other global variables
[19:11:46] willywos: http://c2.com/cgi/wiki?GlobalVariablesAreBad
[19:11:47] krzkrz: has joined #ruby
[19:12:03] prefixed: fair enough
[19:12:22] shevy: you can store data inside of modules/classes and use defaults to achieve something very similar
[19:12:31] benlieb: has joined #ruby
[19:12:34] toretore: as for the why, it's just something you'll have to accept and trust the combined experience of thousands of developer years
[19:12:41] jonee: has joined #ruby
[19:12:52] shevy: class Foo; SOME_CONSTANT = 5 ... or class Foo; @foo = 5; def self.foo?; @foo <--- Foo.foo? <--- to access that variable
[19:13:33] prefixed: http://ruby-doc.org/stdlib-2.1.1/libdoc/optparse/rdoc/OptionParser.html
[19:13:34] baweaver: has joined #ruby
[19:14:08] toretore: shevy: though that's still the same thing, it's still global
[19:14:23] shevy: how is it global? it resides in Foo
[19:14:23] alphaatom: has joined #ruby
[19:14:27] arturmartins: has joined #ruby
[19:14:50] shadoi: has joined #ruby
[19:15:05] toretore: prefixed: your classes should take the arguments they need to function, and they should know absolutely nothing about arguments given to the program
[19:15:15] toretore: shevy: it's accessible from anywhere
[19:15:21] toretore: and mutable from anywhere
[19:15:31] Ox0dea: toretore: Like... everything else in Ruby?
[19:15:36] shevy: it is most definitely not a global
[19:15:46] prefixed: Why are the options in that example not assigned as OptparseExample fields?
[19:16:04] toretore: i didn't say it's "a" global, i said it's global
[19:16:22] toretore: there is no difference in their scope
[19:16:50] Ox0dea: toretore: The scope of that 5 in shevy's example is the Foo class.
[19:17:29] toretore: ok, scope is the wrong word, but it's accessible from *anywhere* in your program, just like a $global
[19:18:32] prefixed: this argument code seems dumb
[19:18:35] toretore: all the caveats that apply to a global variable apply just the same to an attribute on a class
[19:18:41] prefixed: why aren't the options instance variables?
[19:18:53] aspiers: has joined #ruby
[19:19:18] Ox0dea: toretore: He didn't define an attribute writer.
[19:19:23] toretore: prefixed: do you have any code you can share?
[19:19:25] Ox0dea: It's globally *mutable* state that tends to cause problems.
[19:19:26] mandarinkin: has joined #ruby
[19:19:38] prefixed: I'm looking at the example code
[19:19:45] prefixed: http://ruby-doc.org/stdlib-2.1.1/libdoc/optparse/rdoc/OptionParser.html
[19:20:11] toretore: prefixed: it's much easier to give advice on real code
[19:20:20] prefixed: toretore that's real code
[19:20:34] prefixed: in fact, the documentation explicitly states that it's real code
[19:20:38] willywos: is the argument about if a class constant the same as a global variable?
[19:20:42] toretore: Ox0dea: right, globally mutable state, which it is
[19:20:42] jpfuentes2: has joined #ruby
[19:21:04] toretore: prefixed: i mean your code
[19:21:07] Ox0dea: toretore: By way of #instance_variable_set, you mean?
[19:21:08] jhack: has joined #ruby
[19:21:16] prefixed: toretore I am using that code
[19:21:30] Ox0dea: willywos: No, a class instance variable.
[19:21:40] toretore: Ox0dea: oh you're talking about the def self.foo? sorry, i thought we were talking about the constant
[19:21:51] toretore: prefixed: for what?
[19:21:57] prefixed: parsing arguments
[19:22:04] prefixed: am i being trolled?
[19:22:11] prefixed: I'm using it to make a sandwidch
[19:22:26] Ox0dea: prefixed: There are better ways to do that.
[19:22:36] prefixed: ok. i thought so.
[19:22:53] prefixed: maybe someone should fix that
[19:23:02] Ox0dea: prefixed: Perhaps we'll be of more assistance now that we've gotten your XY problem out of the way.
[19:23:16] RatelDev: has joined #ruby
[19:23:18] Ox0dea: Which deli meats and/or cheeses are you in possession of at present?
[19:23:37] prefixed: I'm not really trying to make a sandwich
[19:23:44] Ox0dea: I don't believe you.
[19:23:51] willywos: you have to say sudo
[19:23:52] prefixed: I just had lunch. it was fantastic
[19:24:03] Ox0dea: prefixed: Did you eat Ruby code?
[19:24:13] prefixed: didn't even have to make it myself AND i had a pint alongside it
[19:24:27] toretore: prefixed: you're parsing arguments, but *then* what are you doing with them?
[19:25:13] toretore: the original question wasn't about *how* to parse arguments, it was what to do with them *after*, which is why i was asking to see your code
[19:25:29] podman: has joined #ruby
[19:25:55] prefixed: It's ok. I think i've got it from here. I prefer to only ask questions as a last resort.
[19:27:15] prefixed: here's a useful style question though: is it useful to write self.somemethod, or should i just skip the self
[19:27:54] arup_r: I have included the module of errors still getting name error https://gist.github.com/aruprakshit/f3887ad573c5c9f7620f#file-consoe-rb-L6
[19:28:07] toretore: prefixed: that's not a style question, it's two different things altogether
[19:29:00] _ixti_: has joined #ruby
[19:29:28] alphaatom: has joined #ruby
[19:30:04] bruno-: has joined #ruby
[19:31:20] kfpratt: has joined #ruby
[19:31:37] jud: has joined #ruby
[19:31:41] davedev24: has joined #ruby
[19:32:04] RatelDev: has joined #ruby
[19:32:12] shinnya: has joined #ruby
[19:32:15] Ox0dea: prefixed: Implicit `self` is "the Ruby way".
[19:32:27] Ox0dea: You only ever need an explicit self for syntactic disambiguation.
[19:32:33] Ox0dea: You have to say `self.class`, for instance.
[19:32:37] alphaatom: has joined #ruby
[19:32:54] Ox0dea: `self[foo]` is another common case.
[19:33:10] circ-user-uf50s: has joined #ruby
[19:33:35] Antiarc: self.foo can also be used to call a foo instance method when a local variable named foo exists, too
[19:33:49] apeiros: and self.writer=
[19:34:10] Ox0dea: apeiros: writer=() works, though.
[19:34:47] apeiros: I don't think so?
[19:34:49] apeiros: ACTION checks
[19:35:01] symm-: has joined #ruby
[19:35:09] Ox0dea: Nope, I was wrong. :/
[19:35:12] toretore: unless there's a "def " in front
[19:35:13] Ox0dea: It totally should, though?
[19:35:15] Hanmac: has joined #ruby
[19:35:32] apeiros: because () is just interpreted as expression grouping
[19:35:36] dfinninger: has joined #ruby
[19:35:44] krzkrz: has joined #ruby
[19:35:45] apeiros: a = (1 + 2) # valid
[19:35:59] RatelDev: has joined #ruby
[19:36:13] arup_r: moving the question to RoR
[19:37:06] bricker: has joined #ruby
[19:37:15] Ox0dea: apeiros: Um, is it not possible to call foo= methods with multiple arguments?
[19:37:30] apeiros: 1+2 is still a single argument :)
[19:37:33] RatelDev: has joined #ruby
[19:37:38] yokel: has joined #ruby
[19:37:56] apeiros: well, actually it is possible, but only via send I think.
[19:38:05] RatelDev: has joined #ruby
[19:38:07] apeiros: normal syntax uses parallel assignment
[19:38:15] toretore: >> class Moo; def foo=(v); 'foo'; end; def bar; foo=(1); end; end; Moo.new.bar
[19:38:16] ruboto: toretore # => 1 (https://eval.in/400784)
[19:38:19] arup_r: one day I will hide my nickname too
[19:38:27] n008f4g_: has joined #ruby
[19:38:30] RatelDev: has joined #ruby
[19:38:34] apeiros: x.foo, x.bar, x.baz = 1, 2, 3 # will call foo=/bar=/baz= iirc
[19:39:23] apeiros: toretore: foo= methods always return rhs when called normally ;-)
[19:39:27] chamila: has joined #ruby
[19:39:28] apeiros: you'd have to use puts/p
[19:40:15] Scripore: has joined #ruby
[19:40:37] schaerli: has joined #ruby
[19:40:39] Ox0dea: >> def self.foo=(*); 42 end; self.foo=('wtf')
[19:40:41] ruboto: Ox0dea # => "wtf" (https://eval.in/400785)
[19:40:50] chamila: Hi all, I'm very new for C ruby , I want to know what happens in "T_STRING == rb_type(input)"?
[19:41:08] Ox0dea: chamila: It's checking whether input is of type String.
[19:41:10] toretore: >> class Moo; def foo=(v); 'foo'; end; def bar; p foo=(1); end; end; Moo.new.bar
[19:41:12] ruboto: toretore # => 1 ...check link for more (https://eval.in/400786)
[19:41:30] toretore: i was just demonstrating that it will indeed call self.foo=
[19:41:32] yardenbar: has joined #ruby
[19:41:34] bodzio: has joined #ruby
[19:41:50] chamila: 0x0dea: T_STRING stands for String?
[19:41:50] Ox0dea: toretore: It didn't, though. :P
[19:41:55] Ox0dea: chamila: Yes.
[19:42:13] toretore: nm, i'm an idiot
[19:42:13] chamila: 0x0dea: oh okay, thanks
[19:42:16] Ox0dea: toretore: Well, it did call it, but the return value is... surprising, to say the least.
[19:42:36] toretore: it doesn't actually call it
[19:42:55] Ox0dea: Erm, not without an explicit self, no.
[19:43:22] apeiros: the riddle of ruby's writer methods :D
[19:43:45] toretore: yeah apeiros had it right all along
[19:43:51] BeatNick_: has joined #ruby
[19:44:03] Ox0dea: We should've known.
[19:44:05] apeiros: you doubted that?!?
[19:44:07] Antiarc: yeah, there's no way for ruby to know if you want to set a localvar or call a method there
[19:44:10] Antiarc: so it opts for the tightest scope
[19:44:11] apeiros: pffsssshhh??? :D
[19:44:17] Ox0dea: Antiarc: Makes perfect sense.
[19:44:21] toretore: i'm a skeptic :P
[19:44:24] Ox0dea: Related: https://bugs.ruby-lang.org/issues/11326
[19:45:02] apeiros: Ox0dea: oh, wow, lol
[19:45:08] toretore: >> class Moo; def setFoo(v); 'foo'; end; def bar; setFoo(1); end; end; Moo.new.bar
[19:45:09] ruboto: toretore # => "foo" (https://eval.in/400787)
[19:45:14] Antiarc: (Imagine if you had a foo = val variable set in a method, and then later added a foo=() writer to the object, and your methods that used the localvar started breaking)
[19:45:18] Ox0dea: toretore: Needs more Java.
[19:45:25] jhack32: has joined #ruby
[19:45:56] apeiros: toretore: no MooFactory?
[19:46:03] apeiros: no MooBean?
[19:46:28] Antiarc: IMooFactoryProviderFactory
[19:46:47] Ox0dea: Yeah, I was gonna mention that Java class names are required to be greater than twenty characters in length.
[19:47:54] paulcsmith: has joined #ruby
[19:48:17] eGGsha: has joined #ruby
[19:48:30] drewdavis: has joined #ruby
[19:49:04] SegFaultAX: has joined #ruby
[19:50:27] Igorshp: has joined #ruby
[19:51:00] theery: has joined #ruby
[19:52:36] devbug: has joined #ruby
[19:53:48] RatelDev: has joined #ruby
[19:53:52] shevy: you get paid for verbosity!
[19:53:56] marr: has joined #ruby
[19:54:07] benlovell: has joined #ruby
[19:54:38] RatelDev: has joined #ruby
[19:55:07] eggoez: has joined #ruby
[19:55:38] RatelDev: has joined #ruby
[19:57:01] toretore: pay = wc -c **/*
[19:57:56] RatelDev: has joined #ruby
[19:59:17] RatelDev_: has joined #ruby
[20:00:13] RatelDev: has joined #ruby
[20:01:11] RatelDev_: has joined #ruby
[20:01:45] RatelDev: has joined #ruby
[20:02:31] casadei_: has joined #ruby
[20:03:01] huddy: has joined #ruby
[20:03:46] RatelDev: has joined #ruby
[20:05:03] kidoz_: has joined #ruby
[20:05:16] RatelDev: has joined #ruby
[20:06:40] bungoman: has joined #ruby
[20:07:37] bungoman: has joined #ruby
[20:07:53] zacstewart: has joined #ruby
[20:09:34] mike___1234: has joined #ruby
[20:12:00] benlieb: has joined #ruby
[20:13:30] xkickflip: has joined #ruby
[20:13:41] ngscheurich: has joined #ruby
[20:15:53] dopie: has joined #ruby
[20:16:06] arup_r: why subclss === superclass is false ? That's causing somewhere else a huge problem ? https://gist.github.com/aruprakshit/1c283bf3918ef1cc0231
[20:16:31] k3asd`: has joined #ruby
[20:17:02] bertro: has joined #ruby
[20:17:37] vdamewood: has joined #ruby
[20:18:20] baweaver: has joined #ruby
[20:18:40] t0rrieri: has joined #ruby
[20:18:53] Ox0dea: arup_r: Other way around.
[20:19:21] Maletor: has joined #ruby
[20:19:30] Ox0dea: `sub === super` is not going to do what you think it might.
[20:19:32] chouhoulis: has joined #ruby
[20:19:35] Ox0dea: Try `super === sub`.
[20:20:17] arup_r: both I did.. and getting false.. which is not trustble
[20:20:29] nofxx: There's #superclass, or Parent < Child
[20:20:38] pandaant: has joined #ruby
[20:20:43] arup_r: https://gist.github.com/aruprakshit/1c283bf3918ef1cc0231#file-irb-L3
[20:20:46] Antiarc: are you comparing classes or instances of classes?
[20:20:52] nofxx: need this once, found a stack let me see
[20:21:05] nofxx: yeah... http://stackoverflow.com/questions/4545518/test-whether-a-ruby-class-is-a-subclass-of-another-class
[20:21:13] adaedra: What are you trying to do in the first place, arup_r ?
[20:21:32] adaedra: Leave === to case
[20:21:35] arup_r: I am not comparing.. but due to the fact my rescue is not being able to catch the error that's the actual problem
[20:21:51] davedev24: has joined #ruby
[20:21:51] wallerdev: has joined #ruby
[20:22:08] Antiarc: How areyou rescuing?
[20:22:20] adaedra: yeah, show us the throw/resuce
[20:22:24] arup_r: adaedra, due to the fact I am not able to do rescuing I guess https://gist.github.com/aruprakshit/45681f6e942dcad5a82d
[20:22:29] swgillespie: has joined #ruby
[20:22:45] k3asd`: has joined #ruby
[20:22:59] arup_r: I tried to handle it here https://gist.github.com/aruprakshit/45681f6e942dcad5a82d#file-payments_controller-rb-L32
[20:23:04] arup_r: but it couldn
[20:23:21] arup_r: No idea why.. that's why I was inspecting
[20:23:31] arup_r: but my inspection is suspicious
[20:23:35] _blizzy_: has joined #ruby
[20:23:57] miwood_: has joined #ruby
[20:24:06] adaedra: the stack show that the exception come from outside the resuced block
[20:24:11] SCHAAP137: has joined #ruby
[20:24:31] arup_r: yes from here https://gist.github.com/aruprakshit/45681f6e942dcad5a82d#file-terminal_settings-rb-L24
[20:25:31] nofxx: hey this looks intersting, anyone tryed? https://github.com/manastech/crystal
[20:25:46] adaedra: I'm missing some of the stack code
[20:26:01] adaedra: nofxx: you must be new here
[20:26:24] arup_r: Yes.. I didn't give,, I thought that is not needed.. Bcoz I show the code which is raising
[20:26:26] rbowlby: has joined #ruby
[20:26:45] havenwood: nofxx: It's very nice. There's a #crystal-lang channel too if you didn't know.
[20:26:45] jhass: nofxx: we got an IRC channel too, #crystal-lang ;)
[20:27:00] nofxx: adaedra, well, I'm in the old ruby-lang for years, but been away for months
[20:27:10] adaedra: arup_r: exception go up to https://gist.github.com/aruprakshit/45681f6e942dcad5a82d#file-payments_controller-rb-L16, which is outside of rescue scope
[20:27:14] nofxx: jhass, nice, gonna give it a spin =D
[20:27:40] adaedra: except if you rescue it in the hidden code
[20:28:00] arup_r: No man.. Let me add the class then one min
[20:28:44] arup_r: adaedra, added
[20:29:20] adaedra: But if you want your throw to be caught by the rescue l.32, you have to move your E24PaymentPipe.new after the begin
[20:29:40] adaedra: the rescue will only catch what happens between l30 and 31
[20:29:49] arup_r: Oopss!!!!!!! Yup
[20:30:17] drewvans1one: has joined #ruby
[20:30:24] quimrstorres: has joined #ruby
[20:30:40] lxsameer: has joined #ruby
[20:31:03] endash: has joined #ruby
[20:32:48] prefixed: yo. so let's say i'm using OptionParser and have a flag, -f, which is supposed to represent a file name. Can I run the script as follows: ./myscript.rb -f somefile.txt ?
[20:33:52] mikeric: has joined #ruby
[20:34:59] douglasssss: has joined #ruby
[20:35:16] adaedra: arup_r: also note that Module#=== takes an instance as argument ??? and if you want to test if an object is of a type, Object#is_a? is more appropriate.
[20:35:31] MagePsycho: has joined #ruby
[20:35:37] Ox0dea: prefixed: This would be the third time you've been linked directly to the OptionParser docs...
[20:35:40] jenrzzz: has joined #ruby
[20:36:10] Poiju_: has joined #ruby
[20:36:55] Axy: has joined #ruby
[20:36:55] Axy: has joined #ruby
[20:37:21] roolo: has joined #ruby
[20:37:26] shadoi: has joined #ruby
[20:37:49] MasterPiece: has joined #ruby
[20:38:41] prefixed: Ox0dea funny. I would have thought after the second time, you'd realize I don't really understand the docs.
[20:39:16] adaedra: I don't remember the docs from option parser to be that unreadable
[20:39:26] choppington: has joined #ruby
[20:39:28] adaedra: I even remember progressive samples that help well
[20:39:52] momomomomo_: has joined #ruby
[20:40:56] Ox0dea: > Specifies short style switch which takes a mandatory, optional or no argument.
[20:41:19] Ox0dea: prefixed: Out of earnest curiosity, which word(s) do you have trouble with there?
[20:42:04] jgpawletko: has joined #ruby
[20:42:07] Ox0dea: Calling it a "switch" would be momentarily confusing if you'd had prior exposure to CLIs, but I assume that's not the case.
[20:42:12] crunk_bear: has joined #ruby
[20:42:14] baweaver: has joined #ruby
[20:42:14] Ox0dea: Au revoir, arup_r.
[20:42:27] arup_r: I am tired now.. :(
[20:42:31] arup_r: need to sleep
[20:42:32] adaedra: Bye Ox0dea
[20:42:37] adaedra: Bye arup_r *
[20:42:42] ZYPP: has left #ruby: ("Textual IRC Client: www.textualapp.com")
[20:42:51] Ox0dea: arup_r: Sorry about that `super === sub` nonsense from earlier.
[20:43:06] adaedra: Ox0dea: d'ou tu parles fran??ais toi
[20:43:13] arup_r: adaedra, your auto completion is buggy :)
[20:43:42] adaedra: arup_r: nope, that's human error here, I was thinking about both replies at the same time and switched nicks
[20:43:50] arup_r: saying with ref to "Bye Ox0dea"
[20:44:11] arup_r: Ohkay!! I was kidding..
[20:44:17] JeramyRR: has joined #ruby
[20:44:21] arup_r: I am using HexChat it is awesome
[20:44:32] adaedra: I don't like it that much
[20:46:07] ybian: has joined #ruby
[20:46:50] simplyianm: has joined #ruby
[20:46:55] shevy: arup_r aha the successor to xchat
[20:47:27] arup_r: shevy, it is awesome for my old aged laptop
[20:48:32] Senjai: arup_r: Weechat best irc client
[20:48:37] Ox0dea: Confirmed.
[20:49:26] Azure: has joined #ruby
[20:49:47] Hanmac: has joined #ruby
[20:50:04] sypheren: has joined #ruby
[20:50:11] towski_: has joined #ruby
[20:51:55] prefixed: Ox0dea the documentation doesn't really cover all use cases. you know how you said something like "[--input file]" specified an optional argument? I don't see this explained in the documentation
[20:52:46] hololeap: is there any performance difference between these two types of method chains: `array.map(&:name).map(&:downcase).map(&:to_sym)` vs. `array.map { |x| x.name.downcase.to_sym }`
[20:52:48] Carnage\: has joined #ruby
[20:52:50] Ox0dea: prefixed: You've conflated me with somebody else, I'm afraid.
[20:52:56] BeatNick_: has left #ruby: ("Leaving")
[20:53:07] Senjai: Ox0dea: conflated... yeah. Haven't heard that in a sentence for a long while
[20:53:08] Ox0dea: prefixed: Using square brackets for optional arguments is *right there* in the documentation, dude.
[20:53:38] Ox0dea: hololeap: The latter is more space-efficient.
[20:53:47] Ox0dea: It doesn't create as many intermediary arrays.
[20:54:22] DoubleMalt: has joined #ruby
[20:54:25] Ox0dea: Ergo, it's also almost certainly faster.
[20:54:32] phutchins: has joined #ruby
[20:54:46] edwinvdgraaf: has joined #ruby
[20:55:04] devbug: has joined #ruby
[20:55:14] hololeap: Ox0dea: thank you
[20:55:20] Ox0dea: Sure thing.
[20:55:32] Ox0dea: hololeap: Feel free to whip out benchmark/ips to test the theory. :)
[20:55:37] Musashi007: has joined #ruby
[20:55:47] hololeap: Ox0dea: i might just do that
[20:55:49] benlieb: has joined #ruby
[20:56:45] Ox0dea: hololeap: Oh, and use Uberscore (https://gist.github.com/0x0dea/628de90e12acc1874a9a) if you want the brevity of the latter without having to open a block and introduce an arbitrary name.
[20:56:51] Ox0dea: (But not really, obviously.)
[20:56:53] prefixed: Ox0dea not in this context "[--input file]"
[20:57:06] prefixed: it's in this context: "--input [file]"
[20:57:11] arturmartins: has joined #ruby
[20:58:57] xkef: has joined #ruby
[20:59:56] dfinninger: has joined #ruby
[21:00:50] prefixed: so someone eff'd up and told me the wrong thing. I SHALL END THEM
[21:01:09] bronson: has joined #ruby
[21:01:21] bodzio: has joined #ruby
[21:01:39] fabrice31: has joined #ruby
[21:01:42] segfalt: has joined #ruby
[21:02:48] Hobbyboy: has joined #ruby
[21:02:51] crwilcox: has joined #ruby
[21:03:09] konr: has joined #ruby
[21:03:58] fantazo: has joined #ruby
[21:05:04] baweaver: has joined #ruby
[21:05:54] yfeldblum: has joined #ruby
[21:06:16] gs: has joined #ruby
[21:07:19] Polysics: has joined #ruby
[21:08:11] uber: has joined #ruby
[21:08:25] peter_paule: has joined #ruby
[21:08:40] momomomomo_: has joined #ruby
[21:09:01] davedev24: has joined #ruby
[21:09:52] Polysics: has joined #ruby
[21:10:06] mandarinkin: hololeap, http://pastie.org/10298996
[21:11:08] hololeap: mandarinkin: it looks like the second way is quite a bit faster
[21:11:37] hazelux: has joined #ruby
[21:13:47] mandarinkin: second is 5 time faster on 1m elements
[21:14:33] pengin: has joined #ruby
[21:15:19] alphaatom: has joined #ruby
[21:15:23] hazelux: is there a way to access the decorated object from a decorator? How do I get Person from DecoratedPerson.new(Person.new)?
[21:15:44] xkef: has joined #ruby
[21:16:05] Senjai: hazelux: Depends on what DecoratedPerson is
[21:16:06] polpak: has joined #ruby
[21:16:06] drewo: has joined #ruby
[21:16:33] alphaatom: has joined #ruby
[21:16:38] jbw: has joined #ruby
[21:16:52] hazelux: Senjai: DecoratedPerson < SimpleDelegator
[21:17:00] hazelux: Senjai: I'm not sure if that's the best decision though
[21:17:44] kham1: has joined #ruby
[21:18:03] pietr0: has joined #ruby
[21:18:07] Senjai: hazelux: delegator.__getobj__
[21:18:13] Senjai: but you generally shouldnt have to
[21:18:53] Senjai: hazelux: Also this is documented fairly well here:
[21:18:55] Senjai: http://ruby-doc.org/stdlib-1.9.3/libdoc/delegate/rdoc/SimpleDelegator.html
[21:19:16] blackmesa: has joined #ruby
[21:19:53] hazelux: Senjai: thanks! Why shouldn't you have to?
[21:21:16] momomomomo: has joined #ruby
[21:21:27] casadei_: has joined #ruby
[21:22:19] heftig: hazelux: IIRC decorators are supposed to remain compatible so you can still use the DecoratedPerson everywhere you can use the plain Person
[21:22:23] relix: has joined #ruby
[21:22:33] heftig: so there's no need to obtain the decorated object
[21:22:39] El3ktra_: has joined #ruby
[21:22:40] bungoman: has joined #ruby
[21:23:07] matcouto: has joined #ruby
[21:23:55] Casty: has joined #ruby
[21:24:15] heftig: or maybe it was that you the decorator is only used by code that doesn't need to handle the decorated object
[21:24:28] El3ktra: has joined #ruby
[21:24:32] heftig: code that needs the latter would get the object passed without needing to unwrap it
[21:24:49] El3ktra: has left #ruby: ()
[21:25:28] hazelux: heftig: That's what I expected, too. This is the problem that is actually causing the problem (inside an ActiveRecord model): User.likes.exists?(activity: decorated_activity)
[21:25:49] dubkoidragon: has joined #ruby
[21:26:06] hazelux: I tried asking in #rubyonrails, but they seem pretty unresponsive.
[21:26:18] apeiros: heftig: I understood it the same way as your first description.
[21:26:36] apeiros: a decorated object *adds* stuff. all the rest is supposed to be identical.
[21:26:53] heftig: apeiros: otherwise it's an adapter, i guess
[21:26:55] Senjai: hazelux: I wouldnt be suprised if that failed
[21:27:03] Senjai: hazelux: thing.is_a?(activity) would fail
[21:27:18] Senjai: I'm not sure that is_a is delegated
[21:27:22] Senjai: or anything for class checcking
[21:28:17] gamename: has joined #ruby
[21:28:35] jbw: has joined #ruby
[21:28:56] heftig: Senjai: I think SimpleDelegator is too simple and ducky here
[21:29:05] heftig: hazelux: try DelegateClass
[21:29:15] Senjai: heftig: I dont think it should be used like this at all :/
[21:30:16] blackmes1: has joined #ruby
[21:30:25] hazelux: Yeah, and monkeypatching is_a? and .class are not good ideas.
[21:31:51] Ox0dea: `case foo; when :bar.to_proc` works, but `case foo; when &:bar` doesn't. I wonder if it should...
[21:31:53] Senjai: hazelux: Dont use a delegator here.
[21:31:54] heftig: hm, no, DelegateClass doesn't work, either
[21:32:23] kadoppe: has joined #ruby
[21:32:55] apeiros: Ox0dea: & is for method calls
[21:33:06] apeiros: case/when isn't a method call
[21:33:26] hazelux: Senjai: Any other ideas, besides callbacks?
[21:33:36] hazelux: I'll gist it so you guys can see it better.
[21:33:50] apeiros: *if* &:bar should work in case/when, it should be syntax for calling to_proc everywhere. but the additional meaning of "convert it to a block" is lost there.
[21:34:01] Ox0dea: Yeah, that makes sense.
[21:34:09] Senjai: hazelux: The question is: "What are you trying to accomplish by using the delegator in the first place"
[21:35:04] baweaver: has joined #ruby
[21:35:59] peter_paule: has joined #ruby
[21:36:22] bungoman: has joined #ruby
[21:36:36] hazelux: Senjai: I need to send a notification when an activity is saved. And I want to avoid callbacks.
[21:37:12] Senjai: hazelux: So your doing this to avoid fixing code that needs to be fixed?
[21:37:21] Senjai: hazelux: Oh, wait, sorry
[21:37:30] Senjai: hazelux: You want a callback, except not on the active record objec?T
[21:37:49] Senjai: hazelux: define a seperate object that is responsible for saving the record, and sending a notification afterwards
[21:38:07] sarkyniin: has joined #ruby
[21:38:10] Senjai: Dont use a delegator, use an -actual- class that would hold the responsibility
[21:38:52] Spami: has joined #ruby
[21:39:05] Muhannad: has joined #ruby
[21:41:09] El3ktra: has joined #ruby
[21:41:52] hazelux: Senjai: https://gist.github.com/maxcodes/5542ce3d1bd4de980751
[21:42:59] Senjai: Is this meant to be a before_create?
[21:43:08] Senjai: Or a every time this is saved thing
[21:43:16] Senjai: a before_create is totally fine for a notification
[21:43:17] jenrzzz: has joined #ruby
[21:43:19] hazelux: after_create, rather
[21:43:21] Senjai: I'd prefer it in the controller
[21:43:30] Senjai: In your controller, create the thing, then send the notification
[21:44:47] failshell: has joined #ruby
[21:45:26] freerobby: has joined #ruby
[21:47:02] devbug: has joined #ruby
[21:47:59] hazelux: Damn. Yeah, I think I just made a mess out of myself trying to use delegators for this. Thanks Senjai and heftig!
[21:48:05] momomomomo: has joined #ruby
[21:48:32] Senjai: hazelux: If it feels like its too hard, it often is being done incorrectly ;)
[21:48:34] jamesaxl|2: has joined #ruby
[21:49:01] Senjai: hazelux: +1 on trying not to use AR callbacks though
[21:49:42] avahey: has joined #ruby
[21:50:13] failshell: has joined #ruby
[21:51:53] freerobby1: has joined #ruby
[21:52:31] bruno-: has joined #ruby
[21:52:52] hazelux: Senjai: so tempting though! But yeah, it's just asking for trouble down the line. Thanks for helping out even if it was slightly out of context
[21:53:44] Senjai: hazelux: np
[21:53:50] peter_paule: has joined #ruby
[21:54:20] ytti: yeah that happened
[21:56:47] vdamewood: has joined #ruby
[21:58:07] casadei_: has joined #ruby
[21:58:27] dfinninger: has joined #ruby
[21:58:33] devbug: has joined #ruby
[21:59:22] vivekananda: has joined #ruby
[22:01:52] decoponio: has joined #ruby
[22:02:11] mikeric: has joined #ruby
[22:03:07] theery: has joined #ruby
[22:04:56] tubulife-: has joined #ruby
[22:05:27] quimrstorres: has joined #ruby
[22:05:57] JeramyRR: has joined #ruby
[22:09:24] vdamewood: has joined #ruby
[22:14:42] ledestin: has joined #ruby
[22:15:45] duggiefresh: has joined #ruby
[22:15:49] yorickpeterse: ok naming question:
[22:16:04] yorickpeterse: I have a method that should yield self and then iterate upwards a tree yielding all parents
[22:16:10] yorickpeterse: so it's self -> parent of self -> parent of parent of self -> etc
[22:16:15] yorickpeterse: How the heck should I call this?
[22:16:22] nahtnam: has joined #ruby
[22:16:26] yorickpeterse: "self_and_every_parent" is meh
[22:16:49] yorickpeterse: and "while_parent" is too vague I think
[22:18:04] adaedra: self_and_ancestors
[22:18:17] adaedra: family_tree
[22:18:36] dgutierrez1287: has joined #ruby
[22:18:45] choppington: has joined #ruby
[22:19:04] adaedra: each_up_to_root ?
[22:20:44] Esya: has joined #ruby
[22:21:52] programmerq: has joined #ruby
[22:22:39] jgpawletko: has joined #ruby
[22:22:43] apeiros: self_and_ancestors is what I'd go with too
[22:22:52] apeiros: it's also what awesome_nested_set uses iirc
[22:23:21] Mweshi: has joined #ruby
[22:24:12] CloCkWeRX: has joined #ruby
[22:24:42] bungoman_: has joined #ruby
[22:25:22] dfinninger: has joined #ruby
[22:25:49] noethics: has joined #ruby
[22:26:58] yorickpeterse: Hm yeah, self_and_ancestors sounds good enough
[22:27:05] yorickpeterse: apeiros: that's an actual thing?
[22:27:37] apeiros: awesome_nested_set? yes. it's a gem to use the nested set pattern with AR
[22:27:47] apeiros: (tree's in database)
[22:28:13] yorickpeterse: surprised it's not called acts_as_awesome_nested_set
[22:28:37] shevy: yorickpeterse call it: tree_of_life
[22:28:58] yorickpeterse: I sure hope it's not alive
[22:29:48] apeiros: yorickpeterse: iirc the call in the AR model is acts_as_nested_set
[22:30:01] apeiros: (it's a replacement for the nested_set gem)
[22:30:25] yorickpeterse: How to name ActiveRecord gems:
[22:30:28] yorickpeterse: 1) take a noun
[22:30:32] yorickpeterse: 2) prefix with acts_as_
[22:30:42] adaedra: acts_as_i_dont_care
[22:30:59] yorickpeterse: when it gets vendored by Rails just replace acts_as_ with active_
[22:31:05] apeiros: acts_as_noun
[22:31:15] apeiros: active_noun
[22:31:21] swgillespie: has joined #ruby
[22:31:33] yorickpeterse: https://rubygems.org/search?utf8=%E2%9C%93&query=acts_as_ -> 594 results
[22:32:46] adaedra: thanks, rails
[22:33:26] adaedra: ???classes_and_includes_and_extends_for???
[22:34:14] drbrain: "its_a_big_truck_we_can_just_dump_stuff_on_it"
[22:34:29] michael_mbp: has joined #ruby
[22:38:30] havenwood: has joined #ruby
[22:38:46] tvw: has joined #ruby
[22:42:29] baweaver: has joined #ruby
[22:42:35] atomical: has joined #ruby
[22:46:00] CloCkWeRX: has joined #ruby
[22:47:23] symm-: has joined #ruby
[22:49:34] crwilcox: has joined #ruby
[22:50:21] ccooke: has joined #ruby
[22:50:24] hololeap: ACTION feels that ruby is rather like a big truck
[22:51:12] endash: has joined #ruby
[22:51:46] poguez_: has joined #ruby
[22:52:04] duoi: has joined #ruby
[22:54:41] crwilcox: has joined #ruby
[22:55:25] s00pcan: has joined #ruby
[22:55:35] sepp2k: has joined #ruby
[22:59:55] delsol: has joined #ruby
[23:02:02] sharpmachine: has joined #ruby
[23:02:25] fabrice31: has joined #ruby
[23:02:51] jpfuentes2: has joined #ruby
[23:04:55] duoi: has joined #ruby
[23:06:28] seal: has joined #ruby
[23:06:34] quimrstorres: has joined #ruby
[23:06:44] duoi: has joined #ruby
[23:10:51] jayhawker42: has joined #ruby
[23:14:48] Scripore: has joined #ruby
[23:21:10] Spami: has joined #ruby
[23:21:31] freerobby: has joined #ruby
[23:23:11] lkba: has joined #ruby
[23:25:58] bruno-: has joined #ruby
[23:28:43] charliesome: has joined #ruby
[23:29:10] volsus: has joined #ruby
[23:29:53] Fezzler: has joined #ruby
[23:30:04] MagePsycho: has joined #ruby
[23:31:06] Thomas-0725: has joined #ruby
[23:33:04] jonee: has joined #ruby
[23:33:04] _blizzy_: has joined #ruby
[23:34:11] sepp2k1: has joined #ruby
[23:35:03] haneen: has joined #ruby
[23:36:54] crwilcox_: has joined #ruby
[23:41:14] _blizzy_: has joined #ruby
[23:41:40] dfockler: has joined #ruby
[23:42:28] charliesome: has joined #ruby
[23:43:40] bricker: a big slow truck except it drives itself and has cool flames painted on the side
[23:43:51] chrisarcand: has joined #ruby
[23:44:21] ZeeNoodleyGamer: has joined #ruby
[23:45:08] j4cknewt: has joined #ruby
[23:45:28] sepp2k: has joined #ruby
[23:45:53] casadei_: has joined #ruby
[23:49:14] Igorshp: has joined #ruby
[23:49:42] baweaver: has joined #ruby
[23:50:31] aspiers: has joined #ruby
[23:53:13] charliesome: has joined #ruby
[23:54:07] blandflakes: has joined #ruby
[23:55:26] MasterPiece: has joined #ruby
[23:56:54] swgillespie: has joined #ruby
[23:57:41] chrisarcand: has joined #ruby
[23:57:50] allomov: has joined #ruby
[23:57:52] teotwaki: has joined #ruby
[23:57:59] endash: has joined #ruby