Fri Aug 29 18:12:21 CEST 2008

YML Bugfix: plain text escaping in plain YML files

... was not implemented, now it's working ;-)


Posted by Volker Birk | Permanent Link

Tue Aug 19 23:20:19 CEST 2008

I love it!

Much fun with C++, Part MMCMXVII:

Trying, no, risking to try to implement standard conform code, I was so naive to assume, that this could be possible without getting into deep troubles and suffering even deeper pain.

Of course, it's not.

Actual sample: errno and strerror_r().

First errno: our C++ friends decided in their infinite sapiency that errno can be a macro, but it does not need to.

But: C++ requires you to include cerrno instead of errno.h. And there we go: including cerrno means, that any symbol in there is now in std:: and not in :: anymore - for errno that means, it depends: if your toolchain supplier decides that errno is not a macro, then it's in std:: ; of course, if it is a macro, you may not write it as std::errno :-(

So I added to my code:

// motherf*cker
#ifndef errno
#define errno std::errno
#endif

Nice, isn't it? Well, venturing the usage of strerror_r(), it's getting even worse.

strerror_r() is POSIX. That means, it is not included in cstring where strerror() lives. It remains in string.h. But: usually it's not a good idea to include both of them.

So I decided to include string.h only. And there the GNU is screwing me:

They have a GNU extension for strerror_r(). How "nice"! And how sexy it is:

You have exactly the same parameters as the POSIX version: errno (sic!), buffer and buffer size.

But they will not fill your buffer. Or, to be exactly: they're not promising to.

It depends on the phase of the moon and the length of your beard: if GNU are in good mood, they're filling your buffer. If not, they're ignoring your buffer and returning a pointer to the string you were requesting.

WTF?!

And portability bytes again: you have to cast the return value then to a ptrdiff_t, because who says that a char * is the same size as an int?

// GNU "extension" - how "nice"
std::ptrdiff_t ret = (std::ptrdiff_t) ::strerror_r(err_no, buf, error_text_length);
if (ret == 0)
    return buf;
if (ret == -1)
    return "";
return (char *) ret;

Well... OK. Forget it.


Posted by Volker Birk | Permanent Link

Tue Aug 19 21:48:55 CEST 2008

YML: debugging feature added

Stefan asked me to add a switch for generating line numbers for generated lines; he does not mean the line numbers of the generated line but the line number in your script, which generated the line, of course ;-)

So I added the generate_comments macro, see the YML documentation, section 2.10.5.


Posted by Volker Birk | Permanent Link

Mon Aug 11 21:45:05 CEST 2008

YML 1.3 is there, with many new features

Hi, for today I added many new features, which are especially helpful for YSLT, my successor to XSLT.

There is a new Block Line Quote '||', for example, and some other sexy features. I also updated YSLT itself.

I'm very sorry, that there is so less YSLT documentation yet, I'm working on it ;-) On the YML Homepage you can find some new sample code, so maybe this will help.

Have a look on the nice & sexy CYY language - just a gag, but already in productional use here. It's using YSLT as a macro processor in C++, and it can be combined with nearly any other language, too.


Posted by Volker Birk | Permanent Link

Sat Aug 9 07:11:23 CEST 2008

Vesper hat recht... Deutschland zensiert wie China das Internet

Wie sie sich alle aufregen, der Volker Beck, der Dieter Wiefelspütz, der Peter Danckert und der Dirk Niebel.

Dabei hat Vesper nur die Wahrheit gesagt.

Eine unangenehme Wahrheit, natürlich.


Posted by Volker Birk | Permanent Link

Mon Aug 4 19:51:17 CEST 2008

Webshop auf Python-Basis als Freie Software - Programmierer gesucht

Griassens,

hier mein CfP von debate@ccc.de:

On Mon, Aug 04, 2008 at 12:37:50PM +0000, Dr. Morpheus wrote:
> Jung aber gut:
> http://ubercart.org/

