Kategorie ‘Code’

Gerade gefunden: Ein Link für alle, die wissen, was eine Turingmaschine ist.

Kommentare deaktiviert für Maschine

Ja, da war ich wohl ein wenig voreilig, das Verständnis des Buildsystems anzunehmen. Das stellte sich heraus, als ich den erfolgreich kompilierten gcc unter einem Debugger1 betreiben wollte. Wer schon einmal versucht hat, ein Kompilat mit eingeschalteter Optimierung zu debuggen, weiß, was ich meine: Variablen lassen sich nicht mehr auslesen, das Programm scheint im Code wirr vor und zurück zu springen -- selbst ein sehr einfaches, selbst geschriebenes Programm ist kaum noch nachvollziehbar. Nicht so schlimm, dachte ich mir, und habe mit CFLAGS='-g -O0' configure gleich den nächsten Build angestoßen. Die Ernüchterung folgte allerdings auf dem Fuße:2 die Flags waren irgendwo unterwegs verlorengegangen, und das Resultat kein bißchen brauchbarer als beim ersten Versuch.

Dabei bin ich eigentlich froh und dankbar, daß der gcc als Buildsystem die GNU Autotools verwendet. Sie werden zwar manchmal als veraltet und zu kompliziert abgetan, aber ich komme mit ihnen immer noch weit besser klar als mit CMake, Python Distutils und allem anderen, das ich bislang gesehen habe. Die Probleme beim gcc rühren allein daher, daß es mit dem bloßen Kompilieren nicht getan ist; stattdessen wird der dabei erzeugte Compiler dazu verwendet, aus dem Sourcecode noch einen Compiler (Stage2) zu erzeugen, und dieser wiederum erzeugt dann das fertige Kompilat (Stage3).3 Of will man in verschiedenen Stadien verschiedene Optionen verwenden, und deshalb gibt es auch einen ganzen Zoo von Umgebungsvariablen, deren Zweck nicht immer ohne weiteres klar ist.

Ach so, die Lösung: nach dem Konfigurieren einfach make BOOT_CFLAGS='-g -O0' bootstrap eingeben, und schon klappt es.

  1. Für den Fall, daß noch nicht alle des Programmierens nicht mächtigen Leser aufgegeben haben, sei gesagt: Ein Debugger ist ein Programm, mit dem man den Ablauf und den Zustand eines anderen -- möglicherweise fehlerhaften -- Programmen schrittweise verfolgen kann. []
  2. Jedenfalls halbwegs -- so ein Notebook ist nicht gerade die schnellste aller Entwicklungsmaschinen []
  3. Dieser Bootstrap genannte Zauber dient dazu, den fertigen Compiler mit sich selbst zu kompilieren, was ein guter Test für seine Zuverlässigkeit ist. []
Kommentare deaktiviert für Suboptimal

Eine kurze Statusmeldung: Inzwischen läuft der Build durch, und ein passendes Problemchen zur Analyse habe ich auch schon gefunden. Am Anfang ist es immer ratsam, sich einen weniger drängenden Bug zu suchen, weil es sonst leicht passiert, daß jemand mit mehr Erfahrung und Überblick schneller ist...

1 Kommentar

Es war vor ein paar Tagen, da saß ich in meinem Lieblingssessel, es war etwas früher als üblich, und es sollte ein schöner Abend werden. Endlich die Gelegenheit, etwas zu tun, zu dem mir sonst die Zeit fehlt -- doch was nur? Lesen mochte ich aus irgendeinem Grund nicht, und der Vokabelkasten neben mir wirkte auch nicht gerade verlockend. Ein Computerspiel vielleicht, dachte ich mir, wenn die Monster zur Tür hereinkommen und du die Taschenlampen und Bumerangs strategisch ums Bett herum verteilst ist das sehr befriedigend, weil die Kiste dir mit jeder Monsterwelle eine neue Herausforderung vorwirft aber du löst sie jedesmal und die Lösung ist so einfach und so elegant wenn du nur die Taschenlampen hinten in die Kurven und die Shuriken vorne an die Geraden stellst, aber nein irgendwie ist das ja auch alles repetitiv und ein bißchen langeweilig, und dann wußte ich du brauchst Code code CODE und es ist völlig egal daß du jeden Tag acht Stunden am Rechner verbringst du mußt jetzt und gerade den Compiler anwerfen und ein programmieren und jedes Problem ist eine Herausforderung aber das Programm löst sie und der Code ist so elegant nur ist es gar nicht repetitiv wenn du nur das richtige Problem hast und hinterher können tatsächlich Leute dein Programm benutzen und...

