Author Archives: Tony

Ruby on Rails – Skipping validations based on where object is created

I ran into an issue today where I wanted to skip validations based on where an object was created. To be more specific, I wanted to validate strictly if a “venue” was created through my web interface but I want to skip validations when importing venues. The reasoning is pretty simple, I want [...]
Posted in Software | Tagged , , , , | 6 Comments

Back links for your Ruby on Rails application

Here is a nice little helper I wrote to display back links: def back_link link_to "« Go Back", request.env["HTTP_REFERER"].blank? ? "/" : request.env["HTTP_REFERER"] end If you just use the HTTP_REFERER without checking if it’s blank, weird things can happen if someone lands on your page from an email, for example. If you enjoyed this post, make [...]
Posted in Software | Tagged , , | Leave a comment

Free Market Research Methods Part 1 – Analyzing Public Filings

Last week I attended a Market Research workshop presented by Dr. Dean Chang, Director of Mtech Ventures and Education. Instead of the general advice given at many market research presentations, Dr. Chang put himself in the shoes of a founder and walked us through some motions. This article will cover his take on analyzing public [...]
Posted in marketing | Tagged , , , , | 2 Comments

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 [...]
Posted in Random, Software | 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 , , , , | Leave a 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 , , , | 7 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