today (2008-03-10) magnus hagander commited patch which adds new, quite handy functionality: “enum type for guc parameters".
smtp + sql = more than it seems so (part 6)
in last part of this howto we did setup pop3/imap client access.
together with things set in all previous parts it makes a fully working mail system.
but, there are still things that might be added/modified. one of these is vacation support …
Continue reading smtp + sql = more than it seems so (part 6)
searching for longest prefix
couple of times is was brought to attention of #postgresql channel – how to find longest prefix.
case: you have phone number, and you want to find which carrier it is bound to.
there are at least 3 ways of finding it, and i decided to take a look at which is fastest.
smtp + sql = more than it seems so (part 5)
last time i finished with working smtp system, with accounts, aliases and quota. now, let's add ability to get th
e mails for client (imap/pop3) and some smtp-auth.
Continue reading smtp + sql = more than it seems so (part 5)
smtp + sql = more than it seems so (part 4)
at the end of previous part of this text, we got our system working, and accepting emails for local accounts. plus i promised to add quota now 🙂 so, let's do it.
Continue reading smtp + sql = more than it seems so (part 4)
waiting for pg 8.4
i will try to follow development of 8.4, and write examples of what's possible with it, based on current HEAD code.
of course there is no guarantee that it will work in final, released 8.4 (it is a bit too early to talk about it, but given the fact that the patch got committed, there is pretty good chance we will see it whenever 8.4 will be released.
today 2 new features: limit (select ) and optional as in select.
smtp + sql = more than it seems so (part 3)
at the end of last part of this text, i finished having ready postgresql and exim (pop/imap installed but not configured), with exim being able to ask postgresql whether given domain is local. now, let the saga continue.
Continue reading smtp + sql = more than it seems so (part 3)
failing ls ?
i have this program, which forks-off worker processes, and then runs in them various tasks.
one of the tasks is to execute some command via system(), but since we need to get stdout and stderr (separately), we used ipc::run module.
simple example of such code would be:
#!/usr/bin/perl use strict; use Time::HiRes qw( usleep ); use IPC::Run qw( run ); use POSIX ":sys_wait_h"; sub REAPER { my $child; while (($child = waitpid(-1,WNOHANG)) > 0) { } $SIG{CHLD} = \&REAPER; } $SIG{CHLD} = \&REAPER; for (1..100) { my $x = fork; die "cannot fork?!: $!\n" unless defined $x; if ($x) { usleep(10000); next; } my @cmd = qw(ls -lad .); my ($in, $out, $err); my $status = run \@cmd, \$in, \$out, \$err or die "ls: $?"; printf ("%u\n", $status); exit; }
what it does:
- defines REAPER function, and sets it as sigchld handler – for details, please check perldoc perlipc. this is basically to avoid creation of zombie processes in case we have long-running parent process, which forks relatively short-lived child-processes.
- forks off new process
- after forking, master sleeps for 0.01 second (not to put to much pressure on testing system)
- child process runs sample command (ls -ald .) via ipc::run, with empty stdin, and catching stdout and stderr.
- child then exits
- whole forking/ls-ald. thing is repeated 100 times to show that it's effect is not random.
what's wrong? here is output from it on my machine:
=> perl test.pl ls: -1 at test.pl line 24. ... ... ...
which basically means ls failed – which is far from true, as this ls succeeds, simple check:
=> perl -e 'use IPC::Run qw(run);my @cmd = qw(ls -lad .);my ($in, $out, $err);my $status = run \@cmd, \$in, \$out, \$err or die "ls: $?";printf ("%u\n", $status);' 1
now, the riddle is: why it fails? (yes, i now know the answer, but it took me some time).
vimrc
due to requests (in “real life", not on blog), i put my .vimrc in svn, to be easily accessible.
svn repo at: http://svn.depesz.com/svn/environment/.vim/main-rc.vim
smtp + sql = more than it seems so (part 2)
in first part of this text i described how i installed base ubuntu system in chroot, and then got exim, courier and postgresql in there. now to some configuration.
Continue reading smtp + sql = more than it seems so (part 2)