« first day (566 days earlier)      last day (2689 days later) » 

00:00
new to Ruby, how do you mark an action in Rails to take POST requests? getting a 404...
controller order with action create I've tried the routes get '/:controller/:action' and resources :order
used to asp.net with [HttpPost] attributes
00:34
How would you design a database that has players and games
Each player would have n games
Each game would belong to n (well, 2) players
But each game needs 1 winner and 1 loser
has 1, :winner

Where winner is a table with a reference to the player and the game?
Sounds good
00:46
or would it make more sense for the player to have n results
and result is a table with a reference to the game, and a flag if they won
@JoshLeBlanc the first option would be fine, with winner id being the player that won.
I was thinking
the latter would work too if you had results with a player id and a game id and the game table had everything that both players have in common.
in fact that would probably be required if player count wasn't always two
Let me paste what I'm thinking
I don't have enough experience with this ;_;
class Player
	include DataMapper::Resource

	property :id, serial
	property :bnet_id, Integer
	property :wins, Integer
	property :losses, Integer
	property :games, Integer
	property :race, String
	property :league, String
	property :elo, Integer
	property :last_updated, DateTime

	has n, :results
	has n, :games, through: :results
end

class Game
	include DataMapper::Resource

	property :id, Serial
	property :map, String
	property :length, String
	property :played, DateTime
	property :uploaded, DateTime
wins and losses can just be calculated fields instead of their own thing
that looks fine
01:03
I could change it to remove the through:, and the *_id properties in Result. Dunno what that would do. Never used through in datamapper before
yeah, I know almost nothing about Ruby
I just assumed that was all regular old ORM stuff.
I know almost nothing about databases
01:06
for small things like this it is less about what is "right" and more about what is convenient for you to write
SQL?
@CuddleBunny look at your routes and find the correct one
@JonathanMusso like a command to list routes?
rake routes
you need to find the correct route for the action
will try that
order_index GET  /order(.:format)               order#index
            POST /order(.:format)               order#create
what is the _index for?
is that what you called it?
01:13
it is order_controller.rb' with class OrderController < ApplicationController`
I had added only: [:index, :create] when I took it off I got many more things
order_index GET    /order(.:format)               order#index
            POST   /order(.:format)               order#create
  new_order GET    /order/new(.:format)           order#new
 edit_order GET    /order/:id/edit(.:format)      order#edit
      order GET    /order/:id(.:format)           order#show
            PATCH  /order/:id(.:format)           order#update
            PUT    /order/:id(.:format)           order#update
            DELETE /order/:id(.:format)           order#destroy
before you were only allowed those routes
resources creates full CRUD routes
yeah, I had added the only assuming it broke because I didn't define all of the above actions.
oh, I think I see. I should post to mysite.com/orders instead of /orders/create
the index yea
then each record is the show
01:18
aha, that worked. Thanks
glad to have helped
used to asp.net where a route like the two in order_index would both go to order#index but one would have a [HttpPost] attribute...
heh, now I just need to figure out why my action crashes the debug server D:
Nevermind, wrong tab... it is still running
well, it didn't crash the server but it crashed mongodb...
 
1 hour later…
02:38
I'm never going to figure this out
class Player
	include DataMapper::Resource

	property :id, Serial
	property :bnet_id, Integer
	property :wins, Integer
	property :losses, Integer
	property :games, Integer
	property :race, String
	property :league, String
	property :elo, Integer, default: 2000
	property :last_updated, DateTime

	has n, :results
end
When created, produces
#<Player @id=nil @bnet_id=2809973 @wins=47 @losses=42 @num_games=89 @race="ZERG" @league="MASTER" @elo=nil @last_updated=#<DateTime: 2015-07-29T23:37:59-03:00 ((2457234j,9479s,309345000n),-10800s,2299161j)> @game_id=nil>
oh wait
nevermind
No, why is there a @game_id ???
I'm like 6% sure it's ruining my life
Oh
If anyone's wondering, the answer is "Josh is too tired to do thinking"
Night all
 
