Our Command through simplicity blog
A quick Rails guide for designers
I almost always work with great designers when building Ruby on Rails web applications. These designers are capable of doing amazing HTML and CSS and are already able to navigate a RoR directory structure or able to do so after a quick intro. I’m not focusing on this basic structure convention in this guide but instead I will be taking designers a step further and actually enable them to add a little bit of functionality to views i.e. enabling them to control some logic in *.erb.html files lo...
Restore full backup of Redmine from Google Storage
Restore database from dump file # required settings DB_USERNAME='<redmine db username>' DB_PASSWORD='<redmine db password>' DB_NAME='<redmine db name>' REDMINE_ROOT='<full path to redmine root>' # e.g. /home/peter/rails/redmine.commanigy.com' BACKUP_ROOT='<full path to backup root>' # e.g. /home/peter/backups (will be created) RESTORE_FROM='<date in YYYYmmDD format>' # e.g. '20110201' for February 1, 2011 $ mysql -u $DB_USERNAME --password=$DB_PASSWORD $...
A bash version of keep_releases known from Capistrano ruby scripts
Today I needed a clean up feature in my bash script similar to what’s known from Capistrano when using the “keep_releases” argument. I wasn’t able to find a simple version so I created it myself. Maybe others find it useful too so here goes releases_path=/data/sites/yoursite.com/releases # change this keep_releases=5 versions=`ls -xt $releases_path` releases=(${versions// / }) # check available number of versions in releases directory releases_count=${#releases[@]} if [ $releases_count -...
Finding Apache configuration file (httpd.conf) location
Just a quick tip for programmers working with Apache. Sometimes I’m asked where to find the Apache configuration file on a given server. Since it’s possible to configure this there is no “default location” so I usually do: $ ps -ef | grep apache which gives me a list like deploy@cmd01:/$ ps -ef | grep apache root 4053 1 0 06:26 ? 00:00:04 /usr/sbin/apache2 -k start www 5189 4053 0 11:00 ? 00:00:00 /usr/sbin/apache2 -k start www 5199 4053 0 11:00 ? ...
How to hide icon in your dock for any Mac application
Just got a beta of a Mac notifier for Podio and didn’t like it showed both an icon in my menubar and my dock (sometimes also referred to as the taskbar). If you want to avoid having any Mac application shown in your dock, it’s possible to patch its package by doing these simple steps Open Finder and browse to your application Right-click the file and select “Show Package Content” Browse to “Contents” and open “Info.plist” If you find an element called “Application is agent (UIElement)” ...
Use sensible defaults when building a web, mobile or desktop application
While working on migrating “gomore.dk”, a Danish ridesharing service, to Rails 3, I figured it would make sense to look into the existing database to figure out if I could add some sensible defaults when creating e.g. new rides. The site already contains a decent database so I figured it would be rather easy to measure which defaults to use. As an initial example, I would like to know how many seats were shared on each trip and therefore I did a simple query as shown below: From this, ...
An error occurred while validating. HRESULT = '8001010E'
Just a quick tip. While upgrading one of my projects from VS.NET 2008 to VS.NET 2010 I ran into a problem I wasn’t able to find a correct solution for it anywhere. While building my setup projects I got: An error occurred while validating. HRESULT = ‘8001010E’ Various posts suggested to remove all dependencies but in my case it was caused by an invalid reference to the framework. This is what I did to have it compile again: Right-click .vdproj Select “View” | “Launch Conditions” Right-c...
Universal builds for Mac App Store with Xcode
While working on Wallpapery, I had to do a universal build for both 32- and 64-bit. I expected I should simply set “Architectures” to “Standard (32/64-bit Universal)” but after approval in Mac App Store and user complaints I found out, I had missed a couple of steps. To build your product for both 32- and 64-bit architectures (aka i386 and x86_64) you have to explicitly unmark “Build Active Architecture Only” and filter list of “Valid Architectures” to only list “i386 x86_64” I wasn’t awa...
How to get display name from NSScreen
While working on Wallpapery I needed to get a given screens display name. There is no “displayName” method on NSScreen so I added a category to provide this functionality. Seems like others are looking for this too so I’m posting my code below. NSScreen+DisplayName.h #import <Cocoa/Cocoa.h> @interface NSScreen (DisplayName) - (NSString *)displayName; @end NSScreen+DisplayName.m #import <IOKit/graphics/IOGraphicsLib.h> #import "NSScreen+DisplayName.h" @implementation NSScr...
How to send mass text messages from your own number
A couple of months ago we needed to make a service which would be able to send out sms text messages to a large number of people. The text message itself should come from a specific number so recipients would be able to reply back for more information. Another requirement was the ability to send a text message to a specific number and then trigger the mass sending to the configured recipients. The part sending out bulk sms is easy. A lot of companies have great, simple APIs to do this but t...