Currently Browsing: Featured Articles

The Art of Abstraction

Think for a moment about the word ‘abstract’ and its definition. When you think of an object, like a table for sake of example, what image comes to your mind? Most certainly, your image is different from mine. My mental image of a table looks a lot like the dinner table I sat at while growing up, while your table may look like the one sitting in your dining room. Yet I can use the word ‘table’ in a conversation and you will instantly know what I’m referencing without knowing exactly what my version of a table looks like. We take this mental feat for granted every day as it...

Sync a database with Capistrano

Here’s a quick capistrano task for synchronizing a remote database to your local development environment:   set :application, "appname" set :application_path, "/home/someurl/apps" set :user, "appuser" set :password, "***********" set :use_sudo, false   set :production_database,'mydb_production' set :production_dbhost, 'localhost' set :dbuser, 'dbadmin' set :dbpass, '************'   desc "Synchronizes remote database to local development database" task :sync_to_local, :roles => :web do sql_out =...

Painless db backups in Rails

Quite often in Rails projects, I need some way to backup the contents of database quickly. The script below is an easy way to backup the database of your current environment using the database.yml file already set up in your Rails project. Feel free to modify the below script to do your bidding. /script/backup_db: #!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'erb' require 'yaml'   unless config = YAML::load(ERB.new(IO.read(RAILS_ROOT + "/config/database.yml")).result)[RAILS_ENV] abort "No database found...

Automated image sharpening

The Problem Working in an agency setting, where the crispness and clarity of your images is extremely important, writing web systems that automatically generate thumbnails can be problematic. When resizing images downwards, as is often the case in thumbnail generation, pixel values are approximated from their original size. These approximations can result in thumbnail images which are blurry and difficult to read. The bigger the change in pixel size, the more dramatic the effect. So if you resize a 900×900px image into 120×120, you will see a major difference in clarity. Photoshop has several...