Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Cock Democracy
Jan 1, 2003

Now that is the finest piece of chilean sea bass I have ever smelled

noskill posted:

So it seems like they apologized for not communicating how things work, but there's no mention whether or not their "new" routing is going to be changed. Which probably means that it won't.

Don't get me wrong, I think that their damage control at this point is actually a good thing; I'm just not sure if I want to continue using their new routing mesh.
I'd say he mentioned it. He said they "commit to resolving this issue" and that they'll be posting an in-depth review, which I'd be interested in reading.

Adbot
ADBOT LOVES YOU

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

Lexicon posted:

In Ruby, python, and other environments, I've tended to raise a NotImplementedError within methods that are intended to be implemented by descendant classes. Going by Stack Overflow, etc, this seems to be a common pattern, yet yesterday I happened to look at the documentation for that class and it seems like a flat-out inappropriate usage based on their description: http://www.ruby-doc.org/core-1.9.3/NotImplementedError.html

Anyone have any thoughts on this? It's really not a big deal - whatever exception is raised it gets the point across.

Why not just document the required methods and maybe provide a linting test that checks? If you don't actually define the methods it'll raise the right error without any work from you.

noskill
Dec 6, 2012

OMCK

Cock Democracy posted:

I'd say he mentioned it. He said they "commit to resolving this issue" and that they'll be posting an in-depth review, which I'd be interested in reading.

Like I said, don't get me wrong -- I sure hope that they can come out of this, probably even in a better shape than they were. I'm very interested in seeing what they have to say from technical perspective and I sure hope this is not just :words:

Lexicon
Jul 29, 2003

I had a beer with Stephen Harper once and now I like him.

Cocoa Crispies posted:

Why not just document the required methods and maybe provide a linting test that checks? If you don't actually define the methods it'll raise the right error without any work from you.

True. I've just always liked having the pattern of explicitly defined methods that raise in the superclass. Makes it very clear what you need to implement in the descendant.

Smol
Jun 1, 2011

Stat rosa pristina nomine, nomina nuda tenemus.

Cocoa Crispies posted:

Why not just document the required methods and maybe provide a linting test that checks? If you don't actually define the methods it'll raise the right error without any work from you.

First, a NotImplementedError conveys the intent better than a NoMethodError. Second, it doesn't rely on external tools the other party might not have or might not run.

It's an easy way to prevent miscommunication, so there is no reason not to do it.

E: Here's Heroku's response to routinggate.

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

Smol posted:


E: Here's Heroku's response to routinggate.

Purple diagrams! Yes!

Oh My Science
Dec 29, 2008
Maybe I'm reading into this incorrectly but does the cedar stack use intelligent routing instead of random?

Also, as someone who spent the last year digging into rails 3.x is the focus in 4.x now multi threaded apps? It seems to be that way with the introduction of live streaming & thread-safety enabled by default.

noskill
Dec 6, 2012

OMCK

Smol posted:

E: Here's Heroku's response to routinggate.

Seems like what they're saying is that Unicorn on Cedar stack should perform better than Thin on Cedar stack. However I remember reading that Unicorn on Cedar is not exactly reliable and had some issues.

Any input on that?

Hefty
Jun 11, 2008

I'm brand new to ruby as well as rails, so I'm going through the exercises over at code academy and messing around with some very basic rails apps.
My question is, what's the best way to debug controllers (and to a lesser extent, views) when you're not trying to debug anything specifically? Just poking around seeing what the scaffolded code does, seeing what happens when you change x to z, etc. I tried installing ruby-debug, but apparently it "Can't handle 1.9.x yet". Am I pretty much stuck writing a bunch of logger.debug statements everywhere?

I'm running ruby 1.9.3p385 and rails 3.2.12, if that makes a difference.

MrDoDo
Jun 27, 2004

You better remember quick before we haul your sweet ass down to the precinct.

Hefty posted:

I'm brand new to ruby as well as rails, so I'm going through the exercises over at code academy and messing around with some very basic rails apps.
My question is, what's the best way to debug controllers (and to a lesser extent, views) when you're not trying to debug anything specifically? Just poking around seeing what the scaffolded code does, seeing what happens when you change x to z, etc. I tried installing ruby-debug, but apparently it "Can't handle 1.9.x yet". Am I pretty much stuck writing a bunch of logger.debug statements everywhere?

I'm running ruby 1.9.3p385 and rails 3.2.12, if that makes a difference.

