Wednesday, May 7, 2014

Check PostgresSQL version


psql --version
That's it!

Tuesday, March 18, 2014

Problem uploading image using MiniMagick gem in OSX

Rails gave the following error when saving ActiveRecord object with photo.

Validation failed: Photo Failed to manipulate with MiniMagick, maybe it is not an image? Original Error: MiniMagick::Invalid
After some digging, realized that my ImageMagick couldn't handle JPEG files. To be sure do the following:

convert -list configure
You should be able to see "jpeg" as one of the entries in "DELEGATES". If not, do the following:

brew remove jpeg
brew remove imagemagick
brew install jpeg
brew install imagemagick
References:
http://stackoverflow.com/questions/10810356/carrierwave-error-msg-failed-to-manipulate-with-minimagick-maybe-it-is-not-an http://stackoverflow.com/questions/5624778/imagemagick-jpeg-decode-delegate-missing-with-os-x-homebrew-install

Monday, March 10, 2014

Fix OSX in built iSight camera not detected


sudo killall VDCAssistant
That's it!

Tuesday, February 18, 2014

Set up canonical url for A/B test page variations

Say you have 2 page variations for an A/B test. Page A (original) - /home Page B (variation) - /home_variation In order for Google spiders to only pick up contents in Page A since it has already been crawled and SEO-ed and we don't want Page B to affect SEO rankings, we need to specify in Page B that the url to Page A is canonical, ie. the main url.

Saturday, February 8, 2014

Export queried data from MySQL in bash command line


SELECT distinct(users.email), users.firstname INTO OUTFILE '~/Downloads/users.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' FROM users;