10 hours later…
12:19
good morning
Rails newbie here: In what file should I put set_trace_func proc {?
never seen this before
3
A: How to get a backtrace from a SystemStackError: stack level too deep?

Jonathan SwartzCombining suggestions from several answers, this will throw an error (with stack trace) when your call stack gets too deep. This will slow down all method calls, so you should try to put it as close to where you think the infinite loop is happening as you can. set_trace_func proc { |event, fil...

It is a way to have the stack shown when getting a recursion loop. Looks very convenient to solve my current "stack level too deep" error. The answer says "put this function in your code". But I am not sure where.
That question is not Rails-specific. I guess Rails has a special place where such things belong.
I wonder if you could put it in ApplicationHelper
Anonymous
hello everyone!
12:31
Good morning, all! Cat in the garage... so full eight hours sleep for me, and a very upset cat this morning.
morning
good job Wayne
@NicolasRaoul If there's a particular controller method that you know is triggering this, put it at the beginning of that method.
Anonymous
@WayneConrad I saw the link on Crystal. Does it differ much from Ruby? Except for native support for C code (with a wrapper, but no additional libraries needed)? Which. BTW I think is really cool
The syntax is very similar to Ruby, but it's statically typed and compiled. I think speed, obfsucation, and ease of deployment will be its strengths.
MRI is supposed to get static typing as well, so it's an interesting race between the two.
> The compiler is written in Crystal.
Neat
12:40
That's always a seminal moment in a language, when it bootstraps itself.
SSR
SSR
13:00
Hi
Can any one help me with a query?
13:37
I can sure try
Anonymous
What is the ruby compiler written in?
Anonymous
And is crystal a fork of ruby, since it has such a similar syntax?
The ruby compiler is in c. Crystal is not a fork.
If you look at the source in the docs, you can actually see the C code for all of the functions
14:22
Task for today: Change the text on a floating window
Things I've done today: Updated to windows 10. Ate a Danish.
Time spent: 3 hours
I got paid 50 dollars to update windows and eat things
Heh, cool.
I'm getting paid to eat a breakfast burrito with habenero sauce. It's good work.
I just worked out how much my dad gets paid. Realized how much money the company pisses away with meetings
* My father's the senior developer here
Oh yeah, meetings.
Crystal has a built-in way to require everything in or under a path. That's pretty sweet.
That's neat
You don't use windows, do you Wayne?
14:38
Not much.
When I have to, I install Cygwin and pretend it's a funny looking *nix.
Crystal has real macros. I like how the author is staying close to Ruby, but deviating from it in interesting ways.
Is this ging to be your next language, wayne?
14:54
I doubt it. I look at new languages all the time, stick a foot in the water, and then something else looks shiny. Today, Crystal is shiny. Tomorrow...?
Crystal's standard library has big chunks of undocumented API
It is in alpha, though.
Hello guys, just wanted to present my ruby gem to you, it's called gitalytics, it fetches git log on your repo and can create an html with some statistics, it is pretty basic but I am looking forward for receiving comments or feature requests, you can take a look into it at: gonzalo.robaina.me/gitalytics
@pepito2k Hello, welcome, and thanks for the links.
thanks, I don't mean to be a spammer I would try to participate as much as I can
c:\beta>gitalytics
fatal: ambiguous argument '%ai': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
:(
geez, that was fast
15:02
@pepito2k On my screen, the screen shot is missing... I just see the text "Gitalytics Screenshot". Is that a problem with my browser?
The screenshot is also missing for me
the screenshot is broken, I have to fix that
@JoshLeBlanc does this command work for you ? git log --numstat --pretty='%H %ai %an <%ae> %s'
@pepito2k Are you interested in feedback?
absolutely
that's weird @JoshLeBlanc, that's the command used within the gem
15:05
Lessee... worked out of the box when run against the ftpd gem. Yay! I'm using Ruby 2.2.1 on *nix.
@pepito2k The first line on windows is WARNING: terminal is not fully functional
Not sure if you would get that when running from ruby
I installed the gem and ran it that way... I didn't clone the github project or anything.
mmm never tried it on Windows
@pepito2k The README could maybe use a little more love. What should be in a gem's README? may or may not have ideas for how to improve it.
thanks @WayneConrad, I will check that
15:10
The "He/she did something useful" syntax is a bit ponderous. I understand the reason behind it, though. Perhaps something like this: "Alfonso Cora has made 1 commit during 1 consecutive day, doing something useful on 1 of those days."
No, wait... I think it can be better still. think think think.
What do you think of this? "Wayne Conrad has made 306 commits on 57 separate days during a span of 654 days."
you're right
I never thought on that
I wanted to get rid of the "something useful" description because it makes a very broad assumption about my work :D
The next thing I found is interesting... I'll make an issue for it.
cool, thanks. I really appreciate your help
15:17
good morning :D
Oh cool, I've got a really large repo to test it with. Over 10K commits, several G big.
I think it's going to take a while processing it
Let's find out :D
I'm glad you stopped by now. In a few weeks I won't have access to this monster repo.
I know what happens with the bug you just issued
is it possible that you were committing with different email addresses ?
email address?
15:23
yup
That seems likely. Let's find out.
maybe I should group by the name instead
Yep, three different email addresses.
Either group by name, or display email. Maybe an option to select between the two behaviors, with group-by-name being the default.
great idea
The Git repo is 3.4G. Here goes nothing.
15:32
I'm going out for lunch, will be back in about an hour or so... thanks a lot for your help
It's been a pleasure. Talk to you later.
15:57
The list of all SO Crystal-lang questions still fits on one page.
16:14
Alright, I'm doing a code kata in Crystal. Let's see if it makes me happy.
It's got an rspec kind of test lib built in.
Stack traces are in Python order (top of stack last) rather than Ruby order (top of stack first).
Testing the program I'm fixing up
I feel like it shouldn't take an hour to go through a couple dozen million records and find ones that haven't been exported yet
If there's an index on the field that marks the exported one, the database should do all the hard work, and (probably) quickly.
No there has to be something wrong
"database" ha. To my knowledge, it's an indexed file
Hey everyone, how are y'all today?
Pretty good, how are you?
16:26
Not bad man, thanks. Working on these two projects in tandem. The heat FINALLY broke here. Looking forward to some rain.
It's 32 celcius here, apparently
It's like 9 Celsius in the office, though
Very cold
Yeah it's been close to 40 C with the humidex the last week.
Ahh. my buddy in Moncton has said you guys have had rain for 2 weeks
@JonathanMusso sup
got the printer working :D
@Chris hey buddy just about to start building a new model and controller? how's the printer?
Yup. Rain pretty much every day for weeks
16:30
man wicked!
Who do you know in Moncton?
one of my friends worked for IBM for 10 years out there
but he left about a year ago
Good morning Jonathan
morning @WayneConrad!
@Chris I sent you a msg off your site
@Chris Do you have pics? We live for pics.
16:35
:D
it's a requirement
Crystal-lang strings are double-quotes... single-quote is used for character literals.
Taking a note from java
I guess having character literals is because Crystal wants easy integration with C libs.
@JonathanMusso cool, yeah I have a video of printing a test page, ill send it to you.
wicked, ty
16:45
i sent it to your gmail address
@Chris this is great, well done
thanks dude
i ordered some tshirts this morning :)
# crystal-lang has shorthand for initializing member variable:
class Bar
  def initialize(@bar)
  end
end

p Bar.new(1)
# => <Bar:0x2403fe0 @bar=1
slick, cotton?
yeah i like american apparel tshirts so i went with those.
16:59
nice
17:13
I wonder if there's a simple way to test whether a language has tail call optimization.
Oh, yeah, it's trivial.
def foo(i)
  return 0 if i == 0
  foo(i - 1)
end

foo(1000000)
Aaaand Crystal doesn't have TCO.
17:33
If y'all want me to shut up about Crystal, just say so... I know this is the Ruby room.
not at all Wayne
The language geek in me is not very far below the surface...
so my china axe just shipped @WayneConrad :D
only taken the whole week lol
Cool! My fingerpicks have probably shipped, too. I don't have tracking on them... just that the lady I ordered from on Monday said "they'll probably ship today."
@JonathanMusso you looking for a good axe?
17:40
:D
you selling one @cleong?
no but i know some really good ones for their price
your in the toronto region right?
north of it
man are you trolling?
because this made me laugh my f'n ass off
lol
not trolling get them
17:42
^ China Axe
looooool
they do look great, but Wayne and I are talking about guitars XD
oh i see
nice though, would be good for splitting wood
17:48
@kotAPI Hello, welcome.
Whats going on here?
@kotAPI We're talking about guitars, axes, the Crystal language, and even Ruby. Pull up a chair and hang out. We'd love to have you join us.
Damn, you guys are one of the friendliest chat rooms around here i suppose? :P
@kotAPI welcome to the channel
That program I thought was broken has been confirmed as broken
So yay
I get to fix it/re-write it
17:54
@JoshLeBlanc I noticed, you are building a multiplayer game with Ruby?
No, just a small thing for a clan
ah, so you were just trying to organize data for a normal app in the db?
So who plays guitar here?
18:00
I used to play a little bit
sweet :D
i used to play just one song, wonderwall xD
heh, you see Noel's new album?
no, how's it?
I've only checked out a few live videos on YT. wasn't bad at all
playing guitar is fun man
btw how old are you guys?
18:14
25
fuuuu I hate migrations! I always write them backwards
migrations?
sorry, new to rails xD
Old. Really old.
A "migration" is a mini-language for specifying database schema changes.
if we add all of our ages together, we are still a century off for Waynes age
I am only joking of course :)
18:26
We didn't have ones and zeros when I was a pup--you used a lower-case ell for a one, and an upper-case oh for a zero.
I'm 24
@GonzaloRobaina Hell, welcome, and happy de-lurking day.
haha that's a good one Wayne
That was literally true on the old manual typewriter I learned to type on.
18:31
guys a little help, i'm taking the harvard's cs50 and started my own server, can you visit this and tell me what do you see? 192.168.56.101:8080
welcome to the internet
@kotAPI That's a private, non-routable IP address. It won't work for us.
ohhhh :D
thought i can make it public
how do i host a server so the others can use it?
What you have to do is find the public IP of the router that is connecting to the internet. Then you add a rule to the router telling it to forward a port to your machine.
18:34
you sign up for education.github.com/pack and get yourself 100$ of Digital ocean credit, after that you read up on how to setup a rails server and tadaaa
is it free if you;re a student?
yup
probably won't work for me
hmm I want to make a nice type logo, not sure if I will have enough space though...decisions..decisions
19:10
@HunterStevens Are you buried in that Asterisk book?
Any Rails guru here ?
not a guru, but what's up?
Stuck with this:
Automatic deletion of join models is direct, no destroy callbacks are triggered.
need to prevent deletion of a HABTM relation forcing to have at least one
tried with validations and callbacks
but nothing seems to work for me
hmm, does this help
5
Q: How do I trigger destroy callbacks for an object which is part of a join model that automatically deletes that object?

EricRails 2.3.8. I have 3 models, User, Source, and Subscription. User attr_accessible :source_ids has_many :subscriptions has_many :sources, :through => :subscriptions Source has_many :subscriptions Subscription belongs_to :user belongs_to :so...

Anonymous
19:27
@WayneConrad Yes, which is why I have not been on chat much this week. I have also taken time to research about unit testing and stuff
Anonymous
Is it practical to test rake tasks? Even if they are performed once? Like, it makes sense, as it prevents you from doing a whole bunch of attribute changes on production data
@HunterStevens Heh, that's what I figured. OK, just wanted to say hi.
Anonymous
Hi!
Anonymous
I just finished the telecom-based chapters today. Wrote a ton of notes on my tablet from it (over a dozen 8.5x11 sheets)
@HunterStevens On a one-off task, if it can be destructive, tests could be good. I have a project with a rake task that needs to be tested. We put the guts of the take task into a class in the rails project and tested that class normally with rspec. The rake task just makes an instance of that class and runs it, so doesn't need any direct tests.
19:29
@JonathanMusso yes, that seems to be the way... been working on it all day without any real progress thou :(
Anonymous
I have another book at home my father bought me. I plan to read it this weekend, once I finish this (old) Asterisk book. packtpub.com/networking-and-servers/…
Anonymous
Yup, I've written 12 pages worth on my tablet this week. And will probably have 15 total by the end of the day.
Anonymous
Essay on why suites with only integrated tests are a scam
20:09
I've written all of 20 lines of code in Crystal, and I'm already creating an issue explaining why I think it's doing it wrong. :/
It occurs to me, at this moment in time, that I might just be a wee bit opinionated.
@WayneConrad doesn't it depend a ton on libraries and frameworks though? Ruby for applications is way different than Rails...
just like writing Node.js feels way different than client side js
@CuddleBunny Hello, welcome! Do you like carrots? Otters don't eat carrots... you can have mine.
I do like carrots.
@CuddleBunny I think Crystal does depend a lot on libraries, just as Ruby does. I'm writing an issue to complain about an aspect of its syntax... so that doesn't involve libraries at all.
I am a C# guy so I think they're both wonky.
20:18
Haha! Good answer.
@Ahmad Hello, welcome back.
o/ heya wayne!
what's up?
so I POSTed some JSON to a Rails and I'm getting params['{"data":{"place":{"name":"10019","address":"New York, NY 10019, USA","url":"https://maps.google.com/maps/place?q'] = 10019 instead of params[:data] = 'some json...' wat?
oh nvm, content type is still urlencoded form..
What's the C# guy doing having to use Ruby? I can't imagine that's fun for you.
freelance job
he was like: "I've always wanted to do a project in Rails"
Oh, so $. That eases the pain of having to be in alien territory.
20:28
and I had done the Ruby starter tutorial 10 years ago, so I felt qualified :)
I told him that Ruby was probably the hipster barista of web languages and that I'd go get my Bieber wig and Starbucks apron and go to town. Though I guess Node.js deserves that title now.
There are so many hipster's-of-web-tech now that I can't keep track of them all.
Rails isn't the hipster anymore. It was 10 years ago. Maybe five. Now it's "that old guy that still works at the coffee shop."
the hipster now is react and javascript
ndoe or something
But that's all okay. It's far better than PHP
20:34
Very much so.
Did I really put an apostrophe in "hipsters?" Sheesh.
RubyMine is pretty slick too
does anybody uses rubymine ?
Anyone who actually knows Rails probably does most of it from terminal, but RubyMine helps people who know almost nothing like me do everything.
I remember using it when I started with ruby but then realized that it wasn't really helpful for me
now I generally use Atom or Sublime
they don't use as much resources as rubymine
yeah, RubyMine uses half a gig of RAM. Could have been painful a few years ago.
20:53
I'm an Emacs guy, but when I'm a stranger in a strange land, an IDE can be very good.
Here's my feature request for Crystal. I hope it's reasoned and even tempered. I feel strongly about it, so it took many passes over it to keep it from being a screed. At least, I hope it's not a screed.
21:28
@GonzaloRobaina gitalytics chewed on my monster repo for 2 hours, but finished.
git log >/dev/null took 5 seconds, so there may be some room for optimization.
LOL
sorry for getting you processor hot
22:12
@WayneConrad yeah, I think your suggestion makes sense. I've been using the alpha builds of ASP.NET 5 and they changed the name of keyword param and it broke stuff and it was annoying. Two builds later they just took the keyword param out and all was better. Having that always optional would drive me nuts...

« first day (566 days earlier)      last day (2689 days later) »