Talks

I really enjoy giving talks. This is particularly because I like to teach people something and because I’m really enthusiastic about the technical things I talk about. Once of these things are obviously decentralized version control system, in particular Git and Mercurial. Finally after two years of submitting talks to various conferences, people and conferences in the PHP community start to pick up this topic. Seems that 2010 is the year of DVCS, and I’m really looking forward to give a talk about the advanced features of Git at

The talk will give a very brief overview how Git works, and will then give a more detailed insight in how Git handles commits, files, etc so that people get a very good understanding about the concepts that are needed to fully understand tools like git rebase, git reflog and git svn. The aim is to provide them will all necessary information and a few examples to get lost commits back, rebase their branches and design more complex git workflows in the future without needing to search the web or ask a guru.

A second talk will be more focused on beginners and developers coming from subversion. This talk will be part of a series of talks the german telekom is organizing. I’ll also give an extended version of this as an in-house workshop at a Munich based company.

So for me it seems that after five years, DVCS is mature enough to get into companies and that we can expect a bright variety of companies to adopt new tools and workflows. Let’s see what’s coming…

For sure I still offer Git and Mercurial trainings, so feel free to contact me (dsp ~at~ php ~dot~ net)

probably shameless self promotion

Clojure, and it’s not a typo.

Why lisp can be sooooo sweet. A clojure class extending java.

compile it

