Tuesday, November 05, 2013

GNUBahnen

Anfang des Jahres habe ich eine kleines Emacs Lisp Programm geschrieben um Textbeschreibungen zu HVV-Routen zu generieren. Das Generieren einer Route funktioniert zwar einwandfrei, aber da der HVV keine API oder Daten zur verfügung stellt und das extrahieren der Daten aus der Website zu aufwending ist, läßt sich das System nicht nutzen. Das ist nicht so schlimm weil es eh nur ein Prototyp zum von Texten aus Routenbeschreibungen sein sollte.


Jetzt lese ich grad ein Paper von 1998 zum generieren von Wegbeschreibungen der U-Bahnen in Montreal und Paris. Beim überfliegen war mir schon aufgefallen das wahrscheinlich Lisp benutzt wurde, als die Autoren dann aber schreiben das sie ihr Programm in GNU Emacs Lisp geschrieben haben war ich doch etwas erstaunt und mußte feststellen das Ich doch nicht der einzige war der seinen Editor für solche Zwecke gebraucht.


Fraczak, Lapalme & Zocke: Automatic Generation Of Subway Directions: Salience Gradation As A Factor For Determining Message And Form

Monday, November 04, 2013

Org-mode, biblatex & xelatex

Wie man die beiden überzeugt miteinander zu reden.


Ich arbeite Momentan ein einem kleinen Paper für meine Diplomarbeit. Zur Organisation des Textes, der Notizen und Quellen benutze ich Org mode. Org hat eine LaTeX Export, so daß man sich das Strukturieren und Schreiben konzentrieren kann. Aber standardmäßig nutzt Org weder xelatex (UTF-8, direkter Output als PDF) noch biblatex (?) und ganz wichtig, es gibt keine direkte \cite Unterstüzung.


Quellverweise

Zum Markieren von Quellverweisen nutzen wir Links im Org, die dann beim export zu \cite{ref} umgewandelt werden. Dazu wird im Org-Dokument ein neuer Linktyp angelegt:


#+LINK: cite rtcite:bibliography.bib::%s

cite und bibliography.bib können auch umbenannt werden, ersteres wird für Links ala [[cite:Ref13]] im org-Dokument gebraucht, letzteres ignoriert.



Damit die Quellverweise umgewandelt werden ist noch etwas elisp Code nötig:


