MacVim with Python 2.5

Posted June 23, 2009 by amaslov
Categories: Mac, Vim

I have built the latest MacVim (snapshot 45) with Python 2.5.4 from http://www.python.org and put it here. Since I do builds of new snapshots for myself I will share them here if there is any interest.

You can download MacVim + Python 2.5 here: http://sites.google.com/site/amaslov/Home/MacVim-snapshot45-py25.zip

MySQL: unicode in console by default

Posted April 29, 2009 by amaslov
Categories: MySQL

Recently I became tired of typing set names utf8 at the beginning of each MySQL console session. Google search quickly suggested a solution: just add

[mysql]
default-character-set=utf8

to the ~/.my.cnf file.

Mercurial: finally as usable as git

Posted April 24, 2009 by amaslov
Categories: Mercurial

I have always preferred Git to Mercurial and the main reason was Git having lightweight local branches. My typical work scenario with Git is: create a branch, code a task, merge the branch into the “master” branch. If anything happens along the way (urgent issue, for instance) – I can easily switch to a new local branch preserving the current changes in their own branch and do the work immediately.

Mercurial does have the Bookmarks extension that provides local branching. But it is very different from Git’s local branches: bookmarks are rather pointers to a common change history than isolated branches. For instance, all the commits inside a bookmark are automatically shared on “push” and “pull” with other repositories.

Anyway, since I had to use Mercurial for one of my projects (http://www.developers.org.ua), I had to find the solution: the Tasks extension. Now I can easily switch between branches working on whatever tasks I need for the moment.

Now I am very optimistic regarding Mercurial taking into account that it is Python-based and I can (easily?) develop my own extensions.

For more details on how Bookmarks work in Mercurial and what are the possible alternatives to the Tasks extension please see the discussion in the Mercurial newsgroup.

VIM: ack instead of grep

Posted April 23, 2009 by amaslov
Categories: Vim

I much prefer ack to the standard grep – it’s way better. If you are curious why – just open the ack page.
Replacing grep with ack in VIM is pretty easy: set grepprg=ack. But there’s a catch – ack does not output columns for search results, making search result navigation a nightmare – on each “:cn” VIM puts cursor at the beginning of the line and I have to do an additional search for the word. Definitely no fun!

Adding columns to ack turned out no big deal. Here’s how to do this (works for ack 1.86, so just get this version or tweak the patch file):

  1. Download Ack.pm.diff (taken from this thread: here, Eric Van Dewoestine, thanks a lot!).
  2. Find the location of Ack.pm in your system (may be multiple files), typically locate Ack.pm.
  3. Patch each Ack.pm: sudo patch -p0 -b < /path/to/Ack.pm.diff /path/to/Ack.pm (if you have Ack.pm installed per user, please remove sudo).
  4. In your vimrc add the following:
    set grepprg=ack --column
    set grepformat=%f:%l:%c:%m

Enjoy!

VIM: updating ctags file automatically

Posted March 6, 2009 by amaslov
Categories: Vim

Most VIM developers use ctags for browsing the code. It is quite annoying to refresh the tags manually though. I forget to do this all the time – and suddenly navigation breaks.

Recently I have stumbled upon a great VIM plugin, simple and brilliant: AutoTag, http://www.vim.org/scripts/script.php?script_id=1343. This little thing updates your tags automatically on each buffer save. Just try it – you won’t go back, I promise! :)

I would suggest one small tweak to correct the plugin issue (which I believe will be fixed soon by it’s author). After having enabling the plugin I started to receive annoying messages containing ctags console output. I had to press “ENTER” each time to continue editing. To get rid of these messages simply change the line in autotag.vim:
autocmd BufWritePost,FileWritePost * call AutoTag ()
to
autocmd BufWritePost,FileWritePost * silent call AutoTag ().

If you are curious about silent:help silent :) .

Usable console on Windows

Posted May 18, 2007 by amaslov
Categories: Uncategorized

HOWTO: Installing Java on Ubuntu/Debian

Posted April 28, 2007 by amaslov
Categories: Linux

Joel’s Guide To Interviewing: Must Read

Posted April 13, 2007 by amaslov
Categories: Development

Good SQLAlchemy extension

Posted April 11, 2007 by amaslov
Categories: Python

Excellent thread about languages, mostly Python vs Ruby vs Java

Posted April 11, 2007 by amaslov
Categories: Development