You can use the debugger gem if you are just using a regular text editor. I have found IDEs like RubyMine to be pretty nice though at giving you a visual debugging environment when you are first starting out.

Smol
Jun 1, 2011

Stat rosa pristina nomine, nomina nuda tenemus.
Yep, I cant recommend Rubymine enough. Its text editor is no emacs, but the IDE features more than make up for it. The debugger, for example, is one of the best I've used.

Anyway, for quick "what's the value of this variable" debugging, the easiest way is to probably add "raise foo.inspect" to you code.

Hefty
Jun 11, 2008

This is exactly what I was looking for. I use ReSharper in Visual Studio, but I guess I never really checked out their other products. Thanks, guys.

UxP
Aug 27, 2007

MrDoDo posted:

You can use the debugger gem if you are just using a regular text editor. I have found IDEs like RubyMine to be pretty nice though at giving you a visual debugging environment when you are first starting out.

The Debugger gem supports remote connections for people less inclines to Kitchen Sink IDEs, which I've found super loving useful as of late. Somewhere in the boot process of your app (like inside 'config/environments/development.rb') toss this in

code:
require 'debugger';
Debugger.start_remote
Then, anywhere else in your application just throw in the same "debugger" call as you would otherwise. If you run your app at this exact moment, you might notice that the debugger seems to pass over the breakpoint. But no fear, in another terminal window, connect to the debugger session with `rdebug -c`, and the next time you pass over that debug breakpoint it'll catch and you can do your thing.

'ruby-debug' for 1.8.x also supports this exact same thing, FWIW. There's some very sparsely documented features around that, like the ability to pass in the host and port you bind to so you can run concurrent remote debugging sessions (for like a web worker and a job worker), or truly remote sessions.

Thought I'd just throw this info out there. Doesn't seem like many people know about this. If anyone uses Pow, now you don't have any excuse for not debugging.

Lexicon
Jul 29, 2003

I had a beer with Stephen Harper once and now I like him.
^ That's cool, but why is it preferable over simply adding the debugger gem to your Gemfile, and then inserting `debugger` at the point of interest? I do this all the time, and it hits the break in the console I'm using to run either rails server or rails console.

Lexicon
Jul 29, 2003

I had a beer with Stephen Harper once and now I like him.

Smol posted:

Yep, I cant recommend Rubymine enough. Its text editor is no emacs, but the IDE features more than make up for it. The debugger, for example, is one of the best I've used.

