MrSamuel

Activity Graph

Page 1 of 2 | Next »

2017-06-29

[23:39:45] MrSamuel: has joined #ruby
[23:51:46] MrSamuel: Quit: MrSamuel

2017-05-12

[05:45:50] MrSamuel: has joined #ruby
[05:46:33] MrSamuel: Hello everyone

2017-03-10

[08:28:15] MrSamuel: has joined #ruby
[09:07:33] MrSamuel: has left #ruby: ()

2016-06-27

[09:13:37] MrSamuel: has joined #ruby
[12:59:42] MrSamuel: Quit: MrSamuel

2016-06-26

[13:21:08] MrSamuel: has joined #ruby
[13:27:17] MrSamuel: Quit: MrSamuel

2016-06-09

[03:26:18] MrSamuel: has joined #ruby
[05:51:56] MrSamuel: Quit: MrSamuel
[06:00:39] MrSamuel: has joined #ruby
[06:01:14] MrSamuel: Client Quit

2016-06-06

[00:35:37] MrSamuel: has joined #ruby
[00:35:45] MrSamuel: is `unsigned x = -1` undefined?
[00:35:53] MrSamuel: oh lol wrong channel
[01:08:04] MrSamuel: Quit: MrSamuel
[01:19:54] MrSamuel: has joined #ruby
[01:35:52] MrSamuel: Quit: MrSamuel

2016-05-20

[03:18:46] MrSamuel: has joined #ruby
[03:48:24] MrSamuel: Quit: MrSamuel
[04:11:23] MrSamuel: has joined #ruby
[04:56:37] MrSamuel: Quit: MrSamuel
[05:10:29] MrSamuel: has joined #ruby
[05:26:35] MrSamuel: Quit: MrSamuel

2016-05-19

[08:56:44] MrSamuel: has joined #ruby
[10:28:19] MrSamuel: Quit: MrSamuel
[10:30:58] MrSamuel: has joined #ruby
[10:33:05] MrSamuel: Client Quit
[12:57:41] MrSamuel: has joined #ruby
[13:08:39] MrSamuel: Quit: MrSamuel
[13:56:55] MrSamuel: has joined #ruby
[14:15:25] MrSamuel: Quit: MrSamuel

2016-05-07

[02:31:30] MrSamuel: has joined #ruby
[05:55:41] MrSamuel: Quit: MrSamuel

2016-05-05

[12:05:44] MrSamuel: Remote host closed the connection

2016-05-03

[08:27:07] MrSamuel: has joined #ruby
[08:42:33] MrSamuel: i made some packages in the aur
[08:42:45] MrSamuel: is it worth discussing with anyone bring those package to the official repos?
[08:43:02] MrSamuel: oh whoops wrong channel :D

2016-04-05

[02:30:48] MrSamuel: has joined #ruby
[02:38:03] MrSamuel: Quit: MrSamuel

2016-03-30

[10:05:31] MrSamuel: has joined #ruby
[10:52:41] MrSamuel: Remote host closed the connection

2016-03-29

[03:06:29] MrSamuel: has joined #ruby
[03:10:41] MrSamuel: Client Quit

2016-03-26

[08:01:55] MrSamuel: Quit: Leaving

2016-03-23

[04:16:19] MrSamuel: has joined #ruby

2016-02-17

[00:11:41] MrSamuel: has joined #ruby
[00:41:25] MrSamuel: Quit: MrSamuel
[01:03:15] MrSamuel: Client Quit
[01:03:15] MrSamuel: has joined #ruby

2016-02-16

[01:22:35] MrSamuel: has joined #ruby
[01:22:56] MrSamuel: Is there some way with a hash to write hash.with_value(key) {|value| ???}
[01:23:03] MrSamuel: when value might be nil
[01:23:23] MrSamuel: the block is not invoked if has.include? key is false
[01:23:42] MrSamuel: kind of like the opporsite of hash.fetch
[01:43:32] MrSamuel: What does the safe navigaiton operator give on nil entries?
[01:43:37] MrSamuel: e.g. {x: nil}
[04:07:52] MrSamuel: Quit: MrSamuel
[09:25:38] MrSamuel: has joined #ruby
[10:17:55] MrSamuel: Quit: MrSamuel
[10:29:35] MrSamuel: has joined #ruby
[10:31:31] MrSamuel: Client Quit
[10:32:44] MrSamuel: has joined #ruby
[12:39:53] MrSamuel: Quit: MrSamuel
[20:33:40] MrSamuel: has joined #ruby
[21:27:55] MrSamuel: Quit: MrSamuel
[21:33:51] MrSamuel: has joined #ruby
[23:27:37] MrSamuel: Quit: MrSamuel

