Categories
Uncategorized

Infografiken fast wie im richtigen Leben

Dass man viele Dinge des täglichen Lebens in durchaus amüsanten Diagrammen darstellen kann, zeigt Jessica Hagy in ihrem Blog: http://thisisindexed.com/

Categories
Uncategorized

AppleScript experiences

Today I messed around in AppleScript. To be honest, it has not only been a pleasure.

Current working directory

One of the really annoying things I came across: An AppleScript application does not start within its directory, but within ~ (user’s root).
So if you want to do some work in the script’s real current working directory, you have to change there explicitely.
And even that comes with a drawback. You have to manually extract your script’s working directory.
To make the story short – here’s my solution of putting the working directory into a variable:

set pathOfScript to quoted form of (POSIX path of (path to me))
set cwd to do shell script "echo " & pathOfScript & " | sed 's/\\(\\/.*\\/\\)\\(.*\\)/\\1/g' "

Basically this two lines request the posix path to the script (including the script’s filename) and strip the filename using a regexp.
If you wonder about this crazy regular expression – it just selects the text between the first and the last forward slash (/).
It’s just blown up by massive need for escaping backslashes.
Briefly it’s this: search for (/.*/)(.*) and throw away the last group containing the filename.

Displaying a dialog box

Whenever there’s need for debug output and there’s no debugger (like in Apple’s Script Editor) you can always fire up a dialog box:

display dialog "hello world"

Scripting the Terminal

Apple’s shell (called Terminal) is also scriptable by AppleScript. You can e.g. open Terminal and execute a command taken from a variable ‘_cmd’:

set _cmd to "ls"

tell application "Terminal"
  activate
  do script with command _cmd
end tell

My motivation

Why the heck did I use AppleScript in the first place?
Well – I’ve written a Java application (deployed within a JAR file) but unfortunately I didn’t find an easy way to start this application via double click.
Manually entering the Terminal, exploring to the destination path and entering ‘java -cp FirstJar.jar:SecondJar.jar:. my.main.Class” is really annoying.
So now my AppleScript takes following actions:

  1. Open the Terminal
  2. Get the current working directory and change to it (cd …..)
  3. Start Java handing over the correct classpath and program arguments.
Categories
Uncategorized

mode selektor


Modeselektor – Black Block
Hochgeladen von sabotage
Categories
Uncategorized

Die Wurstaffäre

Ingolstadt, 10.2.2009

Flash-News aus der Ingolrockcity-WG:
Insider-Berichten zufolge musste eine minutiös geplante Wurstbrat-Aktion kurzfristig in letzter Minute abgeblasen werden, da das Olivenöl schon bei sonntäglichen Weißbierkaiserschmarrnbrataktivitäten bis auf den letzten Tropfen wegkonsumiert gewesen worden war.
Nachbarn und umläufige Anreiner reagierten bestürzt bis gar nicht auf diesen Vorfall.

UPDATE: Nachdem der Hunger keine weitere Verzögerung mehr zuließ, haben sich die Bewohner der Holzer-WG wagemutig dazu entschlossen, Würschtl ohne Fett in der Teflonpfanne herauszubraten. Saulangweilig.

Categories
Uncategorized

Die Geschichte vom Weißbierkaiserschmarrn

… ist eigentlich gar keine. Aber endlich wars so weit. Das Rezept wurde mir von einem Neo68er zugetragen und am Sonntag endlich in die Tat umgesetzt. Eine wahre Freude.

Categories
development web

My whereabouts (preface to DOM manipulation with Javascript)

Hi there, for a long time I didn’t blog here. That’s partly because in June I changed my working field from pre-development to development for the mass production. This has been a great opportunity – connected with a permanent hiring at my alltime-favourite car company: Audi.

But now I’m enjoying my winter holidays at my parent’s place – and I’ve got time to checkout something that had interested me for quite a time: Javascript. Some years ago I already did take a few steps with JS – but then it wasn’t really comfortable at all.

Now – a few years later, there are interesting libraries available that cover a wide variety of  common tasks – mostly driven by developers from the AJAX movement.
But not only are there some libs – there are great IDEs that allow a fast and efficient development.

After asking a few fellow developers, I decided to try the Eclipse based Aptana IDE together with jQuery – a lightweight library that seemed to suite my needs quite well. I also took a glance at dojo – but the small distribution package of jQuery (one single .js file) was exactly what I was searching for.

Categories
development web

jQuery

As I already told, I’m doing my tests within the Eclipse based Aptana IDE.
During creating the project, you can already decide which Javascript libraries to use (I chose jQuery).

