Archive for September, 2005

Configuring PostgreSQL ODBC connector

Thursday, September 22nd, 2005
  1. apt-get install unixodbc odbc-postgresql

  2. Add the following line into /etc/odbcinst.ini

    [Postgres]
    Description             = Postgres
    Driver          = /usr/lib/odbc/psqlodbc.so
    Driver64                = /usr/lib
    Setup           = /usr/lib/odbc/libodbcpsqlS.so
    Setup64         = /usr/lib
    UsageCount              = 1
    CPTimeout               =
    CPReuse         =
    
  3. Add the following DSN into /etc/odbc.ini

    [test]
    Description   = test
    Driver    = Postgres
    Trace   = No
    TraceFile   =
    Database    = test
    Servername    = localhost
    Username    =
    Password    =
    Port    = 5432
    Protocol    = 6.4
    ReadOnly    = No
    RowVersioning   = No
    ShowSystemTables    = No
    ShowOidColumn   = No
    FakeOidIndex    = No
    ConnSettings    =
    

NOTE that the hostname is called servername here! If you use a standard hostname, the driver will connect to a socket, not the inet and you get a “connection refused” message.

  1. The DNS-less connection string to PostgreSQL (don’t need step 3 then) would be: "Driver=Postgres;Database=test;Servername=localhost;Port=5432;Username=test;Password=xxxx;"

NOTE: It’s error-prone and hell to debug.

  1. Driver should not be in curly braces {} (should be according to the spec).
  2. Absolutely no spaces anywhere (should be ok according to the spec).
  3. Error messages are not very informative as it fails silently and calls another connection methos producing “Data source name not found, and no default driver specified” :-|

A useless pointer: DSN-less connection strings – discussed here.

Postgresql dates

Wednesday, September 21st, 2005

There seems to be a few ways of extracting individual date values from Postgres: 1. extract(what from date) 2. date_trunc 3. substring

More on this here and here.

Stages of project management

Sunday, September 18th, 2005
  1. Enthusiasm
  2. Disappointment
  3. Fear
  4. Panic
  5. Looking for cuplrits
  6. Punishing of cuplrits
  7. Awards for those not involved in the project

Monitoring resource usage in Linux

Wednesday, September 14th, 2005

Three packages I found in Debian: dstat, ifstat, systat – allow to show cumulative statistics, but not on per-process basis.

Here’s an interesting discussion on what can an cannot be done with Linux: http://mirror.hamakor.org.il/archives/linux-il/01-2005/13574.html

One pointer is laptop-mode (Documentation/laptop-mode), although for different reasons the information there might not be accurate.

A nice summary on linux profiling: http://www.cs.utk.edu/~mucci/latest/pubs/LCSC2004.pdf

Perfsuite: http://perfsuite.sourceforge.net/ IOTrack: http://www.pdc.kth.se/~pek/iotrack/

TCPreplay

Wednesday, September 14th, 2005

Programs for more interactive TCP replaying:

Monkey see, monkey do TCPopera Tomahawk TPCivo

Conifure Ad-hoc wireless router on Linux

Thursday, September 8th, 2005

It’s acutally quite simple-got it to work in 5 min.

Setup at the server:

  1. iwconfig eth1 essid <essid> mode ad-hoc
  2. ipconfig eth1 10.0.0.1 up
  3. echo “1″ > /proc/sys/net/ipv4/ip_forward
  4. iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Setup on a client:

  1. iwconfig eth1 essid <essid> mode ad-hoc
  2. ipconfig eth1 10.0.0.2 up
  3. route add default gw 10.0.0.1
  4. echo “nameserever 10.0.0.1″ > /etc/resolv.conf

Should work. Another thing you may try is if your network card supports a “master” mode (iwconfig <interface> mode master) and if it does, you can setup an access point. I guess the rest should be similar (use “mode managed” on a client of course).