Lisp golfPosted by Holger Schauer in
Lisp
Some time ago, I was looking at splitting some text with Elisp, Perl, Ruby and Common Lisp. Yesterday, when I again had to do quite the same thing, it occurred to me that the Common Lisp solution was unnecessary complex/long. I'm not a Perl guru, but I believe the following is probably hard to beat even with Perl:
For the uninitiated, it's not the cl-ppcre library which is interesting here but the built-in iteration facilities of format. See the Hyperspec on the control-flow features of format for details. Now, I usually tend to avoid the mini languages that come with Common Lisp like the one of format or loop when writing real programs, but when using Lisp as a glorified shell they come in very handy. Automated unit testing via ASDF?Posted by Holger Schauer in
Lisp
Dear Lazyweb, I'm looking for a way to automate unit testing with the help of ASDF. I'm using XLUNIT at the moment, but this isn't really relevant. What I want to achieve is that on every compilation of some source file, it's corresponding test file will be loaded (and hence the tests it contains run). However, what I seek to avoid is simply adding the test files to the component definition; the test files should be kept separately. From what I gather from the ASDF documentation, this should be possible using :perform forms, but the very same docs leave me wondering how. What I found (looking at Jörg Höhles asdf file for iterate) is how to load and run a complete test-system, but this is not what I want to do. Ideally, I would like to have a single perform instruction looking something like this:
Here #'glorified-find-component needs to recursively follow the components parent and #'find-component-test should return a component c-test (with c expanded, obviously). Now, I guess I'm just clumsily reinventing the wheel and hence I'm wondering if somebody has already solved "the problem".While I'm at it (it referring to testing), Stefil looks like a very interesting test environment in case you're developing your programs with Emacs and Slime. From there, I found a link to Phil Gregory's test framework comparison which I found much more enlightening than the ALUs list of test frameworks. Endspurt gegen Vorratsdatenspeicherung in FreiburgPosted by Holger Schauer in
Freiburg, German
Morgen abend wird in Freiburg eine der dezentralen Kundgebungen gegen Vorratsdatenspeicherung stattfinden. Die Demo unter dem Namen "Freiheit statt Angst" findet am 6.11. ab 17.00 Uhr am Münsterplatz statt. Ich werde leider nicht da sein können, weil ich mal wieder in Mannheim weile, aber hoffentlich finden sich auch so genügend Leute.
Now I'm all over the shop ... or Converting from RCS to MercurialPosted by Holger Schauer in
Programming
Like I mentioned in a previous post (here), I hadn't looked closer at those modern distributed revision control systems like Git, Darcs or Mercurial. This was mainly due to two facts: As I'm currently neither involved in any major open source project which uses these systems nor in a project at work which requires the facilities offered by such systems, and as there was no easy access for them in XEmacs, the more traditional systems like Subversion, CVS and RCS are fine for me. However, there was this nag that I might miss something and as revision systems always have been somewhat of a pet peeve of mine, I eventually spend some time reading up more on them. I've read quite a lot of discussions on the web, and gathered that mercurial might be worth a closer look, as it claims to be quite easy to handle, comparably well documented and quite fast. And then finally I've read on xemacs-beta that the new vc package (in Pre-Release) would support mercurial as well.
Well, that's where I am now: I have several pieces of code lying around which I sometimes develop on my main machine and sometimes on my laptop when moving around. This is the scenario where a server-based approach to revision control is not what you want: you won't be able to access your server while you're on the road and hence you can't commit. Now, with RCS that's not a problem, as there is no server involved. But of course, since RCS is a file-system local revision system, syncing is a major problem and you have to go to great pains to ensure you don't overwrite changes you made locally in between syncs. I hope that a distributed version control system like mercurial will solve the problem, as I no longer have to decide which version is the current head version, instead cherry-picking change sets at will. But of course, for this to happen, I have to convert my RCS repositories to Mercurial. This doesn't seem to be a common problem: there are a lot of tools for conversion from CVS or Subversion (see Mercurial Wiki, e.g. Tailor for instance), but not from RCS. I ended up following the instructions given in the TWiki Mercurial Contribution page. I have some minor corrections, though, so here we go: -1. (Step 6 in TWiki docs) Ensure all your files are checked in RCS. I won't copy the advice from the TWiki page here, because I believe in meaningful commit messages and would urge you to do a manual check. 0. You'll need cvs20hg and rcsparse which you will find here. You'll need to have Python development libraries installed, i.e. Python.h. For Debian systems, this is in package python-dev. Installation is as simple as two "./setup install" as root which will install the relevant libraries and Python scripts. 1. Create a new directory for your new mercurial repository (named REPO-HG, replace that name):
2. Initialize the repository:
3. (Step 4 in the TWiki document) Create a new copy of your old RCS repository (named REPO here, replace that with the name containing your old RCS files), add a CVSROOT and a config file (mistake one in the TWiki docs: As with all CVS data, the "config" file needs to go to CVSROOT, not to CVSROOT/..). Of course, if you're no longer interested in your old data, you may omit the initial copy.
4. Inside your directory with the old RCS data, move everything out of the RCS subdirectories (mistake two in the TWiki docs: the double-quotes need to go before the asterix):
5. Run cvs20hg to copy your old repository to mercurial. If you don't follow the directory scheme shown below, you'll end up with your new mercurial repository missing the initial letter of the name of all top-level files and directories.
6. Check that everything looks like you would expect: Looks just like the sunPosted by Holger Schauer in
Music
Last week I went to see "Broken Social Scene present Kevin Drew's 'Spirit If ...'" playing in Heidelberg. I hadn't written about it earlier because the concert wasn't very exciting. The reason I do so now is that, like most concert I visit, it made me listen more closely to the records of the band. I also bought "Spirit If ..." at the concert, right before the start. Afterwards, I was afraid to have made a classic mistake: generalize from previously nice records to a new one and buy it without a first try, and possibly wasting time, money and emotions.
Where was I? Ah, yes, the reason why I'm writing this entry now: the concert of last week was the first in a very long time in which the concert wasn't up to match the records at all. In particular, I thought that the reduced amount of band members playing and especially Kevin Drews ambitions might be responsible for the uninspired concert, as I left with the impression that Kevin was a little to self-loving and maybe even a little jealous when Branden Canning played and sung two songs that got a lot of applause. But after having listened to "Spirit If ..." now several times, I must conclude that it probably was mainly due to the reduced possibilities of only playing with six instead of the usual ump-teen players. And btw: adding volume doesn't really help -- too often I had to put on my ear plugs which only results in even more reduced distinguished tunes. You gain something, you lose somethingPosted by Holger Schauer in
Linux
Two days ago, I updated my laptop from Ubuntu 6.06 "Dapper Drake" (aka LTS) to "Feisty Fawn", aka version 7.04. Just in case you wonder, how I did that, I just followed the usual directions and first updated to Edgy and then to Feisty via issuing "gksu 'update-manager -c'" twice. Things went quite smoothly, but I did encounter some problems:
- I lost access to my databases during the migration from Postgres 7.4 to 8.2., i.e. there was no proper migration and as support for version 7.4 has been dropped, I even have no way to dump the old data and import it again. I need to figure out whether I can easily access the old dbs from Postgres 8.2 (mind you, I'm talking of the raw data and the DB server, not client access). - As a result, my local copy of serendipity stopped working. I re-installed serendipity (a clean start seemed to be a good idea), but still Iceweasel gets wrong information about the phtml files it generates. Probably a problem with the PHP installation, which I need to get straight (I'm not a PHP guy, though). - When booting into Edgy, when switching from the splash screen to X. the screen went black and there was no way to get a display. I solved that by ssh-ing into the box, modifying /etc/X11/xorg.conf by using the ati driver instead of the fglrx driver and then editing /boot/grub/menu.lst so that it wouldn't show the splash screen or suppress messages. The problem went away after going to Feisty. - To get VMware running again, it wasn't enough to issue the usual /opt/bin/vmware-config.pl that you have to do with every new kernel. It kept telling me that the headers directory wouldn't fit my current running kernel. Fortunately, I already had loaded the new version down which solves the problem (I guess there is a new version numbering scheme in newer kernels). - The update of course also brought with it the switch to Iceweasel, so of course, I lost some of my trusted extensions (Reveal, Surfkeys). - What really annoyed me was the ugly, fat looking "optimal" font that I encountered in most applications. Why Gnome doesn't use subpixel hinting as a default is beyond me (especially as I'm quite certain to have had that setting in the old setup, too). - The new eclipse version of course knew nothing about my local installed plugins, implying that I had to reinstall them. On the nice side, my mail setup kept working and the network setup kept working, which I think is way more important. Vagabunden in der PolitikPosted by Holger Schauer in
German, Politics
Satz des Tages in der gestrigen Debatte um die Terrorwarnungen unseres Innenherumirrenden von seiten des Innenpolitikers Michael Hartmann (SPD) lt. Heise Newsticker: "Vagabundierendes Atommaterial werde nicht gestoppt durch vagabundierende Interviews".
Six minutes from 1984Posted by Holger Schauer in
Politics
... to become reality, according to the surveillance society clock of the American Civil Liberties Union (ACLU). Now, if that's so for the US, I wonder what a corresponding German clock would show. I would guess we're still not on the same level but our politicians probably have already promised to their American idols to fix it.
The Tender BarPosted by Holger Schauer in
Literature
The Tender Bar is a memoir written by JR Moehringer -- and one of the books I've read during my holidays. It's really outstanding, both in the many funny anecdotes it tells, all of which are centered around the bar which was basically the authors' replacement for his dad, as well as for the really joyful writing style. I only wish most blog authors, myself included, could achieve a similar ability to write so inspiring and refreshing simply by going to our favorite bar, too.
Programming languages I knowPosted by Holger Schauer in
Programming
Joey seems to have inspired a "list of programming languages you know"-contest over on planet.debian.org, so this is mine:
Missing in this list is stuff like Scheme, Dylan, Oz, Oberon, Eiffel, Haskell and probably some other "tiny" languages which I looked at at some point in time and really didn't ever took a second look. Of those, I may take another look at Haskell in the future, but currently I have no concrete plans in doing so. How much playing time does your MP3 collection have?Posted by Holger Schauer in
Linux, Programming
I love the Unix toolbox:
[elendil->Get_the_gore]mp3info -p "%S\t%m:%02s\t%t\n" * | perl -ne '{ $time=$time+$1 if (/^(\d+)[ \t]+(.*)$/); print $2."\n"; } END { print "Total seconds: $time\n"; $min=$time/60; $secs=$time%60; print(sprintf("Total time: %d:%d\n",$min,$secs)); }' 2:10 Fox in a box 3:16 Loaded heart 2:53 All grown up 3:07 Pleasure unit 2:51 Where evil grows 3:16 Casino 2:38 Don't cry 2:24 Mary Ann 3:48 You lied to me before 1:50 So sophisticated 2:50 Little baby 2:44 Sweet potato 2:56 Voodoo doll 1:51 Hammer stomp Total seconds: 2314 Total time: 38:34 Printing out the track number and the track title works only if the file contains an ID3 tag, of course. Splitting the dark side ...Posted by Holger Schauer in
Programming
For a review, I needed to get the track list of a given CD. As the track list wasn't available via CDDB, I went to some large online store and found the tracklist. I need to convert it to XML, though. The original data I fetched looks like so:
1. Fox In A Box 2. Loaded Heart 3. All Grown Up 4. Pleasure Unit ... whereas I need: <li id="1">Fox In A Box</li> <li id="2">Loaded Heart</li> <li id="3">All Grown Up</li> ... After cutting the original data to my Emacs, writing out a simple file and using Perl for that simple transformation seemed just gross. In the past, I've been an Emacs hacker. But no more, or so it seems, since it took me nearly half an hour just to come up with this simple function:
What took the most time was that I've had forgotten to escape the grouping parenthesis in the regular expression and that it took me a little while to accept that there is really no \d or equivalent character class in Emacs regexps. Which probably means that I've been doing too much in Perl, sed and the like. OTOH, it just may hint at the horror of regular expressions handling in Emacs. What I also dislike is that whenever you want some result in Emacs and see it, too, you have to invoke an interactive operation like message. Of course, there is IELM, but this doesn't really help you for interactive functions operating on regions.And five minutes later, I realize I need to convert some string like "The (International) Noise Conspiracy|The Hi-Fives|Elastica" into a similar list structure. With a simple cut & paste and roughly 30 seconds later, I have
Hmm. Perhaps I've come quite a long way on the dark side already ... On the other hand, in Ruby, this is just as simple (I'm using irb, the interactive ruby shell here):
The difference here is the implicit array Ruby generates, which of course in Perl you could hide in the array position of the foreach loop. Note the annyoing misfeature of irb to always show the prompt even when your still continuing your current input line. In Common Lisp we can do it just as short:
The same thing here: The result of the split could have been easily embedded in the loop. The lesson, of course, is that in the end this example only serves to show that things that are easy to achieve in a high-level are indeed easy to achieve. Or to put it otherwise that the use of regular expressions is no more a discriminating feature between programming languages. Here's your XSLPosted by Holger Schauer in
Programming
Gary King discusses some issues of XSLT. He concludes:
I still feel as if there is less here than meets the eye; that it ought to be possible to express these graph-transformations more elegantly and with less fuss and bother. To me, the only interesting part of XSLT isn't XSLT itself, it's the embedded XPath where XSLT's power comes from. XPath is a pair of scissors for cutting out the nodes of an XML document instance you're interested in and is about as powerful (and hence horrible to get right) as regular expressions (although it's something completely different, of course). XSLT is just the framework which provides a relatively boring set of instructions and control-flow operations. And it's "clean functional" design only gets in the way every so often. Sure, coming from a Prolog and Lisp background, I know all the tricks to work around the hassle, but quite often it would be way easier to just set that damned variable *again*. If I want to do clean functional programming, I know where I can find a language without that XML syntax, thanks. Give me the unclean intermix of programming styles offered by Common Lisp anyday, please. Being a Lisp guy just like Gary, I would be happy to use a language with parenthesis, as I have to do XML transformations quite often and the intermix of elements from different namespaces (XSLT namespace and target namespace) is mostly a pain to read and write. Using xslide, an Emacs mode for XSLT, eases the pain a considerable bit, but it still isn't really fun. And sometimes I need to hack XSLT in a proprietary system which only provides editor capabilities that know nothing about XML (think notepad-style editing capabilities) and then XSLT suddenly has the next most horrible syntax imaginable. However, the corporate world has its own rules and to be fair, the major benefit of XSLT is that you have one standard syntax for XML transformations rather than having xyz numbers of incompatible library APIs. Update: Also in response to Gary, David Lichteblau pointed out his approach to (macro-)pre-processing XSLT stylesheets to overcome some of Gary's problems. Willkommen im RechtsstaatPosted by Holger Schauer in
German, Politics
So ärgerlich das ist, dass man in letzter Zeit immer mehr schwachsinnige Politikerideen per Gerichtsurteil kippen muss, muss man doch dankbar dafür sein, dass es diese Möglichkeit a) überhaupt gibt und es b) auch noch genügend Bürger gibt, die nicht jeden Unfug mitmachen. Aktuelles Beispiel: Verwaltungsgericht Mannheim stoppt Französisch-Zwangsunterricht an Gymnasien. Geklagt hatten wohl ein Vater und Sohn aus der Elterninitiative in Karlsruhe. Herzlichen Glückwunsch!
Extremely dangerousPosted by Holger Schauer in
German, Politics
Was hat uns die vergangene Woche gebracht? Einen Vorschlag, im Bio-Unterricht die biblische Schöpfungsgeschichte zu lehren, etwa.
Die Gesetzesverabschiedung zur Illegalisierung von normalen Tätigkeiten von Systemadministratoren müsste eigentlich den Fachkräftemangel in der IT-Branche demnächst kräftig erhöhen. Und dann mal wieder eine Diskussion über die Vorratsdatenspeicherung, mit Ausnahmen für, nein, nicht für Ärzte oder Rechtsanwälte, sondern für Geistliche und Abgeordnete. Man glaubt es nicht, und das ist wohl der größte Fehler. Der Oberhammer kam aber mal wieder von unser aller Möchte-Gern-Stasi-Chef: Gezielte Erschießungen und Internierungen sind das nächste Ziel. Da hat Fefe völlig recht: Dachau wäre doch gut geeignet. Aber das geht dann wohl sogar Beckstein zu weit, wenn man dieser Reaktionszusammenfassung auf tagesschau.de glauben darf (ausgerechnet Beckstein!). Tolle Woche, das, muss man schon sagen. Das Nichtstun wird momentan zur größten Gefährdung, denn dann haben solche Schießbudenfiguren in Amt und Würden freie Fahrt 50 Jahre Grundgesetz zu ruinieren.
« previous page
(Page 3 of 8, totaling 114 entries)
» next page
|
QuicksearchBlog AdministrationKategorienTagsCalendar
Powered by |
|||||||||||||||||||||||||||||||||||||||||||||||||
Dieser Blog wird von Weblog-Writer.net zur Verfügung gestellt; einem kostenlosen Dienst der IDEE GmbH
Powered by Serendipity 1.3.1.
Design by Carl Galloway.


