Changing MySQL database encoding

For some time now, I had a pending task of converting the latin1-encoded MySQL database powering this site into utf8. I finally managed to do it after getting some advice from the kind people at a Vienna WordPress meetup.

The essence is that out of all the methods suggested in the official documentation, what worked best for me was dumping all the data to a text file, marking up and encoding it as utf-8 in a text editor and then importing it into a new database (instead of working on the production DB) that we point the wp-config.php file to after everything is verified.

Continue reading Changing MySQL database encoding

Fine-looking R plots

While strolling through a friend’s copy of The Economist today, admiring a very coherent visual identity they chose, I remembered reading this blog post about R having such a theme a while back.

Lead by curiosity, I gave it a try.

Blue makes for a soothing colour to present such shocking data, don’t you think?

Quick instructions… Continue reading Fine-looking R plots

Python notebook

As I went searching for an RStudio equivalent for Python I discovered IPython notebook, which I shortly described in this Stack Overflow answer:

IPython has a really cool sub-project called IPython notebook. It basically allows you to interactively code and document what you’re doing in one interface and later on export it as a notebook or script or print it as static html (and therefore pdf as well).

IPython notebook screenshot

It starts a web application locally and you use it from your browser.

There’s also a Qt console for IPython, a similar project with inline plots, which is a desktop application.

Speech recognition helloworld in Python

As shown in this video, this is how you try out the “helloworld” speech recognition using Sphinx from Python in Ubuntu…

$ sudo apt-get install python-pocketsphinx pocketsphinx-hmm-wsj1 pocketsphinx-lm-wsj

And the code (a script called speech_recognition.py, you can download it as a gist) goes as follows (it may be necessary to change paths to your language model and hidden markov model files):

Continue reading Speech recognition helloworld in Python