Category Archives: Software

Where is my crontab located on Mac OS X 10.5 Leopard?

I googled around for a few minutes with no luck. After probing around my system, here is where I found my crontab file: Macintosh-2:mls TAmoyal$ sudo ls /usr/lib/cron/tabs/ Password: TAmoyal I found it by checking the crontab man page: man crontab Where I saw a “FILES” section: FILES /usr/lib/cron/cron.allow /usr/lib/cron/cron.deny And that lead me [...]
Also posted in Random | Tagged , , , , | Leave a comment

Interning empty string error in Ruby on Rails

I don’t like writing short posts about fixing code errors but I think this one deserves a quick shout out. If you get an error in your Rails application that says “interning empty string”, there could be something wrong with an error message in your validations. For example, I had something like: def geocoding_works_when_geotarget_is_true [...]
Posted in Software | Tagged , , , | 11 Comments

Logging your Rails model (the easy way)

In one of my Rails applications, I have some pretty heavy tasks in my models. I decided to log to different files for two of my models so that I can easily make sure these tasks are performed correctly without going through my application log. I also call some of my model methods [...]
Posted in Software | Tagged , , , , | 1 Comment

Validating multiple fields with one validator in Flex3

I like laying out forms in MXML because it’s easy to read. In a recent project, I had five email fields and it looked something like this: <mx:Form id="myForm"> <mx:FormItem label="1." labelStyleName="tenEmailsLabel"> <mx:TextInput id="email1" width="300" fontSize="13" /> </mx:FormItem> <mx:FormItem label="2." labelStyleName="tenEmailsLabel"> <mx:TextInput id="email2" width="300" fontSize="13" /> </mx:FormItem> <mx:FormItem label="3." labelStyleName="tenEmailsLabel"> <mx:TextInput id="email3" width="300" fontSize="13" /> </mx:FormItem> <mx:FormItem label="4." labelStyleName="tenEmailsLabel"> [...]
Posted in Software | Tagged , , , | 9 Comments

Configuring Phusion Passenger on a 256MB Ubuntu Slice @Slicehost

I installed Phusion Passenger a few weeks ago to get a production environment up and running for my Rails app. It was super easy to install and felt like magic. I checked off the item on my TODO and moved on. After all it didn’t say “YOUR APP WILL BE SLOW AS [...]
Posted in Software | Tagged , , , , , | 6 Comments

How to quickly set up a test for Twitter OAuth authentication from your local machine

Working with API’s such as Twitter from your local machine can be a pain. A problem that comes up is Twitter does not let you set your callback URL to hit your localhost. If you are working with OAuth on your local machine and want to test the user authorization flow, you are screwed. [...]
Posted in Software | Tagged , , , , , , | 12 Comments

Defending Against Attacks With Rails

A couple weeks ago I presented on Rails security at a local Ruby On Rails meetup. I finally got around to posting the slides online. The presentation covers topics including authentication, hashing, salting, key stretching, white listing, session hijacking, replay attacks, session fixation, cross-site request forgery, cross site scripting, sql injections, other injections, and some [...]
Posted in Software | Tagged , , , , , , , , , , , | 1 Comment

How to point your browser at websites on your server without registering a domain

I recently started managing my own server and found it difficult to point my browser somewhere on my system without going through DNS records and registering a domain name. That is sort of a pain, but here is a quick hack to make this super easy. Let’s say you want to create an admin site [...]
Posted in Software | Tagged , , , | Leave a comment

Text inputs with rounded corners using jQuery (without image)

I have yet to find a solution for making rounded inputs without an image. I hacked one together today because I know it will save me a lot of time later. While the solution is hackish, I like it better than going into photoshop and making an image every time I want to [...]
Posted in Software | Tagged , , , | 12 Comments

Simple Time Select for Ruby On Rails Just Got Simpler

I added a start_hour and end_hour feature to my simple time select. Here are the details from the README: Simple time select also takes a start_hour and end_hour option to be specified in military format (between 0-23). <%= time_select "event", "time", { :default => Time.now.change(:hour => 21), :simple_time_select => true, :minute_interval => 20, :time_separator => "", [...]
Posted in Software | Tagged , , , | 8 Comments