Browser Caching and How Reload vs Refreshing Works

I found out an interesting new thing about how browsers cache assets recently. I already knew that if you use Control+F5 in Windows or Command+Shift+r in OS X that it would clear the browser’s cache and reload the page from the server. This is very useful when you are developing and need to force the browser to load a new copy from your development server. Recently, when I was checking that the TrustAuth site had proper caching headers for the static assets I found out about a third way (1. cache clearing reload, 2. normal reload) the browser can reload the page.

Fun with Ruby Enumerators

One of my favorite features in Ruby is the Enumerable module and the ability to create enumerators. For background, an enumerator in Ruby is like an iterator, it responds to the method next which returns successive elements from some container that is often an array or hash. Ruby’s Enumerable module contains many helper methods for working with enumerators such as each, map, reduce, all?, any?, and many more. These methods also return an enumerator which allows methods to be chained. As an example, say I have an array of objects we’ll call users that each have a name. If I want to transform that array into a new array where each object becomes an array of the letters in the name string, I can do the following:

Cool Unix Terminal-fu

I ran into an interesting problem recently. Looking to do some analysis of the log for a Rails app I maintain, I fetched a copy from the server. Since I don’t have a log rotator running for this app, the log is roughly 340 megabytes or in other words, a ton of text! I wanted to explore this data quite a bit using grep and the like to see what the most accessed routes are, how fast are the request completion times, etc. The log contains data from October 2013 to the present and since the log is appended to, the most recent data is at the end which left me with a problem. How do I find the most recent matches for a grep search?

A couple rsync problems

A couple days ago I decided to move my podcast management to my desktop from my macbook pro. Since I’m running an SSD, I don’t have much space on the mac to store 80+ GBs of podcasts. So after rsyncing my current list and then painstakingly resubscribing to all of my podcasts in iTunes and adding the existing episodes, I decided to try to back them up using rsync again to my FreeNAS box.

Using a raw disk as a VirtualBox drive in Windows 7

The other day I was listening to episode 386 of Security Now! and learned from a listener who had written in that VirtualBox was capable of using physical disks for virtual machines and that this would work with SpinRite. Using this feature it is possible to run a SpinRite scan on a secondary disk in a virtual machine while still using the host machine. So to make sure I don’t forget how this was done and to hopefully help someone else out there, here are the steps that I took to get this working. An interesting thing to note here, since you can create raw drives in OS X, you should be able to run in the virtual machine a SpinRite scan on a secondary disk on a Mac!

Unicorn Rails Ubuntu init script

Today I’ve been updating the TrustAuth project website to reflect the changes I made the last couple of months. While I was deploying, I rediscovered the terrible state of the Ubuntu init script I had been using to run Unicorn. It wouldn’t properly stop Unicorn so I had to SSH into my server and restart Unicorn when I updated the website. If I didn’t it would still be serving the old Rails pages. So tonight I set out to fix this.

Setting up a symbolic link for Apache in OS X Lion

Today I was fixing my OS X installation that had been wiped out before and ran across a problem that I forgot about. I store the code for the TrustAuth website in Dropbox for convenience and sym linked it to the appropriate folder to run the site locally.

Site back up!

Well, my blog has been down for a while but I finally got it back up so that I can test out the TrustAuth WordPress plugin! Checkout trustauth.com/blog for the latest information about TrustAuth.