Another article I wished management people would read

Max Indelicato, who's blog I occasionally read, posted an entry with the nice long title The I.H.S.D.F. Theorem: A Proposed Theorem for the Trade-offs in Horizontally Scalable Systems.

Now, I'm not crazy about abbreviations. I think there are far too many of them thrown around mostly causing confusion without being useful.

This article is one of those articles I wish management would read (and understand!) since this is one of those failed communications issues between management, the system architect and the developer. A good architect would make management understand the problems faced and which trade offs are made (and what implications they will have on the future system). This is, in my limited experience, seldom the case (and since developers in general is terrible at, or just don't care to, explaining this will become a potential bomb).

Posting code examples

When bloging about PostgreSQL and programming I often want to post code examples. The platform I'm using doesn't support automatic syntax highlightning (and sometimes I want to create a stand alone HTML page with syntax highlightning too).

Since I use Vim as my editor I make use of the command :TOhtml.

I find it convinient to make use of the CSS type of conversion insted of the default one and then just copy the contents of the body from the converted text to my blog entry. I already have my own settings for the code highlight in my own style.css.

I also finds it very useful to use TOhtml on conjunction with visual mode to convert only a part of a source to HTML.

Working from the command line is also an option. Example:

$ vim -c 'TOhtml' -c 'wqa' myscript.sql

The above exampel generates a file myscript.sql.html.

Finally an example of a highlighted file:

#!/usr/bin/env python
# -*- coding: utf-8 -*-
Say hello to the world.

if __name__ == '__main__':
    print "Hello World!"

# vi: set fileencoding=utf-8 :

pgarchives extension Shredder on OS X

Since I like to play around with things I just had to give Magnus Haganders PG Archives extension a try.

Since I run the alpha of Thunderbird on my MacBook I had to make two minor alterations.

Bump the maxVersion in install.rdf to get it to install (Thanks Magnus).


Alter the binary called in pgarchives.js:

    process('/usr/bin/open', Array('/Applications/', '' + msgid), false);

A silly post I know but I had nothing publicly interesting to write about today... :-)

Figure out processes startup environment

Sometimes it is necessary to figure out what environment variables a process was started with. If you're on a *nix system having a procfs you can just take a look in /proc/<pid>/environ.

This is a sample from a server running a PostgreSQL instance:

roppert@piper ~ $ ps aux | grep postgres
postgres 23603  0.0  1.0  37996  3864 ?        Ss   Dec02   0:05 /usr/lib/postgresql-8.3/bin/postgres --silent-mode=true
postgres 23606  0.0  1.0  37996  3896 ?        Ss   Dec02   0:00 postgres: writer process                               
postgres 23607  0.0  1.0  37996  3880 ?        Ss   Dec02   0:00 postgres: wal writer process                           
postgres 23608  0.0  1.0  37996  3940 ?        Ss   Dec02   0:00 postgres: autovacuum launcher process                  
postgres 23609  0.0  0.6   9316  2408 ?        Ss   Dec02   0:07 postgres: stats collector process                      
roppert  31814  0.0  0.1   4612   740 pts/4    R+   23:29   0:00 grep --colour=auto postgres
roppert@piper ~ $ sudo cat /proc/23603/environ 
TERM=screenSHELL=/bin/bashUSER=postgresPATH=/bin:/usr/bin_=/usr/lib/postgresql-8.3/bin/postgresPWD=/var/lib/postgresqlPGLOCALEDIR=/usr/share/postgresql-8.3/localePGSYSCONFDIR=/etc/postgresql-8.3HOME=/var/lib/postgresqlSHLVL=2LOGNAME=postgresPGDATA=/var/lib/postgresql/8.3/datarobertg@piper ~ $ 

I have no clue on how to do this on a Windows system. Anyone?

RSS 2.0