(defun my-rtcite-export-handler (path desc format)
  "converts rtcite:<bib"
  (let* ((search (when (string-match "::#?\\(.+\\)\\'" path)
                   (match-string 1 path)))
         (path (substring path 0 (match-beginning 0))))
    (cond ((eq format 'latex)
           (if (or (not desc) 
                   (equal 0 (search "rtcite:" desc)))
               (format "\\cite{%s}" search)
             (format "\\cite[%s]{%s}" desc search))))))
(org-add-link-type "rtcite" nil 'my-rtcite-export-handler)

Ich habe meine bibtex Quellen direkt im Org-Dokument als Quellcode der vor dem PDF generieren getangled wird, die Überschrift aber mit :noexport: getaggt ist. Wenn man nur BibTex nutzt genügt es am Ende des Dokuments einfach folgendes einzufügen:

#+BEGIN_LATEX
\bibliography{<dateiname ohne .bib>}
\bibliographystyle{alpha}
#+END_LATEX

Für biblatex sieht das etwas anders aus, das muß im LaTeX-Header eingebunden & konfiguriert werden:


#+LANGUAGE: de-de
#+LATEX_HEADER: \usepackage[style=alphabetic,citestyle=alphabetic]{biblatex}
#+LATEX_HEADER: \addbibresource{<Dateiname.bib>}

Die #+LANGUAGE: Option sorgt dafür das das Babel Paket als ngerman konfiguriert wird, wonach sich biblatex richtet und statt Ed. nun Hrsg. ausgiebt.

Das Ausgeben des erfolgt wieder am Ende mit

#+LATEX: \printbibliography

xelatex mittels latexmk


xelatex erfordert andere standard Pakete als pdflatex, bzw. solche wie inputenc stören/sind überflüssig.


(setq org-export-latex-default-packages-alist
                '(("" "fontspec" t)
                  ("" "xunicode" t)
                  ("" "url" t)
                  ("" "rotating" t)
                  ("AUTO" "babel" t)
                  ("babel" "csquotes" t)
                  ("" "soul" t)
                  ("xetex" "hyperref" nil)
                  ))

Entweder weder konfigueriert man Org so das mehrmals xelatex und zwischendurch biber aufgerufen werden, oder man installiert noch latexmk und ruft diese einmal auf:

(setq org-latex-pdf-process '("latexmk -xelatex -bibtex-cond -f %f"))

Update Wie ich gestern herausfand sind die Software recht "neu". latexmk unterstützt xelatex erst seit Juli 2013, biber ist nicht in TeX Live 2009 (Version die Ubuntu 12.04 liefert) und die hidelinks Option für hyperref wurde 2011 oder so eingeführt. Benutzer von TeX Live oder MiKTeX sollten nach einem update auf 2013 alles haben.


TeX Live ist recht einfach zu installieren aber will standardmäßig erstmal 3GB installieren (die basis ist nur ein Zehntel enhält aber nicht die hier benutzten Pakete so daß man nachinstallieren muß)


Tuesday, October 29, 2013

#lisp mention

Computerlinguistik und Sprachtechnologie: Eine Einführung hat ein Unterkapitel zu "Programmiersprachen in der Computerlinguistik" das etwas belustigend ist. Es wird chronologisch mit Lisp & Prolog angefangen. Der Text zu Prolog ist recht kurz, dafür gibt es ein kleines Lisp Programm zum Sätze generieren (mit einem kleinen Fehler, in Zeile 34 fehlt ein ' vor den leeren Klammern). Der Autor verweist auf die verlorene Relevanz in der Computerlingustik mit xkcd hin, erwähnt den Regex Coach und empfiehlt Practical Common Lisp. Etwas befremdlich ist jedoch die kategorisierung von Lisp als funktionale Programmersprache, insbesondere da später Perl & Python als dynamische Sprachen betitelt werden.

Monday, September 30, 2013

Es müffelt

Was tun bei muffig stinkenden Klamotten? Eine Frage die sich mir vor kurzem leider stellt.


1. Vorbeugung

Damit es garnicht erst zum Muff kommt ist das wichtigste die Klamotten nicht zu lange in der Waschmaschine oder im Korb liegen zu lassen. Sobald die Maschine fertig ist raus damit, in den Trockner oder aufhängen. Ich setze mir dazu auf dem Handy ein Termin damit ich nicht umsonst in den Keller laufe.


Außerdem kann sich der Muff auch in der Waschmaschine selbst festsetzen. Um dem vorzubeugen ist es wichtig nicht immer die Universaltemperatur von 40° zu wählen, sondern die Wäsche zu sortieren und auch regelmäßig bei 60° oder 90° zu waschen.


2. Es stinkt

Sofern der Gestank nicht zu stark fest sitzt, reicht einfachen Branntweinessig als "Klarspüler" bei der Wäsche zu verwenden. Wenn das nicht hilft, die betroffenen Wäschestücke in einen Müllsack stecken, etwas Essig dazu, zu machen & mehrere Stunden einwirken lassen. Danach waschen, der Essiggeruch verschwindet beim Trocknen.


Generell hilft es die Wäsche an der frischer Luft und Sonne trocknen zu lassen.

Friday, September 27, 2013

König Ödipus

Inspired by a BBC show about Greek drama & democracy I started reading the classic Greek dramas by Sophocles, Euripides, Aeschylus. They're all in the public and thus cheap to acquire, basically you can read them all for free at Project Gutenberg … in English. I started out with Reclam Heftchen in German and would like to stay in German. Anyways, this post is just a I can point at a König Ödipus PDF I created with TeX:


Update: Kleinere Korrekturen (Zeilenumbrüche) & auch als EPUB

Sunday, April 21, 2013

Papers, Please

My favorite game at the moment is Papers, Please. It's and indy game set in a dystopian world in the 80s:


The communist state of Arstotzka has ended a 6-year war with neighboring Kolechia and reclaimed its rightful half of the border town, Grestin.

The atmosphere is just great as in well done. A split town after a war (East & West Greting), a another split town elsewhere (Glorian & True Glorian). Dark graphics, work to pay heat & food, denying people from other countries access, terrorism. And your job is to control, inspect, protect the regime. The rules change daily, to add pressure a timer is running and you get paid only for processed people. I love games set in such a gloomy environment, sadly it's still in beta but it looks very promising, would gladly pay for the full game.



Tuesday, March 26, 2013

Growl for Emacs

There are several packages for Emacs which let you send notifications to Growl but afaik none which implements sending notifications over the wire, implementing GNTP (Growl Notification Protocol). Given that it's not very hard to implement I put together an implementation. It's not very complete, it has no encryption, lacks error handling, it just does what I need, register notifications with icons and sending them.

Monday, March 18, 2013

uuurgh

That was too much LaTeX last night. I dreamt of writing a book on compilers or so and whenever I wrote GNU it had to be with spaces in between and a stylized ©. When I printed it out I found many places where I had to correct it, and the font for GNU was ugly.

Sunday, March 17, 2013

org-mode

I have just fallen in love with this emacs mode. I'm already using it to bring a little bit more structure into my live. I use it to manage information on some websites, my finances, TODO lists at work. I even bought the printed org manual. At the moment I'm working on a small project for university, a mix of text and code. When writing papers etc. mixing code with text usually is problematic, it's too wide, formatting stinks, code is usually copied from file but and must be manually copied formatted etc. when you change it. With org-mode you simply include the source code in your org file along with all the text and when you're done you simply export it as a LaTeX file. All in one place and easy to navigate.


org-mode best mode

Wednesday, March 13, 2013

Procrastination - With shaving tips

This is an old post which I never published. I still shave with a DE razor but switched to Merkur 37C, Tabac shaving soap and a 100 pack of Astra platinum. For more information I recommend visiting /r/wicked_edge

I shave, as does probably everybody else and as I'm male I'm mostly concerned about my facial hair. I started out by using an oldish Braun Micron electric shaver from my father. It served me well until I had to join the army. Army, so I thought, means going outside, camping and an electric shaver without batteries would simply be of no use in the woods. Hence I switched to wet shaving and got a Wilkinsons Protector 3 from my mother as a gift. Back then it was top of the line and I like the design. I used it with various shaving foams and gels, but it was always difficult to clean, the hair stuck between the blades. Luckily every recruit gets a welcome package with a Gillette Mach 3, which was far easier to clean, the only downside was that the handle wasn't as nice.

Years passed and somehow I heard about straight razors, safety razors and using shaving soap and a badger brush instead of canned gel. I talked to my dad about it, about wanting to buy a straight edge razor but they're kinda expensive. He then decided to gift me a used Dovo 500 & a badger brush for my birthday. It didn't quite work out, as either the blade is too dull or I was just to afraid & untalented. But I made use of the brush. Being completely inexperienced I started out with Wilkinsons shaving soap in a black bowl. It being in a bowl made it the obvious choice, and compared to the other bowl options It was cheap & available in supermarkets. It was difficult for me to build up lather but it didn't matter much as I always shaved immediately after showering. I was happy to have gotten rid of expensive canned goo. I still keep the last can around for travelling or an "emergency". Then my shop stopped selling the soap and I had to try the next best option: The Palmolive shaving stick. I cut bits of it into the used Wilkinson bowl and build up "lather" in it. Later I found out I don't strictly need soap if I shave immediately after showering and don't dry my face, yay even more money saved.

More time passes and a thread, on a forum I frequent, talks about shaving. There's one guy who's into safety razors or double edged blades because they're so cheap. He said he pays about 0,20 USD per blade when buying em in bulk. As I was chronically short on money the "cheap blades" didn't leave my head. So I did some research, tried to find out a good & cheap beginners safety razor model, but it's always came down to a ~30€ investment. Finally in the week after Easter I decided to go ahead and used my Amazon gift certificate to buy a Merkur 23C. The retailer didn't have blades and as I wanted to pay just once for shipping I decided to buy them at a drugstore, a mistake. They only had Wilkinsons (seriously, last Saturday I've visited 3 of the biggest drugstore chains in Germany and only one shop had a 2nd brand) which sells at 3.95€ for 10 blades, making it ~0.40€ per blade. Anyways, my first shave with a safety razor. I expected to get many cuts & a bloody face, but somehow it worked out, not one cut. Some areas don't weren't as smooth as I wanted, esp. my chin line and the neck (which was never smooth unless I went against the grain which I hardly ever do), but hey it's cheaper and feels better (not the shave but using the razor).

This week I had an exam, so I was procrastinating more than usual and did more research on how to get a better shave, better equipment, where to get the cheap blades (buy them in bulk on eg. http://connaughtshaving.com/) and how to shave better. Watching videos I always wondered how they get the lather to be so thick, mine usually sucks in comparison and I never got a 2nd serve out of it, never. Wanting to improve it, I went shopping on Saturday, went to five different shops too look for a bowl/mug, derby blades, tabac shaving soap and a new aftershave. I settled on a müsli bowl, tabac shaving cream and Old Spice. No luck on finding a Turkish shop which sells Derby blades. After I had gotten home and eaten the kumpir, I immediately went to use my new equipment. Wow what a change a) the creme smells, palmolive doesn't b) palmolive hardly lathered - tabac did great c) going against the grain didn't work at all but at least I was able to get three servings out of the creme.

So my current setup is as follows:


  • Tabac shaving creme (~4.50 €), Palmolive shaving stick (~0.80 €), Gillette shaving gel (backup)
  • Merkur 23C (~30 €), Gillette Mach 3 (backup)
  • Wilkinson Blades (10 for 3.95 €)
  • Balea Badger Brush (~8 €)
  • Generic ceramic müsli bowl (1.50 €)

total: 30 + 4 + 8 + 0.8 = ~43 € for a starter kit. Seems expensive to me, but keep in mind that running costs are very low afterwards (unless you become a shaving fanatic, buying more razors and esp. more brushes, damn things can cost up to ~200 €). It's just soap + blades, compared to a system razor, where you would have to buy soap anyways, it's ~30 € for a 12 pack of system blades vs ~7 € for 100 blades which last about 10 months. What you save in blades can be invested into different soaps (scents) or a higher grade brush (30-50 €). The general recommendation is to buy a badger brush, they're more pricey than synthetic, but seem to be worth it.

Since Saturday I've worked on my lathering technique and improved to so much that I even got two servings out of the Palmolive stick yay

Wednesday, March 06, 2013

rcirc + growl + convos on windows

How to growl with rcirc to get notified about convos:
Being annoyed about missing a convo with rcirc, I decided to get emacs to play a sound when somebody says something in a convo. Playing a sound with emacs is easy (play-sound '(sound "c:/path/file.wav")). Then I remembered that's to oldschool, I need to use growl. So here's my setup:


Ingredients

  1. Growl for Windows
  2. todochiku
  3. some elisp code

First install growler. Then because it disables M-x while it runs, we'll edit the config file c:/Documents and Settings/<USERNAME>/Local Settings/Application Data/Growl/2.0.0.0/user.config. Look for Alt+X and replace it with a combo you won't need, like Alt+Z.


Then install todochiku and configure it, specifically change the todochiku-command to c:/Programm Files/Growl for Windows/growlnotify.exe or whereever you installed growl. If you want icons get it from EmacsWiki: To Do Chi Ku and customize the todochiku-icons-directory to wherever you unpacked the icons.
Congratulations, you can now growl from within Emacs with (growl "Emacs here" "growling is a go").

The last step is to add some more code to get notified about hidden convos. The code below does that and redefines the hook that already comes with todochiku to include the text that mentions your nick.


(defun growl-convo-rcirc-print-hook (process sender response target text)
  (when (and (string= sender target)
             (not (string= (rcirc-nick process) sender))
             (not (string= (rcirc-server-name process) sender))
             (not (memq (rcirc-get-buffer process target t)
                        (rcirc-visible-buffers))))
    (todochiku-message "IRC convo" (format "<%s> %s" sender text) 'social)))
(add-hook 'rcirc-print-hooks 'growl-convo-rcirc-print-hook)

(defun growl-rcirc-print-hook (process sender response target text)
  (when (and (rcirc-channel-p target)
             (string-match (rcirc-nick process) text)
             (not (string= (rcirc-nick process) sender))
             (not (string= (rcirc-server-name process) sender)))
    (todochiku-message (format "IRC mention" target)
        (format "%s <%s> %s" target sender text)
        'social)))

Tuesday, March 05, 2013

Magic: The Gathering Sands of Time

Back in 1996 I somehow came upon Magic: The Gathering, and started to play with a limited budget due to being a 9th grader. To be honest, imho I sucked at it, I was a newbie but even when I stopped playing I still sucked. One reason I sucked was that in tourneys I got anxious, sweaty, heart racing & tunnel vision, that makes playing harder and loosing tougher. Playing M:TG wasn't good for my health nor my budget and two years later I decided that it's simply to expensive (you had to keep buying the latest sets to play in tourneys) and sold off all cards but one deck and three cards where I liked the artwork & and signed card.


Despite the stress, it was enjoyable and I still consider it to be a good game overall. I even play twice a year in a booster draft. What I love about the game is that it kinda is like Nomic, a game about rules. You start with a fixed set of rules and via the cards extend these. You can play and win in a plain way, simply deal enough damage with spells or creatures to kill your opponents. Or you extend the rules, twist & abuse them. That's what I liked (apart from rushing out as many creatures as fast as possible). One so called combo I came up with (and happens to be the reason for this post) is Equisands (not my deck, it has cards which didn't exist in 1997). The core of this deck is the card "Sands of Time", once in game it removes a phase from the game and replaces it with a similar rule. By it's own the card seems stupid but it changed the game in that block fundamentally. Because the removed "untap" phase was central to a another game mechanic of "phasing" (prior to your untap phase cards with "phasing" would leave the game until your next untap phase). The Sands removed that, cards could still phase out via other mechanics but they would never ever enter the game again and "Equipoise" phased out everything your opponent had more of then you. I am so proud of that combo because I came up with it on my own, nobody else I played with used that combo. I don't claim to be the first world wide, but in that circle of friends I was. Sadly I don't I ever won with it, I didn't have enough cards nor the money to buy them and I didn't understand yet that sacrificing cards/lifepoints can be good strategy too. But I was proud of my "invention" and it defined M:TG for me.

Monday, March 04, 2013

Music & Literature

Today I received a LP in my mail, the limited edition 12" vinyl from Melt Yourself Down. When I heard their song "Fix My Live" on BBC6 I knew I had to have that song, so I went to their site and ordered the LP and with it came free downloads for both their songs. Had I bothered to read their site, I could have found out that the mp3s where actually free and I wouldn't have this LP which I can't use because my record player is broken. Yet I'm happy to have this great piece of music and to have supported a independent band.


In literature news: I've managed to read five books last month which is a new record for me. That's probably more than I have read in the last two years and one of them was even a manual (for org-mode)! One was about the history of Lockheed-Martin, their lobbying and "golden" toilet seats. The last three were about Expat live in Estonia: Vello Vikervaars "Marrying into Eastern Europe" and Justin Petrones "My Estonia" 1 & 2. Then this Friday being out of books to read I followed the "recommendation" of Justin and bought A. H. Tammsaares five part epic "Truth and Justice" (in German). That was a bit of an effort as they weren't available on Amazon. In the end I had to buy them from four different antiquity dealers and got the impression that I've bought the last ones.