Gestern war wieder Saugnapf-Sonntag, dieses mal keine Themensendung, sondern Schrammel, Folk, Hiphop, und CD-Verpeilung. Torrent ist hier Saugnapf 5.
Interview mit Guy Steele in Dr Dobb’s
Guy Steele ist gerade das Thema in ziemlich allen Lisp-Weblogs. Er hat gerade den “Excellence in Programming Award 2005” von Dr Dobb’s bekommen, und die neue Ausgabe für April 2005 ist ein längeres Interview von ihm. In dem Interview erzählt hautpsächlich von seinem Werdegang an MIT, Harvard, dann bei Thinking Machines und dann Sun. Deswegen habe ich mir für 20$ ein Jahr lang Premium Access zu Dr. Dobb’s geklickt, was recht nett ist. Man kann die neue Ausgabe immer als PDF runterladen, und auch alle Backissues.
Jedenfalls habe ich gestern beim Rumbasteln an meinem HTML Pattern Matcher Nested Backquotes gebraucht. Siehe da, in CLtL2, das Guy Steele geschrieben (bzw. editiert) hat findet sich in Appendix C eine Implementierung von BACKQUOTE, geschrieben von Guy Steele. Code von “Legenden” ist eigentlich immer lesenswert. Auch die Lambda-Artikel von Guy Steele sind extrem spannend.
Saugnapf 4 Online
Endlich ist auch die Seite für die saugende, quiekende und das Trommelfell-massierende Spitzensendung Saugnapf, 4. Ausgabe, Online. Hier ist das Tracklisting, hier das Torrent. Dass das Leechen euch erfreuet, und der Sound euch zum Hüpfen, Tanzen und Zittern bringt.
ecto
Ecto somehow managed to fuck up all the fixed-width text used for program code in the LISP entries. This will get fixed ASAP, sorry.
Update: it should be better now :). Here is the LISP sourcecode I used to cleanup the entries. I replace P entries with monospace font with PRE entries. This sourcecode uses the HTML pattern matcher which can be found at svn://bknr.net/trunk/bknr/src/html-match . It is a real memory abuser, and quite slow too, but it works 🙂
(defun load-file (file)
(with-open-file (s file :direction :input)
(let ((lines (loop for line = (read-line s nil 'eof)
until (eql line 'eof)
collect line)))
(reduce #'(lambda (s1 s2) (concatenate 'string s1 s2)) lines :initial-value ""))))
(defun cleanup-ecto (file output-file)
(let* ((body (cons :html
(net.html.parser:parse-html (load-file file))))
(res (html-replace body
(html-pattern ((:p :style "font-family:monospace;font-size:13pt;") ?body)
(cons :pre
(html-replace ?body
(html-pattern :br (string #\Newline))))))))
(with-open-file (s output-file :direction :output :if-exists :supersede)
(net.html.generator:html-stream s
(mapcar #'(lambda (x) (net.html.generator:html-print x s))
(cdr res))))))
Festival mit esd unter Gentoo
Unser Router, welcher in einem unbenutzten Kuechenschrank untergebracht ist, hat Soundkarte und Boxen, schliesslich wollen wir Musik von jedem Computer innerhalb unseres Netzes mittels poc in die Kueche senden. Natuerlich wollen wir die Soundkarte fuer mehr nutzen: beispielsweise fuer die cron-gesteuerte Standuhr zur vollen Stunde oder fuer per Text-to-Speech umwandelbare Informationen. Fuer Text-to-Speech verwenden wir festival, welches auch als Gentoo Package zur Verfuegung steht. Leider ist in der aktuell von Gentoo angebotenen Version kein esd Support per USE-flags einstellbar. Da wir esd benoetigen, musste nachgeruestet werden:
Die unterstuetzten Audiomodule (esd, freebsd, irix, linux, mplayer, nas, sun und win32) werden vom Paket speech-tools bereitgestellt. Welche dabei konkret mit einkompiliert werden, haengt von der Datei config/config.in ab. Im ausgelieferten tgz ist esd-Support deaktiviert. Um diese Datei innerhalb des Gentoo-Buildvorgangs zu aendern, fuegen wir in der Datei /usr/portage/app-accessibility/speech-tools/speech-tools-1.2.3-r1.ebuild ans Ende der src_unpack Funktion folgendes an: use esd && sed -i 's/# \(INCLUDE_MODULES += ESD_AUDIO\)/\1/' config/config.in. Dies bewirkt, dass bei aktiviertem esd USE-flag das esd-Modul mitkompiliert wird.
Da wir auf unserem Router kein X installiert haben, muss die Makefile-Konfiguration des esd-Moduls angepasst werden: Wir fuegen zusaetzlich use X || sed -i 's/-lX11 -lXt//' config/modules/esd_audio.mak in das ebuild-Script ein, um nicht benoetigte Libraries zu entfernen.
Um zu ueberpruefen, ob unsere Aenderungen angewendet wurden, rufen wir ebuild /usr/portage/app-accessibility/speech-tools/speech-tools-1.2.3-r1.ebuild unpack auf und pruefen die unter /var/tmp/portage/speech-tools-1.2.3-r1/work/speech_tools/config/ liegenden Dateien config.in und modules/esd_audio.mak. Danach verwenden wir emerge um speech-tools und festival zu installieren. Ein aufgerufenes saytime verwendet daraufhin esd fuer die Audioausgabe.
Javascript experiences: tooltips
I finally wrote my first “real” javascript program this weekend. I have a lot of articles about biology. Each article can have tables, figures, and references to other articles. Furthermore, each article has a kind of small introductory text, called the “definition”. I wanted to have tooltips showing these figures, tables and definitions when dragging the mouse over a link. For example, if a paragraph features a link to another article, I wanted to have a tooltip showing the title, author and definition of the other article showing up. This would also be the first “real” program written with my “lisp to javascript” compiler.
Utz utz das Technomuseum
Kam gerade in einer Mail, die mir der liebe Mrf gevorwärtst hat. Ursprünglich über die netaudio Mailingliste. Ein kleines Lisp Snippet hat das übrige erledigt.
(defun load-techno-urls (file)
(with-open-file (s file :direction :input)
(loop for l = (read-line s nil 'eof)
with last-url = nil
with res = nil
until (eql l 'eof)
do (if (and (>= (length l) 7)
(string-equal (subseq l 0 7) "http://"))
(progn
(when last-url
(push last-url res))
(setf last-url (string-trim (list #\Space #\Tab #\Newline) l)))
(if (and (>= (length l) 1)
(eql (char l 0) #\Space))
(when last-url
(push last-url res)
(setf last-url nil))
(when last-url
(setf last-url (concatenate 'string last-url l)))))
finally (return (remove-duplicates (cons last-url res) :test #'string-equal)))))
A short practical overview of MOP: part 2
This is the second posting of what will be a series about practical uses of the Metaobject Protocol. The MOP enables introspection and customization of the Common Lisp Object System. In the first posting, we saw how to create custom slot definition objects, and how to add new slots to a class definition. In this posting we will see how we can use these custom slot objects to control slot access to our indexed objects.
A short practical overview of the Metaobject Protocol
I’ll try to write this blog entry in english. I’m not very used to writing in english though, so please bear with me 🙂
I will try to show how to use the Metaobject Protocol for CLOS (the Lisp OO system). When learning how to use MOP, I had quite a hard time finding examples on the web, and the seminal work about MOP (The Art of the Metaobject Protocol) doesn’t offer that much help either. Furthermore, MOP is not really standardized as it is, and most Lisp implementations offer subtly different implementations. The code I’ll present here has been tested with PCL-based Lisp implementations (SBCL and CMUCL, for example), and with Allegro CL. I guess it can easily be ported to other Lisp implementations, but haven’t got around to do it for now.
A good deal of the functionality of BKNR is based on the Metaobject Protocol, namely:
- the Indices package, which offers object-oriented indices on CLOS objects.
- the XML import/export package, which offers XML bindings for CLOS objects,
- the Datastore package, which offers persistent CLOS objects and support for logged transactions.
The Metaobject Protocol is a “meta”-layer above CLOS which allows both introspection and customization of the Object System.
Languages
Ich weiss immer noch nicht so recht, in welcher Sprache ich hier bloggen soll. Deswegen blogge ich jetzt abwechselnd auf deutsch, englisch und französisch. So wird jeder irgendwas nicht verstehen können 🙂
I’m still not sure about which language to use for this blog. I’ll blog in three languages for the next few posts: german, english and french. This way, everybody will be missing something. I’ll write a few technical postings in english though, to satisfy the new readers that slashdot has given me 🙂
Je ne sais pas trop quelle langue utiliser pour ce blog (en fait, je crois que je peux oublier le français, il y a quasi aucun lecteur ou lectrice francais qui me lit :). Je vais donc changer de langue au gré de mes humeurs dans les prochains temps. Comme ça, il y aura toujours quelqu’un qui ne comprendra pas les posts que je vais écrire, et je pouvoir me marrer en secret. Haha 🙂