python

Install OpenCV 3.1.0 with Python 3.5+ in Ubuntu 14.04

Getting OpenCV 3 up and running with Python 3.5+ on Ubuntu 14.04 is a pain in the ass. For the most part the instructions here are the same as in this guide, with a few changes needed specifically for Python 3.5+. I’m going to assume that you already have pyenv and pyenv-virtualenv installed for the purpose of this guide. Install prerequisites sudo apt-get update sudo apt-get install -y build-essential cmake git pkg-config sudo apt-get install -y libjpeg8-dev libtiff4-dev libjasper-dev sudo apt-get install -y libpng12-dev libavcodec-dev sudo apt-get install -y libavformat-dev libswscale-dev libv4l-dev sudo apt-get install -y libgtk2.

Setup Ubuntu 14.04 with Cuda and Lasagne

Installation of prerequisites # Install common stuff sudo apt-get install build-essential sudo apt-get install zsh git # Install SciPy dependencies sudo apt-get install libblas-dev liblapack-dev libatlas-base-dev gfortran # Install pyenv curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash # Install python 3.5.0 env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.5.0 # Install cuda wget http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda-repo-ubuntu1404-7-5-local_7.5-18_amd64.deb sudo dpkg -i cuda-repo-ubuntu1404-7-5-local_7.5-18_amd64.deb sudo apt-get update sudo apt-get install cuda popd # Create theanorc echo "[global]" > ~/.theanorc echo "floatX = float32" echo "device = gpu" Create pyenv and install lasagne Choose a name you see fit.

Pyplot in Jupyter inside pyenv on El Capitan

With the new root protection feature in El Capitan, it’s hard to install pip packages into the system python. Besides, it’s generally considered bad practice to clutter up your system python’s library with packages. Most developers prefer to set up their own virtualenv for python and then install packages into that local environment. I did the same for setting up Jupyter Notebook and everything worked as expected. Well, mostly everything.

A new contributor to the Cscope plugin for ST2

A while back when Sublime Text 2 was in beta, I was fascinated by all the pretty colors and smooth transitions (and the python scripting of course) so I figured that I’d give the cool new kid on the block a chance. At the time there were very few plugins for C++, so naturally there was none for Cscope (there was one for Ctags, but it wasn’t particularly useful at that point).

Making an asynchronous plugin for Emacs

With the libclang functionality working reasonably well as a python module, it was time to move on to getting it to work with Emacs. Naturally, my first instinct was to simply use Pymacs to interface with Python and then figure out a way of making it asynchronous. So I spent a couple of hours and made a functioning version with Pymacs, and then explored my options for making it asynchronous. Two solutions stood out:

Standalone libclang utility library available now

Emboldened by my previous success and with a better idea as to how SublimeClang fetches code completions internally, I set about trying to make the Emacs plugin a reality once more. I initially figured that I would write it entirely in C++, with Emacs communicating with the server using sockets or something like that. However, I soon realized that most of the code I wrote would be more or less identical to how SublimeClang works.

Universal newlines support in python

While reading a file’s contents in Python and messing around with trying to get the line number and column number for a given point in the file or vice versa, I noticed something weird. For a given byte-count, the point I ended up at after reading those many bytes in Python was about 50 less than that reported by Emacs. I checked and double-checked my math, but no matter how I looked at it, the result was the same: Python was seeing more bytes in the file than Emacs was.

Progress with libclang! (in C++, not Python)

As you might remember, I gave up on porting SublimeClang over to Emacs. After raising two bugs on irony-mode, one of which ended up with the author (who seems to be a really nice guy, by the way) cloning my repo to see why it wasn’t working, I finally managed to get auto-completion up and running with irony-mode. And it turned out to be too slow. I mean, for me it was even slower than brianjcj’s auto-complete-clang plugin, which uses the clang binary to drive completions.

Progress with clancs

Clancs being the name of the repo I’ve created on Github to track my efforts at porting SublimeClang to Emacs, as documented in a previous post. So far I’ve removed (almost) everything ST2-specific (and Python 3-specific, just to make it easier to narrow in on what’s not working) from the plugin, I’ve also taken care to ensure that anything Emacs-specific is being done only from a handful of functions in one module.

Getting libclang to work.. anywhere

People at my office currently use Source Insight (sorry, can’t be bothered to put a link, just look it up in your favorite search engine) to navigate and edit our codebase which is comprised of bazillion lines of code spread across a million files. Recently, upper management heard about this wonderful tool called Eclipse (again, just search for it) that some people use and which just happens to be FREE! Also, we use QNX, and Momentics (which is a modified version of Eclipse) is used for live-debugging of systems runinng QNX, so it made sense to them that their engineers use Eclipse.

My first contribution to open-source!

(Technically, this is my second contribution, the first being to the Worldforge project. But since Google paid me to contribute to it, in my head it doesn’t count.) I recently discovered that Calibre supports fetching news from different news sources and converting the fetched news to mobi/epub. In addition to this, one can schedule this to happen, say, everyday at 6 am, and also configure Calibre to transfer freshly-downloaded items to your kindle via Amazon’s Whispernet.