« first day (1169 days earlier)      last day (2086 days later) » 

8:30 AM
I'm iterating over an array in an erb template and it's printing all this guff:

`[#<Bud id: 1, identifier: "left bud", session_id: 1, created_at: "2017-03-24 06:47:39", updated_at: "2017-03-24 06:47:39">, #<Bud id: 2, identifier: "right bud", session_id: 1, created_at: "2017-03-24 06:47:50", updated_at: "2017-03-24 06:47:50">]`
How do I stop that?
Ugh... I had <%= instead of <%
Stop panicking
 
 
1 hour later…
9:34 AM
I just encountered a very strange bug.
GamePlayer.get(param[:player_id], param[:game_id]) was the formot on my dev machine for doing a lookup on a table with a composite key of two foreign keys
However on my server, it needed to be param[:game_id], param[:player_id] -- reverse order
 
 
2 hours later…
11:50 AM
Oh neat, JetBrains changed their education policy - Instead of only 1 year of products, you just have to renew it every year
 
 
4 hours later…
3:50 PM
@JamesZaghini This is good advice :)
@Cereal Yikes!
 
4:12 PM
Hi guys, I asked a question earlier, gone back to think about it, but haven't come up with a clean solution as of yet.
I'm wondering if you guys have had something of this form in the past and how you went about it.
Here's ma repaste of my question
Hello guys, I hope you're having a good weekend.
I was wondering what the best way to handle errors for scenarios like this:
def init
obj.each do |o|
result_1 = call method 1
#set result 1 in new obj

result_2 = call method 2
#set result 2 in new obj

result_3 = call method 3
#set result 3 in new obj

#and so on
end
end

How do you handle errors for method 1, 2, 3, and so on, in that loop?
Ideally, I'd like the init method to continue even when an error occurs in any method calls
 
Do you want to ignore errors, or remember them so you can do something about them once you're done with the loop?
 
That's a good point Wayne. I think i'd prefer to log the error in the result_#{i} variable.
 
begin
  do_something
rescue SomeError => e
  puts e    # for example
end
 
If not, I could just ignore it if it's a hassle.
 
That's the general strategy for continuing on error. Replace SomeError with the most specific error class that applies. The most general error class that you would normally use there is StandardError.
 
4:20 PM
I considered begin rescue, but do I have to do it for each method call?
 
You can do anything you want in the rescue section. You can log the error, or add it to an array, or ignore it, or print it.
Yes, but you can make that less painful by putting the error handling in a separate method that you can reuse.
    def handle_errors
      yield
    rescue SomeError => e
      ...
    end

    result_1 = handle_errors { ... }
    result_2 = handle_errors { ... }
 
That's a very interesting approach Wayne.
Didn't consider that.
Thank you!!!
 
with_error_handling
 
^ Better name.
Jan is better at names than I am.
 
Hahaha, nice one Jan.
It embarrassing how long I spend thinking of good names.
 
4:24 PM
I should be embarassed how long I don't spend thinking of good names.
 
Hahaha!
There should be a job specially for this.
And caching.
 
Maybe I could be an off-by-one error specialist.
 
4:59 PM
I've got a bad error, and all I've got to go on is some blood splatter. No bodies, no witnesses.
This is going to be one of the "funner" problems I've ever debugged.
I wonder if I should add more logging. That wouldn't let me catch this killer, but it might help with the next.
 
5:15 PM
Fun bug or feature of rails I had the pleasure of working with today..
MyModel.joins(:foo).where(...) returns a list of models, but they are read only. MyModel.includes(:foo).where(...).references(:foo) does not have them as read only
 
I think that makes sense. A join, in SQL terms, creates tuples that don't have a neat one-to-one mapping to the underlying database rows (consider an outer join, for example).
 
6:05 PM
True. But Rails, at least Rails < 5, only has inner joins by default with symbols.
 
6:18 PM
I could swear I've done left outer joins in ActiveRecord < 5.
I might be wrong. It's not something I do often, and it could be that I just bypass ActiveRecord models and go straight to the connection for that sort of thing.
 
6:33 PM
You can do it if you manually write out the SQL within the join method
but Rails 5 adds left_outer_join
Okay... time to bail on work early to sneak out for my week long vacay :D
 
@Jared Yeah, that's what I recall: joins("left outer join foo") or some-such.
@Jared Nice chatting with you. Enjoy your vacation!
One of my coworkers eats a snack every day that sounds like chewing on gravel. I wonder what it is.
 
6:55 PM
@WayneConrad Yeah. Couldn't figure out what caused it, just did a #first call with named parameters
Which brought up the question of why I couldn't do the get with named parameters
 
7:13 PM
For a second I thought Cereals @reply to Wayne was to the coworker snack message and I was both amused and confused.
 
I bet it's moon cheese
It's like if you took cheese
Then removed everything you love about cheese
 
For some reason, that sounds bad.
 
7:29 PM
That sounds very bad.
Oh. Moon Cheese is a real thing.
 
I have some in my cupboard
 
I presume you put it in your cupboard before you found out what it tastes like. Or your wife did.
 
I bought it to try it. They've been in the cupboard ever since
It's been months
 
Are you waiting for a food drive to come by to get rid of it?
 
I'm hoping it becomes sentient
Every once in awhile I eat one and remember why I'm not eating it. I don't think they go bad until 2020 or something
 
7:39 PM
You can save it for the zombie apocalypse. Maybe feed it to the zombies to do them in.
 
Good idea
 
7:58 PM
I still don't understand the cause of my bad bug, but I found some relevant code that lacks test coverage. I'll stall by adding tests.
 
8:55 PM
Here's a Ruby 2.4 change I just stumbled across: In Ruby 2.4, dup.nil works, returning nil. Previously, it caused a TypeError: can't dup NilClass
 
9:47 PM
Guys, what's the easiest way for a non-technical folk to hide their IP address?
preferably a browser extension so they don't have to install any software.
any recommendations?
 
Not possible?
Tor?
 
Tor is an interesting option. Is it possible with chrome?
Found one solution with chrome :).
 
I believe that you need a tor browser, but I really have no idea. I actually route all my traffic through the NSA servers.
 
Eliminate the middleman?
 
Yeah, also that way they get four copies. One from me, one from my ISP, one from the backdoor on my computer, and one from the website I visit.
 
9:56 PM
That's sensible.
 
Wait what?
 
We're joking about the NSA's apparent ability to pretty much destroy online privacy. Sort of joking.
 
On a related note, the NSA can see lots of "hidden" traffic from the tor network, because they can see what comes out of the tor endpoints, so still don't do anything illegal, even if you're on tor.
 
haha! I was getting worried.
@thesecretmaster Defo. I'm just bypassing a limit on a tool that tracks your usage by ip & cookies.
Now I'm writing a bot to just do that for me. Ain't nobody gat time for that.
 
I didn't think you were doing anything terrible, just wanted to let you know. Not that I work at the NSA or anything... (I don't work at the NSA)
 
10:09 PM
@thesecretmaster no doubt. If not NSA, FBI?
 
That's classified (I don't work anywhere. I go to high school) :(
 
Why do I feel like I'm being trolled?
 
You're not. It's just @thesecretmaster's sharp sense of humor.
 

« first day (1169 days earlier)      last day (2086 days later) »