Solar is a theme for Python Sphinx.
Made the Switch to Vim - at Last!
Eclipse was my IDE of choice. I liked the Python support with Pydev extension, Git integration, multiple project management and Task/Todo support among other things. I have written about some of these before.
What I didn’t like was the high memory usage. Tried a number of things - updating Eclipse and JDK, making sure 64-bit Java is used for the VM, disabling or removing features/plugins not used and closing unused projects. It didn’t help much - ~300MB RAM with a single project opened in workspace!
I have been using Vi/Vim for a long time (~10 years) but only for simple tasks. I even got a book but the learning process was slow. On second thought, I realized it will be quicker if I noted down the features I wanted and focus only on them. So, I came up with this list
- Python, Pylint integration
- Git integration
- Diff
- Debugging python code
- Execute shell commands
- Find and replace
- File explorer
- Working with multiple files
- Project management
- Help and autocomplete
- Tasks integration
I’ve got most of this setup thanks to some really good blog posts, wiki articles and stackoverflow posts [see Links below]. Here is my vimrc. I use solarized for the color scheme and Inconsolata font at 10pt.
Some tips
Find and highlight occurrences of a word
Press * while cursor is on the word.
To remove highlight, use
:set nohl
Close a file
Also known as delete a buffer.
:bd
Print margin at column 80
This is useful if you want to restrict the number of characters per line.
:set cc=80
For more information, check “Right margin in Vim”
Display line number
:set number
Diff of 2 files
:vert diffsplit second_filename
This did not work on the windows version of vim 7.3. Remove or comment out
set diffexper
in vimrc. You will then need to install diff. I used diff.exe that came
with Git. For more information check
Running diff.
Links
Qt-devel on SLES 10 SP1
Problems
No Qt development (qt-devel) RPM in the SLES 10 SP1 DVD.
The devel files were part of the SDK. Could not download SLES 10 SP1 SDK from Novell (No longer available). The official installer did not work.
./Qt_SDK_Lin64_offline_v1_2_en.run:
/usr/lib64/libstdc++.so.6:version `GLIBCXX_3.4.9' not
found (required by ./Qt_SDK_Lin64_offline_v1_2_en.run)
Cannot upgrade libstdc++ at the moment!.
How I got it installed
Downloaded the latest available SDKs for SLES 10 from Novell http://download.novell.com/Download?buildid=JETn_0Tw_XM~
Extracted qt-4.3.4-0.7.1.src.rpm from the 2nd DVD iso
Built RPM from the source RPM
rpmbuild -bb qt.spec
This stopped with error: Failed build dependencies:
cups-devel is needed by qt-4.3.4-0.7.1.x86_64
libjpeg-devel is needed by qt-4.3.4-0.7.1.x86_64
libmng-devel is needed by qt-4.3.4-0.7.1.x86_64
libtiff-devel is needed by qt-4.3.4-0.7.1.x86_64
dbus-1-devel is needed by qt-4.3.4-0.7.1.x86_64
Installed all the above packages using zypper
Compile was successful but these rpmbuild errors occured
suse_update_desktop_file
Due to a bug in
/usr/lib/rpm/suse_macroshttps://bugzilla.novell.com/show_bug.cgi?id=166170.unpackaged files found
Updated spec file to include them in sql package.
Removed existing Qt installation and installed new RPMS
zypper rm qt qt-qt3support qt-sql qt-x11
RPM’s installed in this order
qt qt-sql dbus-1-qt qt-x11 qt-qt3support qt-devel
You can download the RPM spec file from http://db.tt/3y0MzGpY
2011 in Review
The WordPress.com stats helper monkeys prepared a 2011 annual report for this blog.
Here’s an excerpt:
The concert hall at the Syndey Opera House holds 2,700 people. This blog was viewed about 31,000 times in 2011. If it were a concert at Sydney Opera House, it would take about 11 sold-out performances for that many people to see it.
PostgreSQL Notes
Some things I’ve learnt recently.
Simple boolean function to check if a column exists
1
| |
Identify duplicate values in columns
1
| |
col1 is an integer but I wanted it formatted as text in my python script
1
| |
Beginning PyQt (Tutorial, PyCon Ireland 2011) - Slides and Code
This is a tutorial I delivered at PyCon Ireland 2011.
A quick introduction to developing a GUI to a command line program using PyQt. I used the sphinx-build command from Sphinx documentation project as an example.
The basic command for generating HTML documentation from source is
sphinx-build sourcedir outdir
A GUI (dialog) was designed using Qt Designer to replicate the functionality of the command above. This was then converted to Python code and then a main application was written to make use of the dialog.

Slides for the talk: slides.pdf
Code repository: https://github.com/vkvn/sphinx-build-qt/
You can clone the repo using
git clone git://github.com/vkvn/sphinx-build-qt.git
and checkout like this
1 2 | |
This code works unaltered on Windows too. Thanks to Qt! You would need to have the
C:\Python2*\Scripts in your PATH or wherever you’ve got sphinx-build
installed.
Python and Databases - Slides and Example Code
This was a short introduction on using Python with SQL databases that I delivered to a group of visiting researchers.
Slides : python-databases.pdf
Code: https://github.com/vkvn/python-databases
Outline
- Python modules for working with databases
- SQLite
- pyodbc
- Client software
- Create and connect to a database
- Create a table
- Inserting a row
- Inserting multiple rows
- Retrieving data
- Updating data
- Example using pyodbc
3 New Themes for Python Sphinx
Just created a repository for the Sphinx themes I have been creating for various documentation projects. These themes were created by modifying base themes included with Sphinx. Here are some screenshots.
Agni (means Fire)
Jal (means Water)
VLinux-theme (used for the VLinux project)
Download
- Agni - agni-1.0.zip
- Jal - jal-1.0.zip
- VLinux-theme - vlinux-theme-1.0.zip
You can clone or fork the github repo.
How to use
- Download the zip file of the theme you want to use and uncompress the archive.
- Modify
conf.pyof an existing Sphinx project or create a new Sphinx project usingsphinx-quickstart. - Change the
html_themeparameter to match the theme name (agni, jal or vlinux-theme). - Change the
html_theme_pathto location of the downloaded theme.
Now Running Android 2.3/CM7 on the Milestone (With Some Honeycomb Goodness!)
CyanogenMod 7 (Android 2.3/Gingerbread) port for Milestone is now available (RC4, but quite stable) - http://android.doshaska.net/cm7
Instructions to update are similar to what I have posted before except there is no need to install OpenRecovery and all three data wipe options should be used including Factory reset.
NOTE: This is going to wipe out all your data. So, backup first!
Also, latest version of Google apps for CM7 needs to be installed.
Optional
Honeycomb theme for CM7. Download here.
Honeycomb live wallpaper from Android Market
Screenshots
Power control, Google search, Beautiful Widgets, Google Reader and LauncherPro

Analog Clock from the Honeycomb theme

Also includes Music widget.
New icons from Honeycomb theme

Keyboard

Python Sphinx - Include Sections From Other Documents
I was trying to do this today and came across couple of different ways
of including content from other documents. My first attempt was to use
.. literalinclude:: but that is only good for including code or text.
What I wanted was to include sections from other documents into the current
document so that any changes made in them will also be reflected in the
document where it was included. This can be done using the .. include::
ReST directive.
Lets take this document usage.rst as an example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | |
Lets say you want to include the Command section. Mark this section by
adding markers like this. In this case begin-command and end-command
is used. This is not really necessary and any string could be used as a
marker but I feel this gives better control as to what is included.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | |
Note
Spacing is essential.
The .. at the beginning of a line makes it a comment. It will not be included in the final document
To include this section in a different document, add this
1 2 3 | |
Note
The / in the beginning of the path refers to the top level i.e., the ‘source’ directory.
If the file is in the same directory, just filename is sufficient
Reference
http://docutils.sourceforge.net/docs/ref/rst/directives.html#including-an-external-document-fragment



