Blog

16 December, 2010

I used to be somebody

11 November, 2010

Datamapper, MySQL and Sinatra on OSX

Trying to set up Sinatra with Datamapper today, I was running into a lot of problems. I got errors when trying to install the mysql gem and the dm-mysql-adapter gem. When I actually managed to do it, Datamapper gave me the following error:

Can't connect to local MySQL server through socket '/opt/local/var/run/mysql5/mysqld.sock'  

I spent hours trying to fix it, but I finally suceeded. This is what worked for me:

  1. Uninstall Mysql on your computer (you also may need to do this)
  2. Uninstall the gems (sudo gem uninstall mysql, sudo gem uninstall dm-mysql-adapter)
  3. Download the latest mysql DMG from the MySQL website
  4. Install the gems (sudo gem install mysql, sudo gem install dm-mysql-adapter)
  5. Restart your computer
  6. Now do this to make the socket path work

That should hopefully make MySQL and Datamapper work. Connect like this in you app and you're good to go:

14 October, 2010

Transparent background in Processing.js

This took me a while to figure out because the documentation on the processing.js is way behind. I wanted to overlay a processing.js element on top of a video canvas, which I already did a while ago, but updating to the newest version of processing.js made the canvas background grey. I searched through the source code and found out that to enable transparent background in your processing.js canvas, you need to add this directive to your javascript code:

You can find a working example in this Github repository.

13 October, 2010

Record video from C++

Update: I've created an openframeworks wrapper around the VLC remote features. You can find the details here.

For a new project I needed to be able to record video from within an OpenFrameworks / Cinder project. I immediately started looking for libraries supporting this, but both of the frameworks fell short. Then I saw that the amazing VLC player had all that I needed:

  1. Full control from the command line
  2. Ability to capture from input devices
  3. Ability to save captured movie to file

I researched how to run terminal commands on OSX from within C++, and found out that it's very easy using the system() function. So I created a Gist on Github that shows how to run a simple command from a C++ script. All you need is to run the needed commands from C++ to make VLC do whatever you want to. Check out VLC's command line documentation for more info. You may also need to look at the OSX specific page. I will continue to update this GitHub repository with code as I continue to develop this project further.

07 October, 2010

Self Portrait