Easier error handling by using automatic code generation [Perl interpreter]

Perl interpreter has an interesting mechanism to checks if function arguments have correct values. Below is its example from util.c:

char *
Perl_delimcpy(register char *to, 
      register const char *toend, 
      register const char *from, 
      register const char *fromend, 
      register int delim, I32 *retlen)
    register I32 tolen;


    /* ... */

Body of PERL_ARGS_ASSERT_DELIMCPY is in proto.h:

    assert(to); assert(toend); assert(from); assert(fromend); assert(retlen)

What makes those macros interesting, is that they are automatically generated by a perl script (regen.pl). They are created from a data stored in embed.fnc, a sample entry of this file is presented below:

: Used in util.cp
op  |void   |example_function   |NN const char *name|STRLEN len|

The script needs to be executed after any change in embed.fnc.

Interesting and weird.

Remote control of devices by using PC Speaker

This is one of my older projects that aims to control external devices directly, by using the PC Speaker port. It can control multiple devices at one go, but they must be powered one at a time. I made it a couple of years ago and it was working fine, but due to mistake during plugging it literally burned ;(

Now, when both cheap USB chips are available and PC speaker is unused (or integrated with sound card) it doesn't make sense, to build it, but this is still an interesting concept.

CMS written entirely in PL/pgSQL

In one of my previous jobs, I heard that it would be inspiring, to write a CMS with all logic stored and executed on database side. Every request would be performed in stored procedures, theirs final result would be HTML page sent back to the user.

I will present, how to do it with PotgreSQL, Apache, Linux and a bit of bash scripting. The script is a cheat because I promised to write everything in stored procedures, but as you will see, it's just a gateway to the database, there isn't any logic.