My use case: Filtering the rows of a big HTML table on client side. Of course, this usually calls for a database driven solution, but as a matter of fact I wanted to support the filtering even in offline situations.

Preparing the HTML file

<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="myFilter.js"></script>
<title>My HTML page with client side filtering</title>
...
</html>

myFilter.js

Within myFilter.js we can define our own user functions. By the way: I really love object orientated development – but this time is not the day of OO. So please don’t be disappointed if you’ll see classic procedural style in this blog entry. Maybe some day I’ll find out how to do nice and lean OO within Javascript. 😉

There’s one special callback function that is called from jQuery core after the page has completed loading:

$(document).ready(function(...){});

Within this anonymous method, all the magic is taking place. Within there we’ll even define our own methods, such as

filterTable = function()
{
   //your code goes here
}

Selectors

One of the base concepts of jQuery (next to Chaining) are Selectors. With selectors one defines the subset of the DOM that you want to manipulate, e.g.:

$('#traceTable > tbody > tr')

Selects all rows of the HTML table with the id=’traceTable’.

Chaining

A typical jQuery command is chained. That means that a method call to a jQuery object returns another jQuery object. This may look a  bit weird at first glance, but it’s quite comparable to piping in Unix environments, e.g.:

$('#traceTable > tbody > tr').each(function (i) //execute the function for all <tr> elements of tbody in #traceTable
{
   filterRow($(this), filterText);
});

What you can see here is a combination of several techniques. Both the selector $(‘…’) and the each() function are returning objects of type jQuery. Within each() an anonymous function is called for every element of the selector. Note: In the context of each() there’s also a context change of $(this). It references to the currently traversed element of the selector!

Categories
Uncategorized

EM 2008 – die Blumentopf Reportagen

Wie schon vor zwei Jahren – zur WM 2006 – berichtet das “Blumentopf Experten Team” zu allen Deutschland-Spielen in Form von kurzen HipHop-Songs, die erkennen lassen, wie viel Potential die Münchener Jungs haben:

GER – POL (8. Juni, 2:0)
GER – CRO (12. Juni, 1:2)
GER – AUT (16. Juni, 1:0)
GER – POR (19. Juni, 3:2)

Categories
Uncategorized

SVN mit Apache (HTTP) und SSL (HTTPS) installieren

1) APACHE installieren.

http://apache.mirror.clusters.cc/httpd/binaries/win32/apache_2.2.8-win32-x86-openssl-0.9.8g.msi
(Standard-Installation -> Port 80 (anderer auch möglich, aber firewalltechnisch problematisch)

2) SVN herunterladen und installieren
http://subversion.tigris.org/files/documents/15/41687/svn-1.4.6-setup.exe

3) die .so-Module aus dem bin-Verzeichnis von SVN in das modules-Verzeichnis des Apache kopieren.

4) httpd.conf von Apache (im Ordner /conf) bearbeiten.

Folgende Zeilen müssen (natürlich nicht auskommentiert) in der httpd.conf stehen
(die erste müsste schon vorhanden sein und muss lediglich noch einkommentiert werden)

LoadModule dav_module modules/mod_dav.so
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so

5) Ein Repository anlegen (z.B. mit TortoiseSVN)
5.1)
Es empfiehlt sich, einen Parent-Path für alle Repositories einzurichten.
z.B.: D:\development\svn
5.2) In diesem Pfad ein (oder mehrere) Verzeichnisse anlegen, die dann die Repositories beinhalten.
z.B.: D:\development\svn\main
5.3) Mit installiertem TortoiseSVN gehts am einfachsten (siehe Abschnitt ‘Web-Links’). Auf den neuen
Ordner im Explorer rechtsklicken > TortoiseSVN > Create repository here…
Als Dateisystem empfehle ich FSFS.

6) Repositories im Apache bekannt machen
Folgenden Abschnitt (mit korrektem Pfad) AM ENDE der httpd.conf einfügen:
<Location /svn>
DAV svn
SVNParentPath D:/development/svn
</Location>

Ab diesem Zeitpunkt haben wir ein prinzipiell lauffähiges Subversion-System.

7) Zugriffsrechte regeln
Grundsätzlich kann ein bestehendes DHCP-Verzeichnis angebunden werden.
7.1) Das Tool htpasswd.exe aus dem Verzeichnis “Apache/bin” in das Repository-Hauptverzeichnis kopieren.
Alternativ kann man es auch in die Path-Variable aufnehmen.
7.2) Auth-File mit dem ersten user erzeugen: htpasswd -cm svn-users chle
Es erscheint eine Passwort-Abfrage für den neuen Nutzer.
7.3) Weitere User werden mit dem Kommando ‘htpasswd -m NEUERBENUTZER’ angelegt.
7.4) Auth-File im Apache bekanntmachen (Erweitern der Location-Definition ‘svn’ in httpd.conf)