(set! *compile-path* "build")
(compile 'net.experimentalworks.clojure.outdegree)

Ah yeah and hsv2rgb transformation:

Writing a simple PHP sourcecode buildscript in Scala

Scala is a fascinating language. Running on the Java VM, Scala offers a powerful mixture from both the imperative Java world and functional programming including modern techniques like Actors. Personally I prefer to not just learn programming languages, but also try them out while reading through the book.

As I wanted to have nice a build system for my PHP subversion checkout, I used this need as a project to start coding Scala. So what do I exactly need? I want to build multiple versions of PHP from the same branch without checking out the code twice. I also want to configure these builds somewhere without always typing in the parameter list or so. For further versions I want to be able to configure these in a file that can easily be distributed to other machines.

I set down and wrote a parser for a configuration file that can configured build targets which is then build by
the program. The configuration file I used is specialized for this purpose, which is why I didn’t used something like ant or so. The result is called bauaffe-3.0.0a1.jar.

I’ll just show a few things done in the project, but mainly focus on what the nice script can do. Further blog posts will be about the actual implementation.

The configuration looks like this

$ cat ~/.buildmaker
begin default configuration
    define source "/Users/dsp/dev/c/php-src"
    define build "/Users/dsp/dev/c/php-src/build"
    define defaults as
        with "iconv=/opt/local"
    build trunk as
        "php60" using defaults
        "php60-debug" using defaults
            enable "debug"
    build branch "PHP_5_3" as
        "php53" using defaults
            environment PHP_AUTOCONF="autoconf213"
        "php53-debug" using defaults
            enable "debug"
            environment PHP_AUTOCONF="autoconf213"

.
Proper indention is not necessary (as e.g in python).


You might want to think that parsing the configuration file can be difficult. Well, if you use C you would use YACC, if you use PHP, I don’t know what you would have done, but Scala is made to create this kind of Domain Specific Languages (for my the config is a DSL). You can easily transform a EBNF directly to scala code using the JavaTokenParsers provided by the Scala Library. As an example this it the statement that parses the first line:

def begin : Parser[Configuration] =
"begin" ~ ("default" | stringLiteral) ~ "configuration" ~ rep(define | build) ^^ {
case "begin"~name~"configuration"~confs => new Configuration(name, confs)
}

which is directly taken from the BNF:

config ::= "begin" ( "default" | string ) "configuration" ( define | build )*

Did I mention that the actual parser is 170 lines of code with usual indention and formatting?


Configuration
The configuration file is searched in ~/.buildmaker, or if ~/.builmaker doesn’t exists, buildmaker.conf in the current directory. How do you configure the tool? First of all you can specify a configuration. It is usually called “default”. It is not yet supported to name it differently, although the parser is able to parse it. In further versions multiple configurations per file are allowed.

Variables
Variables are set using the define syntax. At the moment you can set the build and source variable as well the defaults variable, which is usually a block of statements that can be used in the branch configurations.

Branches
A branch is configured using the build syntax. You first have to specify which branch to build. Every branch can then configured to have build target with a given set of options. Branch options are:

  • with string: Builds the target with the given extension
  • enable string: Builds the target with the given extension
  • environment string=string: Builds the target with environment variable

. You can specify using defaults which will cause the runner to use the options specified in the defaults define.

At the moment the parser will not do a good job in notifying you what you are allowed to do and what not, although pure parse error will be emitted. You can also not set any other variable than the described once.

Building
Calling

$ java -jar bauaffe-3.0.0a1.jar list
TARGET                         LAST BUILD
php60                          None
php60-debug                    None
php53                          Sat Jan 09 16:55:12 CET 2010
php53-debug                    Sat Jan 09 16:59:37 CET 2010

gives you a list of parsed targets and their last build date. You can build a target using

$ java -jar bauaffe-3.0.0a1.jar 

or build all using

$ java -jar bauaffe-3.0.0a1.jar all

Please notice that the current version requires that you now what you are doing. You might miss some error messages or find them not useful. I’ll change this before the first release, if I’ll do a final version of it. I hope you like the little tool.

Download It!

Scala (pronounced /ˈskɑːlə, ˈskeɪlə/) is a multi-paradigm programming language designed to integrate features of object-oriented programming and functional programming.[1] The name Scala stands for “scalable language”, signifying that it is designed to grow with the demands of its users.

Show exit status of the last executed command in ZSH prompt

We recently stumbled over the problem that we want to know the exit status of the last command that was executed in our ZSH. Well the obvious thing is echoing $?, but as we need this quite often we want to have it in our right prompt. Googling around a little bit, we found the solution:

In your .zshrc add the following line

RPROMPT='[%?]'

This will give you the last exit status on the right site of your shell.

My zsh now looks like this (with the additional stuff)

buenosaires:~/dev/c/git.git/>                                         (next)[1]

Writing a hg to subversion gate

Using a decentralized version control system (DVCS) like Mercurial (hg) or Git as a client for Subversion is very common. With the unique features of a DVCS a developer can have both the features of offline development and local branching while still being able to push to a subversion server. This approach is often used in environments in which subversion is the given version control system. While the approach of using this bi-directional push and pull mechanism, provided by git-svn or hgsubversion, works perfectly for one developer, it has limitations working in a team using the usual DVCS push and pull concepts.

The following article will outline the current limitations of bi-directional dvcs to subversion bridges and shows a simple approach to implement a solution for a certain instance of the problem.

Continue reading

Ask a Droid

I bought a G1 dev phone six month ago. Not because I seriously wanted to write applications for the android platform, but because it was the only way to get an Android based phone in Europe. Nevertheless, the complete Android platform is really appealing to me, mainly because it’s more open than an iPhone, there are much more nerdy apps for it and – yeah I know what you think – it’s based on Java.

Warning this is a potential boring blog entry. Apprx writting time was about 5min

I once tried writing applications for the iPhone and started to like the concept of Obj-C while still I hate the syntax and I don’t like the API that much. Android makes things simple for me, and I guess for most people knowing a little bit java. It implements big parts of the Java standard (although it doesn’t claim to be standard compatible) which makes it easy to start writing apps if you know the libraries a little bit. Android also includes the powerful HTTP libraries of the Apache project as well as Json and XML parsers.

Having said this, the most important factor why I started to love my phone and the Android system: I can easily deploy apps on my phone, I debug it on my phone, I have nearly the complete power of the java framework and I totaly enjoy seeing my first app starting on the actual phone after 1 hour of coding. The app itself is fairly simple. It’s a basic search interface phpMyFAQs upcoming Rest API.
So you can search an existing phpMyFAQ installation for a search term and display the result. Although the app needs phpMyFAQ 2.6.0-alpha it’s already available in the Android Market. So feel free to check it out. You can test it with the URL: http://faq.phpmyfaq.de/. The source can be found at http://github.com/thorsten/pmfMobileKit. Expect more updates to the app soon.

CRE

Ich bin mir gar nicht mehr sicher, wann ich das Chaosradio entdeckt habe. Es wird so ca. vor zwei Jahren gewesen sein, als der Begriff Podcast geschaffen wurde und die ersten deutsprachigen Podcasts das Licht der Welt erblickt haben. Als technologieverliebter Nerd stößt man so unweigerlich früher oder später auf das Chaosradio. Während ich anfangs eher das dreistündige Chaosradio, das auch auf Fritz ausgestrahlt wird, anhörte, bin ich doch relativ schnell dazu übergegangen Pritloves Express-Variante zu abonnieren. Denn sind wir mal ehrlich, zwar sind die Anrufer bei Chaosradio manchmal ganz amüsant, doch zum Großteil eher nervend. Die kompakten und meistens inhaltlich guten Folgende des CREs machen da deutlich mehr Spaß.

Inhaltlich ist das CRE eher technisch aufgestellt und befasst sich mit allem was den Nerd erfreut, sozusagen die Cub-Mate des audiophilen Tekki. CRE ist also gut für die Geek-Gesundheit, liefert einen Blick über den Tellerrand und, hepp, befasst sich sogar mit Soziologie und Politik. Und manchmal werden sogar langjährige Wünsche erfüllt.

Absolute Highlights sind natürlich Folgen wie die Bayrische Hackerpost, Internet Memes und der Mifare-Hack. So ist es kaum verwunderlich, dass man nach späterstens zwei Wochen CRE freie Zeit anfängt unruhig den CRE Blog anzusurfen und den Podcast Feed zu abonnieren. Leider fehlt immer noch was zum Thema PHP, aber das ist ja per se uncool, deswegen wird das wohl auch nichts mehr. Schade eigentlich, vielleicht gibts ja nochmal was dediziertes zum Thema Flamewars, da kann man PHP dann immer gerne einstreuen. Überhaupt gibt CRE immer Anlass zur Diskussion, meistens weil ein Detail in irgendeinem Nebensatz nicht stimmte oder allgemein der Gast inkompetent war, aber eh klar: man selbst ist immer der bessere Experte (vorallem wenn es um DVCS geht, wo’s vielleicht sogar stimmen würde *rant*). Aber auch “ranten” gehört zur Informatikerausbildung. Also immer brav CRE hören.

Was man am CRE verbessern kann?:
Ich finde die Idee mit einem Photo pro Podcast eigentlich ganz gut. Mehr fällt mir auch nicht ein.

Und jetzt weiter in der von Tim initiierten Blogkette:
Zurück zu Nummer 12 in der Blogkette.
Weiter zu Nummer 14 in der Blogkette.

und jetzt weitermachen!

hg-scm.org

For those of you, who didn’t notice so far, in the last 6 month we worked on a more userfriendly and accessible page than the current mercurial website. Three weeks ago we launched hg-scm.org which is quite similar to git-scm.org. I hope you enjoy it