What the New Bubble Means for Software Engineers

There has been a lot of recent talk about a bubble in the tech world. Today DHH railed against the effects of the bubble on the engineering talent pool. I largely agree.

Yes, a lot of money is being thrown at companies that are not going to succeed or may succeed financially, but will not make the world better. But there are also investments in businesses that are going to both make the world a better place and generate profits.

It's incumbent upon good developers to choose worthy projects. It's your life. Make it count. You are in high demand. Make a good choice. You shouldn't necessarily take the largest pile of cash thrown at you. Would you take $250k/year to maximize mobile click rates for health insurance claim distraction widgets with HTML 9 Boilerstrap JS?

Talented engineers have the power to make good money doing what they enjoy. More importantly, those individual decisions add up to shape how technology affects society. Let's do good things!

A great lesson from Rework is that you should be working on your best idea. Be aware that it may not be your idea. There are a lot of great projects just getting started. Whether you bootstrap it or join a VC-backed startup, find something that will excite you every day.

 

SPF Records in Google Apps and Amazon SES

Today I learned about adding SPF records in DNS to help with email deliverability. Fun times!

These pages were helpful:

Set up SPF with Amazon Simple Email Service

Set up SPF with Google Apps

To use both domains, you need to put them in a single SPF record, like so:

v=spf1 include:_spf.google.com include:amazonses.com ~all

To test your SPF records, use onew of the tools suggested here. The format of the Port25.com email was nice. You should see "SPF check: pass" in the response.

Is Ruby Slow? Try Every Icon

Can a machine produce every possible image? 

While Every Icon is resolved conceptually, it is unresolvable in practice. 

It posits a representational system where computational promise is intricately linked to extraordinary duration and momentary sensation.

In 1996, John F. Simon, Jr. created "Every Icon", a program/art piece to display every possible 32x32 icon.

The quotes above are from his statement about the project: http://numeral.com/articles/paraicon/paraicon.html

Every Icon is an awesome conceptual art piece, and a fun programming problem.

Here's my ruby version: https://github.com/teeparham/every_icon

Send Devise Emails with Resque

Sending devise emails using resque does not work out of the box with devise and resque_mailer. There are a few purported solutions online that don't work.

Below are 2 ways to make it work. Either way, I'll assume you already have devise and resque working with this in your Gemfile: 

Tell Devise you are going to use a different mailer in config/initializers/devise.rb: 

Now create the DeviseResqueMailer class. Here are 2 alternate ways to make it happen:

1. Copy/Paste FTW

Add lib/devise_resque_mailer.rb: 

2. Use a new module in resque_mailer:

Use this fork of resque_mailer: http://github.com/teeparham/resque_mailer/tree/model-mailer . Specify that fork in your Gemfile:

gem 'resque_mailer', :git => 'git://github.com/teeparham/resque_mailer'

You'll now have an additional model available called Resque::ModelMailer. Include that in a new mailer (again, lib/devise_resque_mailer.rb): 

For either #1 or #2, If you use a mailer class called DeviseResqueMailer, the view files for the mailer need to be in the expected place. Move your devise views from app/views/devise/mailer/ to app/views/devise_resque_mailer/.

You should now be able to send emails directly in development, or using resque in production. 

Why is this necessary?

The devise mailer takes a resource (typically a user) as the argument to all its mailer actions. ResqueMailer repurposes the Mailer class as a Resque Job class. Enqueuing a job with an argument of an object (a user) is not advised since the marshaling and unmarshaling of that object may not be well-defined since it must be stored in redis as a primitive type. Essentially what we're doing is queuing a resque job of the DeviseResqueMailer class with the class name and id ("User", 123 for example) instead of the object itself. Then when the job is performed, we call User.find(123) and pass that to the mail action. 

 

Update Your Rails App to Ruby 1.9.3

Ruby 1.9.3 is offically released. Updating from 1.9.2 is easy with rvm.

Note that 1.9.3 will install rake 0.9.2.2, so you should remove any gem spec for rake from your Gemfile if you have specified a rake version there.

Also, you should update your .rvmrc file in your project(s) to "rvm 1.9.3".

Test rails app with ruby 1.9.3-preview

Update: Ruby 1.9.3 is officially released! This is old news now.

See this post instead.

Let's test our Rails 3 app with the new ruby 1.9.3 preview release, using RVM and bundler.

Step 1 - Install ruby 1.9.3 preview and run our tests. That should do it!

But we get this:

/Users/tee/.rvm/rubies/ruby-1.9.3-preview1/lib/ruby/1.9.1/test/unit.rb:167:in `block in non_options': file not found: test/unit/**/*_test.rb (ArgumentError)

Let's update rake to fix this. First, let's create a new branch to isolate any hacks we need to make.

Then put this in your Gemfile:

Now install your bundle and test again:

 

Finished tests in 1.825648s, 651.5643 tests/s, 1483.5197 assertions/s.

1289 tests, 2885 assertions, 0 failures, 0 errors, 0 skips

 

Victory! (OK you got me - the numbers are fibbed).

More info on the rake error here:

https://github.com/jimweirich/rake/issues/51

http://www.ruby-forum.com/topic/2335362