hololeap

Activity Graph

Page 1 of 4 | Next »

2016-05-30

[19:12:44] hololeap: has joined #RubyOnRails
[19:13:27] hololeap: is there a less verbose way to do this: http://dpaste.com/2648NVE
[19:37:20] hololeap: Quit: KVIrc 4.9.2 Aria http://www.kvirc.net/

2016-03-12

[20:39:43] hololeap: has joined #ruby
[20:40:19] hololeap: does the frozen_string_literal header need to be set on every ruby file where i want that to be enabled, or just the first ruby file that is loaded?
[20:56:21] hololeap: it looks like its per-file
[22:13:33] hololeap: Ping timeout: 240 seconds

2016-03-03

[18:32:46] hololeap: Quit: KVIrc 4.9.1 Aria http://www.kvirc.net/

2016-03-02

[08:33:49] hololeap: has joined #ruby
[12:25:39] hololeap: Ping timeout: 248 seconds
[23:47:45] hololeap: has joined #ruby

2016-02-12

[01:56:09] hololeap: has joined #ruby
[08:19:24] hololeap: Quit: KVIrc 4.9.1 Aria http://www.kvirc.net/

2016-01-28

[02:23:37] hololeap: has joined #ruby
[02:25:00] hololeap: i've got a string that is a bunch of 2-digit hex representations of chars like "0a3f2d44". i'm using `hex.scan(/.{2}/).map {|s| s.to_i(16).chr }.join` to convert it to raw data. does anyone know how to accomplish this with String#unpack ?
[02:28:26] hololeap: oh its Array#pack that i want
[02:30:00] hololeap: no its an arbitrary amount. H* is perfect
[02:30:48] hololeap: but now i'm confused as to the meaning of "pack" and "unpack"
[02:31:09] hololeap: how do you remember what each is used for?
[02:32:40] hololeap: it doesn't even work with more than one string in an array
[02:32:44] hololeap: >> ['313233', '343536'].pack 'H*'
[02:33:09] hololeap: weird design choices
[02:34:11] hololeap: ok, that helps
[02:36:00] hololeap: raw packet data going to a Sonos speaker. i want to see if i can play it ;)
[02:36:20] hololeap: but tshark wants to output it as ASCII hex instead of raw data
[02:38:48] hololeap: i doubt i will get it to work since i don't know the encoding format and there aren't any mp3/wav/etc headers
[02:38:58] hololeap: but its worth a shot
[02:41:38] hololeap: its pretty sick. just needs lowpass + reverb
[02:46:25] hololeap: Darmani: mechanize, selenium-webdriver, activerecord (for DB), celluloid (if you're brave)
[02:47:27] hololeap: Darmani: no those are all gems, most of them have docs/wiki on github
[02:48:19] hololeap: Darmani: the ruby standard library has all the pieces you need, but frankly you'd be re-inventing the wheel a bit
[02:52:27] hololeap: Darmani: it depends on how you want to do it, but you will likely need timers/events to throttle your scraper, and the best library i have found for that is celluloid. however, it basically forces you to understand and implement the Actor model which requires studying and outside-the-box thinking
[02:55:19] hololeap: Darmani: mechanize uses nokogiri to parse the html, so that's a good place to start
[02:55:54] hololeap: Darmani: you can use xpaths/css paths to navigate and parse the html
[02:56:13] hololeap: Darmani: http://www.nokogiri.org/tutorials/searching_a_xml_html_document.html
[05:12:48] hololeap: pantato: bundle exec rspec tests/create.rb ?
[05:14:50] hololeap: pantato: just a guess
[05:18:49] hololeap: cscheib_: not sure, but maybe net-ssh-multi would work better for you
[05:31:40] hololeap: cscheib_: you could also use a brute-forcing tool like medusa
[06:20:01] hololeap: i keep telling this kid that he should learn ruby as his first language, but he insists on learning php because there's "more jobs"
[06:25:49] hololeap: or they learn bad programming and never recover
[06:31:16] hololeap: ruby as a first language can teach some bad habits, but not as many as php
[06:32:28] hololeap: i wonder how i would of fared if i had learned haskell as my first language...
[06:35:35] hololeap: i think that functional programming matches real-life better than imperative programming, but if you start out with imperative it takes some effort to switch your way of thinking
[06:36:51] hololeap: java and c# suck as starter languages because it's hard to make something simple without running into cryptic compiler errors
[06:37:08] hololeap: it kind of scares you off from the get-go
[06:39:15] hololeap: that's cool though, how did the scala one fare?
[06:43:12] hololeap: sometimes i feel like ruby's metaprogramming hurts more than it helps
[06:43:43] hololeap: since its hard to document dynamically-created methods and the like
[06:44:34] hololeap: looking at the rails code base hurts my brain most of the time
[06:48:39] hololeap: i have yet to find a difinitive guide on metaprogramming best-practices
[06:49:18] hololeap: but i guess there could be quite a few different schools of thought on that topic
[06:51:28] hololeap: that's pretty much what i learned
[06:56:56] hololeap: any word on when ruby 3.0 will come out?
[06:57:58] hololeap: i like that they are making strings immutable by default
[06:58:47] hololeap: has joined #RubyOnRails
[08:13:02] hololeap: Guest77742: yes, that is the primary use for mutexes
[08:14:07] hololeap: unless there is no chance that it is being read while the other thread is writing it (e.g. it is written before the other thread exists)
[08:16:06] hololeap: you might be able to get away with it
[08:16:53] hololeap: if there's no chance of a race condition then i guess you don't need it
[08:20:01] hololeap: i doubt it but i'm not 100% sure
[08:20:36] hololeap: probably best to wait for someone else to chime in
[08:26:00] hololeap: Cork: can you give an example?
[08:31:51] hololeap: Cork: there's no harm in it existing for the rest of the function. the GC will clean it up regardless... but if the prepare method took a block you could do something like @db.prepare("SQL") {|s| s.execute(user[:address], user[:email]) }
[08:32:15] hololeap: then it would only exist inside that block
[08:33:34] hololeap: using your example, did you write the prepare method or is that from a library?
[08:34:33] hololeap: because you could re-write it so that it doesn't return s, but yields s instead
[08:35:14] hololeap: or use block_given? to allow both
[08:38:39] hololeap: using blocks to narrow down the scope is pretty common and helps keep the code clean
[08:41:37] hololeap: Cork: but if the method is from a library and doesn't take a block, there's no point in arbitrarily wrapping the whole thing in a lambda
[08:43:54] hololeap: that's another matter. if you're passing a mutable object to a method, it's best to call .dup on it first so the method gets a copy and doesn't do anything destructive to the original
[08:45:25] hololeap: Cork: could you explain what scenario you are trying to avoid?
[08:47:01] hololeap: Cork: if the object is being created inside the method and never leaves it (i.e. isn't returned) then it will get trashed when the method ends
[08:47:51] hololeap: it doesn't matter if it's assigned to an instance variable
[08:48:10] hololeap: the variable name gets trashed too
[08:48:44] hololeap: it won't unless it somehow leaves the scope of the methodd
[08:49:00] hololeap: that's what the garbage collector is for
[08:50:17] hololeap: oh, derp sorry i was getting instance and local mixed up
[08:51:51] hololeap: anyway, he's talking about the local variable s from his example, which isn't returned
[08:52:10] hololeap: but it's nothing to worry about
[08:54:57] hololeap: manveru: its usually not a good idea to call destructive methods on a object passed as a parameter
[08:57:37] hololeap: that's not what i gathered from his example
[08:58:49] hololeap: <Cork> hololeap: https://pastebin.mozilla.org/8857844 a bit of a half psudo code though
[08:58:58] hololeap: <Cork> the point is i don't want s to be laying around for the rest of the function
[09:00:20] hololeap: Cork: do you need the data to be immediately destroyed for some security reason, or are you worried about it hanging around and wasting memory?
[09:03:48] hololeap: Cork you don't need the lambda, the GC will get rid of local variabe s and the object it references at some point soon after the method ends
[09:06:36] hololeap: the only difference is if it gets garbage collected before or after the `Mailer.deliver_welcome(user[:email])`, and i don't see how that would matter unless you're working with crazy memory constraints
[09:09:14] hololeap: if you gave us more details we might be able to help more
[11:03:47] hololeap: Ping timeout: 264 seconds
[11:19:44] hololeap: has joined #RubyOnRails
[11:19:44] hololeap: has joined #ruby
[23:31:12] hololeap: Quit: KVIrc 4.9.1 Aria http://www.kvirc.net/

2016-01-02

[15:20:42] hololeap: Quit: KVIrc 4.3.2 Aria http://www.kvirc.net/
[16:09:46] hololeap: has joined #ruby
[16:14:03] hololeap: has joined #RubyOnRails
[17:01:51] hololeap: does the new "did you mean" feature use #methods for its method name lookup?
[17:02:45] hololeap: * Kernel#methods
[17:05:29] hololeap: ok, that's come good info
[17:06:32] hololeap: shevy: its all good. do you know if the "extra features" of the gem are included by default in ruby23?
[17:09:12] hololeap: i just tested and it doesn't look like it automatically requires did_you_mean/extra_features. i was kinda hoping it would just for the detection of a misspelled "def initialize"
[17:09:32] hololeap: but its a cool feature nonetheless
[17:09:47] hololeap: George_: yes
[17:10:19] hololeap: https://github.com/yuki24/did_you_mean#extra-features
[17:10:50] hololeap: i guess they affect stability, so nvm
[17:11:39] hololeap: havenwood: yeah
[17:17:31] hololeap: Quit: KVIrc 4.3.2 Aria http://www.kvirc.net/

2015-12-31

[22:12:07] hololeap: has joined #ruby

2015-12-21

[07:20:14] hololeap: Quit: KVIrc 4.3.1 Aria http://www.kvirc.net/

2015-12-20

[19:19:41] hololeap: has joined #ruby

2015-12-18

[01:44:27] hololeap: has joined #ruby
[01:46:20] hololeap: can anybody give me a brief comparison between ruby and scala for event-driven programming? which do you like better?
[02:34:46] hololeap: Ping timeout: 240 seconds
[03:04:02] hololeap: has joined #ruby
[03:29:22] hololeap: Ping timeout: 256 seconds
[04:52:09] hololeap: has joined #ruby
[05:02:26] hololeap: Ping timeout: 240 seconds

2015-12-12

[04:58:26] hololeap: Ping timeout: 240 seconds
[05:46:41] hololeap: has joined #RubyOnRails
[05:46:41] hololeap: has joined #ruby
[07:25:12] hololeap: Quit: KVIrc 4.3.1 Aria http://www.kvirc.net/

2015-12-11

[17:13:04] hololeap: has joined #ruby
[17:15:34] hololeap: has joined #RubyOnRails

2015-11-15

[01:34:03] hololeap: has joined #ruby
[02:30:57] hololeap: Read error: Connection reset by peer

2015-10-26

[01:48:19] hololeap: Quit: KVIrc 4.3.1 Aria http://www.kvirc.net/

2015-10-25

[03:09:45] hololeap: has joined #ruby
[17:40:46] hololeap: Ping timeout: 268 seconds
[19:50:45] hololeap: has joined #ruby

2015-10-15

[02:30:15] hololeap: Quit: KVIrc 4.3.1 Aria http://www.kvirc.net/

2015-10-14

[18:19:20] hololeap: has joined #ruby
[18:19:35] hololeap: is anyone here familiar with celluloid? #celluloid seems pretty dead...
[18:20:10] hololeap: i want to know how to shut down my actors cleanly so i don't get "Couldn't cleanly terminate all actors in 10 seconds!" every time i quit
[18:22:24] hololeap: i have some long sleeps that i've refactored `wait_time.times { sleep 1 }` hoping this would give each actor a chance to respond, but it would be helpful to know if there was a way to check if an actor has recieved a shutdown signal so that i can clean it up
[18:27:48] hololeap: toretore: that's helpful :)
[18:28:41] hololeap: i don't either... to both of those
[18:35:50] hololeap: toretore: true... so i should have cleared up the block problem by breaking the sleeps into multiple 1 second sleeps, no? and the shutdown logic would just be with the finalizer method?
[18:42:18] hololeap: it's a bit too big for that...

2015-10-04

[14:05:46] hololeap: has joined #ruby
[14:06:41] hololeap: does anyone know if eventmachine and activerecord play nice together? i'm having some strange issues
[14:09:50] hololeap: when i try to do a database call within the eventmachine loop it hangs the thread
[14:10:09] hololeap: mabe pg is the culprit
[14:24:38] hololeap: [k-: it's running inside a EventMachine::ThreadedResource ... isn't that threaded automatically?
[14:24:56] hololeap: i need to look at that and see how it works
[14:28:53] hololeap: meh, i've used it before and didn't have any issues. i can't figure out what i'm doing differently...
[14:30:35] hololeap: i'm going to try celluloid instead
[14:31:14] hololeap: since none of my i/o is tied to em
[14:34:18] hololeap: goldfish6744: what platform are you running on?
[14:35:35] hololeap: goldfish6744: oh...
[14:37:02] hololeap: ruby probably isn't the best program to learn OO concepts in. it's too easy to break the rules
[14:37:21] hololeap: not program
[14:38:41] hololeap: cantaberry: you never saved the_window to an instance variable
[14:39:22] hololeap: yeah but it's a local variable so it dies when the method ends
[14:40:10] hololeap: you need to use instance variables (starts with a @) to be able to use it between methods
[14:42:29] hololeap: [k-: use mono if you hate microsoft
[14:45:56] hololeap: c# is probably more popular than ruby
[14:46:38] hololeap: mono is actually pretty good from what i've seen. i just don't usually program in windows so i don't use .NET
[14:59:06] hololeap: or you just don't like mainstream languages...
[15:01:01] hololeap: it looks like ruby was at its peak back in 2009
[20:10:41] hololeap: Quit: KVIrc 4.3.1 Aria http://www.kvirc.net/

2015-09-28

[09:05:55] hololeap: Ping timeout: 265 seconds

2015-09-27

[21:11:04] hololeap: has joined #RubyOnRails
[21:12:55] hololeap: i have a database that has the following structure: City belongs_to Subregion; Subregion belongs_to Region; ... each table has a "name" column. i want to be able to do something like `City.where(region_name: 'US')` ... any ideas how i could do this?
[21:14:32] hololeap: gabeodess: sweet, thanks
[23:30:01] hololeap: has joined #ruby
[23:30:14] hololeap: can anyone please help me understand why this isn't working? https://gist.github.com/hololeap/30c501e46629c7529d81
[23:42:08] hololeap: shevy: i found a couple of blatent typos. i fixed them but it still isn't working. i added some working code for reference
[23:47:07] hololeap: shevy: i know, but i don't understand why. the arrays get merged and splatted before being sent to super(), so there shouldn't be any problem
[23:49:50] hololeap: that _should_ be equivelant to `Struct.new(*(variables + Array(subarray_names))) { ... }`
[23:50:02] hololeap: since its inheriting from Struct
[23:58:42] hololeap: donkey_hotei: how is the user inputting the array?

2015-09-09

[01:27:03] hololeap: Quit: KVIrc 4.3.1 Aria http://www.kvirc.net/

2015-09-08

[00:31:35] hololeap: has joined #RubyOnRails
[00:31:35] hololeap: has joined #ruby
[05:23:52] hololeap: Quit: KVIrc 4.3.1 Aria http://www.kvirc.net/
[18:33:58] hololeap: has joined #RubyOnRails
[18:33:58] hololeap: has joined #ruby
[19:15:01] hololeap: Quit: KVIrc 4.3.1 Aria http://www.kvirc.net/
[23:17:09] hololeap: has joined #RubyOnRails
[23:17:09] hololeap: has joined #ruby

2015-09-07

[01:26:04] hololeap: Ping timeout: 255 seconds
[02:07:52] hololeap: has joined #RubyOnRails
[02:07:52] hololeap: has joined #ruby
[03:54:36] hololeap: Quit: KVIrc 4.3.1 Aria http://www.kvirc.net/
[04:17:03] hololeap: has joined #RubyOnRails
[04:17:03] hololeap: has joined #ruby
[06:21:40] hololeap: Ping timeout: 256 seconds
[07:04:00] hololeap: has joined #RubyOnRails
[07:04:00] hololeap: has joined #ruby
[09:18:44] hololeap: Ping timeout: 265 seconds
[09:33:52] hololeap: has joined #ruby
[09:33:53] hololeap: has joined #RubyOnRails
[10:02:47] hololeap: Quit: KVIrc 4.3.1 Aria http://www.kvirc.net/
[17:33:55] hololeap: has joined #ruby
[17:33:56] hololeap: has joined #RubyOnRails
[19:59:17] hololeap: Quit: KVIrc 4.3.1 Aria http://www.kvirc.net/
[20:28:53] hololeap: has joined #RubyOnRails
[20:28:53] hololeap: has joined #ruby
[23:44:41] hololeap: Quit: KVIrc 4.3.1 Aria http://www.kvirc.net/

2015-09-06

[02:34:01] hololeap: has joined #RubyOnRails
[02:34:01] hololeap: has joined #ruby
[05:17:37] hololeap: Quit: KVIrc 4.3.1 Aria http://www.kvirc.net/
[22:12:12] hololeap: has joined #RubyOnRails
[22:12:12] hololeap: has joined #ruby
[22:39:51] hololeap: Remote host closed the connection
[22:40:17] hololeap: has joined #RubyOnRails
[22:40:17] hololeap: has joined #ruby

2015-09-03

[00:20:17] hololeap: has joined #RubyOnRails
[00:20:17] hololeap: has joined #ruby
[00:32:31] hololeap: Quit: KVIrc 4.3.1 Aria http://www.kvirc.net/
[00:33:20] hololeap: has joined #RubyOnRails
[00:33:20] hololeap: has joined #ruby
[00:47:38] hololeap: Quit: KVIrc 4.3.1 Aria http://www.kvirc.net/
[00:48:52] hololeap: has joined #RubyOnRails
[00:48:52] hololeap: has joined #ruby
[02:26:01] hololeap: Ping timeout: 272 seconds
[02:48:53] hololeap: has joined #ruby
[02:48:54] hololeap: has joined #RubyOnRails
[04:55:19] hololeap: Ping timeout: 260 seconds

2015-09-02

[15:59:24] hololeap: has joined #RubyOnRails
[15:59:24] hololeap: has joined #ruby
[16:00:18] hololeap: Client Quit
[18:21:31] hololeap: has joined #RubyOnRails
[18:21:31] hololeap: has joined #ruby
[18:53:20] hololeap: Ping timeout: 252 seconds
[19:41:34] hololeap: has joined #ruby
[19:41:35] hololeap: has joined #RubyOnRails
[19:41:43] hololeap: Client Quit

2015-08-31

[00:03:52] hololeap: has joined #RubyOnRails
[00:03:52] hololeap: has joined #ruby
[03:29:35] hololeap: Quit: KVIrc 4.3.1 Aria http://www.kvirc.net/

2015-08-27

[16:12:39] hololeap: has joined #ruby
[16:12:40] hololeap: has joined #RubyOnRails
[17:10:19] hololeap: Ping timeout: 260 seconds
[21:31:17] hololeap: has joined #RubyOnRails
[21:31:17] hololeap: has joined #ruby
[22:05:32] hololeap: Quit: KVIrc 4.3.1 Aria http://www.kvirc.net/

2015-08-25

[05:45:52] hololeap: has joined #RubyOnRails
[05:45:52] hololeap: has joined #ruby
[17:33:59] hololeap: Quit: KVIrc 4.3.1 Aria http://www.kvirc.net/