Tuesday, October 26, 2010

Merge many text files to one

import glob

search_pattern = '*.vcf'
dest_file = '__.txt'

with open(dest_file, 'w') as F:
    for infile in glob.glob(search_pattern):
        with open(infile) as f:
            F.write(f.read())
            F.write("\n\n")

print 'All done'
raw_input('Press enter...')

Saturday, October 23, 2010

Run GAE SDK for Python and Django on Ubuntu Maverick

First, I make the following structure in my project's directory:
~/projects/gae/ - directory for GAE's projects
~/projects/gae/google_appengine/ - downloaded GAE sources
~/projects/gae/google_appengine/test/ - test project using GAE

So, to run this test project as well as other further projects that use GAE
  1. Download Google App Engine SDK for Python and unpack it to ~/projects/gae/.
  2. Install python-2.5
    sudo add-apt-repository ppa:fkrull/deadsnakes
    sudo apt-get update
    sudo apt-get install python2.5
    
  3. Install easy_install for Python 2.5
    cd /tmp
    wget http://pypi.python.org/packages/2.5/s/setuptools/setuptools-0.6c11-py2.5.egg
    sh setuptools-0.6c11-py2.5.egg
    
  4. Install Django 1.1 for Python 2.5
    easy_install-2.5 django==1.1.1
    
  5. Put into ~/projects/gae/google_appengine/test file
    echo "#!/bin/bash
    
    python2.5 ../google_appengine/dev_appserver.py ./" > run
    chmod a+x run
    

When you need to run development server for the Test project you should do
cd ~/projects/gae/google_appengine/test/
./run

Friday, October 22, 2010

Default opening software

This file ~/.local/share/applications/mimeapps.list contains all overridden openers for particular MIME types.

Google Chrome and Flash player

Having installed new Ubuntu 10.10 I found that Google Chrome cannot display flash content and asks to install flash player. But at flash player download website it says that I have already installed one.
Googling a bit gives me an advise. I made the step below and it gets work.
$ sudo apt-get install flashplugin-installer
$ sudo locate libflashplayer.so
/usr/lib/flashplugin-installer/libflashplayer.so
/usr/share/ubufox/plugins/npwrapper.libflashplayer.so
/var/lib/flashplugin-installer/npwrapper.libflashplayer.so
$ ln -s libflashplayer.so /usr/lib/flashplugin-installer/libflashplayer.so

Clock widget hangup

If you are very annoyed by system hangup when you have clicked clock widget to watch calendar or whatever in your Ubuntu 10.10 I can advise to do the following:
sudo apt-get purge evolution-data-server evolution-couchdb evolution evolution-exchange
That's all. After this you are avoided such unpleasant behavior.
It, however, removes Evolution mail client but if you don't use it as me that is not a problem.