2016-02-03

[06:55:07] MrSamuel: has joined #ruby
[06:56:07] MrSamuel: has joined #RubyOnRails
[06:56:23] MrSamuel: Hi, is there any way to have a polymorphic belongs_to with a custom type mapping for legacy data?
[07:02:21] MrSamuel: arup_r, things which aren't class names
[07:02:26] MrSamuel: like, the class is Category
[07:02:29] MrSamuel: but the type name is cat
[07:02:38] MrSamuel: this is from a legacy database
[07:08:05] MrSamuel: arup_r, what do you mean options to tell Rails where to go and find?
[07:44:35] MrSamuel: Ping timeout: 240 seconds

2016-02-01

[05:34:32] MrSamuel: has joined #ruby
[06:12:03] MrSamuel: Coraline: Did you propose a CoC for Ruby?
[06:17:03] MrSamuel: Quit: MrSamuel

2016-01-29

[08:28:59] MrSamuel: has joined #ruby
[09:04:16] MrSamuel: Ping timeout: 250 seconds

2016-01-26

[10:20:28] MrSamuel: has joined #ruby
[10:22:22] MrSamuel: Client Quit
[10:23:08] MrSamuel: has joined #ruby
[14:51:06] MrSamuel: Ping timeout: 240 seconds

2016-01-16

[03:01:11] MrSamuel: has joined #ruby
[03:12:15] MrSamuel: Quit: Leaving

2015-10-22

[01:20:46] MrSamuel: has joined #ruby
[21:02:42] MrSamuel: Quit: Leaving

2015-07-28

[02:29:58] MrSamuel: has joined #ruby
[03:08:37] MrSamuel: Quit: MrSamuel
[03:13:04] MrSamuel: has joined #ruby
[03:33:21] MrSamuel: Quit: MrSamuel

2015-07-27

[05:24:25] MrSamuel: has joined #ruby
[05:25:05] MrSamuel: has joined #RubyOnRails
[05:25:22] MrSamuel: Hi, what is the best way to write Model.where(???(a - b) > 0???)
[05:25:47] MrSamuel: sevenseacat: that doesn???t work if I join other models with the same column names
[05:26:31] MrSamuel: I don???t have any example output
[05:28:42] MrSamuel: sevenseacat: I don???t ahve an error, I know from experience if you write where clauses like that, they fail if there are conflicting column names because ActiveRecord traditionally fully qualifies SQL columns with the table name, which is important for joins that have the same column names
[05:29:01] MrSamuel: I was just wondering what is the correct way to write queries with joins, which require custom where clauses
[05:29:17] MrSamuel: sevenseacat: I can???t change the existing DB schema
[05:29:36] MrSamuel: Right, so that???s what I???m asking
[05:29:46] MrSamuel: should I just qualify it directly in teh string?
[05:30:10] MrSamuel: where(???#{self.table_name}.a > #{self.table_name}.b???)
[05:30:20] MrSamuel: is that the correct approach or is there a better one?
[05:30:58] MrSamuel: sevenseacat: The fake response isn???t really helping and just makes you look like a prick, IMHO.
[05:31:05] MrSamuel: Radar: thanks
[05:31:39] MrSamuel: I???m fine with the rules, as long as they apply both ways, thanks.
[05:32:26] MrSamuel: Awesome, thanks for your time everyone, it???s been entertaining :)
[05:32:30] MrSamuel: has left #RubyOnRails: ()
[08:05:34] MrSamuel: Quit: MrSamuel
[08:27:55] MrSamuel: has joined #ruby
[08:42:18] MrSamuel: Quit: MrSamuel

2015-07-23

[02:55:27] MrSamuel: has joined #ruby
[04:55:08] MrSamuel: Quit: MrSamuel

2015-05-08

[02:47:37] MrSamuel: How do I select all derived instances when using ActiveRecord STI?
[02:59:56] MrSamuel: http://stackoverflow.com/questions/30115014/how-do-i-select-all-derived-instances-when-using-activerecord-sti
[03:02:19] MrSamuel: Hmm, okay yeah it???s my fault :)

2015-05-05

[02:55:11] MrSamuel: Hi. I???m calling model.update_attribute(:foo, ???bar???) when model.foo might already be bar. In the case that it???s not it does useful work, in the case that it???s the same, it makes an empty transaction which isn???t very efficient. In those cases, I???ve manually wrote model.foo = ???bar???; model.save if model.changed? but this feels a bit dirty. What is the best way to do this efficiently?
[02:57:57] MrSamuel: smathy: because there are literally thousands of them
[02:58:10] MrSamuel: smathy: also we are running over ssh in some cases and it takes up to 40ms rount trip
[02:58:32] MrSamuel: It seems inefficient and even stupid to have empty transactions if it isn???t required