Nun, der dritte Webshop auf PHP-Basis :-( Und kein Land in Sicht...

Hiermit kündige ich an, dass wir als Firma 
offiziell ein Free-Software-Projekt sponsern, falls die Leute da was mit
Django-Project machen  sowie mit
PostgreSQL 

Django-Projekt ist "Python on Rails".

Voraussetzungen für Bewerbungen: Erfahrung mit Python-Programmierung.
Wir bezahlen da den Lead-Developer zwischen halbtags ein Jahr lang und
Vollzeit ein halbes Jahr lang, je nach Wunsch des Lead-Developers.

Ausserdem gibt's die Infrastruktur und ein Bisschen Kohle um was zu
machen gestellt. Folgefinanzierung dürfte kein Problem sein. Es ist aber
auch erwünscht, dass die beteiligten Programmierer damit dann
kommerziell Webshops für Dritte anbieten.

Falls jemand das in Rails machen möchte (Ruby), können wir gerne reden.
Mir wär's in Python am liebsten.

Einen grossen Testkunden bring ich gleich mit. Das ganze wird unter die
GPL 2.0 gestellt. Das Projekt ist Eigentümer am Quellcode, wir wollen
ihn nicht haben. Voraussetzung: er bleibt ausschliesslich frei und unter
GPL 2.0.

Interesse?

mailto:vb@logix-tt.com

Viele Grüsse,
VB.

Posted by Volker Birk | Permanent Link

Mon Jul 28 09:52:59 CEST 2008

Kommt alle zur Demo am 11. Oktober 2008 nach Berlin!

Bürgerrechtsorganisationen rufen für Samstag, den 11. Oktober 2008 unter dem Motto "Freiheit statt Angst" zu einem Marsch durch Berlin auf, um gegen die ausufernde Überwachung durch Staat und Wirtschaft zu protestieren. Die Organisatoren sind sich einig, dass es höchste Zeit ist, vor dem Hintergrund permanenter Verschärfungen von Sicherheits- und Überwachungsmaßnahmen für die Verteidigung unserer Grundrechte auf die Straße zu gehen. Die Demonstration wendet sich unter anderem gegen die für Herbst geplante Aufrüstung des Bundeskriminalamts zu einer zentralen, exekutiven Polizeibehörde mit der Befugnis zum geheimen Ausspionieren von Privatcomputern.

Mehr zum Thema erfährt Ihr hier.


Posted by Volker Birk | Permanent Link

Sun Jul 20 20:57:20 CEST 2008

Just for fun II: Towers of Hanoi in YC

The following source code implements Towers of Hanoi in YC:

 include yc.yml

program {
    include forindention.ysl

    function "hanoi" {
        param "n"
        param "from"
        param "dest"
        param "by"

        choose {
            when "$n=1" {
                | printf("move the plate from «$from» to «$dest»\\\\n");
            }
            otherwise {
                call "hanoi", with("n", "$n - 1", "from", "$from", "dest", "$by", "by", "$dest")
                call "hanoi", with("n", 1, "from", "$from", "dest", "$dest", "by", "$by")
                call "hanoi", with("n", "$n - 1", "from", "$by", "dest", "$dest", "by", "$from")
            }
        }
    }

    main "<stdio.h>" {
        call "hanoi", with("n", 5, "from", 1, "dest", 3, "by", 2)

        | return 0;
    }
}

You can download this here


Posted by Volker Birk | Permanent Link

Sun Jul 20 17:39:30 CEST 2008

Just for fun: YC

Because I heard of an implementation of the towers of Hanoi in C preprocessor, I sketched the language YC - C as a Y language.

To test it out, here is a sample program:

include yc.yml

program {
    include forindention.ysl

    C {
        | int cfak(int n) {
        |   if (n==0)
        |       return 1;
        |   else
        |       return n*cfak(n-1);
        | }
    }

    function "fak" {
        param "n"

        choose {
            when "$n=0" {
                > 1
            }
            otherwise {
                > «$n» * `call "fak", with("n", "$n - 1")`
            }
        }
    }

    main "<stdio.h>" {
        | printf("fak(5) = %d\\\\n", `call "fak", with("n", 5)`);
        | printf("cfak(5) = %d\\\\n", cfak(5));
        | return 0;
    }
}

You can compile it with the yc command.


Posted by Volker Birk | Permanent Link

Sun Jul 20 17:25:26 CEST 2008

YML: whith() Python function added

Only a small but sensible extension for YSLT: if you're calling a function() with call(), you can use the with() Python function to insert a xsl-with subtree. A sample:

call "fak", with("n", 42)

with() calls yml_with() for each pair of parameters, so you can use with() for more than one parameter, too. Just add more than two parameters to with. The third and fourth parameters are taken for a second call to yml_with(), and so on.


Posted by Volker Birk | Permanent Link