May 7, 2009

.vimrc + Python indentation

I had two separate projects (vcpynet-client and MXManager) which belong together. MXManager is a GUI in PyQt4 for vcpynet-client (which is now renamed to mx-download). That is worth another post. I needed to re-indent the two codes to have the same indentation style. In Ruby I tend to use 2 spaces. In Python it feels a bit more natural to use 4 spaces. These files used both styles which is ok as long as the indentation is strict in each separate file. Re-indenting in Vim should be simple. I defined these in my .vimrc:
set tabstop=4
set softtabstop=4
set shiftwidth=4
set shiftround
set expandtab
set autoindent
set paste
Vim re-indents the file in normal mode by ”gg=G”. Whoops, didn't work on my files. Guess I need to be more strict. I break some lines in a bit unorthodox fashion but Python 2.5 seems to accept it. Vim doesn't. Sed accomplised it, so for the record:
sed -i 's/\ \ /\ \ \ \ /g' 

May 4, 2009

NSLU2 + UTF8 ♥

NSLU2 aka ”slug” is a small consumer-grade embedded ARM device. It is not very fast but quite handy and completely silent. It consumes only ~5 W with an USB flash drive attached. However the Debian image I use does not come with all the needed locales but it's easy to generate them.

Include whatever locales you like to /etc/locale.gen and generate them:

 # locale-gen
Generating locales (this might take a while)...
  en_GB.ISO-8859-1... done
  en_GB.ISO-8859-15... done
  en_GB.UTF-8... done
Generation complete.
The next step is to configure the proper keyboard layout.
 # apt-get install console-data console-tools debconf
 # dpkg-reconfigure console-data
Finally, define the default system-wide locale:
 # echo 'LC_ALL="en_GB.UTF-8"' > /etc/default/locale