2015-02-19

[10:06:13] MrSamuel: Hello, I'm using active record. I have a parent class, say, MapPoint and a child class Category. MapPoint has many Category. When categories are added or removed, I need to update the MapPoint#icon field. What is the correct way to do this using before/after_save that handles the following cases, when creating a new MapPoint from scratch, and when only adding new Categories
[10:06:55] MrSamuel: The first case is relatively easy because icon is nil initially, and when saving a map point all the categories are known
[10:07:57] MrSamuel: How do I know in the second case, whether MapPoint is being saved when I'm in the Category after_save callback - if it's being saved, I can modify the map point from category and it should get persisted right?
[10:08:25] MrSamuel: e.g. Category#after_save -> self.poi.update_icon; self.poi.save
[10:08:38] MrSamuel: poi = map_point
[10:10:06] MrSamuel: is there some way to know that the current object graph is being persisted?
[10:10:31] MrSamuel: Category#after_save -> if self.point.being_saved? ...

2015-01-19

[07:49:06] MrSamuel: Why does "".split('.') return an empty array and not an array with [''] ?
[08:02:21] MrSamuel: Xeago_, sure that makes sense, but it doesn't match up with reality, i.e. "x".split('.') gives ['x'] and ['x'].join('.') gives 'x', which is exactly the same as if it was just whitespace
[08:02:51] MrSamuel: i.e. "".split('.') -> [''] and [''].join('.') gives '' which is absolutely valid
[08:03:13] MrSamuel: unfortunately in Ruby's case "".split('.') gives [] which is an edge case and is documented
[08:11:07] MrSamuel: >> [""].join('.')
[08:11:11] MrSamuel: >> [].join('.')
[08:11:30] MrSamuel: >> "".split('.')
[08:11:43] MrSamuel: >> [""].join('.').split('.')
[08:12:03] MrSamuel: so, that last one, the identity of the function is not preserved
[09:19:51] MrSamuel: ferr, I prefer rspec
[09:20:06] MrSamuel: ferr, the tests seem more logical and structured and it handles complexity better
[09:22:40] MrSamuel: ferr each test file can be run independently
[09:22:48] MrSamuel: you could just group tests logically by file

2015-01-18

[23:04:58] MrSamuel: Is there an activerecord/rails specific room?
[23:18:03] MrSamuel: Is there any way to lazy load a single activerecord record?
[23:18:19] MrSamuel: like, r = Model::lazy_find(:name => "foo")
[23:18:46] MrSamuel: that wouldn't do a db lookup until I actually requested some part of the record
[23:20:04] MrSamuel: centrx, the same reason Core Data has faulting which is pretty useful
[23:20:12] MrSamuel: roamingdog, yes
[23:20:41] MrSamuel: and sorry, it's Model::find(object_id)
[23:21:50] MrSamuel: yeah, sure, okay, how do I make User::find(4) not hit the db until actually required
[23:22:45] MrSamuel: https://github.com/jnewland/lazy_record/blob/master/lib/active_record/lazy/record.rb
[23:22:53] MrSamuel: does anyone have any experience with that?
[23:24:58] MrSamuel: centrx, but that returns an association not a single record?
[23:26:24] MrSamuel: centrx, it's got nothing to do with memory, and everything to do with reducing the overhead of not quering the db if not required
[23:26:35] MrSamuel: https://github.com/jnewland/lazy_record
[23:26:57] MrSamuel: yes because the variable may or may not be used later on
[23:29:32] MrSamuel: roamingdog, but when i want to use it I ahve to write r.first.name rahter than r.name
[23:29:35] MrSamuel: it's a bit of a pain
[23:30:11] MrSamuel: roamingdog, yeah but I'd like to see if it is possible to alleviate the pain point I'm having
[23:30:17] MrSamuel: otherwise I may just try something else

2014-12-07

