May 2012
3 posts
2 tags
May 10th
Free your Mac OSX memory with `purge`
Since Mac OSX Lion, my system got low on free memory from time to time. I have 8 Gb of RAM, but that’s not always enough, or so it seems. To stop your system from using swap files, you can free your memory with the `purge` command. And it helps to run it every couple of minutes; no worries anymore. Use this a launchctl task:
May 9th
5 tags
VirtualBox virtual machine client connecting to...
From time to time, I run an Ubuntu virtual host on my Mac OSX machine (in VirtualBox) for testing and trying. It took me a while to figure out how to setup this virtual machine so it has access to the Internet as well as local access to my host. For referencial purposes, here goes: VirtualBox settings In your VirtualBox preferences, add a ‘host-only network’ (vboxnet0). Adapter...
May 8th
April 2012
1 post
Ships and Tools | Trends →
Food for thought.
Apr 12th
March 2012
1 post
therubyracer compile error OSX 10.7 Lion
I ran into some erros while compiling the therubyracer gem after an update to Mac OSX Lion. It threw errors like this: Most of the solutions on Github and other blogs didn’t work for me. Eventually I fixed it with the following commands: Install latest v8 library through Homebrew ]]> Install libv8 gem ]]> Symlink gcc binary to gcc-4.2 binary: ]]> (this was probably the real solution)
Mar 9th
January 2012
3 posts
6 tags
How to login to postgresql through psql from a... →
If you get these errors while trying to access your PostgreSQL database through ‘psql’: psql: FATAL:  Peer authentication failed for user “postgres” This was exactly what I was looking for. So I updated my postgreSQL install script.
Jan 23rd
16 notes
4 tags
RVM loses default Ruby version when starting new...
I recently installed a new Ruby version on a server using RVM. To make sure your new ruby installation will be used by default, you have to invoke the follow command: (I already blogged about this) But now, my server kept forgetting this and each time I ssh’ed to the server (and thus starting a new shell) I was back at the default system Ruby version. It seems you can repair your RVM...
Jan 23rd
26 notes
Varnish Guru Meditation
I had a problem where a Rails application communicated with a third-party API (Dropbox) to do some actions. The request would take significantly more time than a regular request, lasting for more than 15 second easily (fetching numerous directories and files). Your browser won’t timeout on such requests, but in my case, Varnish was. It would serve me with the following message: Clearly...
Jan 2nd
December 2011
3 posts
Linode rocks →
I’ve been using Linode to host my websites for the past 2+ years and I’m thoroughly impressed by the service. I can’t recommend them enough — it is easily the best web hosting service I’ve used to date. Couldn’t agree more.
Dec 29th
PDFKit Usage →
Wkhtmltopdf is an open source project that uses the WebKit rendering engine to convert HTML to native PDF code. This is the muscle behind the PDFKit gem and other projects like WickedPdf. In this article I am only going to focus on PDFKit with Rails. But many topics will apply to both PDFKit and WickedPdf since they use wkhtmltopdf on the backside. Great guide for starting with PDFKit.
Dec 28th
VirtualBox Linux local networking
From time to time, I run an Ubuntu virtual host on my Mac OSX machine (in VirtualBox) for testing and trying. It took me a while to figure out, how to setup this virtual machine so it has access to the Internet as well as local access to my host. For referencial purposes, here goes: In your VirtualBox preferences, add a ‘host-only network’ (vboxnet0).  Adapter Settings: DHCP...
Dec 1st
November 2011
2 posts
The twelve-factor methodology →
In the modern era, software is commonly delivered as a service: called web apps, or software-as-a-service. The twelve-factor app is a methodology for building software-as-a-service apps that: Use declarative formats for setup automation, to minimize time and cost for new developers joining the project; Have a clean contract with the underlying operating system, offering maximum portability...
Nov 23rd
Default Passenger user and permissions
Quick note to self. If you deploy a Rails application (with Capistrano for instance) to a Passenger / nginx server, you have to make sure you don’t deploy the app as user ‘root’ (I hear people say ‘never ever use root!’ … oh well). Why not? Passenger will run your Rails application as the user who owns the config/environment.rb file (see help). If the owner...
Nov 8th
October 2011
4 posts
Gitlab, self-hosted git server and browser →
Gitlab might finally be the front-end for a self-hosted git server. I’ve lost countless hours trying to install Gitalist and had too many ugly systems installed. But, no more, I hope. (Gitolite support will be available in v 2.0)
Oct 25th
Kindle Format 8 →
We’re pleased to announce a wide range of new features and enhancements – including HTML5 support – coming in Kindle Format 8 (KF8). KF8 is the next generation file format for Kindle books – replacing Mobi 7. As showcased on Kindle Fire, KF8 enables publishers to create great-looking books in categories that require rich formatting and design such as children’s picture books, comics &...
Oct 24th
2 notes
Oct 14th
Amazon on fire
For over 6 months now, I’ve been very happy with my Kindle 3G. It is a second generation one, with a keyboard. Being very lightweigt, having a long battery life and a fantastic screen (you have to see it before you know what I mean) is what still excites me everytime I use it. You see, I became somewhat of a Kindle / Amazon fan-boy! And now, Amazon updated its Kindle line-up with the...
Oct 3rd
September 2011
2 posts
6 tags
“The Mythical Man-Finger. faster, easier to understand, easier to integrate,...”
– http://j.mp/ofkcdS
Sep 27th
6 notes
6 tags
Stock quotes as a Ruby library or via your command...
Stockery, a simple Ruby gem that allows you to query stock quotes from (for now) the Google API or Yahoo Finance API. The nice thing is that you can use it as a library inside your project, or just via the command line and mix & mash it with your favourite shell script. Usage via command line By default stockery outputs a JSON format of the result fetched from Google. Fetch GOOG quote via...
Sep 22nd
52 notes
July 2011
1 post
3 tags
Rack-webconsole, a console inside your browser
“Wouldn’t it be nice to have an in-browser console for a Rails application?” Introducing rack-webconsole Rack-webconsole is a Rack middleware that enhances your development experience providing a JavaScript-powered bridge to your Ruby application backend. With it you can interact with your database and explore the runtime environment from within the browser. Although it should be used mainly...
Jul 29th
12 notes
June 2011
1 post
7 tags
Gem Versioning and Bundler: Doing it Right
Gem Versioning and Bundler: Doing it Right May 30th, 2011 Executables When you install a gem to the system, Rubygems creates wrappers for every executable that the gem makes available. When you run an executable from the command line without bundle exec, this wrapper invokes Rubygems, which then uses the normal Rubygems activation mechanism to invoke the gem’s executable. This has changed in...
Jun 4th
9 notes
May 2011
2 posts
1 tag
Vim Movement Shortcuts Wallpaper - Ted Naleid
via naleid.com Most of the keys are already ‘in-my-fingers’ but I keep forgetting some basic one. This is going to be real useful for me!
May 31st
7 notes
3 tags
The $20 Starbucks Test
The $20 Starbucks Test A couple of weeks ago I had the good fortune to meet Hugh Crean, the ex-CEO of Farecast, ex-Microsoft executive (they acquired Farecast) and current Entrepreneur in Residence at General Catalyst. A group of us talked to Hugh for close to an hour, and I learned more about the travel industry in that short span than I’ve learned in a lifetime of flying, hoteling and using...
May 31st
184 notes
April 2011
3 posts
5 tags
Socket Policy file for AS3 with Node.js socket...
Setting up a socket server with Node.js is very simple. Consuming it with Actionscript 3 should be too. Except, Flash has very strict policy rules concerning which domains/ips can connect through which ports on your server. So, your socket server needs to serve a crossdomain policy xml file which states that your client can connect to the server. Something like this: I’m not using a very strict...
Apr 14th
40 notes
7 tags
Updated Ruby version with RVM causing RubyGems...
This is a reminder for myself and others, it’s nothing new. When your run into errors like these when executing a ‘gem install’ command: ERROR: While executing gem … (ArgumentError) marshal data too short and these: uninitialized constant Gem::Commands::InstallCommand It’s clear there’s something wrong in your Ruby / RubyGems setup. I was using RVM and when I updated my Ruby version to the...
Apr 7th
28 notes
3 tags
MongoDB, Ruby and UTF-8
Yesterday, I was trying to insert a bunch of records in a MongoDB instance. I kept noticing that ‘bad’ strings were passed along, despite various attempts to encode them properly into UTF-8. And finally, when firing up a MapReduce function in the Mongo shell it returned the following error: map invoke failed: JS Error: Error: invalid utf8 nofile_b:1 The complete result: When I searched for...
Apr 4th
6 notes
March 2011
3 posts
5 tags
Node.js with Upstart and Monit
I’ve been using Forever for a while now to keep my Node.js applications up and running on my Linode, Ubuntu, VPS. This works pretty good, as you can easily start, stop and list all your apps running with Forever. Basically, it allows you to start a node process in the background so you don’t block your current shell and it restarts your app when it suddenly decides to die on you. What else do you...
Mar 25th
37 notes
7 tags
Dropbox Photo Gallery
I’ve been working on a Dropbox-powered photo gallery site. I wanted to get rid of as much external services such as Flickr as possible. They do a very good job, have lots of features but I don’t want all my stuff to be spread across several services. But enough about ‘the why’. The how. I wrote a Sinatra application that’s able to import all the directories from...
Mar 18th
22 notes
5 tags
Node.js on nginx
This is a practical and basic guide to run node.js on an nginx based server.  nginx I won’t go into details on how to install nginx on your Linux based server. The basic idea here is that you use nginx to route all traffic that needs to be processed by node to the specified service on your network or local server. You could do this for PHP processing (via PHP-FPM or Fast-CGI) as well, the same as...
Mar 7th
15 notes
February 2011
5 posts
6 tags
Secure Apache webserver on Mac OSX Snow Leopard
When searching for the right way to turn your local Apache webserver (on Mac OSX Snow Leopard) into a secure webserver I stumbled upon this blogpost from Michael Gracie. It explains very clearly how to create the necessary keys and certifcates. Follow all the steps from step 1 up to step 6, until you can do something like this on your localhost: Now you can access both https://https.local and...
Feb 25th
64 notes
6 tags
RVM and your default Ruby version
When installing a new development machine, Homebrew is the way to go to set up your development environment. No need to worry about complex installations and PATH settings. Just do a and let it do it’s thing. Homebrew is quite good at that. For more info on Homebrew, visit the github wiki. RVM (Ruby Version Manager) on the other hand is your wepaon of choice for installing one or more Ruby...
Feb 22nd
10 notes
5 tags
Nokogiri scraping with cookies
Nokogiri is a great library for scraping other websites content with XPath or css based selectors (you know: the way jquery lets you query for DOM elements). You can do something like this: As you can see in the example above, the query is easy, fetching the document through Nokogiri is easy. The tricky part in the example above is that the URL will redirect you to a language select page. The...
Feb 12th
13 notes
9 tags
Amazon CloudFront invalidation for Appoxy AWS...
Amazon S3 is a great service for file storage. Combined with Amazon CloudFront you have access to a high availability CDN for a very low cost. It’s as simple as ‘putting’ your files on Amazon S3, enable CloudFront access and see the powerful CDN cache hits in. The only problem is that cache timeout of files you deliver through CloudFront can be large. This is generally a good...
Feb 8th
28 notes
11 tags
Force 'Rails.env' in Phusion Passenger using...
When deploying your Ruby on Rails project to a shared hosting environment you might run into trouble with the environment variables. By default the environment (<%= Rails.env %>) will be ‘production’.  This is not what you might want when you’re using multiple servers for different environments (eg development, test, staging, production, …).  You can either ask your hosting provider to...
Feb 1st
9 notes
January 2011
2 posts
7 tags
Rails 3 and Nested Forms
When developing nested forms in Rails you need to tell each model what their relation is with other models, like this: What I didn’t know is that you also need to manually declare the attributes relation to accessible, when you are already using attr_accessible in the related model(s). (Thanks dixis for the comment). Read more about it here:...
Jan 25th
67 notes
4 tags
Formtastic & ValidationReflection in Rails 3
When using Formtastic and ValidationReflection make sure the validations on your Models are split up in the different validation methods of ActiveRecord. Like this: instead of
Jan 22nd
6 notes