• HOW TO: Get your web browser gestures back in OS X Lion

    If you’re like me and have a magic mouse and use the internet much, you’ve probably gotten used to using the two-finger swipe to navigate forward and back in your history in Firefox and Chrome instead of using the back button. Apple has changed the default behavior in OS X Lion to swipe between fullscreen apps. Which means suddenly when you’re trying to go back to the previous page, you end up looking at your dashboard or something dumb.

    To get your two-finger swipe navigation back, just go into the Mouse preferences and over to the More Gestures section. Change the first option (Swipe between pages) to use two fingers.

    This will disable the full-screen swiping and get you back up and running. Doing the same thing on your laptop should work as well, except you’ll pick three-finger swiping instead of two.

    Enjoy.


  • Four Steps to Turbocharge Rails + AJAX Development with Nginx and Foreman

    If you’re developing a chatty AJAX app on Rails and using a single mongrel to run it on your workstation, you probably are a bit annoyed with delays waiting for requests to be fulfilled one-at-a-time. So, here I’ll walk through the steps to run your own “cluster” on your OS X workstation using Foreman and Nginx.

    In the course of building the frontend application for Earbits, I’ve been constantly annoyed with the responsiveness of my local development server. As a pretty complex AJAX application, there are lots of little (and some bigger) calls to the Rails backend APIs to do lots of potentially slow things. This means that there are lots of calls that are originating in the browser and being served by one mongrel, so the server ends up handling requests too slowly. Which leads to me being frustrated. Which leads to me finding a nice solution to the problem.

    (more…)


  • Authlogic Perishable Token changes and breaks emails

    Overall, I think Authlogic is pretty great.  It’s saved me a bunch of time that I don’t have to worry about user creation and user session maintenance.  But this one little doozy was causing some issues when sending out one-time-use emails like invites or password resets.

    The perishable_token is the suggested way to send out secured one-time-use emails because it’s updated every time the User model is updated (like, when the user logs in) so the email can’t be re-used to reset the password again for instance.  I’m using it in some pretty strange ways to handle proxy users (users who haven’t actually registered yet on our site), but this issue also is present for the password-reset case.

    I noticed that some users were getting rejected after clicking the link in the email saying that the perishable token was no longer valid. “That can’t be right,” I thought to myself – because I know for a fact that some of those users hadn’t logged in.  But their token was still invalid. So after a little bit of troubleshooting, I realized the issue….

    The token is updated every time the User object is saved. Not just when they login.  And I have jobs running in the background to update the users with external data pulled from various APIs.  So my job was resetting the perishable_token for every user it touched.  Ok, so how did I fix the issue?  Simple really – I just took control of the maintenance of the perishable_token away from Authlogic and handled it myself.

    (more…)


  • Upgrading your Authlogic Gem for Rails3

    If you’re using Authlogic in Rails3 (or if you’re upgrading your existing app from 2.3.8 to Rails3) you really need to be using the rails3 branch of the Authlogic gem. If you’re using Bundler, this is super-easy because you just need to update your Gemfile.

    In your Gemfile, update the authlogic line to be:

    gem 'authlogic', :git => 'git://github.com/odorcicd/authlogic.git', :branch => 'rails3'
    

    Now you should run $ bundle install to grab the new gem. Then, there are just a few more deprecated things in Rails3 that you’ll need to change in your upgraded app. I’ll try to enumerate here from memory, so please forgive me if I forget something.

    (more…)


  • InvalidAuthenticityToken on Logout when using Authlogic

    This one took me a while to debug. When upgrading my existing application to Rails 3 almost everything was working fine except whenever I would click the Logout link I would get an error because Rails couldn’t verify that the UserSessionsController#destroy request was valid from my app.

    This is the error message shown:
    ActionController::InvalidAuthenticityToken in User sessionsController#destroy

    actionpack (3.0.0) lib/action_controller/metal/ request_forgery_protection.rb:96:in `verify_authenticity_token'

    And the solution is simple, you just need to add the new csrf_meta_tag helper to your generated page (probably in the /views/layouts/application.html.erb file).

    (more…)


  • HOWTO: Export IIS7 Configuration to Another Webserver

    IIS7 has this great new feature called Shared Configuration.  Except that it has a tendency to do horrible things which usually result in all the websites and application pools being removed from your server and your production website starting to serve 503 Service Unavailable errors.

    For an innexplicable reason, Microsoft decided to kill the Export function from IIS7 in favor of this new feature.  But for those of us who don’t trust technology, we like to do things manually and to get a repeatable result that doesn’t update automatically when we least expect it.  Yes, I am the sort of person who wonders why the default Windows Update on servers is to Install and Reboot Automatically at 2am…

    In any case, in a simple 3 step process you too can export and import your Internet Information Server 7 websites and app pools. (more…)


FRESH / LATEST POSTS

FRESH / Twitter Updates