[08:03:01] MrSamuel: I wrote some code in python to deal with a child PTY process
[08:03:08] MrSamuel: virtual TTY
[08:03:13] MrSamuel: what are you trying to do?
[08:03:56] MrSamuel: my suggestion is to make sure that the PTY is creating it's own session/process group
[08:04:05] MrSamuel: to make sure that any signals are not going to the child process incorrectly
[08:04:35] MrSamuel: it's a long time since I worked on it but basically a process group isolates processes from signals
[08:05:00] MrSamuel: http://en.wikipedia.org/wiki/Process_group
[08:05:42] MrSamuel: where is it dying
[08:07:52] MrSamuel: quazimodo, are you on linux
[08:08:28] MrSamuel: quazimodo, i suggest you try using http://linux.die.net/man/1/strace
[08:08:33] MrSamuel: to see where the signal is coming from
[08:09:12] MrSamuel: i guess it might be a bit more complex than that but yeah
[08:09:13] MrSamuel: something like that
[08:10:26] MrSamuel: yeah try to use something to limit it to only signals
[08:10:36] MrSamuel: there is probably some option
[08:11:21] MrSamuel: If you close the terminal emulator, the master end of the pty becomes closed; the foreground process group of the slave end receives SIGHUP and likely dies. If you press Ctrl+D at the shell, the slave end of the pty becomes closed, the terminal emulator gets EOF on the master end, and shuts down accordingly.
[08:11:38] MrSamuel: from https://spin0r.wordpress.com/2012/12/28/terminally-confused-part-seven/
[08:11:45] MrSamuel: looks like that might be helpful
[08:12:39] MrSamuel: is it possible something to do with @slave.close
[08:13:17] MrSamuel: https://github.com/ioquatix/script-runner/blob/master/lib/script-wrapper.py
[08:13:42] MrSamuel: that is a python program I wrote to execute a command in a PTY
[08:14:03] MrSamuel: it works perfectly, perhaps use that as a reference for how the API should work even if it is a different language
[08:19:16] MrSamuel: tejas-manohar, i guess we need more context
[08:20:15] MrSamuel: it means you need to sacrifice 15 virgins to allah
[08:20:21] MrSamuel: for your code to work
[08:21:03] MrSamuel: perhaps it's an exit code?
[08:21:06] MrSamuel: a signal number?
[08:22:06] MrSamuel: does your test actually run to completion?
[08:22:17] MrSamuel: perhaps it's something to do with IO buffering
[08:22:48] MrSamuel: perhaps your read/write calls are not working as you expect
[08:22:53] MrSamuel: does the code work in isolation
[08:22:56] MrSamuel: without rspec?
[08:23:31] MrSamuel: or just make a file test.rb and run it
[08:23:39] MrSamuel: like, just in the global scope
[08:23:48] MrSamuel: rather than in a rspec test case
[08:24:45] MrSamuel: if you search for code in rspec that sends signals?
[08:25:02] MrSamuel: like do a search on github for "signal" or HUP etc
[08:26:45] MrSamuel: i wonder if your test is running correctly
[08:26:53] MrSamuel: does it actually complete the test?
[08:27:05] MrSamuel: try putting in a $stderr.puts after every line and see how far it gets
[08:27:14] MrSamuel: use $stderr because it should be sync
[08:29:14] MrSamuel: does it finish your spec?
[08:29:21] MrSamuel: or does it die randomly during it?
[08:30:48] MrSamuel: strace works by kernal system calls which have special markers
[08:30:52] MrSamuel: the markers log data
[08:52:02] MrSamuel: that wouldn't surprise me
[08:52:06] MrSamuel: especially with PTY interactions
[08:52:12] MrSamuel: you might try sync on the pipe
[08:52:15] MrSamuel: e.g. IO#sync
[08:52:18] MrSamuel: to disable buffering
[08:56:21] MrSamuel: yeah i'm not surprised
[08:56:24] MrSamuel: look up expect
[08:57:56] MrSamuel: http://linux.die.net/man/1/expect
[09:02:20] MrSamuel: you probably need to keep on reading until you get what you want or hit some reasonable timeout
[09:02:24] MrSamuel: try using IO.select
[09:04:42] MrSamuel: yeah but read_all will only read what's avaialble
[09:04:47] MrSamuel: you need something like
[09:05:14] MrSamuel: while need_more?; buffer += read; end
[09:05:39] MrSamuel: read isn't guaranteed to return anything
[09:05:57] MrSamuel: it get's buffered in the OS
[09:07:16] MrSamuel: yep but it might get buffered in the OS
[09:07:45] MrSamuel: yes then that is correct
[09:07:54] MrSamuel: well, it will get there eventually
[09:08:41] MrSamuel: http://stackoverflow.com/questions/6701103/understanding-ruby-and-os-i-o-buffering
[09:08:44] MrSamuel: perhaps taht helps
[09:09:17] MrSamuel: i'm going for a run
[12:28:20] MrSamuel: quazimodo, about to go to bed