In RubyMine can you do things like hover over variables to get their value at that point in time? That's about the only thing I miss from my old Visual Studio days - otherwise I'm totally in love with Sublime Text 2 (and it's vim editing mode).

Hefty
Jun 11, 2008

Lexicon posted:

In RubyMine can you do things like hover over variables to get their value at that point in time? That's about the only thing I miss from my old Visual Studio days - otherwise I'm totally in love with Sublime Text 2 (and it's vim editing mode).

You can see all the local scope variables in the debugger pane, which works just as well.

UxP
Aug 27, 2007

Lexicon posted:

^ That's cool, but why is it preferable over simply adding the debugger gem to your Gemfile, and then inserting `debugger` at the point of interest? I do this all the time, and it hits the break in the console I'm using to run either rails server or rails console.

I work inside a very service-oriented architecture, which means a full integration test or manual walk through the UI requires 4 or 5 applications to be running at any one given time. Pow tries to solve this problem by allowing me to symlink my application root to a dot-folder in my home directory, and maintains a pseudo-DNS service to route any requests for "my_app.dev/" to the "my_app" symlink. I don't need to maintain 4 different terminal windows running "rails server", manually configuring differing localhost ports to not conflict.

It might not be preferable over a simple "require 'debugger'; debugger; 0;" line wherever you need for simple standalone applications. I wasn't trying to imply that debugging through a remote console is a better practice of which everyone should switch to, but that it's a tool available for the situations where one might need it. The discussion of debugging came up, and I had coincidentally just recently showed several co-workers Pow and this feature when one was complaining about having to maintain multiple app's console windows at one time, and wished for a simpler solution.

MrDoDo
Jun 27, 2004

You better remember quick before we haul your sweet ass down to the precinct.

UxP posted:

The Debugger gem supports remote connections for people less inclines to Kitchen Sink IDEs, which I've found super loving useful as of late. Somewhere in the boot process of your app (like inside 'config/environments/development.rb') toss this in

code:
require 'debugger';
Debugger.start_remote
Then, anywhere else in your application just throw in the same "debugger" call as you would otherwise. If you run your app at this exact moment, you might notice that the debugger seems to pass over the breakpoint. But no fear, in another terminal window, connect to the debugger session with `rdebug -c`, and the next time you pass over that debug breakpoint it'll catch and you can do your thing.

'ruby-debug' for 1.8.x also supports this exact same thing, FWIW. There's some very sparsely documented features around that, like the ability to pass in the host and port you bind to so you can run concurrent remote debugging sessions (for like a web worker and a job worker), or truly remote sessions.

Thought I'd just throw this info out there. Doesn't seem like many people know about this. If anyone uses Pow, now you don't have any excuse for not debugging.

This is cool thanks. I had a feeling there was probably a way to do it, but I haven't really done remote debugging outside of an IDE, so this makes it easy.

xtal
Jan 9, 2011

by Fluffdaddy
Ruby 2.0 has been released, on the same day as Ruby's 20th birthday. :yotj:

Smol
Jun 1, 2011

Stat rosa pristina nomine, nomina nuda tenemus.

xtal posted:

Ruby 2.0 has been released, on the same day as Ruby's 20th birthday. :yotj:

:snoop:

Great news. Let's hope that we'll be celebrating Ruby 4.0 20 years from now.

flyingfoggy
Jun 3, 2006

My fellow Obamas...
Coming from a complete newbie background, I'm learning ruby/rails and have a fairly solid grasp on making at least basic/intermediate rails apps and can make it through some rails tutorials to add features and such. The problem I noticed is I have primarily been reusing/modifying/adjusting code from online resources and past projects and so that when I tried to write my own methods to do something more complex than the standard routes I got stuck with writers block for a while. What are some good ways to get a more solid grasp on ruby functions/syntax and writing methods?

Obviously a lot will come from practice (I haven't been doing this long), but at the moment am not sure where to go. I'm at a level where a "learn to program" resource is a bit too basic but most other books I have looked at seem too advanced.

Doc Hawkins
Jun 15, 2010

Dashing? But I'm not even moving!


What worked for me was choosing a domain I found interesting and test-driving a library that modeled it.

e: me rite gud

Doc Hawkins fucked around with this message at 17:32 on Mar 1, 2013

tef
May 30, 2004

-> some l-system crap ->
Aside: Rubyists weren't kidding when they said matz is nice. He is super nice!

Pardot
Jul 25, 2001




tef posted:

Aside: Rubyists weren't kidding when they said matz is nice. He is super nice!

Had dinner with him wednesday, and he noticed that I was out of water and filled it for me before I noticed I was out. Super nice.

Pardot fucked around with this message at 16:38 on Mar 1, 2013

KoRMaK
Jul 31, 2012



Is there a way to stop pending migrations from being run when I do rake db:seed or a way to run my own .rb files using rake?

KoRMaK fucked around with this message at 17:46 on Mar 1, 2013

tef
May 30, 2004

-> some l-system crap ->

Pardot posted:

Had dinner with him wednesday, and he noticed that I was out of water and filled it for me before I noticed I was out. Super nice.

Oh I forgot you were at waza, we should have had a goon meet™

Pardot
Jul 25, 2001




tef posted:

Oh I forgot you were at waza, we should have had a goon meet™

I was making pourover coffee for attendees all morning in front of the main stage, so there is a small chance you had some :buddy:

tef
May 30, 2004

-> some l-system crap ->

Pardot posted:

I was making pourover coffee for attendees all morning in front of the main stage, so there is a small chance you had some :buddy:

I drink tea, pip pip. If you saw someone trying to find @kennethreitz and playing with origami, that was me.

(waza was awesome!)

Smol
Jun 1, 2011

Stat rosa pristina nomine, nomina nuda tenemus.
https://speakerdeck.com/alex/why-python-ruby-and-javascript-are-slow

Wasn't at Waza so I didn't see the talk, but the slides are good. Hopefully they'll release some videos soon.

Pardot
Jul 25, 2001




Smol posted:

https://speakerdeck.com/alex/why-python-ruby-and-javascript-are-slow

Wasn't at Waza so I didn't see the talk, but the slides are good. Hopefully they'll release some videos soon.

I think I heard they'll be up in few weeks instead of like 8 months or whatever last time. I hope so at least cause I didn't really get to see any myself.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
Alright, I"m launching my first production rails application on monday, I want to make sure I have my security ducks in a line, here:

w/r/t: https://groups.google.com/forum/?fromgroups=#!topic/rubyonrails-security/AFBKNY7VSH8,

I'm running Running rails 3.2.12, all of my models use attr_accessible
w/r/t: https://groups.google.com/forum/?fromgroups=#!topic/rubyonrails-security/RieVvnRGq8s

I"m running JSON 1.7.7

w/r/t the YAML thing, as I said, I'm using rails 3.2.12

Am I missing anything? Is there anything else I should be aware of?

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

chumpchous posted:

Alright, I"m launching my first production rails application on monday, I want to make sure I have my security ducks in a line, here:

w/r/t: https://groups.google.com/forum/?fromgroups=#!topic/rubyonrails-security/AFBKNY7VSH8,

I'm running Running rails 3.2.12, all of my models use attr_accessible
w/r/t: https://groups.google.com/forum/?fromgroups=#!topic/rubyonrails-security/RieVvnRGq8s

I"m running JSON 1.7.7

w/r/t the YAML thing, as I said, I'm using rails 3.2.12

Am I missing anything? Is there anything else I should be aware of?

Have a backup strategy for when you get attacked by an rear end in a top hat and a page at /security with a PGP public key and an address for when you get attacked by a non-rear end in a top hat.

Smol
Jun 1, 2011

Stat rosa pristina nomine, nomina nuda tenemus.

chumpchous posted:

Alright, I"m launching my first production rails application on monday, I want to make sure I have my security ducks in a line, here:

w/r/t: https://groups.google.com/forum/?fromgroups=#!topic/rubyonrails-security/AFBKNY7VSH8,

I'm running Running rails 3.2.12, all of my models use attr_accessible
w/r/t: https://groups.google.com/forum/?fromgroups=#!topic/rubyonrails-security/RieVvnRGq8s

I"m running JSON 1.7.7

w/r/t the YAML thing, as I said, I'm using rails 3.2.12

Am I missing anything? Is there anything else I should be aware of?

Here's a few security-related tools that are useful for every Rails developer. We run brakeman on our CI, it's very easy to set it up with Jenkins. Also be sure to subsribe to the rubyonrails-security Google group.

http://brakemanscanner.org/

https://github.com/postmodern/bundler-audit

Smol fucked around with this message at 12:47 on Mar 2, 2013

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Smol posted:

Here's a few security-related tools that are useful for every Rails' developer. We run brakeman on our CI, it's very easy to set it up with Jenkins. Also be sure to subsribe to the rubyonrails-security Google group.

http://brakemanscanner.org/

https://github.com/postmodern/bundler-audit

Bundler audit is nice. Thanks!

quote:

Have a backup strategy for when you get attacked by an rear end in a top hat and a page at /security with a PGP public key and an address for when you get attacked by a non-rear end in a top hat.
Is the purpose of the security page so that people can notify me of vulnerabilities? What's the purpose of including a PGP key?

Sewer Adventure
Aug 25, 2004

chumpchous posted:

Is the purpose of the security page so that people can notify me of vulnerabilities? What's the purpose of including a PGP key?

It's so that if they find a really bad vulnerability they can encrypt their email to prevent others from reading about it.

MrDoDo
Jun 27, 2004

You better remember quick before we haul your sweet ass down to the precinct.

Pardot posted:

I was making pourover coffee for attendees all morning in front of the main stage, so there is a small chance you had some :buddy:

The tall guy making coffee?

Pardot
Jul 25, 2001




MrDoDo posted:

The tall guy making coffee?

No, I'm normal height.

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

Would I get in trouble for killing another developer?



Let's put code that was never QA'ed in production. There's a poo poo load of errors in our logs, which he must be ignoring. Server ran out of memory Friday, and did the same thing this morning. I killed that app until I could find the cause, racing against the processes as they creep up towards 3GB each.

The culprite?

@widgets = Widgets.all

THERE ARE 2.3 MILLION ROWS IN THE WIDGETS TABLE

Obsurveyor
Jan 10, 2003

Bob Morales posted:

@widgets = Widgets.all

THERE ARE 2.3 MILLION ROWS IN THE WIDGETS TABLE

All of the pushing untested code to production aside, maybe he thought it was lazy by default?

Adbot
ADBOT LOVES YOU

MrDoDo
Jun 27, 2004

You better remember quick before we haul your sweet ass down to the precinct.

Bob Morales posted:


@widgets = Widgets.all

THERE ARE 2.3 MILLION ROWS IN THE WIDGETS TABLE

Gotta be careful with those scaffolded controllers

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply