light bulb
  • Anyone Want To: Live social activity networking
  • Dan Connor music and albums
  • Music production, pro audio and engineering tips & secrets

ActionMailer 3.2.0 Upgrade SSL Issue

I upgraded my Rails app to Rails 3.2.0 from 3.1.3 and found that my SMTP outgoing mail was no longer able to authenticate with my mail server.

Further investigation revealed that my ActionMailer config was using the configuration option :tls => true, which is now effectively :enable_starttls_auto => true. But of course. After that quick change it worked.

The specific error message I was seeing was:

SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol

Hope this helps somebody.

Anyone Want To: Live Activity Networking

Hey everyone! I've just launched my stealth project, Anyone Want To over at http://www.anyonewant.to. Basically it's like a live, realtime Meetup.com. You can suggest an activity in your area, which gets broadcasted live to people nearby who can then respond to it.

Head over there, take the tour on the homepage, and experiment. There's already some organic activity going down in the Vancouver channel!

Rails CSRF AJAX w/ Devise & JavascriptMVC

So I am building a Rails app that uses Devise for authentication. Devise is kind enough to provide AJAX methods out of the box for authentication and user creation. Unfortunately, things weren't working so good. Now, before you say "yeah, yeah you have to include the CSRF token in the AJAX body", I knew that already and I was. Turns out that Devise (or perhaps Warden) also expects the HTTP CSRF header to be set. The specific key is "X-CSRF-Token".

This is all fine and dandy if you happen to have full control over your low-level AJAX calls. In jQuery you can set a beforeSend callback when calling $.ajax and set the xhr header there. But I am using JavacriptMVC, which has its own AJAX methods buried deep in its model code. Fortunately, JMVC leverages jQuery.

While I wasn't able to assign a beforeSend callback to JMVC's ajax methods, I was able to add the beforeSend method to the ajaxSetup routine for jQuery, which means every ajax call will run this callback.

    jQuery.ajaxSetup({
        'beforeSend': function(xhr) {
            var token = $("meta[name='csrf-token']").attr("content");
            xhr.setRequestHeader("X-CSRF-Token", token);
        }
    });

I believe this will probably conflict with using other beforeSend methods with jQuery, but I haven't had a need to use beforeSend since and I'll address merging/patching the methods together when the time comes. Until then, I'm a) including the CSRF token in my headers and b) in the body of my JSON responses. It's working.

Moved to Vancouver, BC!

As of this week I am no longer officially employed at Servio, I'm a freelancer. Also as of this week I've moved to Vancouver, British Columbia. I'm currently taking on select new clients, so don't be a stranger and say hi!

Spending Does not Improve the Economy

Someone sent me an email urging their friends to spend at least $10 more a month than they otherwise would normally spend in order to help the economy (make that big purchase you've been avoiding!). Oh boy...

Here's my response:

The notion that consumer spending drives the US economy is a fallacy, as is the idea that more domestic spending will improve the US economy. The issues the US faces right now are much deeper. They have to do with the fact that we have an enormous trade deficit and that we have a bankrupt monetary policy. This is largely because almost all industries in the Unites States are service industries whereas we used to have a manufacturing and production emphasis. We no longer export goods, we export the US dollar and play shell games with our currency. We do so in exchange for commodities. Under this model, when the dollar gets weaker the US economy gets weaker and your spending is less and less helpful. This is exacerbated by the fact that we are devaluing the US dollar at an extraordinary rate. The Federal Reserve has created incredible amounts of money out of thin air in the past three years. There's a reason that the Gold/USD exchange is up to $1,500/oz and the USD is now 85% CAD. It's because the inflation is trickling in and global confidence in the dollar is dropping like a rock.

"Economic growth is the production of goods not the consumption of goods." - Peter Schiff

See: http://www.youtube.com/watch?v=gaS-vwZ77x8&t=4m52s

You want to help the economy? Add value to the economy yourself by producing things rather than consuming things. Anything. Produce music, produce intellectual property, produce honeydew, produce microprocessors. Get your money out of institutions who practice fractional reserve banking. Invest in the small businesses and individuals who generate domestic innovation, not the large institutions who just move money around.

Why is your spending power so low? Because inflationary growth has far outpaced income growth.

The median household income in 1950 was around $3,319 whereas in 2010 it was around $54,442. The price of gold in 1950 was $34.72/oz whereas in 2010 it was $1,224.53. A family in 1950 could purchase 95.6 oz of gold with a year's salary whereas in 2010 they could purchase under half that: 44.46 oz of gold.

Same thing happened with house prices. The median house price was around two years' salary in 1950 whereas it was around four years' salary in 2008:

The only thing spending $10 more will accomplish is that it will ensure that when the dollar hits its next big drop you will have fewer of them. Maybe that's a good thing if you've invested in something that will hold value better than the USD, but the spending of money itself is not significant. If spending was the solution we would be seeing more economic value from the $700bil Congress spent in 2008 (about 17% of the total USD in circulation around the world that year). That's far more spending than you or I could ever hope to do.