2016-11-28

Ubuntu 16.04 - Macintosh Tastatur - Schweizerdeutsches Layout

This post is in Swiss German for obvious reasons.

I han chrüzlech so ne ultra-cooli Mac-Alu-Taschtatur übercho. En Mac-Mini hani scho, aber MacOS hani ned wölle... Ubuntu funktioniert rächt guet uf Mac-Hardware. Die folgendi Aaleitig sött aber ou for Mac-Taschtature a nid-Macs funktioniere.

Mac-Tastatur aschliesse: d'Helfti vo de Taschte sind falsch beleit. Compi unbruchbar.

Ubuntu> sudo dpkg-reconfigure keyboard-configuration

-> "Generische PC-Tastatur mit 105 Tasten (Intl)"
-> Swizerland
-> Switzerland - Deutsch (Schweiz, Macintosh)
-> Der Standard für die Tastenbelegung
-> Keine Compose-Taste

Denn neu boote (Login isch ned gnueg).

Erklärig: De Trick isch die erschti Iischtellig "Generischi 105-Taschte", und nid öppe "Macintosh", wie me jo vermuete chönnt.

Jetzt chunnt no d'Fiinarbet.

Es sind no zwöi Taschte vertuuscht: Paragraph/Grad linggs obe, und grösser/chliner linggs unde. Die chamer zom Biispil so tuusche:

echo "keycode  49 = less greater less greater lessthanequal greaterthanequal lessthanequal" >> .Xmodmap
echo "keycode  94 = section degree section degree NoSymbol NoSymbol NoSymbol NoSymbol section degree NoSymbol NoSymbol section degree" >> .Xmodmap
echo /usr/bin/xmodmap $HOME/.Xmodmap >> .xinitrc

Jetz sind alli Symbol uf de richtige Taschte. Leider sind aber nid alli aagschribe. Als Programmierer fähled mir do extrem wichtegi Symbol wie: gschweifti und eggigi Chlammere, Backslash, Tilde usw.

Mit Mac-Benutzer diskutiere nützt nüt. Die findet das guet. Sie chönnd ihre Taschte usswändig und findet, wer das nid chönn, söll sich doch en PC choufe, oder wenigschtens e Logitech-Taschtatur. Mac-User sind e Ploog.

Ich ha drum en wasserunlösliche Folieschriiber gnoh und folgendi Taschte annotiert:

N: Tilde
S: Doppel-S ("esszett")
3: Gartehaag
5: offni eggigi Chlammere
6: gschlossni eggigi Chlammere
7: sänkrächte Strich (unde), Backslash (obe)
8: offni gschweifti Chlammere
9: gschlossni gschweifti Chlammere
fn: Insert
Pfiil lings ufe: Home
Pfiil rächts abe: End

Jetz isch die Taschtatur einigermasse bruuchbar, wemme sich merkt, dass me die undere Symbol mit der rächte "alt"-Taschte erreicht, die obere Symbol mit rächts-alt-Shift.

S'isch echli blöd, dass me für eis vo de meischtbenützte Symbol, de Backslash, grad drüü Taschte gliichziitig trücke mues. Vilich mach ich mer do schpäter ou no en "modmap".

Wiitere Knackpunkt: alt-Space macht nid öppen es normals Läärzeiche wie die normal PC-Taschtatur, sondern es Unicode-Läärzeiche, wo uusgseeht wienes normals, aber imene Programm-File zum Biischpil es Riesen-Unheil aarichte chann:

> file prog.c
prog.c: C source, UTF-8 Unicode text

Das git Ärger. Such die Ziile mitem Unicode-Läärzeiche:

> grep -P "[\x80-\xFF]" prog.c

und ersetzes

> vi prog.c
> file prog.c
prog.c: C source, ASCII text

grettet!

2016-09-06

Extract subversion metadata directly from checkout, without subversion tools

Hello readers!

By now, you suspect that I am an avid subversion user, or at least a professional programmer, so yes. I might as well admit it.

The following trick is not for the showroom. I had to work with incompatible subversion versions. It usually is a pain to work with different versions of subversion. Checkouts are incompatible.

Anyway, I had to find the author and revision number of the last commit in a given checkout, without having the proper subversion command line tool at hand. It can be done, because subversion metadata resides in a sqlite3 database in the .svn directory.

This is the magic incantation:

sqlite3 .svn/wc.db "select changed_author,changed_revision from NODES order by changed_revision desc limit 1;"

There are many other interesting items to be found in .svn/wc.db and the database schema seems to be fairly stable since subversion 1.6 or so.

2016-09-02

following code through history, in subversion and git

Both, git and subversion, have the famous "blame" command, which allows me to see, line by line, who changed this line of code last.

Sometimes it is not the latest modifier of a line who is its true author. For example when a programmer added or removed whitespace for better readability, she will then be "blame"d as it's author, even though she is not.

In this case, it is possible to give the blame command an additional agrument, saying "look at the file in this revision, and tell me who brought it up to that state, line by line".

in subversion:

$svn blame filename
   649     joe  today's code
$svn blame filename -r648
  171     jim previous code
$svn blame filename -r170
 svn: Unable to find repository location for 'filename' in revision 170

in git:

$ git blame filename
3c9fb2a17 (Joe 2016-09-01 16:43:11 +0200 1) today's code
$ git blame filename 3c9fb2a17^
 98bcec40b (Jack 2016-06-23 18:04:55 +0200 1) previous code
$ git blame filename 98bcec40b^
fatal: no such path filename in 98bcec40b^

Note the caret (^) you have to add to the end of the git hash. It means "the previous commit from that designated by the hash". In subversion, where everything is nicely ordered, you simply subtract one in order to get the same effect.

One day I might write a script that traces the history of a single line of code back to its creation. Please tell me if this has already been done.