Nun ja, ich habe dann ein bißchen nach einem passenden Projekt gesucht. Vielleicht ein schönes buntes Mac-Programm? Aber bald fiel mir wieder ein, daß ich vor fünf oder sechs Jahren schonmal ein bißchen im gcc herumgefuhrwerkt hatte, und das hat mir eigentlich von allen Projekten immer noch am meisten Spaß gemacht: einerseits ist der Compilerbau schon soetwas wie die Königsdisziplin der angewandten Informatik, und andererseits gibt es beim gcc unglaublich viele kleine Nischen und Unterprojekte, in denen man sich nicht gegenseitig auf die Füße tritt, man aber auch Chancen hat, daß der eigene Code hinterher im fertigen Produkt Verwendung findet. Naja, und dann hat der gcc natürlich eine sehr zentrale Rolle im GNU-Projekt und eine unglaublich breite Nutzerschaft, und das schmeichelt dem Ego dann auch irgendwie.

Für's erste ist aber statt Blood, Sweat & Code noch der Kampf mit dem Buildsystem angesagt, damit ich den ersten Bootstrap hinbekomme.

3 Kommentare

This is again an entry bound to be uninteresting to most...

If you use Jim Rogers' Pipe Commands for Ada, and the linker complains about an
undefined reference to `c_constant_eof',
try
pragma Import (C, c_constant_EOF, "__gnat_constant_eof");
instead of
pragma Import (C, c_constant_EOF);

[via Usenet]

Kommentare deaktiviert für End Of Filedeutsch

Tags:

When your computer suddenly does funny things, Cosmic Rays may be at the heart of the matter. At least, that is what Nelson Elhage at the Ksplice blog suspects. Personally, I would wager more on defective RAM. Still, Nelson's debugging ist first class, and his post well worth reading.

Kommentare deaktiviert für Kosmischdeutsch

Dumb Thoughts

Whenever I enter our company's precincts these days, I am reminded of ice cream: a packed layer of snow, sprinkled with dark grit, looks just like chocolate chip ice cream; a thin layer of slightly dirty snow on top has more or less the colour of nut ice cream.

On Music

Never mind. I meant to tell you something totally different. It is about iTunes, the program I use to listen to music, and to keep my music library in order (and for a podcast or two). I have not yet bought anything from the iTMS, and nowadays, my iPod is used but rarely. So, I could just as well use a different program. On the other hand, iTunes works very well, it is integrated into the OS (on the Mac, that is), and I do not know of any real alternative.1

Out of tune

Nevertheless, there are some things I do not like. Mostly, these are minor points. For example, you can change the toolbar2 to suit you likings in almost every little utility; this is functionality provided by the operating system, so application programmers do not have to work too hard to include this in their program. Not so in iTunes. Or take Smart Playlists3: You can combine several criteria by either and or or, but not by both4. It is possible to work around this problem5 by combining several Smart Playlists.

Rated

Two points are, however, a bit bigger: the way iTunes works with albums, and with ratings.
iTunes' ratings are quite simple -- and that is the reason it looks a bit slapped-on to me: You can rate each track with one to five stars. These will be shown in your track lists, and you can use them in Smart Playlists6. That is about it. Wait, there is something else: when rating a complete album, the stars are copied to all the album's (unrated) tracks. They will be shown as outlines to remind you that the track as such has not been rated. Likewise, an album will be rated from the combined ratings of its tracks.7.

So far, so good. Such a simplistic rating seems to me to belong to the 90s8. My average rating is slightly better than four -- a prime example of grade creep. This is where I would like to see something completely new. I do not know exactly how it should work; however, the fundamental idea is to take away the need to give absolute ratings. Instead, one could for instance perform relative ratings between two tracks; the application would then calculate absolute ratings for all titles. Or maybe the rating is calculated incrementally, and you rate it up and down each time you listen to a track.9. Or maybe there is a totally different idea. Some engineer is bound to have a great idea.10

Albus, -a, -um

Now, I have to admit I am pretty old-fashioned. Since mp3 and similar formats have been accepted, the music business seems to have shifted toward single tracks.11 Albums are more or less dead.

Well, not for me. I still like to listen to whole records: the tracks belong together, forming a whole that is more than its parts, and sometimes, they even tell a story.12.

Fortunately, albums are not totally gone: iTunes will group tracks by album, putting the cover art next to the list of tracks. You can also instruct shuffle mode to play whole records at a time rather than single tracks. Finally, there is the indirect rating system I mentioned above.

However, I think there is still much room for improvement. For instance, I like to use Smart Playlists, to look for highly rated tracks, of for ones I have not listened to for a while. Sometimes, only isolated tracks from various albums will be collected in this way: I might have stopped listening in the middle of an album last week, so its first tracks are two weeks more recent than the last ones; or maybe, I have rated several tracks differently even though they belong to the same record, and now only a few can be found on my five-star list.

I would really like Smart Playlists to work better with albums: wouldn't it be great to have a list of albums collecting dust rather than just isolated tracks?

[Edit: English]

  1. Again: on the Mac. The situation may be different for other operating systems. []
  2. That is, the upper part of a window, where you will find icons serving as shortcuts to important commands. []
  3. Automatically compiled, rule-based collections of music. []
  4. Say, I cannot select all titles I like especially well and that are either from the 70s or belong to the folk genre. []
  5. Apple Mail does it, too. []
  6. For example, you could create a list of all tracks with four or more stars. []
  7. Unless you have explicitly rated the album already. []
  8. I am tempted to say: to last century. []
  9. I may have been less than clear: a new track is given an average rating, say, 3. Once I have listened to it, I think it is better than that, and iTunes increases its rating to 3.5 or so. After listening for the second time, I still think it is underrated, so it increases to 3.8 -- and so weiter in smaller and smaller steps. []
  10. I have added something to the wish list:

    What I would like to see in a future iTunes version is a truly innovative rating system. Instead of assigning a fixed number of stars per title, something that evolves as I build up my library and listen to music would be great.

    For example, once I have assigned preliminary stars to a new title, iTunes might allow me to compare it to other titles with a similar rating (say, while listening to the track). iTunes could then adjust its rating accordingly. Globally adjusting ratings in order to use the full spectrum of one to five stars might also be useful. Currently, the average rating in my library is slightly above four stars, however it is hard to correct this manually.

    []

  11. Except for concerts, that is. []
  12. And I like vinyl. But the drive does not fit into my Mac. Sob. []
Kommentare deaktiviert für Chocolate Chips and Nut Icedeutsch

Unter Macintoshjüngern-Anwendern gibt es seit Wochen nur ein Thema: die neue Version des Betriebssystems, 10.6, offizieller Codename Snow Leopard, sollte diesen Herbst erscheinen.

Es ist dann doch etwas schneller gegangen als gedacht (ja, das kommt auch in der EDV manchmal vor) -- seit dem 28. August kann man das System käuflich erwerben.

Spätestens jetzt können Nichtmacianer aufhören zu lesen; alle anderen mag vielleicht interessieren, daß Apple die neue Version ganz freimütig mit 0 new features vorgestellt hat -- um dann einzuschränken, eines gebe es doch: die Unterstützung von Microsoft Exchange nämlich. Wer in einem größeren Unternehmen arbeitet, mag sich darob dankbar gen Cupertino verneigen; den Privatanwender dürfte das aber weniger interessieren.

Was ist also neu am neuen System? Alles soll irgendwie etwas schneller, schlanker, flüssiger geworden sein, liest man allerorten. Wer etwas fundierterer Informationen bedarf, dem sei der sehr ausführliche Artikel von Ars Technica ans Herz gelegt. Zugegeben, das war jetzt sehr viel Vorrede, nur um einen Link unterzubringen. Darum bringe ich jetzt noch den letzten Tip an, sich von den ersten zweieinhalb Seiten des Artikels (im ganzen sind es dreiundzwanzig!) nicht täuschen zu lassen -- sie sind bei weitem der Teil mit dem wenigsten Inhalt.

Und nun bin ich still, damit ihr in Ruhe lesen könnt.

Kommentare deaktiviert für Zero New Features

Today, I learned something new about CSS: You cannot use :before inline. Come to think of it, that should have been clear. After all, inline styles are valid for exactly one element -- namely the element with the style option. But since :before is a pseudo-element, it does not have an HTML tag, so you cannot define an inline style for it.

I had tried something like this:

<div style=":before {content: url(xyz.png)}" >Text</div>

This is, of course, rubbish. Inline-styles lack elements as well as curly braces. I have solved the problem at hand slightly differently, though, so at long last this blog has category icons.

Kommentare deaktiviert für Trouble Inlinedeutsch

Mit iTunes kann man Musik hören. Ob das Programm nun gut oder schlecht ist, darüber kann man sicher streiten; ich finde es jedenfalls ganz praktisch.

Weil heute alles irgendwie vernetzt sein muß, erlaubt auch iTunes es, auf die Musiksammlungen anderer Rechner zuzugreifen. Dummerweise kann man Titel nur hören, aber nicht herunterladen -- technisch ist das ziemlicher Quark, aber da haben wohl die Rechteinhaber gedrängelt. Und noch etwas geht nicht: wenn andere Leute auf meine Bibliothek zugreifen, kann ich zwar sehen, wie viele; aber nicht, wer.

Ein kurzer Besuch bei der Suchmaschine meines Vertrauens[1] läßt mich jedoch wissen: wo die Applikation sich sperrt, hilft das Betriebssystem weiter. Bei Juretta finde ich einen netten Aufruf des Tools lsof, der meine Neugier befriedigt:

lsof -r 2 -n -P -F n -c iTunes -a -i TCP@`hostname`:3689

Leider bin ich noch nicht zum Testen gekommen, und der Eintrag von Stefan ist immerhin fast vier Jahre alt. Außerdem geht das so natürlich nur auf dem Mac, weil Windows lsof nicht kennt. Wer mag, kann sich ja eines der Windows-Tools daraufhin ansehen. Ein mögliches Problem: unter Unix ist fast alles eine Datei, auch Netzwerkverbindungen. Unter Windows mag das anders aussehen.

[1] Aus Prinzip ist das nicht Google -- die haben mir ein bißchen zu viel Marktmacht.

[Edit: Artikel vergessen]

4 Kommentare