Blog
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:
- Uninstall Mysql on your computer (you also may need to do this)
- Uninstall the gems (sudo gem uninstall mysql, sudo gem uninstall dm-mysql-adapter)
- Download the latest mysql DMG from the MySQL website
- Install the gems (sudo gem install mysql, sudo gem install dm-mysql-adapter)
- Restart your computer
- 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:
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.
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:
- Full control from the command line
- Ability to capture from input devices
- 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.