Copyright header substitution script powered by perl.

Most people think that I’m some kind of Python crazy fan, while I actually enjoy learning new programming languages. I haven’t write anything useful in perl before, although I’ve played with it.

But last week I had to replace a lot of copyright/license headers in a bunch of code, and I thought it was a good idea to use perl for it. It took my some effort to find an example on how to do this on the web, so I thought posting the code would be a good idea, enjoy.

 #!/usr/bin/perl

foreach $arg (@ARGV) {
        open(SOURCE, $arg);
        @lines = <SOURCE>;
        $source = join("", @lines);
        close(SOURCE);

        $header = "/*
*
* This is my new copyright header. (c) 2007
* All rights reversed.
*
*/";
        $_ = $source;
        s/\/\*(?:.|[\r\n])*?\*\//$header/;
        $source = $_;
        open(SOURCE, ">$arg");
        print SOURCE $source;
        close(SOURCE);
}

It could be probably less verbose or more perlish, if you have suggestion on how to improve it, feel free to post comments.

Advertisements

16-10-2007 Random bits

Vala binding updates

I’ve updated the vala bindings for poppler 0.6.1 and for clutter 0.4.2.
poppler bindings have landed on vala´s trunk branch and should be there for the next vala release:

$ svn co http://svn.gnome.org/svn/vala/trunk

I also wrote an example on how to write a Gtk+ PDF viewer with the poppler bindings on the vala wiki, check out the brand new Poppler Sample.

Clutter bindings are on the trunk bindings branch of the clutter repo:

$ svn co http://svn.o-hand.com/repos/clutter/trunk/bindings/clutter-vala

I’ve started to port the second clutter test, test-behave, which helped me to find some bugs. I haven’t finished the port yet, let’s hope I find some time to finish it.

Blow weirdness

Sorry to planet.gnome.org and planet.opensolaris.org readers for the problems that my blog is experiencing, it seems that typepad has some bug on the ATOM feed, I’ve sent a ticket about it already, hope they solve it as quickly as possible.

Heading to Madrid

Tomorrow I’m leaving Dublin for 6 days. I’m going to spend a few days in Madrid, mostly to meet people that I miss and run away from the coldness 🙂

Call for help – Cherokee 0.6 administration interface

In many regards, Cherokee, besides being one of the faster, it’s probably the most innovative open (and maybe closed as well) source web server out there too. (And no, I don’t think this because it’s developed and maintained by my friend and co-worker alo).

I could give you tons of examples of this, but to be honest, the things that I like the most, it’s its approach towards simplicity and easy of use. Its motto could perfectly be:

"A web server for human beings."

Now, most of the coolest features are already on the SVN trunk waiting for the 0.6 release, but there’s one problem, there’s a show stopper feature not implemented. And probably the most important.

0.6 has been designed with one assumption, users won’t edit the configuration file, Cherokee will provide an administrative interface to do so. When alo told me about this idea, I said, wow, that’s actually what any web server should provide for configuration purposes, it makes a lot of sense.

I’ve been trying to start writing a prototype of the interface using PySCGI (the Cherokee SCGI python implementation) and an AJAX web interface using ExtJS (a widget toolkit written in Javascript and based on the Yahoo UI). So far I’ve only got a grid view with the list of virtual servers, and one you click on one of them, it prints the raw configuration data on another div.

It turns out that I’m a pretty lame web developer, I’m uncomfortable at HTML and JS, I’m quite frustrated, however I’m enjoying the experience of writing the web service side for the asynchronous calls.

So here’s the request for help, we need JS/HTML developers to create the first version of the interface. If you have skills in JavaScript and HTML and you are looking for a project to get your hands dirt on, join the cherokee mailing list or drop me a line to aruiz at gnome dot org and become the legendary Cherokee developer you always wanted to be!