« Back to channel list

#ruby - 27 March 2014

« Back 1 day Forward 1 day »
[00:26:08] benzrf: havenwood: any luck o.o
[00:26:12] havenwood: benzrf: nada
[00:26:26] havenwood: didn't try of os x, but os x was abort, abort abort
[00:27:06] havenwood: benzrf: i get the concenpt, but yeah the OS X implementation just isn't quite there yet
[00:27:14] havenwood: at least not on latest OS X
[00:27:38] havenwood: benzrf: to be fair, i'm out and about and running a dev version of OS X
[00:27:40] benzrf: right now you can do this:
[00:27:56] benzrf: $ [run script for doing the thing]
[00:28:05] benzrf: $ cd quick_test/SomeClass
[00:28:11] benzrf: $ vim some_methods.rb
[00:28:16] benzrf: [write some methods, save]
[00:28:19] benzrf: $ pry-remote-em
[00:28:28] benzrf: > SomeClass.new.a_method
[00:28:31] benzrf: havenwood: eventmachine
[00:28:34] benzrf: it allows multiple conns
[00:28:40] havenwood: but i thought, nvm
[00:28:45] benzrf: [this is what you can do atm]
[00:28:51] benzrf: [not what it is complete]
[00:29:52] havenwood: benzrf: so whatcha gunna call the pry plugin?
[00:32:56] havenwood: benzrf: i just took a code-spike stab at pry extensions with pry-drb, i need to give that some love and make it proper: https://github.com/havenwood/pry-drb#readme
[00:33:40] benzrf: code-spike?
[00:34:22] havenwood: benzrf: a one-off script i wrote that i mentioned at a pry meetup at rubyconf in miami and cirwin convinced me to gemify the next day
[00:35:16] havenwood: benzrf: starts a drb server to persist hash-like values across pry sessions, nothing fancy
[00:36:10] havenwood: benzrf: but uses DRb's fanciness
[00:36:43] benzrf: anyway quick isnt gonna be a pry plugin
[00:36:56] havenwood: benzrf: ah right, can be used for lots of things
[00:37:11] benzrf: to be precise, you'll do `quick pry' and itll open a pry in the module your pwd corresponds toastyne_
[00:37:31] benzrf: *each module will have a binding stored on it so that you can have persistent vars
[00:38:24] benzrf: also planning on integration with dmtcp
[00:38:34] benzrf: so that you can freeze and thaw projects
[00:38:45] benzrf: persisting state for the length of your usage
[00:38:53] benzrf: it's meant to be a dev env, not a tool
[00:39:01] benzrf: smalltalk-style
[00:39:10] havenwood: kinda reminds me of Maglev Gemstone, yeah smalltalk
[00:39:28] benzrf: atm the way it works is that you can create .rb files in any dir
[00:39:41] benzrf: dir structure corresponds to module-constant hierarchy
[00:39:50] benzrf: plus special dirs for singleton classes
[00:40:11] havenwood: i'm pretty curious if MagLev is going to go forward as a thriving project or die on the vine.
[00:40:12] benzrf: whenever a .rb file is written, the code in it is module-exec'd in the module it's stored in
[00:40:21] benzrf: unless there's a syntax error
[00:40:38] benzrf: it also disallows having anything except for method decls unless the file is called 'header.rb' atm
[00:40:52] benzrf: to encourage having code that can be reloaded non-effectually
[00:41:24] benzrf: it also spawns a read-only whatever.in_use.rb file that contains the last evalled version of whatever.rb
[00:41:32] benzrf: so that you can see if it got loaded
[00:41:40] benzrf: presumably usable to make plugins or whatever
[00:41:54] bawNg: I just started getting weird rack errors when trying to do tiny file uploads via HTTP POST... Anyone ever seen errors like "No such file or directory - /tmp/RackMultipart20140327-59318-1cfcqyd.lock"?
[00:42:18] benzrf: bawNg: dont suppose it could be a threading thing
[00:42:32] bawNg: benzrf: No, this is a single threaded application
[00:43:25] wallerdev: your names are too similar
[00:44:02] benzrf: i saw bawNg and i first thought "bnagy's alt nick"
[00:44:46] benzrf: havenwood: also also planning to add some kind of simple api for evaluating code snippest
[00:44:49] benzrf: *snippets
[00:45:02] benzrf: that way, editor plugins for testing code as you write it
[00:45:13] hfp: Hey guys
[00:45:19] benzrf: within an actual env that has the vars you ned
[00:45:31] anoldhacker: I've been looking into DCI (Data Context Interaction ??? http://www.artima.com/articles/dci_vision.html.) I don't like what I'm seeing out there, so I'm rolling my own. There is a problem, however. I have determined that I need to use wrapper objects, and these suffer from identity disorder. My solution is to make them VERY thin. In particular, I want to redefine all of the identity methods. ( https://gist.github.com/student/979729
[00:45:51] benzrf: basically im just swiping as many Smalltalk/SLIME features as I can think of ways to impl
[00:46:28] bawNg: I think I fixed the exception by resetting perms of /tmp
[00:46:44] bawNg: Strange that something messed with the /tmp perms
[00:47:09] anoldhacker: Someone did a b???.a???.d thing???.
[00:49:23] bawNg: Still can't get my file uploads working for larger than microscopic files, but it seems to be something related to nginx
[00:49:57] bawNg: I always up the client upload file size limit on nginx when I install it, but for some reason it doesn't seem to be taking affect in this case
[00:49:58] anoldhacker: As in a config setting that limits file size?
[00:50:28] bawNg: Which is odd, considering I'm pretty sure it works fine for other applications using nginx on this same box
[00:50:40] hfp: Hi guys! In the following: https://eval.in/127491, in the method brightness_index, can I use @r, @g, @b and r, g, b as variable names interchangeably? Is one better than the other? It seems to work with both but would there be any subtlety I missed?
[00:50:42] anoldhacker: I would try changing another parameter. See if it is reading the file that you think it is.
[00:51:21] bawNg: It's not reading a file, it doesn't seem to be reaching my application code at all
[00:51:36] bawNg: And it also doesn't log anything in nginx' error or access log
[00:52:10] bawNg: Nginx just gives a response 500 if the file is bigger than a few, or maybe even under a KB
[00:53:08] anoldhacker: If it isn't getting to your application code, how does it know what to do with the request?
[00:53:33] anoldhacker: Unless it is just choking on the request.
[00:53:34] bawNg: Exactly... something very odd is going on
[00:53:51] anoldhacker: If so, then there is probably some config outside your application to adjust.
[00:54:01] havenwood: hfp: There is indeed some subtlety, especially when multithreading. I guess it doesn't matter till it matters? I can't think of a concise explaination.
[00:54:01] bawNg: A file under 1KB works fine
[00:54:08] bawNg: Everything else doesn't even reach my application
[00:54:37] bawNg: But like I said, my upload file size limit on nginx is file, and even by default it isn't anywhere close to as small as 1KB
[00:54:48] bawNg: So something else is going on, something I've never seen before
[00:55:09] hfp: havenwood: I see. So I should be using the argument variables, not the instance variables? Why are they even set then if we don't need them? Is it so that I can access them from outside the class with Object.r, Object.g and Object.b ?
[00:55:40] havenwood: hfp: If the whole instance should know about it, an instance variable lets that happen without needing to pass local variables around as arguments.
[00:55:57] havenwood: hfp: but sometimes passing them around is exactly what you need
[01:00:33] havenwood: hfp: You *can* access instance variables outside the class, but you have to do it manually unless they're exposed by method/attr.
[01:01:22] havenwood: hfp: usually, you use public methods and don't dip in an get instance variables that aren't exposed - but ya can
[01:03:04] juanmnl: hi, noob here, i'm trying to populate a db with an object "chapter" that has a "number" attribute. Each object should have only one number. I tried number = (0..12) but it doesn't work. What should i do? tx :)
[01:03:11] benzrf: hfp: basically, store something in an ivar if it would make sense for the object to 'know' about it
[01:03:32] benzrf: hfp: if you were to receive this object from an API, would you expect to have to put that data into it?
[01:03:41] benzrf: or would it be already in there?
[01:03:48] bawNg: Found the issue
[01:03:53] bawNg: /dev/sda1 9.2G 8.8G 0 100% /
[01:04:00] benzrf: bawNg: lol
[01:04:19] havenwood: bawNg: hehe
[01:04:19] benzrf: juanmnl: number attribute?
[01:04:30] benzrf: juanmnl: you mean with attr_accessor or the like?
[01:04:41] havenwood: juanmnl: what ought `number ==`?
[01:06:07] bawNg: Best part is, it's nginx's log that filled up /
[01:06:44] benzrf: http://www.gifsound.com/?gif=media.tumblr.com/ba0ff72e7b393f5d933051656fdfeb48/tumblr_inline_mry1bpCONm1qz4rgp.gif&v=IaZMST-vHfM&s=31
[01:09:10] juanmnl: i may have explained wrong. I have a chapter that has a title and a number:integer, i'm using a factory to populate the db. I want to create 12 chapters with the number filled up in sequence ch1(number=0)...ch12(number=11)
[01:09:36] juanmnl: hope it's clearer, doing my best with english :P
[01:10:04] benzrf: chapters.each_with_index {|ch, n| ch.number = n}
[01:10:30] hfp: benzrf: I don't understand what you mean by "if you were to receive this object from an API, would you expect to have to put that data into it?"
[01:11:00] juanmnl: benzrf: tx i'll try that!
[01:11:30] benzrf: hfp: ok, you're considering whether to store data in an ivar or whether to thread it in and out, right?
[01:12:12] hfp: benzrf: I'm not sure what threading it in and out means... "I'm the guy who is learning Ruby" as per shevy's designation
[01:12:51] hfp: In the eval.in I pasted, I was wondering what difference it made to refer to the r, g and b variables as @r, @g and @b vs r,g and b
[01:13:03] hfp: https://eval.in/127491
[01:13:09] hfp: In the brightness_index methos
[01:15:55] benzrf: hfp: did you get the gist then
[01:16:23] hfp: Kinda, what do you mean by the object should know about it or not?
[01:16:59] wallerdev: dat netsplit lol
[01:19:58] benzrf: hfp: well
[01:20:19] benzrf: if you think of an object as an entity that you can ask questions and give commands (by sending messages, aka calling methods)
[01:20:30] benzrf: then the entity's knowledge is the data stored in its ivars
[01:20:45] benzrf: so when considering whether to put something in an ivar or trust the user to provide it
[01:20:59] benzrf: consider how you would expect to use it if you didn't know the internal bits
[01:21:14] benzrf: or what you would expect the object to know
[01:23:30] hfp: Ah, I think I get it. If I set ivar in the initialize method, then the vars are passed when the object is created, as in `Foo = Bar.new(:a, :b, :c)`. Then I would have to turn these variables into ivars in the initialize method so other methods could be called as `Foo.coolmethod` rather than `Foo.coolmethid(:a, :b, :c)`, right?
[01:24:07] benzrf: more or less
[01:24:12] benzrf: any method can set ivars
[01:24:47] hfp: Ok it's just that once you set an ivar with a particular method then other methods can access it yes?
[01:24:57] benzrf: if you think of an object as a little box with methods as levers on the outside, ivars are like a filing cabinet on the inside
[01:24:58] hfp: If you don't then you have to pass the variables for every method every time
[01:26:02] benzrf: if you don't store enough in ivars, you end up with a bunch of methods that might as well be global
[01:26:08] benzrf: *dont store anything
[01:26:21] benzrf: if you store all data ever in ivars, the object becomes single-use and inflexible
[01:26:40] benzrf: try to strike a happy medium :)
[01:26:59] hfp: Ok. Just one thing doesn't addup yet in my mind. In the eval.in I pasted, whether I use ivars or r, g and b in the brightness_index method doesn't seem to make any difference. I don't understand why.
[01:28:01] hfp: https://eval.in/127491
[01:28:50] benzrf: hfp: aha i see
[01:29:04] benzrf: hfp: method calls on self with no arguments look exactly like ivars
[01:29:14] benzrf: if you call a method without using a dot, it means on self
[01:29:22] benzrf: so foo() is the same as self.foo()
[01:29:32] benzrf: (except that you can do the former to call private methods, but not the latter)
[01:29:59] benzrf: attr_reader automatically generates methods that return the value of an ivar
[01:30:02] benzrf: for example:
[01:30:38] benzrf: >> class Foo; attr_reader :some_ivar; def initialize(si); @some_ivar = si; end; end; f = Foo.new(3); f.some_ivar
[01:30:38] eval-in: benzrf => 3 (https://eval.in/127495)
[01:31:00] benzrf: saying 'attr_reader :bluh' has the same result as 'def bluh; @bluh; end;'
[01:31:23] benzrf: so the 'r' in your method is actually calling the r method on self that attr_reader created
[01:31:34] benzrf: because there is no r variable in scope there
[01:31:57] benzrf: if you took away the attr_reader, you'd have to use @r only
[01:32:43] hfp: What about that line `( 299 * @r + 587 * @g + 114 * @b) / 1000`
[01:32:58] hfp: whether I use @r, @g and @b or r, g and b seems to give the same result
[01:33:20] benzrf: that's what i just explained!
[01:33:27] hfp: Ah yes I just got it
[01:33:49] hfp: so the @r = r etc in initialize is not necessary, correct?
[01:33:56] benzrf: no, it is
[01:33:59] benzrf: why wouldnt it be?
[01:34:05] benzrf: in that case r IS a var, because it got setient
[01:34:14] benzrf: ruby looks for a var first, then a method
[01:34:21] benzrf: >> def foo; 3; end; foo = 4; foo
[01:34:21] eval-in: benzrf => 4 (https://eval.in/127497)
[01:34:28] benzrf: >> def foo; 3; end; foo
[01:34:28] eval-in: benzrf => 3 (https://eval.in/127498)
[01:34:29] LadyRainicorn: That is weird. Variables are supposed to take on different values depending on what their name is.
[01:35:08] benzrf: yo LadyRainicorn wanna try out Quick
[01:35:38] LadyRainicorn: x = 5; y = 5; x + 1 # => 6; y + 1 # => :kitty!
[01:35:42] LadyRainicorn: ^ expected behavior
[01:36:20] benzrf: LadyRainicorn: wat
[01:36:46] LadyRainicorn: ACTION is being insane.
[01:36:53] benzrf: 09:35 < benzrf> yo LadyRainicorn wanna try out Quick
[01:37:08] benzrf: my new project o3o
[01:37:14] LadyRainicorn: oh what is that?
[01:37:30] benzrf: only if you already have libfuse-dev installed
[01:37:34] benzrf: are you on loonix?
[01:38:48] benzrf: git clone https://github.com/benzrf/quick/
[01:39:14] wallerdev: trying to scam more people with your virus benzrf ?
[01:39:21] wallerdev: we all know its a dogecoin mining program
[01:40:28] LadyRainicorn: DogeCoin.mkblock(reward: 10e20)
[01:40:49] benzrf: read the src
[01:40:53] benzrf: it's <300 lines
[01:41:05] benzrf: also i refuse to touch dogecoin
[01:41:10] benzrf: if i dont use it i can pretend its not real
[01:41:18] benzrf: LadyRainicorn: u cloned =3
[01:41:21] wallerdev: im pretty sure flash player is a secret bitcoin miner, no other reason for using the cpu it does
[01:41:47] hfp: benzrf: so what I understand so far. The initialize method of a class is the once that receives the arguments when you call new(), right? And if you don't assign these arguments to ivars in initialize, then other methods can't access them. attr_reader allows you to access the values of the variables without writing a specific method, attr_* does it for you. Did I get everything ok?
[01:41:58] LadyRainicorn: benzrf: Why would you do that? Dogecoin is such wow!
[01:42:07] LadyRainicorn: VERY COIN SUCH WOW
[01:42:10] wallerdev: sounds right to me
[01:42:34] benzrf: hfp: almost
[01:42:36] wallerdev: my 401k is in dogecoin
[01:42:38] CaptainJet: conspiracy theory:
[01:42:42] benzrf: hfp: you can read any ivar regardless of attr_*
[01:42:51] benzrf: hfp: attr_* generates methods for accessing ivars
[01:42:55] CaptainJet: ever since bitcoin was announced, adobe flash player was updated to mine from every user's computer
[01:43:08] CaptainJet: adobe is now owner of 31% of the bitcoins in the world
[01:43:11] benzrf: that way code outside of the object can see what's in ivars or set it
[01:43:17] hfp: benzrf: so even without attr_* you can still call Foo.var and it will return whatever var is equal too within the object?
[01:43:30] benzrf: hfp: no, that's what attr_* does
[01:43:37] benzrf: but from _inside_ you can do @var regardless
[01:43:45] LadyRainicorn: With the competence of Flash, they are probably mining a private altcoin.
[01:43:51] hfp: benzrf: hmmm
[01:44:01] hfp: benzrf: so this shouldn't return nil then https://eval.in/127500
[01:44:04] LadyRainicorn: It makes sense since the issue predates Bitcoin.
[01:44:12] LadyRainicorn: FLASHCOIN - THE REAL INNOVATOR
[01:44:26] hfp: benzrf: or it's not what you meant?
[01:44:39] wallerdev: using attr is kinda useless, i just use obj.instance_variable_get(:@my_var)
[01:44:46] benzrf: wallerdev: shut up
[01:44:50] benzrf: hfp: dont listen!!
[01:45:02] benzrf: hfp: no, you're not setting @a
[01:45:06] wallerdev: you need to assign the variables in initialize
[01:45:14] wallerdev: @b = b, etc
[01:45:15] benzrf: a the argument to initialize is just a variable you can see from initialize
[01:45:18] benzrf: nothing happens to it
[01:45:35] LadyRainicorn: I prefer to use obj.instance_eval('@a')
[01:45:54] LadyRainicorn: attr_accessor be damned.
[01:46:03] hfp: benzrf: Ok so if I don't assign them to ivars in initialize they are "lost"
[01:46:21] hfp: attr_* also depends on @vars, I get it now
[01:46:40] wallerdev: i prefer eval("obj.instance_eval('@a')")
[01:46:50] benzrf: attr_* just creates new methods in the class
[01:46:59] benzrf: attr_reader :foo is EXACTLY the same as
[01:47:06] benzrf: at least, in how the result works
[01:47:16] hfp: benzrf: I think I saw somewhere that you could do attr_something and avoid the setting of ivars in initialize together, which one was it?
[01:47:38] hfp: together = altogether
[01:47:42] benzrf: that would be Struct
[01:47:47] hfp: Did I dream it or is there such a thing?
[01:47:53] hfp: attr_struct?
[01:47:56] benzrf: Struct.new creates a new class
[01:48:26] benzrf: Struct.new(:a, :b, :something_else) results in a class whose instances have the methods a, a=, b, b=, something_else, and something_else=
[01:48:29] LadyRainicorn: attr really should have default values.
[01:48:32] wallerdev: >> MyClass = Struct.new(:a, :b, :c); x = MyClass.new(1, 2, 3); x.c
[01:48:32] eval-in: wallerdev => 3 (https://eval.in/127504)
[01:48:47] benzrf: also, initialize is defined to do what wallerdev just demonstrated
[01:48:59] benzrf: hfp: so you can create a class that way, then extend ItS______
[01:49:45] hfp: Ok I think I mostly get it now, thanks
[01:49:47] wallerdev: freenode pls
[01:50:03] wallerdev: you probably dont wnat to use Struct for anything besides the simplest things
[01:53:13] LadyRainicorn: def attr_accessor(var) define_method(var){|v=:UNDEFINED| v==:UNDEFINED ? $ivars[self][var] : ($ivars[self][var] = v)} end
[01:54:03] wallerdev: that clears things up
[01:54:28] hfp: LadyRainicorn: You're making my brain hurt
[01:54:52] hfp: Installing required packages: gcc46.
[01:54:57] hfp: This is taking for eveeeeeeeer
[01:55:05] LadyRainicorn: I should make /r/lolruby.
[01:55:27] hfp: LadyRainicorn: https://www.destroyallsoftware.com/talks/wat
[01:56:16] LadyRainicorn: ACTION recently discovered /r/lolphp.
[01:56:23] LadyRainicorn: It is one of my new favorite subreddits.
[02:01:54] benzrf: LadyRainicorn: try quick already >:o
[02:08:10] benzrf: LadyRainicorn: did u clone the repo
[02:13:22] benzrf: k so bundle install o=
[02:18:48] benzrf: LadyRainicorn: ...any luck
[02:19:21] LadyRainicorn: Oh, what is it supposed to do exactly?
[02:20:08] benzrf: did the gems install?
[02:21:06] benzrf: LadyRainicorn: did the bundle install
[02:22:08] LadyRainicorn: What's brb and pry-remote-em for?
[02:22:52] benzrf: the former isnt used yet
[02:22:59] benzrf: LadyRainicorn: the latter is for pry-remoting over emergion
[02:23:30] benzrf: LadyRainicorn: if the bundle is installed u may proceed to 'cd lib/quick && mkdir quick_test && curl http://bpaste.net/raw/194161/ | ruby'
[02:23:36] LadyRainicorn: Do you know about const_set?
[02:23:46] benzrf: wrong link
[02:23:49] benzrf: LadyRainicorn: yea
[02:24:04] benzrf: w/e that link will work
[02:24:33] LadyRainicorn: The first method defined is for setting constants.
[02:25:14] benzrf: no these are constant methods
[02:25:15] LadyRainicorn: And they're global constants too.
[02:25:25] benzrf: no, they are not.
[02:25:48] LadyRainicorn: oh nvm, just define is globalish
[02:26:07] benzrf: 10:23 < benzrf> LadyRainicorn: if the bundle is installed u may proceed to 'cd lib/quick && mkdir quick_test && curl http://bpaste.net/raw/194161/ | ruby'
[02:34:05] bline79_: I need to capture multi-line output from IO.popen.. is this possible?
[02:34:31] kies: LadyRainicorn, omg /r/lolphp is hilarious
[02:34:53] bline79_: I'm having trouble figuring out how to pull that off
[02:34:55] benzrf: LadyRainicorn: does it mount proply
[02:36:46] LadyRainicorn: IO.popen('echo sup; echo bitches').read
[02:37:39] LadyRainicorn: I haven't gotten to installing FUSE yet.
[02:38:12] bline79_: I mean. I run a command IO.open ("tsung-recorder start") for example.. I want to evaluate the second line that is returned from that command and run some regex on it
[02:44:01] LadyRainicorn: bline79_: IO.popen('printf "rainbows\nunicorns!\n"').read.lines[1] =~ /(unicorns)!/
[02:48:51] bline79_: such a headache with this.. even io.popen hangs when I run my command.. in the cli, the command requires you to press return to get back to a usable shell
[02:49:16] bline79_: system runs it just fine, but it can't see the command output.. just returns bolean value
[02:51:21] mikehaas763: Hi, what's the difference between config.vm.network "private_network", ip: "192.168.33.10" and config.vm.network "private_network", :ip => "192.168.33.10"
[02:51:29] mikehaas763: or will the 2nd one not even do what I want it to do
[02:53:18] bline79_: wow, a friend gave me a nice solution :)
[02:58:26] arubin: mikehaas763: ip: is shorhand for :ip =>
[02:59:15] mikehaas763: So it represents the same type of data structure, just syntactic sugar? I'm not a ruby person, just haven't had the time
[02:59:48] benzrf: mikehaas763: yea
[03:01:00] mikehaas763: Well now I'm just curious, what's the use case for the lengthier one?
[03:03:13] arubin: mikehaas763: Hashes pairs are defined with key => value. Ruby 1.9 added sugar for keys that are symbols (:ip is a symbol).
[03:04:16] arubin: Using symbols as keys is common, and most people use the new syntax.
[03:04:19] benzrf: mikehaas763: so if you wanted to use strings or numbers, you need to use =>
[03:04:26] benzrf: {'foo' => 'bar'}
[03:04:37] benzrf: => is sometimes known as a hash rocket
[03:06:50] mikehaas763: Ok. So in the reading I just did it seems like a symbol if it were compared to more traditional C like languages is sorta kinda like an enum?
[03:07:04] benzrf: basically
[03:07:21] benzrf: mikehaas763: the general idea is that sometimes you care about the actual contents of a string, and sometimes you just care what it's equal to
[03:07:24] benzrf: i.e. like in an enum
[03:07:40] benzrf: in ruby, strings are mutable and non-interned (because mutable)
[03:08:02] benzrf: symbols are internally represented as ints, and there's a lookup table for the textual representation of each number
[03:08:15] benzrf: symbols are immutable and automatically interned
[03:08:23] benzrf: >> :foo.equal? :foo
[03:08:24] eval-in: benzrf => true (https://eval.in/127541)
[03:08:37] benzrf: Object#equal? is a test for identity
[03:08:41] benzrf: like 'is' in python, or == in java
[03:14:22] mikehaas763: Cool, thanks for the knowledge. Unfortunately I can guarantee because of all I've got on my plate ATM I won't be able to start using ruby for at least a year. I got probably ~5 hours into ruby monk once upon a time but feel like I forgot everything since.
[03:38:49] juanmnl: hello, anyone knows the channel for rails? #rubyonrails doesn't seem to work
[03:39:06] centrx: juanmnl, You need register/identify your nick to enter #rubyonrails
[03:39:49] juanmnl: oh! ok, thanks centrx :)
[04:36:31] anoldhacker: Anyone here from the core team?
[04:37:35] viscera: this has probably been asked a million times, but why are #ruby and #ruby-lang two distinct channels instead of one forwarding to the other?
[04:39:05] anoldhacker: I would presume that #ruby-lang is oriented more towards language development.
[04:39:43] anoldhacker: I've posted a question to https://www.ruby-forum.com/topic/4484730. I would really appreciate it if someone familiar with ruby internals would answer.
[04:40:39] viscera: that was my first thought, but there's nothing in the channel topics that indicates that. also, ruby-lang.org points to #ruby-lang as "a wonderful way to chat with fellow rubyists", yet #ruby is more popular
[04:40:58] agent_white: Kinda odd. I have no idea why they would split it up. We are cooler anyways.
[04:41:27] viscera: it's going to irk me, i guarantee it ;)
[04:42:20] agent_white: viscera: Largely though, lack-of-response is due to your timing joining the channel. It's bedtime for much of the US, and the Euro's don't hop on for another ~4 hours.
[04:42:53] viscera: agent_white: i haven't had a lack of response...
[04:43:07] agent_white: viscera: Ohhh! Well then... I dunno!
[04:43:15] viscera: i just noticed that both exist and are seeminly redundant
[04:43:20] viscera: seemingly**
[04:45:15] CaptainJet: you could always just be in both irc channels
[04:45:34] viscera: that's what i'm doing
[04:46:08] CaptainJet: makes it easier to time asking a question
[04:46:25] CaptainJet: if one has people talking, use that one, if not, use #ruby
[04:46:30] CaptainJet: i default to here over #ruby-lang
[04:46:58] viscera: yeah, that's similar to what i do with debian channels (they're split over freenode and oftc networks)
[05:16:26] sincereness: If I have an array of elements how to i remove the doubles or tripes of a certain entires?
[05:21:41] agent_white: sincereness: arr = arr.uniq!
[05:21:54] agent_white: sincereness: Though that will make sure ALL elements are unique.
[05:22:11] sincereness: kk ill try it 1 sec
[05:22:45] agent_white: sincereness: Rather, the assignment is not needed if you use the bang on the end. so either `arr = arr.uniq` or `arr.uniq!`
[05:28:12] sincereness: it worked when i did arr = arr.uniq but i cant append another method on that
[05:28:48] sincereness: for example arr.uniq.first throws method error
[05:32:54] centrx: sincereness, Is the array empty?
[05:33:23] centrx: sincereness, Even if it's empty that shouldn't be an error. Show actual code
[05:33:28] chichou: even if the array is empty it should work
[05:33:53] chichou: maybe you typed arr.uniq!.first ?
[05:34:09] chichou: if arr is already uniq it returns nil
[05:34:59] sincereness: yea its late so ill fix it tomorrow lol
[06:38:58] GreatSUN: I just came across some problem I have in Ruby 1.9.3p429
[06:39:20] GreatSUN: in ruby 1.8 I wrote some class/module that helps to install/load gems
[06:39:39] GreatSUN: it was working like a charm
[06:40:07] GreatSUN: now, I am doing the same in ruby 1.9, but I experience problems
[06:40:26] GreatSUN: it seams the classes defined in the gems are not defined correctly
[06:40:36] GreatSUN: any ideas why this could be?
[06:41:56] agent_white: GreatSUN: We need your code to help you.
[06:42:10] agent_white: GreatSUN: 1.8 is ancient and unsupported... you should DEFINITELY update.
[06:42:18] agent_white: Like.. 2.1.0-kinda update.
[06:42:41] GreatSUN: agent_white: This is where I am out... I am not able to change given ruby version on my own :-(
[06:42:56] GreatSUN: agent_white: there is lots of code....
[06:42:56] agent_white: GreatSUN: Something-something due to work? :/
[06:43:08] agent_white: GreatSUN: And that LOTS of code should be updated!
[06:43:09] GreatSUN: agent_white: yeah
[06:43:18] chichou: updating from 1.8 to 2.1 isn't a little bit rude ? :)
[06:43:41] agent_white: chichou: Being stuck in 1.8 is :(
[06:43:52] GreatSUN: chichou: I would have said, that they should have been updating all the time
[06:44:07] agent_white: GreatSUN: Well... shit. You really should inform your peers that 1.8 is unsupported... not "stable"
[06:44:07] GreatSUN: but the topic was and is kinda "never touch a running system"
[06:44:23] GreatSUN: agent_white: no problem about 1.8
[06:44:41] chichou: no problem ? do you use unofficial patch ?
[06:44:50] GreatSUN: agent_white: but the 1.9.3p429 is doing something I don't understand
[06:45:02] agent_white: GreatSUN: Anyways! Just a note. But if you post your code, code since if it's changed since porting it to 1.9, and a full stack trace, someone can help you!
[06:45:11] GreatSUN: chichou: I don't have a lot of problems with it, a lot of workarounds in place, yes...
[06:45:32] GreatSUN: agent_white: thats a really big thing then
[06:45:42] agent_white: GreatSUN: Yep! Otherwise, we can't help!
[06:45:44] GreatSUN: agent_white: I thought there might be some logical thing begind
[06:45:59] GreatSUN: something that someone else experienced
[06:46:04] chichou: a lot of things changed from 1.8 to 1.9
[06:46:17] GreatSUN: agent_white: the thing is, that I just have problems with one gem atm...
[06:46:27] agent_white: GreatSUN: Well... you're basically saying "Hey! My knee hurts and I switched to Nike
[06:46:37] chichou: chef support 1.8 ?
[06:46:42] agent_white: "Can someone tell my why my knee hurts?!"
[06:46:47] agent_white: GreatSUN: We just need code.
[06:46:51] GreatSUN: and this seams to be cause it is loading sub-parts additionally, but ruby 1.9 loads everything again
[06:47:08] GreatSUN: and it has something like an Immutable class
[06:47:26] agent_white: GreatSUN: Hold your breath until you have a gist with CODE for us, a STACK TRACE, and what you expect but are given.
[06:47:33] GreatSUN: after this errors with a typeerror, it seams the gem is not in place correctly
[06:47:34] agent_white: Otherwise, you are wasting your breath.
[06:48:00] GreatSUN: agent_white: I will try to create something more easy
[06:48:13] agent_white: GreatSUN: Just make it reproduceable.
[06:48:22] GreatSUN: cause if I just copy paste my code this is about 500 lines of code at least
[06:48:38] agent_white: GreatSUN: Enough code to reproduce it will suffice.
[06:48:46] agent_white: GreatSUN: Anything less than that and we cannot help you.
[06:49:58] Macaveli: Morning Friends
[06:56:04] maletor: In Ruby, how do i double fork out of a process so I'm reparented to init?
[06:57:28] chichou: you mean as a daemon ?
[06:58:15] maletor: chichou: Ya.
[06:58:54] maletor: chichou: I want to run a process separate from my Ruby process so when I restart the other process it doesn't interfere. It doesn't necessarily have to run forever which is what daemons do, right?
[06:59:02] Hanmac1: i think there is a gem for that called demonize or something similar
[06:59:17] chichou: maybe Process.daemon can help you
[07:00:00] maletor: chichou: I've been reading a little about it, but doesn't that daemonize the current process? I want a new process group.
[07:04:42] chichou: daemon attach it to daemon group
[07:05:42] chichou: maletor: or system backgrounds or whatever, as far I understand
[07:14:28] GreatSUN: agent_white: I just found the problem
[07:14:38] agent_white: GreatSUN: Good to hear!
[07:15:10] GreatSUN: not really dependent to the ruby version, but a recent change that ruby 1.8 seams not to error on
[07:15:29] GreatSUN: so it was a developer issue which didn't appear in ruby 1.8 :D
[07:16:18] agent_white: GreatSUN: :D Well make sure to prepare for the changes in 1.9, nonetheless.
[07:16:37] GreatSUN: agent_white: I am already
[07:16:56] GreatSUN: agent_white: the main things I am really disappointed of are in the gems
[07:17:02] GreatSUN: for example the mysql gem
[07:17:09] GreatSUN: (mysql2 for 1.9)
[07:17:28] GreatSUN: some methods are just deleted
[07:17:58] GreatSUN: so you have to make a switch for the gem installation, requirement, the connection building and the query actions
[07:18:08] GreatSUN: a lot of if's
[07:19:02] agent_white: maletor: So you mean forking?
[07:19:17] maletor: agent_white: maybe?
[07:19:20] agent_white: maletor: NVM. Didn't see your previous text.
[07:20:10] agent_white: maletor: Like chichou said... http://ruby-doc.org/core-1.9.3/Process.html#method-c-daemon
[07:20:34] maletor: I should be able to use posix-spawn with pgroup: true
[07:20:36] maletor: that'll do the job
[07:21:47] chichou: GreatSUN: any reason to not use bundler ?
[07:24:22] GreatSUN: chichou: bundler supports mysql/mysql2 switch based on ruby version?
[07:29:35] chichou: nop but you can use rbenv
[08:03:59] pipework: Guest91413: Nope, but you can not use rbenv and use rvm or chruby+ruby-install instead.
[08:04:15] pipework: GreatSUN: ^
[08:07:33] GreatSUN: pipework: I think I don't get your sentence. What could I use instead?
[08:10:12] chichou: I prefer rbenv as it's less "intrusive" but it's a personal choice :)
[08:13:00] chichou: and don'tnow about chruby, will take a look at it
[08:13:09] GreatSUN: chichou: bad luck... I can not work with it... They are using rvm stuff here and rbenv is incompatible with it
[08:13:25] chichou: oh use rvm so :)
[08:13:55] chichou: as I said, it's more a preference than a technical choice
[08:14:12] GreatSUN: but anyhow, this is only about require and/or install of gems, isn't it?
[08:14:52] GreatSUN: this doesn't solve my problems with things like mysql/mysql2 where you have to create instance different, use different methods and stuff
[08:15:24] chichou: you will have to get rid of this mess :)
[08:15:52] GreatSUN: chichou: yes, I would like to be updated to ruby 2.1 and to be unresponsible for ruby 1.8
[08:16:02] GreatSUN: sounds like a dream for me atm
[08:16:19] toretore: it's not difficult to switch from 1.8 to 1.9
[08:16:20] chichou: try to get to 1.9.3 first it's the most difficult part ;)
[08:16:33] chichou: toretore: for me it was :(
[08:16:50] toretore: maybe just go straight to 2.0 and don't have to deal with encoding issues as much
[08:17:32] chichou: GreatSUN: are your application over some framework or just pure ruby ?
[08:20:42] GreatSUN: chichou: different things... basic automation stuff is done via chef, then we have ruby scripts and self written libraries for a lot of things
[08:20:57] GreatSUN: I myself am maintaining about 16.000 lines of code
[08:21:40] chichou: sometime it's easier to restart from scratch
[08:25:54] GreatSUN: chichou: it's not, there is a lot of different stuff... for example a mysql server installation cookbook
[08:26:24] GreatSUN: the libraries that are helping a lot if it comes to different OS and stuff
[08:27:18] chichou: GreatSUN: but why do you want to do your switch stuff ? you want to keep code compatible with multiple versions of ruby ?
[08:29:25] GreatSUN: chichou: I have to, else I have to write and maintain two different versions and explain the users which version to use and stuff
[08:29:37] GreatSUN: so that would be a lot of more work to do
[08:30:20] chichou: For that, I would use git and support branch for example
[08:31:32] chichou: I mean, it's not your code responsibility to manage version but I guess it's much more complex in your project :)
[08:41:32] GreatSUN: chichou: yes, it is and there is lots of guys using the code that have no clue
[08:41:45] GreatSUN: that doesn't make things easier
[08:42:40] pipework: GreatSUN: What versions of ruby are you using?
[08:42:44] chichou: good luck then, I wish I never have to work on some project like that :)
[08:48:11] GreatSUN: pipework: atm 1.8.7 and 1.9.3
[08:48:22] pipework: GreatSUN: oh my.
[08:48:44] GreatSUN: chichou: I wished I could work on some nice project as lead architect ;-)
[08:49:28] GreatSUN: chichou: Have been writing at least 7000 lines of code in the last 1 1/2 year
[08:50:06] GreatSUN: pipework: yes, please, give me sympathy
[08:50:27] pipework: You have a good amount of it.
[08:50:39] GreatSUN: pipework: thanks :-)
[09:16:49] shevy: pipework please give me sympathy
[09:17:01] pipework: shevy: I have no more to give.
[09:32:54] harshada: Hey Plz Help FileHandler.loadDataSet not reading string value from input file showing "NaN"
[09:33:13] harshada: => {0=>NaN, 1=>NaN, 2=>1234.0}
[09:34:33] shevy: harshada what is FileHandler
[09:35:54] harshada: @shevy: Actually Its in JRuby
[09:39:33] Hanmac1: harshada: first there is #jruby channel, second what do you got and what do you want? NaN as Float is valid or do you want "NaN" as String?
[09:40:59] apeiros: harshada: also note that "actually it's in jruby" does not answer the question of shevy.
[09:41:00] shevy: harshada aha, can't help you there, I have only good old compiled-from-source mruby :)
[09:44:28] pipework: shevy: You use mruby?
[09:44:36] pipework: So when can we expect RubyOS?
[09:46:35] shevy: pipework mruby ain't finished
[09:47:02] pipework: Actually, it's reached 1.9
[09:48:58] harshada: @shevy: I asked same que in jruby but no body response der so I asked here.. I am expecting output as => {0=>Harshada, 1=>Ghodke, 2=>1234.0}
[09:49:13] shevy: pipework nah, it is far from complete anywhere near
[09:49:19] pipework: shevy: It's 1.0
[09:49:22] toretore: harshada: show code
[09:49:24] tobiasvl: harshada: do you mean {0=>"Harshada", 1=>"Ghodke", 2=>1234.0} ?
[09:49:32] shevy: it's at about 0.0.2
[09:49:32] harshada: tobiasvl: Yes
[09:49:35] tobiasvl: you want to get strings, unless it's a float
[09:49:40] pipework: shevy: It's as complete as it should be for a release.
[09:49:41] tobiasvl: now you just get floats
[09:49:58] shevy: pipework it's like some years left to go
[09:50:08] harshada: input_file = java.io.File.new('test.csv'.to_java)
[09:50:10] pipework: shevy: I don't think years are a measure of completeness.
[09:50:17] harshada: f1 = FileHandler.loadDataset(input_file, ",")
[09:50:19] pipework: OS/2 is extra super complete by that measure.
[09:50:54] shevy: no, that is totally unusable
[09:51:32] pipework: shevy: I don't think the author agrees.
[09:51:49] shevy: that's ok, authors are often biased
[09:51:49] pipework: It's probably just not as full of an implementation as you'd need to be able to do anything interesting with it.
[09:51:50] aagdbl: harshada, what is FIleHandler? It's not a standard Ruby class
[09:51:55] shevy: just look at the rubinius authors
[09:52:15] pipework: shevy: But the creator of the language would have a good idea after writing and working on Cruby.
[09:52:21] pipework: He's on round two.
[09:52:31] pipework: You're on round... zero?
[09:52:58] harshada: aagdbl: its in java.. I am coding in JRuby
[09:53:26] harshada: @aagdbl: So using FileHandler.LoadDataset
[09:53:38] shevy: pipework I am at about 2% completion
[09:53:52] aagdbl: ah. i have no idea then. maybe you should try getting it to work in native java code first to iron out any java api issues
[09:54:02] pipework: shevy: I don't think you're qualified to present any interesting data on that.
[09:54:03] tobiasvl: harshada: but what are you using to map stuff to the hash? is that what loadDataset does?
[09:54:22] pipework: It's complete enough for mruby, even if it's not reached feature parity with cruby.
[09:54:26] aagdbl: also, you dont have to use Java apis. you can use plain old ruby File
[10:28:07] rindolf: (puts "Hello") for 1 .. 10 -> this does nothing in irb (using ruby-2.0.0.p451-1.mga5). Why?
[10:29:25] apeiros: why should it do something?
[10:29:37] apeiros: actually, I'm rather surprised it doesn't give you a syntax error
[10:31:00] rindolf: apeiros: well, I want to run puts 10 times.
[10:31:26] apeiros: rindolf: I suggest you use valid ruby syntax then. above isn't.
[10:31:31] apeiros: e.g. 10.times do puts "hello" end
[10:32:03] Hanmac1: shevy: i have a suprise for you, i am currently working on rwx again ;P
[10:32:22] rindolf: apeiros: ah.
[10:32:36] rindolf: apeiros: so Ruby does not have a foreach statement modifier like Perl does?
[10:32:52] apeiros: it doesn't have an inline-one
[10:33:01] rindolf: apeiros: inline one?
[10:33:20] apeiros: your construct is an inline for
[10:33:22] rindolf: apeiros: by statement modifier, I mean something like puts "x" if foo > 5;
[10:33:38] apeiros: k, then your statement modifier is my inline-for
[10:34:06] apeiros: and no, it doesn't have that
[10:34:23] apeiros: also it's `for x in expr`, not just `for expr`
[10:34:44] ghr: 10.times { puts 'Hello' }
[10:34:55] apeiros: ghr: already suggested ;-)
[10:35:01] shevy: Hanmac \o/
[10:35:10] shevy: I am getting bored with ruby-gnome
[10:35:13] Hanmac: shevy one of the craziest things: some methods has a freaky comment/code ratio ;P .... (20 lines rdoc documentation, 4 lines code ) ;D
[10:36:14] ghr: apeiros ah yes
[10:36:22] ghr: if you really did want a range you can do
[10:36:23] ghr: (1..10).each { puts 'hello' }
[10:37:06] Hanmac: apeiros: you mean like that? (beware bad code)
[10:37:07] Hanmac: >> puts "ups" while ((i ||= 0); i += 1) < 5
[10:37:07] eval-in: Hanmac => ups ... (https://eval.in/127640)
[10:38:29] apeiros: Hanmac: I mean what like that?
[10:38:54] Hanmac: i made something similar to for as a statement modifier
[10:41:56] rindolf: apeiros: ??for x in 1..10 { puts x }?? ==> this does not appear to work either. Only ??for x in 1..10 do puts x end??
[10:42:34] apeiros: rindolf: so you discovered that your alternative syntax is not valid.
[10:42:55] apeiros: rindolf: you might also go an search for how rubys syntax actually looks instead of randomly trying out ideas. just a suggestion.
[10:43:21] rindolf: apeiros: I did, but I was under an impression that { ...} and do ... end were equivalent.
[10:43:44] apeiros: rindolf: they are - for blocks. for/in is not a method and does not take a block.
[10:43:57] apeiros: and most people use it without do
[10:44:01] apeiros: same for while/until
[10:44:24] rindolf: apeiros: OK, thanks.
[11:38:22] elementz: Hi, I am having trouble understanding wether my javascript assets are properly loading when using sprockets.
[11:38:52] elementz: erm, wrong channel. sorry...
[11:41:03] elementz: I would like to run bower commands from within a rake task. How would I write a rake task which executes e.g. 'bower install'? I've tried like so http://sprunge.us/ZWEX . When running rake middleman:update I get the following error: "undefined local variable or method `clean' for main:Object"
[11:41:38] elementz: So I am obviously doing it wrong, but how would I run arbitrary commands from rake then?
[11:42:00] canton7: sh "arbitrary command"
[11:42:03] j416: elementz: the Rakefile is ruby, so you can't just throw shell commands into it and assume them being run
[11:42:11] canton7: or system(), or exec(), or %x{..}, or `...`
[11:42:28] canton7: sh is a method provided by rake which does some nice stuff iirc
[11:42:38] j416: nice stuff
[11:42:39] elementz: canton7: good to know
[11:42:44] j416: like run shell commands? w
[11:44:22] elementz: canton7: what about bundler commands? Would it be recommended to use 'sh' as well? Or would there be some method that I could run that would execute bundler tasks for me?
[11:44:36] canton7: bundler almost certainly exposes stuff for rake
[11:44:38] canton7: let me have a look
[11:47:28] canton7: hmm, they mainly seem to be to do with building gems
[11:48:57] elementz: canton7: ok, I'll try via sh then. thx though
[11:52:31] canton7: to do a clean, try Bundler.load.clean ?
[11:52:38] canton7: got that from trawling the sauce
[11:52:46] canton7: probably safer to use sh though
[11:56:43] elementz: yep. sh is working fine.
[12:01:45] AlexRussia: someone know solution for it: i should in intaller some ruby program for windows(with included mri and some lib).its possible?
[12:25:03] benzrf: hows it going ruby users
[12:40:56] benzrf: is there any significant semantic difference between:
[12:41:02] benzrf: Object.new.extend(some_class)
[12:41:14] benzrf: Class.new.include(some_module).new
[12:45:41] apeiros: benzrf: depends on what you consider significant :)
[12:46:15] apeiros: in both cases you will be able to use some_module's instance methods on the newly created object
[12:55:19] rrios: Hello. I was reading the inject documentation and it says that if "you do not explicitly specify an initial value for memo, then uses the first element of collection is used [sic] as the initial value of memo". But how do I specify an initial value for memo?
[12:55:42] rrios: inject, in the case, being a method from Enumerable
[12:59:00] apeiros: rrios: by passing it as the first argument
[12:59:13] apeiros: >> [1,2,3].inject(10, :+)
[12:59:13] eval-in: apeiros => 16 (https://eval.in/127658)
[12:59:17] apeiros: >> [1,2,3].inject(:+)
[12:59:17] eval-in: apeiros => 6 (https://eval.in/127659)
[13:06:37] rrios: apeiros: Thx
[13:11:55] Hanmac: rrios: it makes a difference when the array can be empty
[13:11:55] Hanmac: >> [[].inject(:+), [].inject(0,:+)]
[13:11:55] eval-in: Hanmac => [nil, 0] (https://eval.in/127666)
[13:13:56] momomomomo: apeiros: +1 simple easy explanation
[13:14:11] momomomomo: why don???t we have eval-in in #rubyonrails :/
[13:14:35] Hanmac: because we are awesome? ;P
[13:15:09] benzrf: momomomomo: cuz sinatra rools rails droolz woot woot
[13:15:31] certainty: drools? isn't that a rules engine
[13:15:42] momomomomo: lol rules is so last year get on gorules
[13:16:13] certainty: the rules of go?
[13:28:11] benzrf: apeiros: about the new class vs extend thing
[13:28:24] benzrf: what, exactly, will be the semantic difference?
[13:59:42] sethetter: Would adding 'Kernel.exit(0)' at the end of a ruby cgi script help ensure no defunct processes?
[14:06:08] benzrf: >> begin; exit; rescue SystemExit; end; puts 'foo'
[14:06:08] eval-in: benzrf => foo ... (https://eval.in/127670)
[14:06:15] benzrf: >> begin; exit!; rescue SystemExit; end; puts 'foo'
[14:06:15] eval-in: benzrf => (https://eval.in/127671)
[14:06:30] benzrf: i think exit! raises fatal
[14:20:10] sprocket: does anybody have any tips for debugging a SystemStackError (stack level too deep)?
[14:20:48] sprocket: i was in the process of upgrading a rails 2 application to rails 4, and this error's popped up when the .save! method is called on one of my active record models
[14:22:30] apeiros: benzrf: a) where the module ends up (class vs. singleton_class), b) the callback on the module (self.included vs. self.extended), c) the creation of a "throw-away" class
[14:26:04] spstarr_work: Question: if I have a hash, say @myhash = { :city = "", :province = "" } and its inside a class, why doesn't ruby allow me to do this in a method in class: @myHash[:city] = "My New City" ?
[14:26:21] spstarr_work: since the hash is an instance variable of the class why doesn't that work?
[14:26:23] spstarr_work: ACTION is new to ruby
[14:26:37] spstarr_work: so im trying to understand why this is complex to update a hash value
[14:26:57] Mon_Ouie: How does it not
[14:27:03] Mon_Ouie: How does it not work?*
[14:27:21] spstarr_work: undefined method `[]' for nil:NilClass (NoMethodError) is the error
[14:27:40] shevy: spstarr_work you dont have a hash there
[14:27:55] spstarr_work: shevy: er isn't that a hash with symbols w/ new style?
[14:28:03] Mon_Ouie: First you're not setting if you get that error, you're just getting
[14:28:22] Mon_Ouie: Oh, that's true, your syntax is wrong too, but that should even be a syntax error
[14:28:39] shevy: spstarr_work you assign a hash somewhere else, sure. but in your given object, you simply do not have a hash at all
[14:28:41] Mon_Ouie: "Old" style is {:city => "", :province => ""}, new style is {city: "", province: ""}
[14:29:13] spstarr_work: @myHash = { city: "", ... }
[14:29:21] spstarr_work: i have it w/o equals though
[14:29:41] Mon_Ouie: And it says you're trying to call "[]" on nil, which means it hasn't been initialized the way you seem to expect it.
[14:29:49] Mon_Ouie: Where is that line located, and where are you using it?
[14:29:58] Mon_Ouie: (where are you using the hash, I mean)
[14:30:12] spstarr_work: oh in a method of this class
[14:30:24] Mon_Ouie: And where's @myHash = ????
[14:30:48] Mon_Ouie: Not in a method, in the class itself directly???i.e. class Foo; @myHash = ???; end?
[14:30:53] spstarr_work: class Foobar ---> @myHash = { city: "", .... } ............ end
[14:31:01] Mon_Ouie: Yeah, that's your problem
[14:31:13] Mon_Ouie: You should do initialization in the initialize method
[14:31:26] shevy: spstarr_work who taught you to put the hash outside of a method?
[14:31:35] Mon_Ouie: @foo = bar sets the instance variable called '@foo' of self to bar
[14:31:41] spstarr_work: shevy: just experimenting as i learn language
[14:31:59] Mon_Ouie: But self within the class block is not an instance of the class, it is the class itself
[14:32:13] shevy: spstarr_work hmm but you must have read about @ivars somewhere
[14:32:14] spstarr_work: so the hash should be just initialized as (0)
[14:32:16] Mon_Ouie: (Also, that block is only ever run once, when you create the class)
[14:32:31] spstarr_work: @myHash = Hash.new(0) ?
[14:32:38] spstarr_work: and then actually initialize it elsewhere?
[14:33:00] spstarr_work: well set the keys for it even
[14:33:11] spstarr_work: i thought you'd want to create the hash with keys but have no values
[14:33:13] Mon_Ouie: Hm? You just need to put initialization code in the initialize method, which is run every time you create a new instance of your class
[14:33:59] shevy: spstarr_work you are making up things as you go :)
[14:34:28] shevy: for instance
[14:34:34] shevy: why do you use Hash.new(0) suddenly
[14:34:39] spstarr_work: yes it works if set in initialize()
[14:34:57] spstarr_work: but that seems different in structure
[14:35:08] shevy: sure it's different now
[14:35:15] shevy: you invoke it inside of a method now
[14:35:18] spstarr_work: ive typically set instance variables *IN* the class outside of any constructor...
[14:35:29] shevy: no worries
[14:35:30] shevy: we all do plenty of mistakes when we are young
[14:35:39] spstarr_work: well to empty/null etc and any structs to null for the elements
[14:35:47] spstarr_work: so ruby seems to say no to this ;)
[14:35:55] spstarr_work: well to hashes
[14:36:11] shevy: of course it does
[14:36:15] Mon_Ouie: >> empty_hash = {}; empty_hash[:foo]
[14:36:15] eval-in: Mon_Ouie => nil (https://eval.in/127675)
[14:36:17] shevy: ruby is right
[14:36:28] shevy: it's simply that you tried to use something in ruby that did not work as you expected it to work
[14:36:44] spstarr_work: right, ruby has different structure
[14:36:44] Mon_Ouie: If you try and access a value that's not present in the hash it returns nil
[14:37:13] spstarr_work: so does ruby have the ability to create a hash with keys but leave it uninitialized values?
[14:37:33] shevy: uninitialized?
[14:37:37] shevy: what is that
[14:37:41] shevy: in the context of a hash
[14:37:42] spstarr_work: yeah like something like this:
[14:37:51] shevy: foo = nil
[14:37:55] shevy: is that uninitialized for you?
[14:38:04] shevy: hash = {}; hash[:bla] = nil
[14:38:05] spstarr_work: myHash = { something: nil, something_else: nil }
[14:38:06] shevy: how about this
[14:38:15] shevy: obviously
[14:38:23] shevy: the keys all point to nil
[14:38:28] spstarr_work: so i should be able to have this in the class body
[14:38:29] Mon_Ouie: nil is the object we use to represent the absence of a value. It's not uninitialized then though, it's initialized to nil
[14:38:35] shevy: I would not call these "uninitialized" though
[14:38:42] Mon_Ouie: You can have it there, but it doesn't to what you think
[14:38:47] shevy: Hash also has .default method btw to designate a default
[14:39:26] shevy: >> hash = Hash.new; hash.default = "We go fishing."; hash[:yo]
[14:39:26] eval-in: shevy => "We go fishing." (https://eval.in/127679)
[14:39:32] spstarr_work: I mean this: class MyClass @myHash = { city: nil, province: nil, country: nil } ..................... end
[14:39:36] Mon_Ouie: Your class itself *is* an object too, and by setting an ivar within the class block, you set an ivar of the class itself
[14:39:43] shevy: why are you again doing this outside of a method
[14:40:04] spstarr_work: because you can set instance variables like this and it works?
[14:40:11] spstarr_work: @myVariable = nil
[14:40:16] shevy: didn't we correct your earlier mistake already?
[14:40:31] shevy: now you just repeat what we corrected already :(
[14:40:38] Mon_Ouie: It's hard to tell the difference between @foo = nil and doing nothing
[14:40:40] spstarr_work: so you should *not* put instance variables of any kind in the class body but in initialize() only
[14:40:43] shevy: learning progress: 0%
[14:40:47] shevy: you can of course
[14:40:53] shevy: but it works on the class instance
[14:40:59] DouweM: spstarr_work: it's no "you should not", it just doesn't do what you think it does
[14:41:01] Mon_Ouie: Because if you try and read an ivar that hasn't been set before it just evaluates to nil
[14:41:17] benzrf: Mon_Ouie: oh hey didnt you make pry-remote-em?
[14:41:20] benzrf: or was it just pry-remote?
[14:41:27] Mon_Ouie: benzrf: Nope, just pry-remote
[14:41:36] shevy: spstarr_work think of it this way - you want your object to have certain values stored in @ivars, ok? so for this, you use these only inside of methods, ok?
[14:42:28] shevy: the first method that will be called for you to use or change is the initialize() method, when an object is instantiated via .new
[14:42:47] spstarr_work: and to me anything in the class body with @ is an @ivar so 'logically' I thought ruby would accept variable definitions
[14:42:49] shevy: I usually have as one of the first methods one called reset(), which resets the object, but also initializes it
[14:43:12] Mon_Ouie: >> class Foo; @foo = 3; end; Foo.instance_variables
[14:43:13] shevy: ok so you must have read this somewhere
[14:43:14] eval-in: Mon_Ouie => [:@foo] (https://eval.in/127680)
[14:43:26] shevy: or did you make it up :)
[14:43:32] Mon_Ouie: It does set an instance variable but not on the object you want
[14:43:54] spstarr_work: Mon_Ouie: I don't mean static
[14:44:08] shevy: what means "static"
[14:44:09] spstarr_work: unless this is STATIC if in class body and not in initialize() ?
[14:44:14] DouweM: spstarr_work: it's in relation to `self`, which is the class object when you're inside the class definition
[14:44:15] DouweM: inside an instance method, it's an instance
[14:44:17] shevy: you use very strange terminology
[14:44:31] Mon_Ouie: Don't use terminology that comes from another language to talk about it, it makes things harder
[14:44:37] spstarr_work: class Foo; @foo = 3; end -> puts Foo.foo < - prints 3
[14:44:44] shevy: spstarr_work look at this: class Foo; @foo = 5; def initialize; @foo = 6; end; end <--- what do you think will @foo be?
[14:44:49] shevy: no spstarr_work
[14:44:51] DouweM: spstarr_work: it's a var, not a method
[14:45:02] shevy: >> class Foo; @foo = 3; end; puts Foo.foo
[14:45:02] eval-in: shevy => undefined method `foo' for Foo:Class (NoMethodError) ... (https://eval.in/127682)
[14:45:07] Mon_Ouie: No, that would print an error. You'd need to create a reader to see it.
[14:45:08] shevy: spstarr_work that example was an error
[14:45:22] spstarr_work: shevy: @foo would be 6
[14:45:25] DouweM: >> class Foo; @foo = 3; end; Foo.instance_variable_get(:@foo)
[14:45:25] eval-in: DouweM => 3 (https://eval.in/127683)
[14:45:36] shevy: spstarr_work are you absolutely sure :)
[14:45:55] DouweM: shevy: your @foo is ambiguous in your question
[14:46:04] shevy: DouweM really :P
[14:46:11] DouweM: shevy: there are two @foo's, and one of them is in deed 6
[14:46:16] shevy: precisely
[14:46:19] DouweM: ambiguous questions don't help :P
[14:46:25] shevy: they would
[14:46:30] shevy: because now he understands it is not the same
[14:46:35] Mon_Ouie: Well actually with just that snippet of code, one of the foos doesn't exist yet
[14:46:37] DouweM: I doubt that
[14:46:56] Mon_Ouie: And there can be many of the "second" foo if you create many instances
[14:46:59] spstarr_work: class foo; @foo = 3; def initialize @foo = 10; end end <-- these are _two_ different instance variables >
[14:46:59] DouweM: Mon_Ouie: you and your "well actually"s :P
[14:47:01] shevy: don't let DouweM doubte you spstarr_work :)
[14:47:10] DouweM: I'm the supreme doubter
[14:47:17] DouweM: spstarr_work: yesss
[14:47:25] DouweM: spstarr_work: or rather, 1 + as many instances of Foo are around
[14:47:31] spstarr_work: DouweM: doesn't that defeat the purpose of a class instance variable?
[14:47:41] spstarr_work: its global scope to the instance of the class
[14:47:49] DouweM: spstarr_work: Foo is an object itself, so @foo within class Foo... end; is bound to that object Foo
[14:47:54] shevy: >> class Foo; @foo = 5; def initialize; @foo = 6; end; end; Foo.instance_variable_get :@foo
[14:47:54] eval-in: shevy => 5 (https://eval.in/127685)
[14:47:58] DouweM: spstarr_work: what purpose is defeated?
[14:48:18] spstarr_work: shevy: so @foo in the class body is 'static'
[14:48:29] shevy: you and your static terminology :)
[14:48:29] DouweM: >> class Foo; @foo = 5; def initialize; @foo = 6; end; end; [Foo.instance_variable_get(:@foo), Foo.nwq.instance_variable_get(:@foo)]
[14:48:30] eval-in: DouweM => undefined method `nwq' for Foo:Class (NoMethodError) ... (https://eval.in/127687)
[14:48:34] DouweM: >> class Foo; @foo = 5; def initialize; @foo = 6; end; end; [Foo.instance_variable_get(:@foo), Foo.new.instance_variable_get(:@foo)]
[14:48:34] eval-in: DouweM => [5, 6] (https://eval.in/127688)
[14:48:36] spstarr_work: (why didn't we just use a different symbol for that!)
[14:48:43] shevy: spstarr_work, class Foo; @bla = x; end <--- is very rarely used, it is not very useful
[14:48:48] DouweM: spstarr_work: it's similar to what's called static in other languages, I guess
[14:48:54] DouweM: spstarr_work: why would we? Foo and Foo.new re both objects
[14:49:00] Mon_Ouie: Also what do you call "class instance variable"? Because a class instance variable in Ruby is the instance variable of a class itself, i.e. @foo = 3 (and not @foo = 10) in your example
[14:49:16] DouweM: classes aren't some special construct in Ruby, they're interfaced with just like objects.
[14:49:26] shevy: spstarr_work ok but self depends on the context too
[14:49:33] DouweM: they are of course special, but you can work with them like objects
[14:49:42] spstarr_work: for each Foo instance you have a variable 'foo' which has a value per instance but separate
[14:49:51] apeiros: shevy: I use class Foo; @bla = x; end quite often
[14:49:56] apeiros: shevy: and I find it very useful
[14:50:05] shevy: apeiros what for
[14:50:09] DouweM: and because what you refer to as Foo is just an instance of the Class class, it can have instance variables as well
[14:50:14] apeiros: most often, multiton patterns and config
[14:51:23] spstarr_work: right, but in every single language ive used, class Foo; @myInstanceVariable = 100; end ........... puts Foo.instance_variable_get(:@myInstanceVariable) 'should' print 100
[14:51:38] DouweM: which it does
[14:51:51] DouweM: >> class Foo; @myInstanceVariable = 100; end; Foo.instance_variable_get(:@myInstanceVariable)
[14:51:52] eval-in: DouweM => 100 (https://eval.in/127693)
[14:52:25] spstarr_work: oh so you have to use a builtin instance_variable_get()
[14:52:39] DouweM: and indeed, Ruby does a lot of things different from other language you may have used
[14:52:47] DouweM: spstarr_work: no you don't
[14:52:54] shevy: spstarr_work why do you want to use instance variable get
[14:53:00] DouweM: I mean, that just reads the instance var from within that object
[14:53:08] shevy: spstarr_work why do you make it so hard and keep on wanting to use ivars outside of a method
[14:53:18] DouweM: it's nothing special with class instance vars or other instance vars
[14:53:22] spstarr_work: we're going off the original issue (which is fixed with def initialize()) but now im curious of why this is 'different'
[14:53:41] DouweM: spstarr_work: let's start from the beginning. `class Foo; self; end` What is the value of self there?
[14:54:03] DouweM: And that's where the confusion starts
[14:54:10] DouweM: No, it's not! It's the Foo class itself
[14:54:23] DouweM: the Foo class is just another object, with a #new method etc
[14:54:27] shevy: spstarr_work ruby would not work if self would be nil at that point
[14:54:36] DouweM: within the class def, self is the class we're in
[14:54:44] spstarr_work: self; isn't an instance variable in class Foo
[14:55:05] shevy: self is special
[14:55:15] DouweM: you can read @foo like self.ivars["foo"], if ivars were a Hash
[14:55:18] shevy: it's not called @self after all
[14:55:18] DouweM: It's always in relation to self
[14:55:19] spstarr_work: ruby supports 'self' like python?
[14:55:22] DouweM: which is the class within the class def
[14:55:24] spstarr_work: self == this?
[14:55:25] DouweM: it's not like python
[14:55:29] DouweM: it's just the this keyword, basically
[14:55:32] shevy: self can be this or that
[14:55:44] spstarr_work: so then: is this not legal:
[14:55:50] etqqkoiflwhb: DouweM: self isn;t a keyword
[14:56:00] spstarr_work: class Foo; self.myInstanceVariable = nil; end ?
[14:56:17] shevy: of course self is a keyword http://ruby-doc.org/docs/keywords/1.9/
[14:56:22] DouweM: etqqkoiflwhb: what would you call it?
[14:56:39] DouweM: spstarr_work: now you're calling a method called `myInstanceVariable=`.
[14:56:41] shevy: spstarr_work that is just a method
[14:56:47] DouweM: spstarr_work: but @ does indeed work on self
[14:56:52] shevy: spstarr_work you just called it myInstanceVariable :)
[14:57:02] shevy: def this_is_not_a_method
[14:57:03] etqqkoiflwhb: shevy: oh, isn;t it implicity passed as a method parameter?
[14:57:16] spstarr_work: ok so thats very pythonisk
[14:57:16] shevy: etqqkoiflwhb I don't know how it works internally
[14:57:29] shevy: some C guru can explain
[14:57:29] DouweM: etqqkoiflwhb: that would still make it a keyword
[14:57:58] spstarr_work: but in python self.foobar may refer to a method or variable instance
[14:58:04] spstarr_work: of the instance of a class
[14:58:23] shevy: what do you mean with "refer"?
[14:58:31] shevy: in ruby you could return an @ivar or whatever another method returns
[14:58:50] DouweM: spstarr_work: you understand that `Foo` is an object just like some var `foo`? You understand that `self` is the class within the class def, and an instance within the methods? You understand that @ refers to that same `self`? You understand that any object can have ivars, and that because classes are objects too, so can they?
[14:58:58] DouweM: If you understand all that, I don't see where any remaining confusion comes from
[14:59:00] shevy: you can use class methods too, Foo.bla()
[14:59:31] shevy: DouweM did you not say before that he is confused? :P
[14:59:35] spstarr_work: I know that 'self' means 'this' or the current instance that is instantiated from a Foo object
[15:00:06] shevy: why does it have to be instantiated
[15:00:28] DouweM: self just refers to the current context. it needs to be an object, which the class Foo is an example of
[15:00:31] spstarr_work: if its not then its a static class
[15:00:41] DouweM: there's no "static" in Ruby
[15:00:44] DouweM: there's just methods on objects
[15:00:46] shevy: he likes the word
[15:00:52] DouweM: a class method on a class is just a method on an object
[15:00:55] spstarr_work: i come from a C world in past
[15:00:56] DouweM: because the class is an object
[15:01:00] shevy: it is hard coded in his neuronal CPU
[15:01:01] DouweM: I know C, forget everything you know about C :P
[15:01:11] DouweM: You don't need no stinking static keyword
[15:01:16] DouweM: classes are objects
[15:01:17] DouweM: methods are methods
[15:01:18] shevy: DouweM is a class in ruby static?
[15:01:34] shevy: if he does not understand us
[15:01:38] spstarr_work: so then what is this called:
[15:01:38] shevy: we will try to understand him
[15:01:42] DouweM: shevy: you know what static methods are?
[15:01:49] shevy: DouweM methods that can not change!
[15:01:51] spstarr_work: puts Foo.instance_variable_get(:@myInstanceVariable) ?
[15:02:03] spstarr_work: if you didn't instantiate an instance from class Foo
[15:02:03] shevy: spstarr_work I call that a class method
[15:02:05] DouweM: shevy: they're methods on the class, so SomeClass.staticMethod
[15:02:12] DouweM: shevy: pretty much a class method indee
[15:02:13] shevy: so when he says static
[15:02:15] shevy: he means class methods
[15:02:31] DouweM: spstarr_work: that's the instance_variable_get method that you're calling on the object Foo
[15:02:32] shevy: spstarr_work write out that word once :)
[15:02:46] DouweM: but again, there are no class methods in Ruby, just methods on objects
[15:02:49] DouweM: classes are objects
[15:02:58] spstarr_work: DouweM: that method is built-in to all classeses though
[15:03:05] shevy: spstarr_work, btw, this method is defined here: http://apidock.com/ruby/Object/instance_variable_get
[15:03:26] DouweM: it's built into the root Object class from which almost all objects inherit
[15:03:26] shevy: yeah, defined in class Object
[15:03:30] shevy: and Object is like your mother
[15:03:34] DouweM: the Class class, of which Foo is an instance, included
[15:03:40] DouweM: So any object has that method
[15:03:42] shevy: everything good comes from class Object
[15:03:44] DouweM: and because Foo is just an object, so does it
[15:03:44] spstarr_work: that assumes you created a new instance though in that example
[15:03:54] DouweM: spstarr_work: a new instance?
[15:03:55] shevy: spstarr_work in that example, yeah
[15:03:57] DouweM: spstarr_work: Foo is already an instance
[15:03:59] shevy: but you can call it on Foo too
[15:04:07] shevy: you can call it pretty much everywhere!
[15:04:10] DouweM: spstarr_work: Foo is an instance of Class. `foo = Foo.new` is an instance of Foo
[15:04:10] spstarr_work: DouweM: sure '1' instance by default
[15:04:11] shevy: everything is an object!!!
[15:04:18] DouweM: You can actually fo zFoo = Class.new`
[15:04:28] shevy: god that is a horrible name
[15:04:31] DouweM: spstarr_work: 1 instance of what?
[15:04:37] DouweM: shevy: blame my keyboard
[15:04:40] shevy: I think he meant the string '1'
[15:04:47] DouweM: I'm dying
[15:04:48] DouweM: seriously
[15:04:49] DouweM: someone save me
[15:04:57] shevy: and let me watch :)
[15:05:02] DouweM: after all that I've done for you!
[15:05:10] shevy: sorry, I joined the evil part of the world soon after birth
[15:05:13] DouweM: ooOOOooh is that how we're gonna play this
[15:05:14] spstarr_work: DouweM: Foo.instance_variable_get(:@bar)
[15:05:21] DouweM: spstarr_work: yeah. let's get back to that.
[15:05:22] shevy: yes, on Foo
[15:05:24] DouweM: playtime is over, shevy
[15:05:32] shevy: but you could also do: foo = Foo.new; foo.instance_variable etc...
[15:05:41] spstarr_work: right but thats an instance of Foo
[15:05:55] DouweM: Which means that you're talking to different instance variables
[15:06:00] DouweM: The one on Foo vs the one on `foo = Foo.new`
[15:06:03] shevy: because these are different objects!
[15:06:04] spstarr_work: explicitly doing Foo.instance_variable_get()... to me is 'static'
[15:06:12] shevy: write out after me:
[15:06:13] spstarr_work: as you have no instance of Foo actually created
[15:06:15] shevy: class method
[15:06:19] shevy: write it out now
[15:06:25] spstarr_work: ok so class method == static method
[15:06:34] shevy: well that is a progress :)
[15:06:47] shevy: DouweM he used the term class method for the first time now, I think we made some progress finally
[15:06:58] DouweM: *high five*
[15:07:03] shevy: *low kick*
[15:07:04] DouweM: class method == static method, sure
[15:07:12] DouweM: but there is no difference between a class method and an instance method
[15:07:25] DouweM: because (listen up kids) classes are instances too
[15:07:28] shevy: now you confuse him
[15:07:30] spstarr_work: DouweM: but thats misleading if you can do this?? Foo.myClassMethod()
[15:07:38] DouweM: there's just an "object method"
[15:07:45] DouweM: and classes are objects just like instances
[15:07:46] spstarr_work: where myClassMethod is defined in class Foo def myClassMethod .. end; end
[15:07:47] shevy: and now DouweM is making up new terms :(
[15:07:55] DouweM: spstarr_work: you can't do that
[15:07:59] tobiasvl: a class is an instance of the class Class. so a class method is an instance method on the Class instance
[15:08:03] shevy: I thought everything is an object in ruby, now we have "object methods" suddenly ;(
[15:08:04] DouweM: spstarr_work: because that's a method defined for instances of Foo
[15:08:08] DouweM: tobiasvl: <3
[15:08:09] spstarr_work: DouweM: ok so thats illegal
[15:08:17] DouweM: spstarr_work: I mean I won't call the police
[15:08:25] shevy: spstarr_work one way to define a class method is via "self.", like: def self.bla
[15:08:27] benzrf: DouweM: classes are just objects that can create other objects
[15:08:29] DouweM: But you can't call a method defined for instances of Foo, on Foo
[15:08:30] spstarr_work: I see so 'class methods' are really built-in methods ruby provides to any Class object
[15:08:33] benzrf: * that was @ spstarr_work
[15:08:34] DouweM: benzrf: yupyup
[15:08:40] spstarr_work: or can you make your own class methods?
[15:08:43] DouweM: jesus benzrf get your act together
[15:08:43] tobiasvl: class << self
[15:08:46] shevy: yeah spstarr_work
[15:08:54] DouweM: spstarr_work: either `def self.class_method; whatever; end`
[15:08:56] shevy: spstarr_work you only have to define it on your class (or module)
[15:08:56] benzrf: spstarr_work: all objects have a special unique class just for them that you don't normally seemant
[15:09:03] benzrf: spstarr_work: it is called the singleton class
[15:09:09] DouweM: or, indeed `class Foo; class << self; def class_method; whatever; end; end; end`
[15:09:09] spstarr_work: oh boy.. thats confusing for where self was different in python ;(
[15:09:10] tobiasvl: EIGENCLASS tyvm
[15:09:11] shevy: seemant? lol
[15:09:11] benzrf: if you put a method in it, it will ONLY be in that one object
[15:09:16] shevy: your tab completion is so awesome benzrf
[15:09:19] DouweM: benzrf: duuude
[15:09:24] DouweM: benzrf: don't go make this more difficult :P
[15:09:24] benzrf: spstarr_work: if you do 'class << some_object'
[15:09:32] DouweM: benzrf: we just got him to understand the term "method"
[15:09:32] benzrf: spstarr_work: the code in that block goes into the singleton class for some_object
[15:09:34] shevy: DouweM stop trying to make complicated stuff too simple!
[15:09:37] spstarr_work: benzrf: a singleton class was 'static' to me
[15:09:42] benzrf: spstarr_work: or if you do 'def foo.bar'
[15:09:43] shevy: DouweM try to explain a monad in one sentence
[15:09:43] spstarr_work: non-instanced
[15:09:48] benzrf: that defines bar in foo's singleton class
[15:09:50] DouweM: shevy: I'd sooner kill myself
[15:10:07] spstarr_work: DouweM: a method was always a function inside a class
[15:10:15] spstarr_work: regardless of static or instantiated class
[15:10:19] benzrf: monads are functors except that the function you map can add to the structure of the thing you're mapping it over.
[15:10:22] benzrf: shevy: do i win
[15:10:29] spstarr_work: MyClass.MyMethodName or MyClass.myVariable
[15:10:31] shevy: I don't even know what a functor is
[15:10:38] benzrf: spstarr_work: ruby's object model is v different from python's
[15:10:41] tobiasvl: poor spstarr_work
[15:10:42] DouweM: benzrf: you win one internet
[15:10:45] benzrf: DouweM: B)
[15:10:45] spstarr_work: benzrf: so im finding out.....
[15:10:49] spstarr_work: and its hurting
[15:10:52] benzrf: spstarr_work: :o
[15:10:54] shevy: spstarr_work nono
[15:10:59] shevy: spstarr_work these are just methods
[15:11:00] tobiasvl: spstarr_work: soon you will be assimilated
[15:11:06] benzrf: personally i find ruby's nicer to work withnale_
[15:11:08] DouweM: spstarr_work: it's easier :P everything is an object! now let's party!
[15:11:14] shevy: I love this tab completion
[15:11:16] benzrf: DouweM: python has that too
[15:11:20] spstarr_work: I See what you're saying
[15:11:22] DouweM: benzrf: I know
[15:11:29] DouweM: but I want to party
[15:11:33] benzrf: spstarr_work: every object has a singleton class and a regular class
[15:11:35] spstarr_work: ruby does NOT allow you to expose instance variables directly
[15:11:40] benzrf: spstarr_work: if i say 'foo = "bar"'
[15:11:44] shevy: spstarr_work yeah you must use methods
[15:11:46] benzrf: spstarr_work: foo's class is String
[15:11:56] DouweM: spstarr_work: you need to define getter/setter methods
[15:11:58] benzrf: spstarr_work: but foo also has a special class that is its own and none other
[15:12:03] spstarr_work: hence get_instance_variable() built-in class method
[15:12:05] DouweM: spstarr_work: or reader/writer as they're called in Ruby
[15:12:10] benzrf: spstarr_work: and if you stick methods in that class, ONLY foo will have those methods
[15:12:11] DouweM: spstarr_work: you don't ever use that though
[15:12:13] benzrf: spstarr_work: no other strings
[15:12:16] DouweM: spstarr_work: it's just there for introspection
[15:12:17] shevy: he got rid of the term 'static'! I am happy :)
[15:12:22] DouweM: shevy: :)
[15:12:33] spstarr_work: static == singleton class really
[15:12:38] spstarr_work: when you really want to be specific ;p
[15:12:46] benzrf: >> "foo".singleton_class.superclass
[15:12:46] eval-in: benzrf => String (https://eval.in/127703)
[15:12:50] benzrf: strictly speakingcode
[15:12:51] benzrf: *speaking
[15:12:55] mrgoodcat: is anybody else having trouble using 'gem install' right now?
[15:12:58] benzrf: foo's actual class is its singleton class
[15:13:01] shevy: spstarr_work not sure, you can define a singleton method on an object instance too
[15:13:03] benzrf: and its singleton class is a subclass of String
[15:13:22] benzrf: a few builtin kinds of objects dont have singleton classes, including symbols and fixnums
[15:13:25] benzrf: >> 3.singleton_class
[15:13:25] eval-in: benzrf => can't define singleton (TypeError) ... (https://eval.in/127704)
[15:13:26] spstarr_work: ACTION rubs eyes and cries
[15:13:28] DouweM: benzrf: you should've stayed quiet until we got him to understand the implications of a class just being an object
[15:13:43] benzrf: that's true in python as well tho
[15:13:49] shevy: spstarr_work,
[15:13:51] shevy: >> class Foo; end; foo = Foo.new; def foo.yo; puts 'hi from yo'; end; foo.yo
[15:13:51] eval-in: shevy => hi from yo ... (https://eval.in/127705)
[15:13:52] DouweM: yeah but he's from the magical world of C
[15:14:08] spstarr_work: actually do we have URLs or tutorials for C --> ruby converts?
[15:14:08] DouweM: and C-likes
[15:14:14] spstarr_work: it would be nice to see how this maps
[15:14:15] shevy: spstarr_work sadly no
[15:14:20] shevy: only in japanese
[15:14:20] benzrf: spstarr_work: when you say 'def foo.bar', it defines the method bar in foo's singleton class
[15:14:23] shevy: or 10 years old
[15:14:27] DouweM: spstarr_work: just view it as a whole different beast :P
[15:14:29] benzrf: spstarr_work: you can also do 'class << foo; end;
[15:14:33] DouweM: forget everything you've learned up to this point
[15:14:38] benzrf: and that's foo's singleton class
[15:14:44] shevy: <DouweM> forget everything you've learned up to this point <-- epic quote
[15:14:45] benzrf: spstarr_work: so for example
[15:14:51] spstarr_work: benzrf: right foo.bar is a 'class method' for Foo
[15:14:56] benzrf: no it is not!
[15:15:01] benzrf: foo.bar is a method on foo's singleton class
[15:15:02] shevy: it's on your object foo
[15:15:19] benzrf: >> foo = "bar"; class << foo; def baz; 3; end; end; foo.baz
[15:15:20] shevy: but forget singletons
[15:15:20] eval-in: benzrf => 3 (https://eval.in/127706)
[15:15:28] DouweM: benzrf: you're aware that a lot of people have trouble understanding singleton classes, *especially* when they're just starting out with Ruby? :p
[15:15:31] shevy: who mentioned singletons first anyway
[15:15:37] DouweM: fucken benzrf
[15:15:37] spstarr_work: class Foo; def Foo.myclassInstanceMethod end; end; ... Foo.myclassInstanceMethod ?
[15:15:46] benzrf: spstarr_work: yes
[15:15:50] shevy: <spstarr_work> static == singleton class really
[15:15:52] DouweM: spstarr_work: sure, but you could also use self. here
[15:15:55] benzrf: spstarr_work: every object has its own special class separate from every other object's class
[15:15:59] DouweM: shevy: but it's not!
[15:16:00] shevy: spstarr_work was the first to mention singletons!
[15:16:00] spstarr_work: or def self.myclassInstanceMethod ?
[15:16:04] spstarr_work: same thing in this aspect ?
[15:16:07] shevy: so he confused himself
[15:16:09] DouweM: spstarr_work: either, because self == Foo at that point
[15:16:16] DouweM: shevy: a skill I admire
[15:16:17] spstarr_work: ACTION smile
[15:16:21] shevy: DouweM lol
[15:16:21] benzrf: spstarr_work: when you say that foo is an instance of string, what you really mean is that foo is an instance of its own unique class that is a subclass of string
[15:16:35] benzrf: spstarr_work: this lets objects have their own methods that other objects 'of the same class' dont
[15:16:40] benzrf: spstarr_work: like a 'baz' method on only oen string
[15:17:01] shevy: btw spstarr_work are you at work?
[15:17:08] spstarr_work: yes and about to get lunch ;)
[15:17:13] benzrf: spstarr_work: def foo.bar is defining bar in foo's 'real' class, which is a subclass of String
[15:17:18] DouweM: shevy: good question
[15:17:30] shevy: DouweM I just thought he has enough time to learn ruby at work, that would be quite a feat
[15:17:32] benzrf: spstarr_work: in a class block, 'self' is the class
[15:17:36] shevy: I never have enough time for anything at work :(
[15:17:42] spstarr_work: benzrf: right for the singleton class of 'foo' only
[15:17:54] spstarr_work: an INSTANCE of foo would not have bar() as a method
[15:17:57] benzrf: spstarr_work: so 'def self.something' defines the method 'something' on the singleton class of self, which is the class you're writing
[15:18:01] spstarr_work: only the singleton ('static') class
[15:18:03] spstarr_work: ACTION runs
[15:18:11] spstarr_work: i have static shock
[15:18:13] benzrf: never use static when talking about ruby
[15:18:16] benzrf: it has nothing to do with anything
[15:18:22] DouweM: static != singleton
[15:18:23] benzrf: and nothing in ruby is like static in java
[15:18:26] DouweM: static isn't a thing in Ruby
[15:18:34] benzrf: lose the comparison o-o
[15:18:48] DouweM: look what you've done, you broke him :(
[15:18:55] shevy: he uses the old word again
[15:19:06] DouweM: yeah all our hard work
[15:19:09] DouweM: ACTION hold shevy and sobs
[15:19:10] spstarr_work: ok so let me ask you this
[15:19:12] benzrf: spstarr_work: rubies are not like coffee
[15:19:15] spstarr_work: why is singleton != static in ruby?
[15:19:18] mrgoodcat: is rubygems.org broken right now? or does it frequently slow down?
[15:19:21] benzrf: spstarr_work: they aren't related
[15:19:25] DouweM: spstarr_work: there's no static in ruby
[15:19:28] benzrf: spstarr_work: that's like asking why isn't def like class
[15:19:30] benzrf: they're just
[15:19:31] spstarr_work: benzrf: what do you mean 'not related'
[15:19:32] DouweM: spstarr_work: singleton class is a whole different concept
[15:19:32] benzrf: different things
[15:19:38] benzrf: there's no reason why they SHOULD be related
[15:19:41] benzrf: they have nothing to do with each other
[15:19:48] shevy: spstarr_work singleton is unique
[15:20:00] spstarr_work: but outside of ruby singleton == static is it not or am I mixing up something altogether?
[15:20:16] DouweM: mixups all around
[15:20:17] shevy: what is the difference
[15:20:24] benzrf: spstarr_work: a singleton class is just a class for a specific object
[15:20:27] benzrf: instead of a group of objects
[15:20:52] spstarr_work: benzrf: right but a singleton is a class for when the class has NO instances
[15:21:14] benzrf: 11:20 < benzrf> spstarr_work: a singleton class is just a class for a specific object
[15:21:17] DouweM: let's forget singleton classes for now...
[15:21:17] benzrf: 11:20 < benzrf> instead of a group of objects
[15:21:27] benzrf: any object in ruby has its own class that no other object has
[15:21:41] benzrf: every string is actually an instance of a special unique class just for that string
[15:21:41] DouweM: I know experienced Ruby devs who have a hard time wrapping their head around the subject
[15:21:44] benzrf: which is a subclass of String
[15:21:48] DouweM: he really doesn't need to know that at this point
[15:22:07] DouweM: spstarr_work: are you clear on the ivar thing from before?
[15:22:17] spstarr_work: yes i have that working in my test code ;)
[15:22:22] DouweM: spstarr_work: do you understand that a class is just another object?
[15:22:28] DouweM: spstarr_work: an instance of Class, to be precise
[15:22:46] bilbo_swaggins: So what is it called when I do
[15:22:46] spstarr_work: DouweM: an instance of a Class or of Class?
[15:22:58] DouweM: spstarr_work: well, if you have any other questions on that, let us know. if you feel comfortable dealing with the class hierarchy stuff in Ruby, come back for benzrf's class on singleton classes
[15:23:04] bilbo_swaggins: class Foo; def self.bar; :baz; end; end; Foo.bar
[15:23:11] bilbo_swaggins: >> class Foo; def self.bar; :baz; end; end; Foo.bar
[15:23:11] eval-in: bilbo_swaggins => :baz (https://eval.in/127709)
[15:23:13] DouweM: spstarr_work: of Class, literally. Class is the a class, of which all classes are instances
[15:23:28] bilbo_swaggins: I think that's what he means by "static"
[15:23:32] DouweM: yeah it is
[15:23:40] benzrf: DouweM: =p
[15:23:42] DouweM: but we got past that, until benzrf started messing with his head again
[15:23:42] spstarr_work: DouweM: i get that 'Class' itself is a object of ruby in this case a built-in
[15:23:50] DouweM: spstarr_work: sure
[15:23:55] spstarr_work: and any NEW clas you create inherits from base 'Class'
[15:23:57] bilbo_swaggins: Someone said something that made it ambiguous
[15:23:58] benzrf: spstarr_work: Class is an instance of itself
[15:24:02] spstarr_work: effectively hence get_instance_variable()
[15:24:05] benzrf: spstarr_work: no, new classes are subclasses of Object
[15:24:08] spstarr_work: is a method of base 'Class'
[15:24:12] benzrf: spstarr_work: classes are INSTANCES of Class
[15:24:22] benzrf: spstarr_work: 'foo' is an instance of String
[15:24:28] benzrf: spstarr_work: and Object is an instance of Class
[15:24:56] spstarr_work: i guess I need to see the heirchy of this
[15:25:01] spstarr_work: but i need to grab lunch :)
[15:25:04] benzrf: spstarr_work: kk
[15:25:10] DouweM: see ya later :)
[15:25:42] DouweM: I'm taking this opportunity to watch the americans
[15:25:43] DouweM: the show that is
[15:27:47] bilbo_swaggins: okay now that we're done, please explain the difference between a Proc and a Lambda, like I'm five
[15:28:07] bilbo_swaggins: Or like I'm 4 even.
[15:28:25] DouweM: well for starters, one is longer than the other
[15:28:59] benzrf: bilbo_swaggins: it is quite simple
[15:29:11] benzrf: bilbo_swaggins: a lambda acts exactly like a method
[15:29:16] benzrf: bilbo_swaggins: a proc acts exactly like a bloc
[15:29:30] benzrf: so 'next' in code going into a proc will work
[15:29:36] benzrf: it will not in a lambda
[15:29:45] benzrf: oh wait wut
[15:29:49] benzrf: i guess it will o.o
[15:29:50] DouweM: and return from a proc will break out of your method
[15:29:51] bilbo_swaggins: but a lambda can scope instance variables?
[15:30:03] DouweM: benzrf: hehe, so much for quite simple :)
[15:30:15] benzrf: ok it is OTHERWISE quite simple ;-;
[15:30:20] benzrf: bilbo_swaggins: the two main diffs are:
[15:30:22] bilbo_swaggins: yeah I'd heard a similar explanation, but it didn't quite click
[15:30:30] benzrf: 1. procs are flexible about how arguments work, lambdas arent
[15:30:38] benzrf: give too many to a block/proc, theyre discarded
[15:30:46] benzrf: too few, nils for the rest
[15:30:53] benzrf: lists are destructured into args
[15:30:58] benzrf: lambda arguments work exactly like methods
[15:31:01] DouweM: I like this explanation: http://awaxman11.github.io/blog/2013/08/05/what-is-the-difference-between-a-block/
[15:31:15] benzrf: 2. lambda control keywords work like in methods, not like in blocks
[15:31:30] benzrf: bilbo_swaggins: 'return' in a block returns from the method that the block was defined in
[15:31:41] benzrf: bilbo_swaggins: 'return' in a lambda returns from the lambda
[15:32:03] benzrf: bilbo_swaggins: and i think a few other kwds like break work differently
[15:32:19] anoldhacker: I have a question for someone familiar with ruby internals @ https://www.ruby-forum.com/topic/4484730. I would really appreciate a response.
[15:33:05] benzrf: anoldhacker: redefining __send__ and __object_id__ might be dangerous
[15:33:09] benzrf: equal? might be ok
[15:33:29] bilbo_swaggins: I will spend some time today exploring the arcanities of function-objects
[15:33:36] benzrf: oh fuckin boy
[15:33:37] DouweM: benzrf is right
[15:33:38] anoldhacker: I'm actually planning on leaving __send__ alone.
[15:33:44] DouweM: don't mess with __ methods, #equal? is fine
[15:33:53] benzrf: ^rule of thumpba_
[15:34:03] DouweM: why do you want to override __object_id__ ?
[15:34:18] bilbo_swaggins: has anyone found this worthwhile?
[15:34:19] bilbo_swaggins: http://www.amazon.com/Purely-Functional-Structures-Chris-Okasaki/dp/0521663504
[15:34:27] bilbo_swaggins: in a language like Ruby, I mean
[15:34:54] anoldhacker: Because roles need to be really thin wrappers. I'm wanting to override all identity methods to avoid having an identity crisis.
[15:35:14] DouweM: anoldhacker: if you want to be able to put them in hashes, you can override #hash
[15:35:38] benzrf: bilbo_bbl: just learn haskell already o-o
[15:35:44] benzrf: shevy: functors are so easy
[15:35:57] anoldhacker: Yep. & #eql? to make it all work.
[15:35:58] benzrf: shevy: they are just things where it makes sense to apply a function to 'their insides'
[15:36:01] benzrf: shevy: i.e. map
[15:36:13] benzrf: shevy: Array is a functor where 'fmap' is #map
[15:36:29] benzrf: shevy: Hash could be a functor where 'fmap' is map over the values
[15:36:29] DouweM: I really liked writing Haskell
[15:36:58] benzrf: shevy: DB queries can be functorized by making 'fmap' work on the results, once you run the query
[15:37:37] benzrf: shevy: Procs are functors if you apply the block to their 'future result'
[15:37:40] benzrf: that is, compose em
[15:37:59] bilbo_bbl: I have a hard time balancing practical projects with heavy theory
[15:38:05] bilbo_bbl: I sort of jump around a lot
[15:38:09] bilbo_bbl: and never finish things
[15:38:13] benzrf: bilbo_bbl: learn haskell
[15:38:16] bilbo_bbl: but sure I want to learn Haskell
[15:38:25] anoldhacker: #__object_id__ is a bit of a special thing. Since Role is inheriting from BasicObject, this is gonna happen. I'm just nervous about it.
[15:38:28] bilbo_bbl: alright I'll take that endorsement
[15:38:39] benzrf: bilbo_bbl: haskell is fun the same way abstract math is fun
[15:38:43] benzrf: bilbo_bbl: do u like abstract math
[15:38:45] DouweM: anoldhacker: why do you think you need to override it?
[15:38:57] DouweM: anoldhacker: just leave it alone and come back when it gives you trouble
[15:39:01] DouweM: which it probably won't
[15:39:08] benzrf: anoldhacker: i keep reading ur nick as 'arnoldhacker'
[15:39:13] bilbo_bbl: thanks benzrf.
[15:39:22] freeone3000: In a ruby script, Net::SSH.start() throws Errno::ETIMEDOUT, while in irb, with the same arguments, it does not. What is the difference?
[15:39:29] benzrf: anoldhacker: maybe make it an_old_hacker
[15:39:33] bilbo_bbl: benzrf: I loved discrete math
[15:39:39] benzrf: freeone3000: the rest of the script
[15:39:42] benzrf: bilbo_bbl: learn haskell
[15:39:45] bilbo_bbl: calculus I was always too lazy to get into
[15:39:46] benzrf: it will explode your braincrash
[15:39:52] bilbo_bbl: but I've been more interested in lately
[15:40:03] benzrf: it has static typing but it doesnt suck
[15:40:11] freeone3000: benzrf: That's an oddly specific error for some random line a few dozen lines up to interfere, especially with this being the first invocation of Net::SSH.
[15:40:13] bilbo_bbl: Ruby is the most typed untyped language ever
[15:40:16] benzrf: bilbo_bbl: 90% of errors in haskell are type errors
[15:40:22] anoldhacker: There are times to wait & see & times to aggressively chase corner cases. Something weird like trying to add DCI to a language feels very much like a time to chase corner cases to me.
[15:40:32] bilbo_bbl: I could stand some inferred static typing
[15:40:44] benzrf: bilbo_bbl: haskell has nearly perfect inference
[15:41:00] bilbo_bbl: Most of my Ruby bugs are type errors
[15:41:01] benzrf: it's good practice to write the types of top-level functions, but everything else is normally inferred
[15:41:01] DouweM: anoldhacker: :) I've warned you, I'd stay away from __ methods. But hey, try it and maybe you won't crash and burn
[15:41:06] bilbo_bbl: or, sorry, "class" errors
[15:41:10] benzrf: bilbo_bbl: haskell has higher-order functions out the wazoo
[15:41:17] benzrf: your wazoo will be full of functions
[15:41:21] benzrf: do you want this y/n
[15:41:23] bilbo_bbl: I don't know
[15:42:33] benzrf: replicate <$> readLn <*> pure 'y'
[15:42:53] benzrf: Prelude Control.Applicative> replicate <$> readLn <*> pure 'y'
[15:42:53] benzrf: "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"
[15:46:49] freeone3000: https://gist.github.com/freeone3000/651a0294ea97e8186419 is my code. Why does the script give me an Errno:ETIMEDOUT on line 40 of noctilucent_builder.rb but not on line 34 of irb.rb?
[15:57:16] olivier_bK: how i can get all params between /exportStats and <br/>
[15:57:42] olivier_bK: https://gist.github.com/zyriuse75/47d006a591427cbbf736
[15:58:04] bilbo_bbl: thanks again benzrf. I'll learn me a haskell for great good and tackle sinatra at the same time
[15:58:57] benzrf: bilbo_bbl: take it in bites
[15:59:03] bilbo_bbl: I copied your chat lines into some notes
[15:59:03] benzrf: dont expect to grok monads in ur first week
[16:14:57] jlebrech: is there a function to turn: %{a 1 b 2 c 3} into {'a' => 1, 'b' => 2, 'c' => 3}?
[16:16:01] jlebrech: i mean %w{}
[16:18:27] havenwood: >> %w{a 1 b 2 c 3}.each_slice(2).map { |k, v| [k, v.to_i] }.to_h
[16:18:27] eval-in: havenwood => {"a"=>1, "b"=>2, "c"=>3} (https://eval.in/127727)
[16:20:18] jlebrech: found that question https://groups.google.com/forum/#!topic/wellrailed/qR-LU4Xmhvk
[16:20:20] havenwood: jlebrech: ^ but simpler if you don't need to turn the value from a String into a Fixnum.
[16:20:24] jlebrech: spatting into hash does it
[16:20:37] benzrf: havenwood: or you could just do:
[16:20:42] benzrf: Prelude Control.Applicative> replicate <$> readLn <*> pure 'y'
[16:20:43] benzrf: "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"
[16:20:54] benzrf: >> Hash[*%w{a 1 b 2 c 3}]
[16:20:55] eval-in: benzrf => {"a"=>"1", "b"=>"2", "c"=>"3"} (https://eval.in/127728)
[16:21:05] DouweM: benzrf: nice
[16:21:05] juni0r: Hash[*%w{a 1 b 2 c 3}] ?
[16:21:19] havenwood: benzrf: like i said, value into an int
[16:21:20] DouweM: I had forgotten Hash took an arglist of key/value pairs
[16:21:26] benzrf: havenwood: >:(
[16:21:29] havenwood: benzrf: but sure, could then map
[16:21:33] benzrf: >> Hash[*%w{a 1 b 2 c 3}].map!
[16:21:34] eval-in: benzrf => undefined method `map!' for {"a"=>"1", "b"=>"2", "c"=>"3"}:Hash (NoMethodError) ... (https://eval.in/127729)
[16:22:01] canton7: mapping the values then makes it a bit more ugly, as you get arrays back
[16:23:45] havenwood: #map_pair, #map_key, and #map_value would come in handy
[16:26:08] canton7: aha, I see you're the author of the top google result for those :P
[16:26:14] canton7: yeah, very handy, agreed
[16:31:36] benzrf: havenwood: damn straight they would
[16:32:36] DouweM: yeah, very useful
[16:34:02] benzrf: ok u know what node.js needs
[16:34:07] benzrf: delimited continuations
[16:34:29] spstarr_work: ACTION subclasses DouweM 
[16:35:13] benzrf: class Spstarr < DouweM
[16:35:19] benzrf: def at_work?
[16:35:27] benzrf: @nick.end_with? 'work'
[16:39:41] benzrf: lex_functor: lex more like lens
[16:40:08] lex_functor: you love it, don't lie
[16:43:47] shlant: hey ruby crew. This is kind of chef-heavy stuff, but I was wondering why this doesn't work and if it's even possible: https://gist.github.com/MrMMorris/678f577074747e698655
[16:44:08] shlant: basically I want to be able to handle no key, single key value and multiple key value
[16:44:37] shlant: in reference to up/down
[16:44:39] spstarr_work: benzrf|offline: hehe
[16:50:36] bklane: I am using a phantomjs gem for scraping and keep getting the error: 'OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read finished A: decryption failed or bad record mac', anyone know how to solve it?
[16:50:48] bklane: I'm hosting on heroku, (unsure if that makes a difference)
[16:51:38] xybre: bklane: HAve you checked to see what the input its processing is?
[16:52:34] bklane: xybre: yup, im scraping something thats identical for each page, on a single domain yet it will randomly run that error when the jobs are being processed in DelayedJobs
[16:52:55] bklane: I just re-run the jobs and they will process but want to try to stop it from happening to begin with
[16:54:07] sabooky: If I have a method that takes arguments and a block, is there a way to pass the block using curly braces on one line?
[16:54:17] sabooky: my_method arg1, arg2, {my block}
[16:54:28] xybre: bklane: Basically what I'm asking is that since its an SSL decryption error, maybe you're not getting the payload you expect, so you should look at the raw payload.
[16:54:37] sabooky: Or do i have to use do/end syntax
[16:54:43] xybre: sabooky: Yeah, but you have to use parens.
[16:55:13] xybre: sabooky: my_method(arg1, arg2){ my_block }
[16:57:19] bklane: xybre: if im doing a get request for a page, should i use http or https?
[16:58:26] sabooky: xybre: Thanks, yeah that worked. Had a brain glitch since it was a ruby dsl. Thanks!
[16:58:49] bklane: xybre: yup thats the problem, the site redirects to https and when i do a request with https it works fine but on the http request it sometimes fails
[16:59:02] bklane: thank you
[16:59:41] xybre: bklane: :D
[16:59:48] xybre: sabooky: Its all good :)
[17:05:59] f0ster: lol , how to fix? https://twitter.com/rem/status/421221771342536704
[17:08:48] havenwood: f0ster: File.delete '-rf ~'
[17:11:04] f0ster: haha, from ruby
[17:15:11] RubyPanther: I was building mruby for android yesterday and the android toolchain did indeed take a ~ literally, and created a dir called ~ in the localdir, I just took a deep breath and said rm -rf ./\~
[17:15:36] f0ster: and that worked?
[17:15:55] RubyPanther: yeah, the ./ is probably not needed but I wanted to protect myself from my own mistakes ;)
[17:16:13] matti: RubyPanther: And then you by accident made space between . and /
[17:16:48] RubyPanther: matti: mistakes can be deadly, I did stare at the screen for a few seconds before pressing enter
[17:17:04] matti: I am sure you did.
[17:17:51] RubyPanther: What is worse on a new sysadmin is creating too many files in a dir for bash to list, because it breaks rm using wildcards
[17:18:07] RubyPanther: you can still delete them with a glob... using Ruby (or Perl)
[17:18:37] matti: RubyPanther: Or using find, or using xargs.
[17:19:22] RubyPanther: xargs is less help unless you're also using find because you can't give ls a glob, bash still has to handle the args
[17:20:04] RubyPanther: They should succeed, but they'll probably also cry and worry they picked the wrong new job ;)
[17:20:48] matti: Its actually more fun to see a developer who is trying to troubleshoot issues on Linux box.
[17:21:09] RubyPanther: Well, in that case you might stump them and waste a whole week
[17:21:53] RubyPanther: You can probably do that much damage just with a carefully exported env var
[17:21:58] matti: RubyPanther: Interesting would be also: make wchar literal file name and then flip back to LA_ALL/LANG = C
[17:22:05] matti: RubyPanther: And ask people to remove it ;]
[17:22:11] razrunelord: How do I make ruby not display floats in exponential format?
[17:22:24] RubyPanther: razrunelord: make them smaller
[17:22:39] RubyPanther: razrunelord: also, define "display"
[17:23:02] matti: RubyPanther: I had a Senior developer failing to notice "logout" in his .bashrc :)
[17:23:03] razrunelord: 1.111111111111111e+129 I don't want this RubyPanther
[17:23:21] matti: razrunelord: "%.2f" ;P
[17:24:33] matti: RubyPanther: chattr +i file.txt and giving them full sudo/root access and asking "get rid of it". Also fun.
[17:25:23] sabooky: Not sure if this is the correct channel to ask this in but.. is there a way to `bundle install` only one group?
[17:25:44] Senjai: sabooky: You mean when you have groups segregated in a gemfile like rails app?
[17:25:49] RubyPanther: >> "%f" % 99999999999999999999999999999999999999999.1
[17:25:50] eval-in: RubyPanther => "100000000000000000620008645040778319495168.000000" (https://eval.in/127753)
[17:26:01] sabooky: Senjai: Correct
[17:26:15] Senjai: sabooky: It installs the group depending on what RAILS_ENV is set to.
[17:26:18] sabooky: Senjai: It's not a rails app, but iirc rails does a similar thing with bundle groups
[17:26:27] RubyPanther: razrunelord: As a float they're the same and it doesn't (can't!) matter, but as a string you need to format with sprintf aka %
[17:26:35] Senjai: sabooky: Rails uses RAILS_ENV to determine the group, I'd look into how it does it
[17:26:37] razrunelord: Thanks RubyPanther got it!
[17:26:37] Senjai: as I'm not suire
[17:26:54] Senjai: RAILS_ENV=production bundle install only installs the production group and any ungrouped gems
[17:27:09] matti: RubyPanther: With the floats you reminded me about Calculator Unboxing video ;]
[17:27:23] sabooky: Senjai: Okay, I'll check the rails code to see if I find any clues in there.
[17:28:09] matti: RubyPanther, razrunelord: https://www.youtube.com/watch?v=wyl-V0mrEio
[17:42:04] spstarr_work: can you even do this in ruby
[17:42:15] spstarr_work: MyClass.instance_variable_get(:@aHash[:company])
[17:42:33] spstarr_work: assuming you 'did' create a instance hash variable
[17:42:37] spstarr_work: it says thats not valid
[17:43:43] DouweM: spstarr_work: that makes little sense :)
[17:43:47] lex_functor: Any of y'all in the Central Valley, CA, region? I'd like to organize a meetup for Rubyists near me.
[17:43:58] DouweM: the variable is still named @aHash
[17:44:16] DouweM: the [:company] part is then a call on the returned Hash
[17:44:23] lex_functor: there are some existing hacker spaces here, including ruby events
[17:44:28] apeiros: :@aHash[:company] # is not valid
[17:44:45] apeiros: I guess you meant MyClass.instance_variable_get(:@aHash)[:company]
[17:45:10] apeiros: also, probably rather an_instance_of_my_class.instance_variable_get???
[17:45:31] DouweM: spstarr_work: `:@aHash` is just a symbol argument to instance_variable_get, which will have it looked up the ivar by that name and return it
[17:45:31] apeiros: (it's possible on the class too, but much less likely that that's what you actually want)
[17:45:47] DouweM: spstarr_work: on that returned ivar value, the Hash in this case, you can call the :company lookup
[17:45:52] spstarr_work: yeah that works
[17:46:14] DouweM: apeiros: this is related to what we were talking about with spstarr_work earlier today. he was actually looking for an ivar on the class then :)
[17:46:30] spstarr_work: DouweM: that is interesting
[17:47:15] spstarr_work: so could you set the ivar of a class within a method?
[17:48:04] spstarr_work: @myHash[:company] = "Foobar" <-- set an instantiated instance variable myHash's w/ symbol company value Foobar
[17:48:06] DouweM: spstarr_work: sure: `self.class.instance_variable_set(:@ivar_name, "value")` but don't do that :P
[17:48:23] spstarr_work: DouweM: i mean within an instantiated class method though
[17:48:35] DouweM: spstarr_work: you can't directly access any object's instance variables, so not your class's either
[17:49:05] spstarr_work: I See, only via the approach you list above
[17:49:08] DouweM: spstarr_work: if you want your instances to read one of their class's instance variables, use a getter method
[17:49:16] spstarr_work: or via a setter/getter method within the class
[17:49:48] spstarr_work: ACTION is building up various examples so i can see how ruby does things
[17:50:05] spstarr_work: def self.classInstanceMethod return "Only available as class method, singleton" end
[17:50:17] spstarr_work: puts MyClass.classInstanceMethod()
[17:50:20] DouweM: spstarr_work: side note: teach yourself now to use snake_case rather than camelCase
[17:50:26] DouweM: for methods and variables that is
[17:50:31] DouweM: classes are still CamelCase
[17:50:41] sigurding: short question: if I execute ???bundle exec monitoring??? I get a /forwardable.rb:186: stack level too deep (SystemStackError). Aborting with STRG + C shows me: https://gist.github.com/jhiemer/2a223fcd419b22a3cb44. Anyone has an idea?
[17:50:42] spstarr_work: i noticed Ruby enforces CamelCase
[17:50:51] spstarr_work: for ClassName
[17:50:52] DouweM: and drop the () at the end of that method. No args, no parentheses
[17:51:03] spstarr_work: thats a habit that dies hard :)
[17:51:16] DouweM: spstarr_work: it needs to have a capital initial letter, but the rest can be as ugly as you like
[17:51:21] Senjai: spstarr_work: Sorry? You can do Classname if you really wanted.
[17:51:34] Senjai: Thats not camel case
[17:51:38] Senjai: thats capitalization.
[17:51:41] Burgestrand: sigurding: is monitoring trying to load monitoring?
[17:51:41] DouweM: constants need a capital letter, and a classname is a constant
[17:51:58] spstarr_work: DouweM: that explained the error ruby told me
[17:52:23] sigurding: Burgestrand: https://gist.github.com/jhiemer/3617edcedbd5325a373a
[17:52:27] spstarr_work: i always kept () at end of methods to indicate it is a method
[17:52:27] Senjai: I mean afaik you could do something like: my_class = Class.new do ... end
[17:52:30] Senjai: my_class.new
[17:52:30] spstarr_work: not a variable
[17:52:33] Senjai: but thats not a good idea
[17:53:11] Senjai: spstarr_work: You should look up the ruby style guide on github
[17:53:34] Burgestrand: sigurding: it???s not a lot to go on, but chances are that the generated file from bundler is not at fault, but the actual ruby script being executed by that load
[17:53:39] Senjai: spstarr_work: Everything in ruby is an object. So there is no reason to differentiate a "variable" from a "method"
[17:54:01] Senjai: spstarr_work: my_class is an object that takes no arguments. my_class(thing) is an object that takes one argument
[17:54:27] sigurding: Burgestrand: I am able to run the execution script via ruby monitor.rb without any issue
[17:54:43] DouweM: Senjai: I wouldn't go mixing objects with variables with methods
[17:54:57] spstarr_work: Senjai: I guess thats the confusion Im trying to unconfuse
[17:54:58] Burgestrand: sigurding: perhaps spelunking would be a good idea. If you replace the ???load??? at line 16 in that file with ???puts???, should give you a hint of what file it is trying to load.
[17:55:03] spstarr_work: I mean I get that "foo bar".length()
[17:55:06] Senjai: DouweM: Well, a variable in ruby is something =
[17:55:10] spstarr_work: literal string is an object too
[17:55:13] Senjai: something="hello"
[17:55:19] Senjai: something is an object and a variable
[17:55:19] Burgestrand: sigurding: (and run it again, of course, to have it print the file path)
[17:55:21] spstarr_work: or 100.repeat(100)
[17:55:24] Senjai: all variables in ruby are objects
[17:55:40] DouweM: variables refer to objects, the variable itself isn't an object :/
[17:55:50] DouweM: methods aren't objects either
[17:55:53] Burgestrand: sigurding: I am *guessing* that the path resolves to the same file, and if that is the case the reason is probably has to do with something else in your setup
[17:55:54] DouweM: they're, well, methods
[17:55:56] sigurding: Burgestrand: it references to itself
[17:55:58] spstarr_work: Senjai: but for code legibility
[17:55:59] Senjai: DouweM: "hello".class ?
[17:56:04] Senjai: DouweM: All methods return objects
[17:56:12] DouweM: that's not the same thing
[17:56:21] DouweM: not trying to be pedantic, but you confused me
[17:56:25] Burgestrand: sigurding: some more context is necessary :)
[17:56:30] Senjai: DouweM: Right, but for the sake of getting used to ruby, you can make that assumption
[17:56:32] spstarr_work: seeing myClass.getThisString (while the name of the method may imply its a method or if ruby does like C++ does and denotes m_methodName)
[17:56:37] sigurding: Burgestrand: ok, wait a sec
[17:56:48] Senjai: DouweM: Given that a method in ruby will always return an object
[17:57:24] DouweM: Senjai: sure, but I'd make that distinction. a lot of things *are* objects, but not everything in the language syntax is
[17:57:36] DouweM: spstarr_work: is that a question?
[17:57:52] Senjai: DouweM: A method is a block of reuseable code that always returns an object
[17:58:04] Burgestrand: DouweM: do you have an example of that? I don???t disagree, I???m just curious about which kind of semantics you two are discussing.
[17:58:41] DouweM: Burgestrand: I was responding to Senjai's "spstarr_work: Everything in ruby is an object. So there is no reason to differentiate a "variable" from a "method"" and "spstarr_work: my_class is an object that takes no arguments. my_class(thing) is an object that takes one argument"
[17:59:02] DouweM: Burgestrand: IMO those statements only make things more confusing to someone trying to wrap their head around Ruby syntax en semantics
[17:59:22] Senjai: There is no reason to differentiate a method from a variable as a user, because they will both always return objects
[17:59:24] sigurding: Burgestrand: https://gist.github.com/jhiemer/3617edcedbd5325a373a
[17:59:30] Burgestrand: DouweM: I see your pain point :)
[17:59:41] sigurding: I updated it with all relevant information regarding bundler
[18:00:07] Burgestrand: I suppose a more correct way of saying it is: all expressions in ruby return an object
[18:00:08] spstarr_work: Senjai: they might but visually looking at code
[18:00:13] Mon_Ouie: Senjai: You can't assign a method to something. That makes them very different already.
[18:00:14] DouweM: Burgestrand: +1
[18:00:35] Mon_Ouie: Also variables are lexically scoped, methods are dynamically scoped
[18:01:06] Burgestrand: sigurding: ah, you have a binstub for a gem you are actively developing?
[18:01:18] sigurding: Burgestrand: yes!
[18:01:47] DouweM: spstarr_work: got a specific question?
[18:02:12] spstarr_work: DouweM: none right now, more experimenting :)
[18:02:25] Burgestrand: sigurding: I???m not sure you???re intended to have a binstub for the same gem you???re developing, but I would say it???s enough to warrant a visit to the bundler issue tracker / IRC (if there is one) or similar. Why do you have a binstub for the project you are currently working on? ^^
[18:03:17] spstarr_work: neat puts MyClass.instance_variable_get(:@aHash).values
[18:03:40] spstarr_work: so that implicitly is a hash returning all values from it
[18:04:04] Burgestrand: spstarr_work: what is implicit about it?
[18:04:06] DouweM: spstarr_work: the instance_variable_get(...) returns the actual Hash object and from that point you can call any method on it you want
[18:04:13] DouweM: it's about as explicit as it gets, indeed :P
[18:04:15] sigurding: Burgestrand: honestly: I am beginner and I followed this: http://rails-bestpractices.com/blog/posts/8-using-bundler-and-rvm-to-build-a-rubygem
[18:04:34] spstarr_work: mixed up my plicits
[18:04:56] Burgestrand: sigurding: I???ll have a quick read, see if I can follow :)
[18:05:21] Burgestrand: sigurding: I can???t see anything about binstubs in it though!
[18:06:09] sigurding: Burgestrand: ok, perhaps I need to ask something: where to you see the binstubs etc?
[18:07:51] Burgestrand: sigurding: by binstubs I refer to the generated file by bundler (the one that contained ???load Gem??????). Those files are generally generated using bundler when working in projects to ensure that when you type ???some_command???, that ???some_command??? loads the right version of the gem from the start. Because you had such a file (that is causing the loading of itself), I assume that you???ve at some point generated binstubs using
[18:07:51] Burgestrand: the bundler command
[18:08:12] Burgestrand: sigurding: i.e. something like ???bundle install --binstubs???
[18:08:18] sigurding: Burgestrand: yes correct
[18:08:51] Burgestrand: sigurding: doing the same with a new imaginary gem to try to get a feeling for what I should tell you to do ;)
[18:08:57] Burgestrand: (I am doing the same???)
[18:10:08] Burgestrand: sigurding: how are you executing the ???monitoring??? command, and from which folder?
[18:10:58] sigurding: Burgestrand: I am executing from the project base dir
[18:11:35] Burgestrand: sigurding: alright! So you want your gem to install a command ???monitoring??? when somebody installs your gem?
[18:11:45] sigurding: an in this directory I am starting it via ???bundle exec monitoring???
[18:12:04] sigurding: Burgestrand: exactly, this should be the project to executre
[18:13:13] Burgestrand: sigurding: alright, I don???t think you should be using binstubs for this development. You can stop bundler from creating binstubs every time you do ???bundle install??? if you edit the file ???.bundle/config??? and remove the BUNDLE_BIN line
[18:14:02] Burgestrand: sigurding: next up after that is removing all stuff inside your_gem/bin, except the ???monitoring??? file, which is the one where you should write your command code
[18:14:53] sigurding: Burgestrand: all done!
[18:15:16] Burgestrand: sigurding: finally, you should make sure your command file is executable by doing ???chmod +x bin/monitoring???
[18:16:04] Burgestrand: sigurding: and at the top of the file, it is good practice to write the line ???#!/usr/bin/env ruby???, which will use the current ruby from the environment if nothing else is specified somewhere else (for example, if your users are using bundler)
[18:16:34] sigurding: Burgestrand: ok done!
[18:16:43] sigurding: would you not recommend to use bundler?
[18:17:06] Burgestrand: sigurding: you should can use bundler, but only for things that bundler should be used for :)
[18:17:33] Burgestrand: sigurding: when you do ???bundle install --binstubs???, bundler will overwrite bin/monitoring with a bundler-generated file
[18:17:36] sigurding: Burgestrand: ok, and that???s something bundler should not be used for?
[18:17:58] Burgestrand: sigurding: and if bundler overwrites bin/monitoring with it???s own file, you cannot place *your* code in it, because it will always be overwritten
[18:18:03] spstarr_work: class variables
[18:18:06] Burgestrand: spstarr_work: be careful with those
[18:18:12] Burgestrand: spstarr_work: they are inherited :)
[18:18:20] benzrf: spstarr_work: they have weird semantics that may be confusing at first
[18:18:24] spstarr_work: Burgestrand: even singletons?
[18:18:40] Burgestrand: spstarr_work: you can use regular @variables in the class scope as well
[18:18:56] Burgestrand: spstarr_work: most of the time, that is also what you should be using ;)
[18:19:11] Burgestrand: spstarr_work: I will give you an example with your singleton
[18:19:16] spstarr_work: but i thought class variables were of scope at the class level like self.myMethod being a class method
[18:19:53] sigurding: Burgestrand: did all the stuff, but still getting the error
[18:20:05] Burgestrand: spstarr_work: http://ideone.com/AOv1TQ
[18:20:06] toretore: spstarr_work: rule of thumb: don't use class vars unless you have a good reason to
[18:20:29] benzrf: i need fixes for pry-remote-em
[18:20:36] Burgestrand: sigurding: generating example gem with custom command for you!
[18:20:49] sigurding: Burgestrand: thx!
[18:21:07] spstarr_work: any reason why ruby mixed up things with self and @@ ?
[18:21:14] DouweM: spstarr_work: @@ is class variables, @ is instance variables where the instance can still be a class
[18:21:24] DouweM: spstarr_work: they have different semantics, and you should generally use the latter
[18:21:26] spstarr_work: so we should have done away with '@@' and just used self.classVariable ?
[18:21:41] Burgestrand: spstarr_work: I will give you counter-example, too :)
[18:21:54] Burgestrand: spstarr_work: http://ideone.com/lgJTJx
[18:22:13] Burgestrand: spstarr_work: @@ is inherited to subclasses (one crazy thing), but @ is not
[18:22:34] spstarr_work: it is not crazy to me from a class-level
[18:22:34] DouweM: spstarr_work: there is no self.classVariable, that's just a method called classVariable
[18:22:52] spstarr_work: DouweM: right but mixing self.method and @@variable seems weird
[18:22:56] DouweM: spstarr_work: if it is a getter, it can return the value of @classVariable, but it's important to see the distinction
[18:23:00] DouweM: spstarr_work: don't use @@variable at all
[18:23:03] spstarr_work: no common one way to denote 'class method/variable'
[18:23:32] DouweM: how do you mean?
[18:23:48] DouweM: a method is object.method, an instance variable is @ivar
[18:23:48] spstarr_work: well, @@foobar is a class variable and self.myMethod is a class method
[18:24:02] DouweM: the latter is just a method on a class, but sure
[18:24:17] DouweM: a variable isn't the same thing as a method, so why would you want a common way to denote them?
[18:24:31] DouweM: if you have a getter for the variable, that's still just a method
[18:24:49] DouweM: which only happens to return the value of that variable
[18:25:02] spstarr_work: i experimented with that and saw what happens
[18:25:58] Burgestrand: sigurding: https://github.com/Burgestrand/Gem-command-example
[18:26:35] Burgestrand: sigurding: main interesting code is in bin/custom_command
[18:26:48] Burgestrand: sigurding: when users install that gem, they will have the custom_command command available
[18:26:59] Burgestrand: sigurding: during development, to test it out yourself, you can use ???bundle exec bin/custom_command???
[18:30:27] sigurding: Burgestrand: thx, I will try it myself :)
[18:30:51] sigurding: need to grab some food and a take a deeper look a it
[18:30:53] Burgestrand: sigurding: I will go to the store real quick (5 min), but I???ll be here :)
[18:31:09] sigurding: Burgestrand: great! thx a lot for your patience
[18:44:44] renier: hey, looking for comments on this. https://gist.github.com/renier/9815009 Is there a better way to pick up files for rake package? Also, can the loop be better? Thanks!
[18:46:15] Burgestrand: renier: bundler uses git to list files. I???m not sure I think it???s a better way; it can be annoying at times, but I wanted to let you know that???s how they do it.
[18:46:40] Burgestrand: renier: that way they can avoid the need to parse the .gitignore, and their way also respects the global .gitignore file.
[18:47:49] renier: Burgestrand, good point. thanks. they use git ls-files
[18:52:33] renier: Burgestrand, hey, so since my gemspec already uses the git method for filling out the files attribute, I can use spec.files and that's it
[18:52:40] renier: saves a lot of code. thx for the pointer
[18:55:41] spstarr_work: so just like python i can do crazy things...
[18:55:42] spstarr_work: puts MyClass.instance_variable_get(:@aHash)[:company].to_s.upcase[1,4].reverse
[18:55:49] spstarr_work: since verything is an object...
[18:57:45] wallerdev: i wouldnt call that just like python
[19:00:15] spstarr_work: method.method.method.method.method
[19:00:21] spstarr_work: from each object returned
[19:00:35] spstarr_work: you do the same in Qt
[19:06:59] shevy: python qt?
[19:07:38] shevy: Hanmac, work hard on rxw! we can't let python get away with all GUIs
[19:08:18] shevy: I am still trying to update my ancient ruby gnome scripts, they used to work fine in 2007 and 2008 but now no longer work that great :(
[19:09:21] RubyPanther: shevy: I don't think Gtk has changed any, probably something else
[19:10:14] shevy: oh but there are RubyPanther
[19:10:23] shevy: ruby accesskey.rb
[19:10:25] shevy: You may have encountered a bug in the Ruby interpreter or extension libraries.
[19:10:26] shevy: Bug reports are welcome.
[19:10:26] shevy: For details: http://www.ruby-lang.org/bugreport.html
[19:11:13] spstarr_work: shevy: didn't I tell you not to use nightly builds of ruby? ;)
[19:11:24] RubyPanther: yeah, I'm going with "Ruby bug"
[19:11:56] shevy: spstarr_work hmm let me try with different ruby versions
[19:12:19] RubyPanther: I do all my guis in Gtk, I gave up Tk completely, and Qt, "hahahahahahahaha" is as far I get ;)
[19:13:17] spstarr_work: Qt bindings for ruby :P
[19:13:20] spstarr_work: i know they exist
[19:13:58] shevy: yeah but the author vanished
[19:15:23] RubyPanther: They are assumed to exist, but Rubyists are smart enough to choose a quality API
[19:15:36] RubyPanther: So nobody really knows for sure
[19:15:36] spstarr_work: ACTION snickers
[19:15:41] shevy: spstarr_work it was rdale, he even was on freenode irc
[19:15:51] shevy: #qtruby still exists
[19:16:10] shevy: qtruby looked much better than ruby-gnome too
[19:16:16] shevy: but without a developer, it is dead
[19:16:34] pipework: Unless somehow they wrote it in a way that's actually fairly complete.
[19:16:42] shevy: the best would be to use an agnostic UI though
[19:16:45] spstarr_work: ACTION prepares to go $HOME
[19:17:00] pipework: spstarr_work: ::1?
[19:23:18] AlexRussia: I again should in your help!
[19:23:54] shevy: please no
[19:23:57] AlexRussia: okay, target in it: i get big text, included some vcards....
[19:24:48] AlexRussia: question: how diffrent text to parts, if i know some string-diffrent?
[19:25:36] AlexRussia: maybe, some method for it....i don't have make own for and some tricks
[19:25:45] jhass: I think he want's to extract vcards from a textblob
[19:25:50] toretore: AlexRussia: show some code perhaps?
[19:25:54] jhass: AlexRussia: can you provide example input?
[19:26:09] toretore: code > words
[19:26:16] AlexRussia: jhass: i want diffrent text by some key.....to parts
[19:26:41] jhass: AlexRussia: provide example input and expected output at least
[19:27:04] toretore: AlexRussia: explain with code and data
[19:27:28] AlexRussia: jhass: you want see my now code?
[19:27:39] AlexRussia: jhass: and example data input?
[19:28:10] jhass: that and what you expect to have, for example the result array you would like to have
[19:29:26] AlexRussia: jhass: now i get one string and using it like data, but i should in some string, where included not one data, should diffrent it, yah, i think, diffrent to array by data.
[19:29:34] AlexRussia: jhass: wait some time
[19:29:40] shevy: show code man !
[19:29:52] jhass: shevy: don't plenk, man!
[19:30:11] AlexRussia: shevy: jhass code now https://gist.github.com/AlexTalker/9794342
[19:30:30] shevy: jhass it is a visual beautification to enhance the readability of the important words I have to write
[19:30:31] AlexRussia: wait, paste data
[19:30:50] jhass: shevy: you're french?
[19:31:00] shevy: AlexRussia this is not good
[19:31:28] shevy: it's not good
[19:31:38] shevy: file.close
[19:31:40] shevy: ARGV.each
[19:31:58] AlexRussia: shevy: w h y?
[19:31:59] shevy: so I take you have a file called telephons.txt
[19:32:12] shevy: AlexRussia your intent is not clear in your code
[19:32:14] AlexRussia: shevy: no, telephons is file for results
[19:32:24] shevy: ok you want to create a new file
[19:32:30] toretore: the code looks fine
[19:32:34] toretore: what is the actual problem?
[19:32:43] AlexRussia: toretore: in diffrent string
[19:32:52] toretore: i don't know what that means
[19:33:12] AlexRussia: toretore: i try rephrase
[19:33:33] AlexRussia: jhass: shevy data, should for work new version https://gist.github.com/9816231
[19:33:55] AlexRussia: jhass: shevy like it, ofc, is example :P
[19:33:57] toretore: it's obvious you're trying to process a bunch of vcard files, extract a phone number and put the numbers into a new file
[19:34:17] AlexRussia: toretore: toooo right
[19:34:30] toretore: but i don't understand what you're asking about
[19:34:31] AlexRussia: toretore: is for my some friend....
[19:34:42] toretore: try explaining with code instead
[19:35:02] toretore: code is much easier to understand
[19:35:02] AlexRussia: toretore: oh....every vrards concatenated in ONE file.But vcardigan unsupport this style, i think
[19:35:23] toretore: you want to have one file with multiple vcards in it?
[19:35:57] AlexRussia: toretore: one file with ultiple vcards is like input....
[19:35:59] jhass: I think he has that and wants to parse it
[19:36:33] AlexRussia: jhass: yah, parse by vcards for using it in vcardigan
[19:36:36] shevy: AlexRussia, write in simple english.
[19:36:49] AlexRussia: shevy: O_O, i write in RUSSIAN english :P
[19:37:15] droptone: Question: I have a hash and I want to set a value to the sum of two strings, with a space in between. For example, MyHash = { 'Value1" => AnotherVar["Address1"] + " " + AnotherVar["Address2"] }
[19:37:16] shevy: yeah, that is bad, the way to think in russian is different to writing in english, it's like matz speaking english while he continues to think in japanese
[19:37:25] droptone: What would the proper syntax be for that statement?
[19:37:46] shevy: droptone that should work
[19:37:52] droptone: that's it? ok, thank you.
[19:37:53] shevy: if AnotherVar is a hash
[19:38:01] shevy: and if it has these two keys
[19:38:08] shevy: and if they are strings
[19:38:19] AlexRussia: jhass: but how to parse it O_O?
[19:38:26] jhass: AlexRussia: File.foreach(input_file, "END:VCARD").each do |vcard_data| vcard = parse vcar_data; extract_from vcard; end;
[19:38:46] shevy: jhass how does parse() and extract_from() look like? :P
[19:38:57] jhass: shevy: use your imagination
[19:39:36] AlexRussia: jhass: then in vcard_data saved one vcard without every vcards in file?
[19:39:44] Mon_Ouie: EIMAG: No error actually occurred, but the result has to be imagined by the user.
[19:39:58] shevy: jhass can you translate that question please
[19:40:14] jhass: shevy: still processing...
[19:40:46] shevy: AlexRussia what do you want to save in the file?
[19:40:50] jhass: AlexRussia: vcard_data will be one unparsed vcard to pass to vcardigan
[19:41:04] AlexRussia: jhass: thanks diasporian!
[19:41:32] shevy: diasporian?
[19:41:39] shevy: jhass: thanks omelette!
[19:42:00] AlexRussia: shevy: try google diaspora*
[19:48:06] AlexRussia: lol, this is crazy, but ./test.rb:13:in `block in <main>': undefined method `first' for nil:NilClass (NoMethodError)
[19:48:25] AlexRussia: code here https://gist.github.com/9816592
[19:49:03] jhass: well, vcard.tlf returns nil then
[19:49:33] AlexRussia: jhass: this is stopped program?O_O
[19:51:21] Hanmac: droptone: AnotherVar.values_at("Address1", "Address2").join(" ")
[19:52:16] AlexRussia: jhass: i can using this exception for output error and continue parsing?
[19:52:45] jhass: I'd just check if vcard.tlf returns nil
[19:53:08] AlexRussia: vcard.tlf.nil? yah?
[19:53:33] jhass: or just if vcard.tlf; do_stuff; end
[19:58:34] AlexRussia: jhass: ou, i find bug
[19:59:34] AlexRussia: jhass: we parsing by 'END:VCARD', in file 2 vcards, but in each 3!
[19:59:45] AlexRussia: jhass: lulz-lulz
[20:02:44] AlexRussia: jhass: don't worry, if vcard.tlf fix it
[20:02:52] AlexRussia: 'if vcard.tlf'
[20:11:58] AlexRussia: File.exist?(file_name) returned bool, true if file exist, else false
[20:12:23] jhass: it does that, yes
[20:13:24] shevy: AlexRussia seems logical, doesn't it? :)
[20:13:42] jhass: probably not in russian english shevy
[20:14:55] shevy: AlexRussia what is "logical" in russian?
[20:15:23] AlexRussia: shevy: logical?O_O you about boolean?
[20:15:50] shevy: AlexRussia no, the russian word
[20:16:03] Authenticator: Is there a way to stop SimpleCov from reporting for a given process? It's failing my forking tests when I run them with coverage on. I'm already setting a CommandName based on the PID...
[20:16:33] AlexRussia: shevy: ????????????????????
[20:17:03] shevy: I cant read that
[20:30:48] sigurding: what are alternatives to bundler?
[20:33:30] centrx: sigurding, To do what?
[20:34:11] sigurding: centrx: I am trying to build an executable gem, which should automatically load all dependencies, when it???s installed
[20:34:24] centrx: sigurding, https://www.ruby-toolbox.com/#Package_Dependency_Management
[20:34:44] centrx: sigurding, bundler doesn't do that?
[20:35:25] sigurding: centrx: it does, but it also means, that bundler needs to be installed before, or?
[20:35:57] centrx: I'm not familiar enough to say how you would do it
[20:36:35] jhass: sigurding: what do you mean by load? require?
[20:37:57] sigurding: jhass: https://gist.github.com/jhiemer/4a98cd2ca6dbc6d0ba59
[20:38:01] sigurding: this is my gemspec.
[20:38:35] sigurding: the user should be able to install the gem on linux/windows and execute monitoring
[20:39:14] jhass: RubyGems will automatically install dependencies listed in your gemspec
[20:39:26] jhass: I think you want to add some bin_file'ish stuff, let me look it up
[20:40:03] AlexRussia: jhass: thanks and shevy also ;)
[20:40:14] jhass: sigurding: ah, no executables, you already have that
[20:40:21] jhass: sigurding: not sure where your problem is
[20:40:50] sigurding: jhass: ok so the gemspec files is enough to resolve the dependencies during install?
[20:41:26] sigurding: jhass: sounds great, is there any way to test this in an rvm enviroment?
[20:41:39] jhass: sure, just make a new gemset
[20:42:15] jhass: (and empty / pristine your global one if you got related stuff installed there)
[20:59:44] lex_functor: AlexRussia: what sound is ??
[20:59:57] lex_functor: I can at least sound out the other characters
[21:08:28] Killa: Hi. I am trying to measure memory footprint of my rails app, I'm measuring the overall kilobytes of the process with method found at https://gist.github.com/pvdb/6240788#file-process_rss, which is returning "203,628 kilobytes". I would expect all of that to be stored in objects, but ObjectSpace.count_objects[:TOTAL] returns only 792372 objects. Every object weights 40 bytes, which sums up to ~30 megabytes of objects. Do I calculate the obje
[21:08:54] Killa: Can anyone tell where should I look for the missing memory?
[21:09:39] LiquidInsect: where are you getting 40 bytes from?
[21:11:09] Killa: LiquidInsect: I've read that somewhere. Is that not accurate?
[21:11:49] LiquidInsect: Killa: are you talking about this? http://web.archive.org/web/20111213162156/http://eigenclass.org/R2/writings/object-size-ruby-ocaml
[21:11:50] RubyPanther: Killa: That is not accurate, check.
[21:12:00] LiquidInsect: 40 bytes might be the overhead alone
[21:12:18] LiquidInsect: not counting additional instance variables, the actual data in each
[21:12:26] RubyPanther: objects take up a varying amount of memory. Fact.
[21:12:30] LiquidInsect: having no idea what your objects are, I can't tell you how big each one would be
[21:13:09] Killa: The page you mentioned and countless different, where they say, that ruby objects weight 5 words
[21:13:19] LiquidInsect: but that's just
[21:13:24] toretore: a string is a single object, but it's not going to be a constant 40 bytes
[21:13:38] RubyPanther: And many objects will only be represented in ObjectSpace by some overhead, a pointer, and a pointer to a C function that frees whatever memory the object uses.
[21:14:02] Killa: allright than, so I am calculating the memory in a wrong way
[21:14:16] Killa: cool, that's something : ]
[21:14:56] Killa: so, that also means I can judge the memory footprint of methods by number of allocated objects, right?
[21:14:59] RubyPanther: Killa: What I do for overall usage is I turn off all my swap, and then measure resident memory
[21:15:16] LiquidInsect: depending on your ruby version, you might want to ask ObjectSpace how big your objects are http://ruby-doc.org/stdlib-2.1.0/libdoc/objspace/rdoc/ObjectSpace.html
[21:15:28] LiquidInsect: memsize_of(obj) ??? Integer
[21:15:50] RubyPanther: Right, you can't judge the memory footprint of methods through any sort of rule of thumb, only through measuring actual memory usage according to the operating system
[21:16:23] Killa: I guess I will have to play with new features from 2.1.0
[21:17:19] Killa: Thanks a lot, everyone
[21:24:40] dmead: hey boys and girls
[21:24:53] Authenticator: Does anyone know how to disable SimpleCov in a subprocess? My forking tests are dying with coverage on.
[21:25:01] dmead: if i want to call another process and collect it's output as it happens, whats the best thing to do?
[21:25:24] jhass: dmead: IO.popen I guess
[21:25:58] apeiros: dmead: or Kernel#spawn
[21:26:02] jhass: that is if as it goes means you don't want to block until it exited
[21:27:57] benzrf: anybody know if there's a remote pry derivative that allows for multiple conns that DOESNT require eventmachine?
[21:28:03] benzrf: id rather use celluloid i think
[21:28:35] apeiros: funny that a remote pry solution would use EM
[21:28:40] apeiros: given that EM is pretty invasive
[21:30:11] jamto11: does anyone know how to turn a time like this "2014-03-19 05:00:00 +0100" to "2014-03-19 06:00:00" ?
[21:30:17] benzrf: i would just use remote-pry but it doesnt really support doing anything but suspending
[21:30:24] toretore: pry-remote-em is made specifically for em apps
[21:30:43] apeiros: toretore: ah, lol, yeah ok, I guess that makes sense :D
[21:30:45] benzrf: the thing is that if i spin off multiple remote-pry's in threads, they dont play well
[21:30:51] benzrf: they take over each others stdouts, and stuff
[21:31:09] toretore: jamto11: first, convert the string into a Time, then use Time#strftime to create the string you want
[21:31:42] toretore: benzrf: what are you using it for?
[21:31:53] jamto11: i have tried that but havent been able to get the +0100 at the end to change the rest of the time
[21:32:01] apeiros: man! I really should work on my sill automaton. procrastinating this for like forever :-S
[21:32:06] benzrf: it's owrking OK right now
[21:32:25] benzrf: but my current solution feels a tad messy o.o
[21:32:29] benzrf: anyway...
[21:32:39] toretore: jamto11: explain "tried"
[21:33:48] jhass: jamto11: also how are those two equivalent? is the second one supposed to be in UTC+2?
[21:33:51] toretore: you have a cet time represented in a string and you want to create another string representing that time as utc without tz information
[21:34:08] toretore: it's not utc
[21:34:16] jhass: not, that'd be 4:00
[21:34:27] benzrf: i need some way to start a remote-pry-em client, but have it send a command or two before giving a prompt to a user
[21:34:31] toretore: fuckin timezones
[21:34:34] benzrf: anybody know if theres a hook for that?
[21:34:35] apeiros: ruby Time + timezones = mess
[21:34:39] jamto11: the thing is it used to be utc zulu then i changed it to non-utc, but i cant get rid of the fuken +400
[21:34:41] apeiros: sadly, rubys time classes still suck.
[21:34:51] apeiros: somebody should pay me to finish chronos :-p
[21:34:52] jamto11: because redshift's convert_timezone thing ignores that
[21:35:06] toretore: jamto11: you are not making any sense
[21:35:14] jhass: apeiros: do some crowdfunding! :P
[21:35:21] apeiros: jhass: NO TIME!
[21:35:32] apeiros: I hate time, really. I mean, my lack of it :(
[21:35:35] jamto11: ill make a gist
[21:35:46] benzrf: redshift ftw
[21:38:30] havenwood: >> -Rational(Time.now) + Rational(Time.now)
[21:38:30] eval-in: havenwood => (54143/1000000000) (https://eval.in/127817)
[21:39:54] havenwood: would be nice if Benchmark supported printing the time taken and returning the return value
[21:39:59] bricker: >> Infinity / 0
[21:39:59] eval-in: bricker => uninitialized constant Infinity (NameError) ... (https://eval.in/127819)
[21:40:16] havenwood: >> Float::INFINITY / 0
[21:40:16] eval-in: havenwood => Infinity (https://eval.in/127820)
[21:41:42] benzrf: >> Float::INFINITY * 0
[21:41:42] eval-in: benzrf => NaN (https://eval.in/127821)
[21:43:06] havenwood: >> 1.upto(Float::INFINITY * 0).take nil.object_id
[21:43:07] eval-in: havenwood => [1, 2, 3, 4] (https://eval.in/127822)
[21:43:24] bricker: Shouldn't inifinity * 0 just be 0? I'm no expert in theoretical mathematics, but that one seems obvious to me.
[21:43:38] bricker: benzrf: why?
[21:43:41] benzrf: >> nil.object_id
[21:43:41] eval-in: benzrf => 4 (https://eval.in/127823)
[21:44:13] benzrf: bricker: because (/0) is equal to (*infinity)
[21:44:24] benzrf: therefore (*0) is equal to (/infinity)
[21:44:29] benzrf: obviously it should be one
[21:44:49] bricker: you just blew my mind son
[21:46:07] bricker: havenwood: you win the award for "most pointless line of code"
[21:46:07] jhass: >> [0**Float::INFINITY, 0**Float::INFINITY, Float::INFINITY**Float::INFINITY, 0**0]
[21:46:08] eval-in: jhass => [0.0, 0.0, Infinity, 1] (https://eval.in/127824)
[21:46:48] toretore: anyone have experience with the bunny amqp client? is there a way to get blocking behavior on Queue#pop ?
[21:47:28] havenwood: bricker: \o/
[21:47:47] benzrf: toretore: why not use 0mq
[21:47:55] toretore: stop it with the zmq shit already
[21:48:01] benzrf: toretore: but it is good
[21:48:50] jamto11: https://gist.github.com/jamesjtong/9819670 timezone problem if anyone has time. thanks
[21:50:57] chichou: jamto11: It looks like you set timezone to UTC+1
[21:51:15] toretore: Time.iso8601('2014-03-19T04:00:00.000Z').strftime('%Y-%m-%d %H:%M:%S')
[21:51:23] bricker: jamto11: so, just to be clear, you want to convert the time to UTC and then add two hours to it?
[21:51:54] jamto11: js autoconverts the frontend to zulu time and i need to handle it on the backend
[21:52:16] toretore: jamto11: so what is the *real* time?
[21:52:20] jhass: jamto11: converts it from what?
[21:52:33] toretore: you don't have your data in order
[21:52:40] bricker: omg is this fullcalender... if it is I had this problem like 6 years ago
[21:52:46] jhass: jamto11: and by convert you mean overrides the timezone without adjusting the time or really converting it?
[21:53:30] jamto11: it really converts it
[21:53:40] jamto11: datepicker
[21:53:45] toretore: jamto11: then why are you adding 2 hours to it?
[21:54:24] chichou: I've done Time.parse time and it returned what you need
[21:54:34] jamto11: sorry its supposed to be 4:00
[21:54:37] toretore: i have no idea what it is you're doing here
[21:54:53] toretore: you have an iso8601 formatted time
[21:55:47] toretore: you want a string that says "2014-03-19 04:00:00 +0000" ?
[21:55:54] _riz_: I'm not sure this is the right way to ask this question, but does anyone know the difference between $stdout.puts and puts ?
[21:56:06] toretore: from one that says "2014-03-19T04:00:00.000Z" ?
[21:56:14] chichou: puts default to STDOUT
[21:56:20] shevy: _riz_ I think these would seem the same
[21:56:27] shevy: STDOUT is just assigned to $stdout
[21:56:28] _riz_: I would think puts, by default, would use stdout, but I'm having a hard time grabbing it when overriding $stdout.write
[21:56:47] jamto11: the iso8601 worked lol..
[21:56:52] _riz_: shevy, chichou yeah, that's what I would have thought
[21:57:02] shevy: .write seems to be like print
[21:57:19] toretore: _riz_: what are you trying to achieve?
[21:57:23] _riz_: what I'm doing is trying to split stdout
[21:57:27] _riz_: like "tee"
[21:57:35] _riz_: where it goes both to stdout and a file
[21:57:48] toretore: _riz_: for what reason?
[21:57:52] _riz_: what I've done works for $stdout.puts but not puts
[21:58:30] _riz_: (also apparently not for stuff called with ``)
[21:58:36] benzrf: how do =[
[21:58:39] toretore: replace STDOUT with a proxy that forwards to both $stdout and your file
[21:58:56] toretore: it's a bad idea, but that's how you'd do it
[21:59:03] _riz_: Where can I read more about STDOUT?
[21:59:21] toretore: it's just a constant containing the same IO as $stdout
[21:59:34] Mon_Ouie: $stdout is the one you have to change
[21:59:49] toretore: yeah, might be the other way around
[22:00:02] Mon_Ouie: STDOUT being a constant it should not be changed
[22:00:41] benzrf: <$ is a thing in haskell
[22:00:46] _riz_: what I really want is a ruby implementation of dup2
[22:00:48] benzrf: they dont have $> tho
[22:00:58] _riz_: but googling has come up empty
[22:01:10] _riz_: (well, actually, with the technique I'm using)
[22:01:13] havenwood: think of STDOUT as the placeholder, and $stdout as the thing to fiddle with. capturing output from subshells is tricky, good ways to do it with IO.pipe
[22:02:25] havenwood: _riz_: RubyTapas episode 29 (which unfortunately is not one of the free ones) covers the issue really nicely.
[22:06:03] havenwood: We should ask Avdi to add that one to the free list, because it does come up and I don't know of another good writeup on the subject.
[22:08:19] havenwood: Though if the $9 for all episodes is a hardship just send a postcard asking for it free. There's a nice Ruby tradition of "free if you send a postcard asking" that helps for those short on cash! :)
[22:11:57] benzrf: Mon_Ouie: you there?
[22:13:33] xybre: benzrf: What is <$ other than unggogleable?
[22:14:08] benzrf: v <$ f = fmap (const v) f
[22:14:27] havenwood: I was gunna say, in Ruby nothing.. :P
[22:15:14] havenwood: my brain transposed to $< initially though, AFGF!
[22:15:34] benzrf: <$ can be handy
[22:15:47] benzrf: it looks wrong to me though
[22:15:54] benzrf: i feel like the arrow should be toward the functor
[22:16:00] benzrf: plus the unwrapped side is the side toward the functor
[22:19:15] bricker: <$ is an ice cream cone obviously
[22:19:29] havenwood: bricker: money flavored
[22:19:33] Mon_Ouie: benzrf: Yes?
[22:19:42] havenwood: benzrf: No!
[22:19:42] Mon_Ouie: xybre: hoogle
[22:19:53] xybre: Mon_Ouie: whoogle?
[22:20:09] benzrf: Mon_Ouie: hey, i dont suppose theres any way you could somehow fix pry-remote to be able to have multiple servers running at once?
[22:21:07] Mon_Ouie: You can have multiple ones listening to different ports (not with a single call to pry_remote though)
[22:21:22] benzrf: i think i tried that and it bugged out
[22:21:26] xybre: Mon_Ouie: Interesting. I wonder what it says about a language that is so symbol ehavy that it requires a special search engine.
[22:21:43] benzrf: xybre: it's really not
[22:21:53] benzrf: xybre: the special search engine is so you can search types and stuff
[22:21:58] benzrf: symbols are a bonus
[22:22:10] benzrf: the majority of haskell code is no more symbolly than RubyPanther
[22:22:21] benzrf: unless you're using lens with all the operators or something o=
[22:22:26] RubyPanther: And I'm not very symbolly
[22:23:41] benzrf: Mon_Ouie: yeah
[22:23:45] Mon_Ouie: benzrf: Maybe you created them all in the same thread and so you had to wait for one to finish before the other started? You'd need to run each call to pry remote in a separate thread
[22:23:51] xybre: benzrf: I just see a lot of stuff like (a : t@(b:_)) = (a+b)
[22:23:55] benzrf: if i start multiple concurrent pry-remotes
[22:24:04] benzrf: the second connection fails to load properly
[22:24:08] RubyPanther: In fact I cringe whenever I see symbol used as data and converted to a string and displayed to a user, "Aiiiiiieeeeeeeeeeeeeeee"
[22:24:12] benzrf: and the 'connected' message shows up in the first one
[22:24:30] benzrf: xybre: that's just pattern matching
[22:24:44] benzrf: xybre: like destructuring assignment
[22:25:03] benzrf: a:b matches a list where a is the first element and b is the rest
[22:25:16] benzrf: the @ is for pulling part of a pattern into a var
[22:25:26] benzrf: (a:t@(b:_)) = [1, 2, 3, 4]
[22:25:31] Mon_Ouie: Hm, I don't know why it happens. I'm starting to feel like using DRb for that was a bad idea, makes it harder to understand those types of issues.
[22:25:34] benzrf: t == [2, 3, 4]
[22:25:49] benzrf: Mon_Ouie: hmmm
[22:26:05] xybre: Ah okay, pattern matching syntax. Like Ocaml. It's so dense yet sparse on semantic content that it throws me off out of context.
[22:27:00] xybre: I'm actually pretty fond of data destructuring, but it always feels weird to actually do.
[22:27:18] xybre: I can never decide if I want more than Ruby has or not.
[22:27:34] benzrf: xybre: do some haskell and you will find that the answer is you do
[22:27:50] benzrf: haskell has general immutability and lack of side effects tho
[22:28:00] benzrf: so destructuring is pretty damn important
[22:28:09] benzrf: it's the only primitive way to take data out of something
[22:28:34] xybre: I also don't like how many operations it sometimes takes in Ruby to do something that I know is conceptually simple.
[22:29:14] viscera: 11 "getting started" guides, and no way to distinguish which is best... i think i should probably use Why's for the lulz
[22:29:35] xybre: There's a lot of invisible, but real temporary objects being created and immediately GC'd. It jsut sorta bugs me.
[22:29:38] benzrf: viscera: what other langs do you know?
[22:29:55] xybre: I like Why's guide personally. But some people like super format stuff.
[22:29:57] viscera: benzrf: little bits of lots...
[22:30:02] benzrf: viscera: python?
[22:30:06] apeiros: xybre: the moment you worry about such things is the moment you lost
[22:30:25] benzrf: xybre: haskell has some interesting abstractions
[22:30:29] benzrf: like monads =D
[22:30:29] viscera: python, java, C, bash, asm, perl
[22:30:41] benzrf: viscera: any lisp?
[22:30:45] apeiros: xybre: focus on understandable, maintainable and readable code. care about performance when it's too slow.
[22:31:00] benzrf: viscera: ok, you probably already know most of the basic concepts in ruby
[22:31:28] benzrf: viscera: ruby's OOP is more like java's than python's
[22:31:36] benzrf: but it's still fairly different
[22:31:58] havenwood: Ruby's OOP is more like OOP than Java's. :P
[22:32:13] benzrf: viscera: ruby objects have an internal set of instance variables, like attributes on python objects, but you can only see them from inside methods
[22:32:20] benzrf: viscera: foo.bar is ALWAYS a method call
[22:32:35] xybre: apeiros: I understand. And most of those temp variables are small and have very little impact so I don't worry about them too much, but it lends itself to some seriously procedural code, or else dense and unreadable object diving. A specific example of this is dealing with large amounts of semistructured data, API responses or legacy databases, dump files, etc.
[22:32:46] benzrf: viscera: syntax is fairly perlish; you can leave off parens on methods, there's 'unless', and there's postfix if/unless
[22:33:00] benzrf: viscera: as in lisp, everything is an expression.
[22:33:02] benzrf: for example:
[22:33:03] benzrf: def foo(n)
[22:33:17] apeiros: xybre: that's what I'm saying - focus on the code, not on its performance implications.
[22:33:22] benzrf: obviously you'd just write n > 3
[22:33:28] benzrf: but the point is that the if is an expression
[22:33:29] apeiros: benzrf: >3 lines go to paste service
[22:33:34] benzrf: apeiros: right sorry
[22:33:59] benzrf: viscera: like in lisp, the result of a block of code is the last expr in it
[22:34:24] benzrf: viscera: also like in lisp, a lot of methods take functions, which you pass as 'blocks'
[22:34:29] benzrf: which are basically similar to lambdas
[22:34:39] benzrf: >> [1, 2, 3].map {|n| n + 3}
[22:34:39] eval-in: benzrf => [4, 5, 6] (https://eval.in/127856)
[22:35:25] benzrf: Mon_Ouie: since im having issues with multiple pry-remotes, and I kinda wanna not use EM, got any suggestions for what I should do?
[22:35:31] viscera: benzrf: okay... thanks...
[22:35:42] benzrf: viscera: ;p
[22:35:54] benzrf: viscera: feel free to try _why's
[22:36:03] benzrf: viscera: it gives a fairly good general feel
[22:36:19] benzrf: viscera: but it's a bit light on detailed explanations of how things work
[22:36:22] viscera: benzrf: i started with it years ago, but then got sidetracked and/or lost interest, as i do
[22:36:26] havenwood: viscera: be sure to read it along with the soundtrack
[22:36:33] benzrf: havenwood: huh
[22:36:50] Mon_Ouie: I'm not really sure, loading pry-remote-em probably is the only way without writing your own code but if you don't want to use EM then???
[22:36:51] xybre: apeiros: I can honestly say I've never had an issue with invisible objects outside of an n++ scenario, but the resulting code doesn't end end looking clean or OO.
[22:37:03] havenwood: benzrf: http://mislav.uniqpath.com/poignant-guide/soundtrack/
[22:37:34] apeiros: xybre: somehow I feel like we're talking at cross-purposes :-(
[22:37:37] benzrf: Mon_Ouie: :[
[22:37:51] benzrf: Mon_Ouie: wanna see what I'm using it for?
[22:38:03] apeiros: xybre: if you end up with code not looking clean/OO you don't do what I suggest to do - that is focusing on the code, to get it readable.
[22:38:03] Mon_Ouie: Yeah, I'm curious about that
[22:38:26] benzrf: Mon_Ouie: are you on osx or loonix?
[22:39:06] benzrf: Mon_Ouie: [package manager install] libfuse-dev if you dont have it
[22:39:14] benzrf: then git clone https://github.com/benzrf/quick
[22:40:17] Mon_Ouie: Aha, that description sounds cool
[22:40:24] benzrf: its p incomplete atmosx
[22:40:35] benzrf: hej da banister
[22:41:01] benzrf: bugging more people to look @ quick
[22:41:07] xybre: apeiros: Hmm, perhaps. What I'm saying is that I don't like the data constructs Ruby gives me because they are both ugly and inefficient. If they were not ugly or not inefficient it wouldn't bug me so much.
[22:41:19] banister: benzrf cool
[22:41:31] apeiros: xybre: then make proper classes
[22:41:44] apeiros: relying on just hashes and arrays is probably what makes your code ugly
[22:41:50] benzrf: Mon_Ouie: once you bundle install, you should be able to `require './service'; Quick::Service.run`
[22:42:09] benzrf: Mon_Ouie: gotta pass it a dirname to mount on my bad
[22:42:20] banister: benzrf Mon_Ouie is a french magician
[22:42:46] banister: the rimbaud of ruby (as he's known around the mean streets of brugges)
[22:43:16] benzrf: oops i mean <!DOCTYPE html>
[22:43:20] benzrf: </haml_joke>
[22:44:10] xybre: apeiros: Classes are porrly suited to semistructured data. Especially if the data changes a lot. Whats required then is to write a DSL which walks an AST of parsed information since Ruby's built in data types are not up to the task.
[22:44:16] Mon_Ouie: Btw, I tried it with a directory that didn't exist (I thought it would create the directory itself too) and I can't ^C it
[22:44:30] graft: benzrf: there's no need for closing tags, just un-indent.
[22:44:57] apeiros: xybre: instead of whining about lacking datatypes - why not go and build them?
[22:45:07] benzrf: Mon_Ouie: oopsie
[22:45:14] banister: xybre what datatype are u looking for (that exists in another language)
[22:45:18] slash_nick: graft: outdent you mean?
[22:45:19] benzrf: Mon_Ouie: the correct way to shut it down is as follows:
[22:45:33] benzrf: require 'brb'; quick = BrB::Tunnel.create(nil, 'brb://localhost:6200', verbose: true); quick.stop
[22:45:35] xybre: I'm hardly whining. The problem is not the data types.
[22:45:59] benzrf: Mon_Ouie: i am using brb atm because EM :\
[22:46:04] xybre: It is possible to create a class per "node" and try to have that class understand itself, tokenize and associate a class with each node and then recusively call its nested nodes in the same fasion. I've done this, but its a lot of excessive overhead.
[22:46:28] benzrf: xybre: use haskell :D :D :D
[22:46:34] benzrf: xybre: it is absolutely ideal for this
[22:46:46] benzrf: parsec is fantastic for parsing, and ADTs sound like something youd want
[22:46:59] benzrf: Mon_Ouie: got it running on an extant dir?
[22:47:37] Mon_Ouie: Yes, I tried pry-remote-em to connect, doesn't seem to output correctly though
[22:47:52] Mon_Ouie: undefined method `<<' for #<PryRemoteEm::Server::EM_CONNECTION_CLASS:0x00000004f0ed40>
[22:48:05] xybre: benzrf: Right and for data structure exploration functional languages shine. Haskell and Ocaml are ones I've explored as being good tools for that job, and I'm currently writing a bit in Rebol which is quite nice if less well known.
[22:48:05] Mon_Ouie: (when I try to eval anything)
[22:48:15] benzrf: ive heard of rebol
[22:48:19] benzrf: Mon_Ouie: huh
[22:49:01] benzrf: Mon_Ouie: it works on my end o-o
[22:49:13] benzrf: Mon_Ouie: wheres the error originating from?
[22:49:26] Mon_Ouie: It does run the code though, if I try to use puts it will display it on the process that started the server
[22:49:34] bilbo_swaggins: xybre, what do you mean by exploration?
[22:50:08] bilbo_swaggins: exploring new ideas?
[22:50:13] Mon_Ouie: I can't easily tell, if I puts $! it's already gone
[22:50:19] benzrf: Mon_Ouie: i have == 0.75
[22:50:46] Mon_Ouie: [pry-remote-em] remote is PryRemoteEm 0.7.5 pryem
[22:51:25] benzrf: Mon_Ouie: anyway.
[22:51:38] benzrf: Mon_Ouie: if you cd into the mount dir, you should see the module hierarchy as directories
[22:51:57] Mon_Ouie: Oh! That's neat
[22:52:04] xybre: bilbo_swaggins: given a large set of semistructured data, find the paths to the values you want, and then use thsoe paths to extract the values you need. An example of this would be some of the traditional web services that dump large data sets with no standard conventions. Pretty much any AST fits this specification as well. Old databases, proprietary file formats, all sorts of fun stuff.
[22:52:06] benzrf: if you create any .rb file in a dir, all of the code in it will be evalled in that dir's corresponding module each time you save
[22:52:18] benzrf: if the file is not named header.rb, the code will be rejected if it is not only method defs
[22:52:27] benzrf: so that you dont accidentally do effectful stuff
[22:52:46] benzrf: try making a new class in your pry, then editing methods in it live =D
[22:52:47] Mon_Ouie: What about meta programming stuff?
[22:52:54] benzrf: ill work something out later -.-
[22:53:16] benzrf: ITF there will be support for things like opening up a pry in the current dir's module
[22:53:31] benzrf: including onto a persistent instance
[22:53:38] benzrf: and the big one is
[22:53:41] benzrf: ACTION drum rolls
[22:53:45] benzrf: integration with dmtcp
[22:55:13] benzrf: Mon_Ouie: anyway, what kinda project will have significant amounts of code outside of method defs?
[22:55:24] benzrf: Mon_Ouie: i guess something small in sinatra maybe?
[22:56:01] Mon_Ouie: Well it could have helpers like attr_accessor that it defines and uses
[22:56:10] benzrf: yeah, so put those in header.rb
[22:56:19] benzrf: probably not a ton of em
[22:56:26] Mon_Ouie: Oh, ok, I'd missed that bit
[22:57:06] benzrf: also gonna be a thing:
[22:57:15] benzrf: easy api for eval in the running process
[22:57:20] benzrf: vim plugin?
[22:57:53] benzrf: Mon_Ouie: btw, you can see what version of each file was most recently evaled by looking at the autocreated foo.in_use.rb file for foo.rb
[22:58:09] benzrf: it gets updated when code from foo.rb is loaded, stays the same when not
[22:58:25] benzrf: potentially also useful for indicating whether changes are currently reflected in the process
[22:59:13] Mon_Ouie: I don't know if it's related to fuse but if you try to ls a module that doesn't contain any classes it says 'no such file or directory'
[23:00:45] Mon_Ouie: ls <that dir>/Object => ls: cannot access tmp/Object: No such file or directory
[23:01:03] benzrf: is it still running?
[23:01:40] Mon_Ouie: Yes, it does have an error, not sure if it's related
[23:01:51] Mon_Ouie: ERROR: Exception #<NoMethodError: undefined method `[]' for nil:NilClass> not an Errno:: !respond_to?(:errno)
[23:02:22] benzrf: line origin?
[23:02:25] Mon_Ouie: Comes from getxattr in fuse, the call comes from quick/service.rb:22:in `block in run' in your code
[23:03:34] benzrf: is your default ls different from just ls --color=auto
[23:03:56] Mon_Ouie: ls: aliased to ls --color=aut
[23:04:28] Mon_Ouie: (well I didn't past the 'o' but you've probably guessed it's there)
[23:05:13] benzrf: yeah the issue is that i misimpl'd a method
[23:05:15] benzrf: [i think!]
[23:06:32] benzrf: Mon_Ouie: it expects a hash from xattr but it got nil
[23:16:52] shevy: in a client like irssi, how do you colourize something like yo
[23:17:39] Mon_Ouie: There's a mode in here that disables the colors, isn't there?
[23:17:42] benzrf: hello brianpWins
[23:18:10] Mon_Ouie: Yes, it's mode +c
[23:18:20] shevy: I am working on a minimal ruby IRC client, I wonder if and how I should enable colour support
[23:18:50] xybre: shevy: In a terminal?
[23:19:10] shevy: no, only for IRC
[23:19:18] shevy: got the terminals well covered already :)
[23:19:31] shevy: well; so that others on IRC can see the colours
[23:19:46] xybre: You mean so I can type [red]this text is red[\red] or something?
[23:20:04] benzrf: Mon_Ouie: i fixed that thing btw
[23:20:14] benzrf: not pushed yet
[23:20:28] shevy: xybre precisely!
[23:20:35] shevy: though typing [red] is probably not so convenient?
[23:20:35] xybre: shevy: http://www.ircbeginner.com/ircinfo/colors.html
[23:20:58] Mon_Ouie: Here in weechat it's C-c c [color code number] (and e.g. C-c b for bold)
[23:21:41] xybre: shevy: And Irssi mentions it allows MIRC color types and to referene this document http://www.irssi.org/documentation/formats
[23:21:49] benzrf: in irssi it is just ^C<code>
[23:21:54] benzrf: ^B is bold
[23:23:48] Mon_Ouie: (I'm not sure the one for the color is that practical. I don't think many people use colors often enough they'd remember what they are). Allowing the first letter instead of the number could help.
[23:24:37] xybre: I'd say skip adding colors to messages.
[23:25:08] xybre: I used mIRC back in the day and everyone did it. Totally sucked. I wouldn't mind parsing a subset of markdown for bold and italics though, like how google does.
[23:25:12] benzrf: http://i.imgur.com/SfrM3IX.gif
[23:25:48] benzrf: xybre: irssi displays _underscored_ and *starred* words underscored and bold, but not whole phrases
[23:25:58] benzrf: http://benzrf.benzrf.com/imgs/8a8869.png
[23:26:53] xybre: benzrf: Thats neat, I wonder how hard it would be to make weechat do that.
[23:27:10] Riking: So I just ran into something really weird
[23:27:28] benzrf: _this is not underlined though_ *and this is not bolded*
[23:27:29] benzrf: Riking: pls tell us more
[23:27:38] Riking: ruby -v was returning 1.9.1
[23:28:00] Riking: and if I ran bundle install, it installed gems into the 1.9.1 directory
[23:28:12] Riking: I ran sudo update-alternatives --config ruby, and changed to 2.0
[23:28:36] Riking: If I ran bundle install again, it still used the 1.9.1 directory
[23:29:13] Riking: So I thought, "Well, bundler does stuff with gems, and I'm pretty sure gem is a command, so let's see if gem has a version, too!"
[23:29:33] Riking: sudo update-alternatives --config gem, and yes, there was a 1.9.1 and a 2.0. Switched it to 2.0.
[23:29:43] shevy: yeah Mon_Ouie, I guess colours are used only very rarely on IRC
[23:29:45] Riking: Ran bundle install again, and it was still using 1.9.1
[23:29:59] shevy: but I think I will add support for it just so that this feature is implemented, even if nobody uses it anyway
[23:30:33] Riking: ...aaaand I just checked and I have ruby-bundler ("Transitional dummy package") installed. silly me
[23:30:47] Riking: which was probably it
[23:31:01] Riking: I did gem install bundler and all happy now
[23:31:23] benzrf: Riking: lol
[23:31:34] Riking: now let's see if rubymine is still on 1.9.1
[23:32:09] Riking: Sdk: ruby-2.0.0-p299 yay
[23:32:22] shevy: upgrade man
[23:32:33] shevy: ruby 2.1.1p76 (2014-02-24 revision 45161) [i686-linux]
[23:59:17] goldenwest: I can't seem to get Curses::Window#bkgdset to work with color