Author Archives: ivanshn

cvxpy, cvxopt and convex optimization

cvxpy module is a nice wrapper around cvxopt that follows paradigm of a disciplined convex programming. Its a bit slower, but has a very similar syntax as cvx toolbox for Matlab (cvx in Matlab is great!). Here are some notes: … Continue reading

Posted in convex optimization, Machine Learning | Leave a comment

Merging in mercurial with vimdiff

Put the lines below in .hg/hgrc file of a repository: [ui] merge = vimdiff [merge-tools] vimdiff.executable = vim vimdiff.args = -d $base $local $output $other +close +close Now whenever you do: hg pull hg update and if there are conflicting … Continue reading

Posted in Mercurial, Productivity, Programming, UNIX/Linux, Vim | Leave a comment

Running script in background on linux

If we want to run a script from terminal and be able to close the terminal without killing a script (because terminal would be a parent process, so if it dies, its children die automatically), here is the command: nohup … Continue reading

Posted in Bash, Productivity, Programming, Python, UNIX/Linux, Vim | Tagged , , | Leave a comment

Installing Scipy on Linux Red Hat

Tried to install scipy using easy_install (also pip). Installation failed with error: Atlas ( libraries not found. Instead: sudo yum install scipy works seamlessly

Posted in EC2, Machine Learning, Programming, Python | Leave a comment

Resolving import errors in Python

If you get an error saying something like ‘Can not import SomeModule”, the first thing to check is that package (which is a regular directory with added file) is in PYTHONPATH. For example, suppose you get an error when … Continue reading

Posted in Python | Leave a comment

Switching back and forth between tabs and spaces for Python indentation

It seems that majority of python developers prefer using 4 spaces for indentation. However, some people still like using tabs. I am using python.vim script written by Eric Mc Sween. The file stays in .vim/indent directory. There is a line … Continue reading

Posted in Uncategorized | Leave a comment

Problems with character encoding when piping output from a python script to a file

Suppose my_unicode_string is a Python unicode string. If you get an error when you do the following: and the error is: UnicodeEncodeError: ‘ascii’ codec can’t encode character u’\xf1′ in position 9: ordinal not in range(128) To get rid of the … Continue reading

Posted in Programming, Python | Leave a comment