Erlingur.is

Erlingur.is

A software developer from Iceland.

Safari 7 blank page problem

It seems that for some reason Safari 7 will cache the 304 blank response body for a page and then return it on subsequent requests. This seems like a bug in Safari 7 on OS X and on iOS 7.

A temporary fix for Rails is to include a before_filter in Application controller that sets the Last-Modified header to the current time. I don’t really like doing this but it’s the only solution I’ve found that works reliably.

class ApplicationController < ActionController::Base
  protect_from_forgery
  before_filter :fix_caching_problem
  
  def fix_caching_problem
    headers['Last-Modified'] = Time.now.httpdate
  end
end

I am, and ever will be, a white-socks, pocket-protector, nerdy engineer,

-Neil Armstrong, 1930 - 2012.

I am, and ever will be, a white-socks, pocket-protector, nerdy engineer,

-Neil Armstrong, 1930 - 2012.

Installing FreeTDS on OS X Mountain Lion

If you get an error like this:

In file included from gdataset.c:47:
glib_trace.h:33:25: error: glib_probes.h: No such file or directory
make[6]: *** [gdataset.lo] Error 1

Or this:

Error: Failed executing: make (pkg-config.rb:21)

Make sure you install the XCode Command Line Tools for Mountain Lion. Go to http://connect.apple.com, sign in with your Apple ID, search for “command” and you should see an item called “XCode 4.4”. Click on it and you should see a list of things to download, click on “XCode 4.4 Command Line Tools for OS X 10.8” at the bottom.

Also a good idea is to install GCC by using osx-gcc-installer.

(And because I always forget, the freetds.conf file is in “/usr/local/etc/freetds.conf”)