Postgres Dump and Restore

This is more a note to myself because I always have to look this up.

pg_dump -Fc -h host -U user database > ~/tmp/database.dump
pg_restore -Fc -d target_database -O -x -1 -c ~/tmp/database.dump
  • -Fc defines the PG custom format for the dump
  • -O disables some owner set stuff
  • -x disables the access right stuff
  • -1 ensures that everything is done in one transaction
  • -c removes any tables which should be created by the dump

Display Info if User is Offline

In a web project we recently had the use case that user will need access to some important info on the website when they are offline.

Read on

Blog Revamped

A few days ago I decided to create a short website about me, so you can find something when you go to http://yux.ch/.

Because I just used the feature set of Octopress which Jekyll also provides, I decided to start from scratch with Jekyll 2.0.

I based the new design on bourbon, neat and bitters. It was a pleasure to use these three libraries to create something handmade!

Maybe you noticed the redirection from yux.ch to blog.yux.ch. This happens because GitHub Pages supports just one CNAME per hosting. As I want to have my page accessible without under yux.ch I will host it by myself soon. For this I will configure my server at nine.ch in a setup which Samuel has described on his blog.

Vim with Ctags

Today I setup my Vim to use ctags.

I want to use it in the situation where I am deep in a project checking the backtrace of a bug and are wondering what exactly a method call does. With ctags I can just hover the call and press CTR + ] to jump to the method definition which lies anywhere in your repository.

If you are interested in such a setup, read on.

Read on

Vim inline git diff

A few weeks ago, I heard about the Sublime Text Plugin GitGutter. When I googled for an equivalent plugin for Vim, I did not find anything usable. There is Svndiff, but I did not like the name and that you had to enable it by hand. So I put the topic aside and went on with other stuff.

Last week, I started over with my Vim configuration. I was using the dotfiles of skwp which included also a pretty nice Vim configuration. But after working with it for some months, I started to feel uncomfortable with it as it had just too much features.

Read on

Javascript tests with PhantomJS

Today I wanted to write some javascript tests for my Moviezz project.

Maybe two years ago, I’ve written javascript tests for a project at nine.ch. I ended up by using Cucumber, Capybara and Selenium for this. The result was okay, but it took you a very long time to run the tests and you could not do anything else than watching your webbrowser clicking links and filling in text.

Some weeks ago, I heard about PhantomJS and I waited since for the right chance to try it out. PhantomJS enables you to run your javascript tests headless, means no browser windows is opened and used to click and fill. This also gives you the ability to run your javascript tests via Jenkins or Travis.

Read on

Ruby1.9: Escape non-ASCII chars

What I learned recently about Unicode and Ruby. There is a TL;DR.

Read on

Hubot, Ubuntu and .deb packages

This week I finally got the time to check out Hubot. Which really is a cool bot for your IRC/Campfire-Channel.

As I dislike solutions like “just extract this tarball and run …” for production deployment, I needed a way to deploy and configure this with puppet. The solution should also be very easy, so we can create a jenkins task to build the package.

I came out with a solution where you just need to run two commands to create a new package from upstream:

rake prepare[2.3.2]
rake build
Read on

Gem: Version Reader

If you are using a VERSION-file to give your new (or old) cool software tool a version, you maybe also want to display it in the footer of the website or in the help command option of your CLI.

Instead of writing stuff like this

def version
  @version ||= File.open('VERSION', 'rb') { |f| f.read }.strip
end

you could use version_reader (written by me) which reads the VERSION-file and does all the stripping and formatting for you.

Read on

Hello World

Hi everyone. This is the hello world post of this blog. This is the blog of Raffael Schmid and I will post stuff about coding, system administrating and other geeky stuff.

About me… I’m an employee at Nine Internet Solutions AG where I first started as an “System Administrator”. But right from the start I was developing stuff and learned Ruby (on Rails). So my job description changed “Web Software Developer”, finally.

This blog is hosted on github-pages and powered by Octopress.