Monday, August 28, 2006

emacs autocomplete eldoc

> how do i make it show completeion when i type
> import aspell

> then aspell. SHOULD autocomplete available classes and functions

> then after i type aspell.Dict(
> should tell me wat arguments

M-TAB should be bound to python-complete-symbol. That should do what you want I
After you have typed your imports, you should be able to use C-c TAB in your
code buffer to run python-find-imports. After doing this, eldoc-mode should
display the function argument information after you type the (.

vim7 code completion for python


Some notes about the new features that interest me.

Open in tabs:

 vim -p filename1 filname2
:tabe filename
To move between tabs:

Omnicompletion whilst programming:

Spell checking:
 :setlocal spell spelllang=en_gb
Highlighted words are probably incorrect.
 ]s - move to next spelling error
z= - spelling suggestion

Emacs: CEDET

If you use Emacs and you’re a programmer, you should definitely check this out:

CEDET = Collection of Emacs Development Environment Tools

You may also want to take a look at:

ECB = Emacs Code Browser

Though I found ECB to be sort of “heavyweight” and I don’t use it on a daily basis, it’s an impressive piece of work and something that a lot of people might like.

Reverse proxy roundup

Author :

inside livejournals backend pdf

Mapping a File to Memory

Finally, we use the mmap(2) call to map the file to the memory area and then read the elements of the array directly from the memory, bypassing the I/O calls. We can see that this approach is orders of magnitude more efficient for both forward and backward sequential reading of the file. Replacing the I/O operations with mmap calls should always be considered for applications that perform frequent I/O operations.

/* example_mmap.c
cc example_mmap.c -o example_mmap */
#define N 1000000
FILE *example_file;
int x[N], i;
hrtime_t st, et;
float secs;

int main() {
return 0;

int read_file_mmap(){
char *example_map;
int offset;
if( (example_file = fopen( "ex_file", "r" )) == NULL ){
printf( "Problem opening the file\n" ); return -1; }
st= gethrtime();
offset = 0;
for ( i = 0; i < N; i++){
x[i] = *(int*)(&example_map[offset]);
offset = offset + sizeof(int);
et= gethrtime();
secs = (( float) (et-st) / (float) 1000000000);
printf( "x[11111] = %ld \n", x[11111] );
printf(" RUNTIME (mmap): %6.4f Seconds \n", secs);

if( (example_file = fopen( "ex_file", "r" )) == NULL ){
printf( "Problem opening the file\n" ); return -1; }
st= gethrtime();
offset = (N-1)*sizeof(int);
for ( i = N-1; i >= 0; i--){
x[i] = *(int*)(&example_map[offset]);
offset = offset - sizeof(int);
et= gethrtime();
secs = (( float) (et-st) / (float) 1000000000);
printf( "x[11111] = %ld \n", x[11111] );
printf(" RUNTIME (mmap): %6.4f Seconds \n", secs);

return 0;

Optimizing Lighty for high-concurrent, large-file downloads

Sunday, August 27, 2006

Concurrency control using postgres

PostgreSQL has had Multi Version Concurrency Control for quite some time. You don't have to do anything special to use it. It's the default to handle
This is an awesome postgres resource

Accept Filtering on FreeBSD

Accept Filtering on FreeBSD:
SO_ACCEPTFILTER is not available on Linux. There is a socket option called TCP_DEFER_ACCEPT, which is roughly equivalent to the “dataready” accept filter on FreeBSD. It’s not quite as good as “httpready”, since with TCP_DEFER_ACCEPT, accept() will return as soon as the socket becomes readable (i.e. after at least one byte of the request is received).

Text Processing in Python

Aahz's Python Page

Managing Many-to-Many Relationships with PL/pgSQL

Saturday, August 26, 2006

SVN Orielly book

installing clearsilver

  • Download ClearSilver 10.2 or later. Extract to a temporary location. Run the following commands (as the root user) from the directory you extracted the files to:
    • ./configure --prefix=/usr --mandir=/usr/share/man --disable-java --disable-ruby --enable-gettext --disable-apache --with-python=/usr/bin/python
    • make
    • make install
    • ldconfig
  • After installing ClearSilver, copy the file from the python directory (under the clearsilver temporary directory) to /usr/lib/python/site-packages/ directory.
    • cp python/ /usr/lib/python/site-packages/
    • or cd python && sudo python install

Davids py resources


Friday, August 25, 2006

Learning to program

VIM C/C++-IDE -- Write and run programs. Insert statements, idioms, comments etc.

Speed up writing new code considerably.

Pycons talks

and elements in RSS

>Has anyone encountered a way to throttle (in either sense of the word!)
>the Bloglines RSS crawler? We have a server with a large number of
>feeds. While Bloglines doesn't fetch any individual feed more than once
>an hour, they tend to fire off requests for all of our feeds in rapid
>succession, creating bursts of heavy traffic that can do bad things if
>they come in during an already high load on the server. Any chance
>they'd understand a 304 Not Modified HTTP status?
Thanks to the people who responded with hints (more polite than "RTF
Standard!") about the and elements in RSS. They do
exactly what I want (respectivesly, tell an RSS reader not to pull
updates more often than X minutes and tell a reader not to pull feeds
during certain hours of the day).

Unfortunately, Bloglines disregards both elements; on inspection, I see
my copy of RSSReader does also. I'll experiment with the 304 HTTP status



Setting up subversion

Context sensitive help in vim for py

You can grab it at:

You will need a version of VIM compiled with an embedded python interpreter.

Thursday, August 24, 2006

Compiling a separate copy of Vim for Python coding

Python omnicomplete requires Vim7 compiled with a Python interpreter (./configure --enable-pythoninterp), but that makes the Vim executable about 4.5mb heavier. For normal text editing I don't need that extra baggage, so I use 2 different copies of Vim; one that's compiled with my normal options (no python) and one that's compiled with python.


Pylint analyzes Python source code looking for bugs and signs of poor quality.

Emacs Python Completion

Get it directly from SVN: [WWW]

Practical PostgreSQL Orielly

Python Bibliotheca

" Bind  key to running the python interpreter on the currently active
" file. (curtesy of Steve Howell from email dated 1 Feb 2006).
map :w\|!python %
set et

From Noahs Embrace the snake

PyPI The Python Package Index

Python win32 extensions ActiveState extensions for Windows COM programming. I use this. This stuff works.

VIM shortcuts
.vimrc for Python

This is how I set my .vimrc file.

autocmd BufRead,BufNewFile *.py syntax on
autocmd BufRead,BufNewFile *.py set ai
autocmd FileType * set tabstop=2|set shiftwidth=2|set noexpandtab
autocmd FileType python set tabstop=4|set shiftwidth=4|set expandtab
set background=dark
map :let &background = ( &background == "dark"? "light" : "dark" )


MySQLdb The MySQL DBI interface for Python
Python syntax file for TextPad TextPad is a little text editor that I like to use on Windows.
Rijndael (AES) in Python Pure Python implementation of the Rijndael cipher by Bram Cohen.
AES is the government's successor to DES.
AnyGUI A very cool idea -- which appears to be dead.
Fnorb A Python CORBA 2.4 server.
Distributed Computing More distributed computing fun from SourceForge
SWIG Easily connect Python to C/C++ libraries.
ReportLab Toolkit This is an open source package that allows generation of Adobe Acrobat (PDF) documents. This is the best Python PDF generator I have found.
Gadfly SQL Relational Database in pure Python (with optional C module extension for speed)
dbxread This module by Steve Holden reads Outlook DBX binary email files.
Ctypes module ctypes is a Python package to create and manipulate C data types in Python, and to call functions in dynamic link libraries/shared dlls. It allows wrapping these libraries in pure Python.
pSQL A Python-friendly interface to SQL -- glad to see this again. Local cached copy: pSQL-0.9.4.tar.gz


Dive Into Python Online book -- Python for experienced programmers
DMOZ Python Open Directory of Python sites. A great place to search.
TIOBE Programming Community Index gives an indication of the popularity of programming languages
PLEAC Programming Language Examples Alike Cookbook
Greg Stein Greg has some good resources, especially for WebDAV.
FAQTS for Python
HotScripts for Python
Cetus links
Python Cookbook at ActiveState
Python Snippets at SourceForge
biopython Python tools for computational molecular biology


build AJAX apps in Python (like Google did for Java)

Scripting C with python

C/C++ Integration

Speaker: Chad Netzer

Python was designed for easy integration with C, but it has never been trivial. There are many different tools available, each with different strengths and weaknesses. Chad will be leading a series of mini-tutorials to expose the audience to some or all of the following: Boost, ctypes, Pyrex, Scons, SIP, SWIG, Weave


JPype is an open-source Python library that gives “python programs full access to java class libraries”.

Why Not Python

Why Not Python?, Part 4
Why Not Python?, Part 3
Why Not Python?, Part 2
Why Not Python?, Part 1

pound - reverse proxy - load balance - https front end

The Pound program is a reverse proxy, load balancer and HTTPS front-end for websites. stunnel: probably comes closest to my understanding of software design (does one job only and does it very well). However, it lacks the load balancing and HTTP filtering features that I considered necessary. Using stunnel in front of Pound (for HTTPS) would have made sense, except that integrating HTTPS into Pound proved to be so simple that it was not worth the trouble.

FAI - Fully Automatic Installation

FAI is an automated installation tool to install or deploy Debian GNU/Linux and similar distributions on a Linux Cluster or a bunch of different hosts. It's similar but more flexible than other tools like kickstart for Red Hat, autoyast and alice for SuSE or Jumpstart for SUN Solaris.

Distributed Caching with Memcached

Python Spell checkers

aspell-python 1.11


Yahoo! python center

py grps



Vaults of Parnassus : Python Resources

python IDEs EMACS

Python screencasts

If you'd like an overview of Python in action, you might like our growing collection of Python screencasts, we have 50 videos right now (mostly for Python, some for Java and others):

Unofficial python tutor wiki