<Location /svn>
DAV svn
SVNParentPath D:/development/svn
AuthType Basic
AuthName “Subversion repository”
AuthUserFile D:/development/svn/svn-users
Require valid-user
</Location>

8.) HTTPS-Verschlüsselung einrichten
Da die Authentifizierung über das Verfahren ‘HTTP-Basic’ im Plain-Text geschieht,
ist es notwendig, eine zusätzliche Sicherheitsschicht zu verwenden. HTTPS wird
von Apache unterstützt.

8.1) Die OpenSSL Konfiguration muss interessanterweise noch zusätzlich geladen werden
und in den bin-Ordner von Apache kopiert werden: http://www.neilstuff.com/apache/openssl.cnf
Das Kommandline-Tool ‘openssl.exe’ (apache/bin) wird in den folgenden Schritten Mittel der Wahl sein.

8.2) Erstellen eines Self-Signed Certificates

8.2.1) Erstellen des Certificate Requests
openssl req -config openssl.cnf -new -out svnserver.csr -keyout svnserver.pem

Das Tool fragt an dieser Stelle nach vielen Informationen. Allerdings muss keine angegeben werden.
Vor allem das Passwort ist an dieser Stelle nicht nötig, das wird später Apache übernehmen.
Es ist sinnvoll, ein paar Informationen (wie Host, Land, Firma, …) anzugeben, da diese später
im Zertifikat nachlesbar sind.

8.2.2) Erstellen eines passwort-losen Schlüssels für Apache
openssl rsa -in svnserver.pem -out svnserver.key

8.2.3) Datei ‘.rnd’ löschen. Diese könnte u.U. für Cracking-Zwecke missbraucht werden

8.2.4) Zertifikat erzeugen
openssl x509 -in svnserver.csr -out svnserver.cert -req -signkey svnserver.key -days 3650
(Die Gültigkeitsdauer von 10 Jahren ist etwas hoch, aber naja)

8.3) SSL in Apache aktivieren

8.3.1) SSL Modul aktivieren (httpd.conf, Zeile einkommentieren)
LoadModule ssl_module modules/mod_ssl.so

8.3.2) Include httpd-ssl.conf: (Zeile in httpd.conf einkommentieren)
Include conf/extra/httpd-ssl.conf

8.3.3) Zertifikat kopieren
Das erzeugte Zertifikat (bestehend aus den beiden Dateien ‘svnserver.key’ und ‘svnserver.cert’)
in ein neues Verzeichnis conf/ssl kopieren

8.3.4) conf/extra/httpd-ssl.conf anpassen:
Die Einträge ‘SSLCertificateFile’ und ‘SSLCertficateKeyFile’ müssen auf die jeweiligen Files zeigen:

SSLCertificateFile “C:/Program Files/Apache Software Foundation/Apache2.2/conf/ssl/svnserver.cert”
SSLCertificateKeyFile “C:/Program Files/Apache Software Foundation/Apache2.2/conf/ssl/svnserver.key”

9) Fertig.
Im Browser kann man unser Beispiel-Repository z.B. unter https://localhost/svn/main erreichen. In Toirtoise-SVN gibt man dieselbe Adresse als URL an.

WEB-LINKS
1) http://svnbook.red-bean.com/en/1.4/svn-book.pdf
2) TortoiseSVN http://tortoisesvn.net/downloads
3) Anleitung “Subversion unter Windows” http://svn.spears.at/
4) Anleitung “Apache mit SSL unter Windwos” http://www.netzadmin.org/server/apache/apache-ssl.htm

Wichtiger Hinweis:
Rechte-Vergabe unter Windows. Apache sollte als Dienst laufen, der die Rechte eines nicht-privilegierten Users besitzt.
Die Zugriffsrechte für die entsprechenden Verzeichnisse müssen dementsprechend angepasst werden.

Es ist sinnvoll, den Zugriff auf das Repository auf HTTPS zu begrenzen (also kein unverschlüsseltes HTTP zu erlauben).

Categories
Uncategorized

setting display properties in windows via script

if you need to set your screen settings and don’t want to go all the long hard road within the control panel, there are several possibilities. two that i have found:

  •  open the display properties panel by executing ‘control.exe desk.cpl,Settings,@Settings’
  • use Anders Kjersems tool ‘QRes’ http://www.aksoftware.tk/ It’s just perfect!