Jul 30, 2014

Upgrade homebrew postgres

1. Update your homebrew

brew update

2. Stop you local postgres (this is the default, but your setup might differ)

launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

3. Backup your old postgres data directory

mv /usr/local/var/postgres /usr/local/var/postgres_old

4. Get latest postgres version

brew upgrade postgres

5. Update your database. Please keep in mind that your version numbers will be different. Just replace them with your local versions!

pg_upgrade -b /usr/local/Cellar/postgresql/9.1.5/bin -B /usr/local/Cellar/postgresql/9.3.5/bin -d /usr/local/var/postgres_old -D /usr/local/var/postgres


Where can I find my postgres installations?
Your postgres installations are installed at /usr/local/Cellar/postgres. Have a look at it to check the version you are working with right now.

Where is my data stored?


I upgraded already and need a new data folder?
You have upgraded to the latest postgres, but now it does not start, because the data is stll in the old format. No worries. Please perform step 3, skip 4 and run the following command instead: /usr/local/Cellar/postgresql/9.3.5/bin/initdb /usr/local/var/postgres (with the correct version number). This should create your new blank data directory and you can continue with step 5.

Jan 14, 2014

Passing a class as default value for a virtus attribute

I might haven’t read the documentation properly or I am just to stupid to google properly, but it took me quite some time to figure out how to pass a class as a default value to a virtus attribute.

attribute :custom_klass, nil, default: ->_,_ { Your::CustomClass }

If you are not using a lambda, the class will get passed, but will be coerced to a Class object and wont respond to kind_of? or similar calls as expect. I tried to write a custom attribute definition with a coercer which just returns the value, but that failed as well. The value was already passed as a Class object.

Perhaps anyone else has a different solution.

Jan 9, 2014

40 Maps That Will Help You Make Sense of the World - A Sheep No More

Oct 28, 2013

Recover from lost commits

Good that I remembered this git talk back from one of the adcloud dev talks. I accidentally deleted the wrong commit during a git rebase. Luckily git does not immediately remove commits, but waits till the next clean up. You can find the commit with git reflog or git log -g and recover it with git branch your-branch-name HEAD@{n}. The HEAD@{n} is listed in the git log output.

Jul 11, 2013

Mercator Map Projection Puzzle

If you ever wondered why you are so bad at guessing country sizes? Have a look at the effect of the most common method of map projection. It will blow away your mind!

Jul 10, 2013

Beautiful and simple desktops

If you are still looking for some beautiful and simple wallpapers, checkout the page. Especially if you are a fan of the flat ui style.

Jul 4, 2013

Forward Port 80 to Port 3000

Why haven’t I thought about this… instead of starting your local applications as root to enable them to run on port 80, you can simply add a port forward to your iptables and you are fine.

Jul 1, 2013
Mar 12, 2013

Fix openssl issues with ruby 2.0.0

Just in case you want to install ruby 2.0.0 and have problems with openssl failing to install. Try the following bits of code. They finally fixed my issues:

$ rvm remove 2.0.0 # get rid of unsuccessful installation
$ rvm get head --autolibs=3 # get the latest RVM and build required libs
$ rvm requirements # just in case, install all other required stuff
$ rvm install ruby-2.0.0
$ rvm --default use ruby-2.0.0

(Source: apple.stackexchange.com)

Sep 18, 2012

Simple error classes in ruby

I just stumbled on this little gem to create your own flat error classes. Instead of defining your class in the most common ruby way of 

class MyCustomError < StandardError; end

You can also write

MyCustomError = Class.new(StandardError)

No ; required. So much nicer

(Source: blog.steveklabnik.com)

« To the past Page 1 of 9