Home » Archive

Articles in the Ruby Category

Miscellany, Python, Ruby »

I took a trip to Portland recently to traipse through OSCON. I was mostly in the exhibition hall with all the great schwag and company booths– many which had posted job announcements. While there, I was once again frustrated by a trend I keep seeing. The trend can be described as an “arms race of job announcements,” and has gotten to the point where it’s difficult to find a development job listed by a company that is not seeking a “ninja,” or a “rockstar,” or some similarly absurdly described candidate.
Smart …

Ruby »

This is just a post that may help me stop being stupid. Writing it may help carve it into the permanent portion of my memory instead of the “forget about it and then periodically have to think twice and remember that you did something stupid” portion.
It’s a small thing, more of an annoyance than a real problem. Something like my tendency to forget “end” after blocks (a Python holdover) and to assume that zero equals false (a sort of “everything else” holdover).
It boils down to this:
belongs_to is singular,  you stupid …

Ruby »

There are plenty of times when I want to grab either one or many random records from a database in Rails. For instance, one random user, one random post, 5 random items, etc. Honestly, it’s one of those things I do in nearly every app I’ve written, so a while ago I created a module to add to any ActiveRecord class that gave me one() and some() methods. This way, I can just include Randomizer and have the methods. Everyone probably already has their method– I actually got this from …

Ruby »

Ahh, security. It’s it’s like flossing and using condoms. We all know we should do it but… well, it’s business time!
We’ve all got the same issues. “Use strong passwords!” which means “don’t use just words” is something we all try to take seriously, but it just ends up being something like “c00lp455″ with even the most basic cracker program would handle easily– replacing letters with numbers was maybe a good strategy in 1988, but you might as well just use “coolpass” today, because that’s not any easier than using numbers …

Miscellany, Ruby »

It’s pretty silly, and wasted more time than I needed to, but I’m really very incredibly “oh my god I’m so sick of this I could puke” bored with Lorem Ipsum text. You know what I’m talking about, that placeholder text you use when you just need to fill a paragraph with something, and don’t feel like typing shaesthstnsahoestha?
This:
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi …

Ruby »

This weekend, during my wife’s birthday celebrations, I talked with someone about my recent programming exploits, including how much fun I’m having programming web applications in Ruby on Rails. The response:
“Sure, Ruby’s fun, but it’s not really useful. It’s a cute scripting language, but it can’t scale.”
Until recently, this was an opinion that I agreed with. Hell, it was actually something I told other people.
One day, I realized why I agreed with it.
Now it’s just an opinion that makes me want to smack someone.

Ruby »

This entry is part of a series, Block Party»
Lately, I’ve been quickly wrapping my head around Ruby– that seductive language that is quickly becoming the very reason I want to get out of bed in the morning. In my attempt to grok Ruby Blocks, I started writing this sort of “if you can teach it, then you know it” series called Block Party. As such, it might help someone who stops by to read it, but it’s fundamentally written to help me.
Because I’m a long-time Pythonista, I decided …

Ruby »

If you’re trying to use RSpec with Autotest in a Rails app, and get a strange error:

invalid option: –autospec
Test::Unit automatic runner.

Usage: -e [options] [-- untouched arguments]

Check whether you’re using the RedGreen colorizing gem. It seems that this conflicts somehow with the setup. The good thing is that I can turn that off and still work well since I have the autotest-growl plugin installed, so I see Growl notifications of my tests.
Hope this helps someone’s frustrated Google results.

Ruby »

Recently, I started working on a new project where people will need to enter city/state, as well as university details. The reasons are unimportant here except to say that entering this into a database using an input field is problematic if you need to use the database later in a programmatic fashion. It only takes one person accidentally entering their city as “New Yrok” for your database calls to start screwing up. The best thing you can do is give people a choice, and force them to use it.
I debated …

Python, Ruby »

This entry is part of a series, Block Party»
We had a great meeting last night for the RubyGorge Block Party. Pasta, beers, great talk, and programming. What more could a guy want? (Wait, don’t answer that… “No, honey! I–” <smack!>)
We stumbled a bit on our discussion of blocks, mostly because I threw Jason to the wolves (“Uh, so let’s start. Jason, go!”). Partly, it was because blocks are such an unusual concept to non-Ruby programmers, that it’s just hard to wrap your head around them.
So, I thought I’d …