Annotations with Symfony2

With Symfony2 much configuration can be added directly to actions with annotations. With Symfony1 there have been cache.yml, route.yml, security.yml and many more configuration files for a single controller. This has not changed with Symfony2. You still are able to configure your (bundle) controller with single files. However, there is a new way which offers more flexibility and adds the configuration right to the place where it is used: to the specific action as meta-info with some sort of annotations.

First, your route.yml has to be edited and your bundle has to be added.

# app/config/route.yml
your_bundle:
    resource "@YourBundle/Controller/YourController.php"
    type: annotation

This is needed in every setup, but as you see, you can specify the route type as annotation. This means, Symfony2 will parse the doc block on any action of your controller file, and import this to route.yml. But don’t worry, Symfony2 does this just once and stores the information on the cached route.yml file.

Now you have to add the routing information on each action which should be imported as route, as shown below. You can also insert params to your route. Additionally to the route you can add various other settings direct to the action as also shown below.

class YourController
{
  /**
   * @extra:Route("/action/{id}", name"route_name", requirements = {"id" = "\d+"})
   * @extra:Template("YourBundle:Controller:action", vars={"your"})
   * @extra:Secure(roles="ROLE_MEMBER")
   * @extra:Cache(expires="+7 days")
   */
  public function yourAction($id)
  {
    $your = 'code ' . does('something with', $id);
  }
}

There is much more to come and everything is still under development. So expect changes and additions to these existing annotations.

Update 24.05.11
Yesterday, Fabien Potencier announced a change in the Annotation System of Symfony2. There is a official blog post explaining the changes.

Pressespiegel Österreich – Finde den Fehler

Der heutige Pressespiegel Online aus Österreich. Finde den Fehler.

Bilder Copyright:
www.kurier.at, www.derstandard.at, www.orf.at, www.heute.at, www.oe24.at, www.diepresse.com, www.krone.at

My computers

So there are a couple of computers idling around here. I all of them gave names of planets and have come to the point where I have to use names of stars because I ran out of planets. Here I have a list of all the devices that I am using on a more or less regular basis. I left out smartphones, server in data centers or not anymore working computers at home.

Earth
My old, but still working home file server which runs Ubuntu. It has three internal HDDs and offers a total of approx. 1,5TB of storage space. I don’t like the really loud fan but I live with it.

Mars
An old Sony Vaio notebook which is not really in use anymore but still works. It runs Windows XP and is often used by others in the living room for just browsing the web. However, I don’t use it anymore.

Pluto
A 15″ MacBook Pro (first generation unibody) which is used by my dad on a daily basis. I just use a remote ssh connection occasionally to fix things or install new software. Yes Pluto is actually not a planet anymore (since 2006), however. I had a Netbook (Saturn) at this time and no other planet name was left.

Jupiter
My main notebook. This is a 15″ MacBook Pro (late 2009) with 8GB of RAM but still a really slow 320GB HDD. I am probably replacing the HDD with a SDD quite soon. I use this MBP every day at university or at home. I am doing my photo editing, programming and daily office work with this computer.

Venus
Not my computer, but my girlfriends. It is a Fujitsu Siemens Windows 7 notebook which I personally do not use at all.

Merkur
My HTPC just beside my TV. It is a Zotac Mag Mini system which runs with Ubuntu with MythTV. It records TV series and movies. I use it also as a small web server for developing small applications.

Uranus
A 23″ iMac actually used by my mum and not quite often by myself. I however often ssh in and install stuff.

Neptun
A 15″ ASUS notebook from 2006. It is running Windows XP, standing around somewhere and not used anymore. It was my main computer for quite a long time before I switched to my MBP (jupiter).

Genua
A 27″ iMac at work I already had to name after an astroid and not a planet, since there are no names left and this is actually not my personal computer.

Should my next project use Symfony2?

In a couple of hours, the Symfony Live event in Paris is going to start. You can expect Fabien Potencier to release Symfony 2.0 at the keynote he is holding on March 3rd at 17:30.

This is actually not a big deal since Symfony2 has been around for a couple of months. The big question is, should you already start developing your next project with Symfony2? There is no definite answer to that but what you can expect is a “not so much” changing API and already robust Framework right from the start. If you are planing a big project with longer time to develop, Symfony2 is a must. If you have already started and use Symfony1.4, stick with it.

Ein Monat Nexus S

Vor genau einem Monat habe ich mein Google Nexus S bekommen. Besorgt hat es mir ein Freund in London und es mir nach Österreich geschickt. Bin ich soweit zufrieden? Absolut! Es gibt dennoch ein paar kleine Dinge die mich stören.

Continue reading Ein Monat Nexus S

Die ersten “Freunde” sind da

Vor bereits einer Woche, habe ich die ersten bestellten Flaschen Whisky bekommen. Das ist ein Novum, da ich doch bisher Whisky bzw. Spirituosen beim vorbeigehen im Supermarkt mitgenommen habe. Erstmals habe ich (online) bestellt. Und dies beim scheinbar besten Whisky Shop in Deutschland, dem “The Whisky Store” von Theresia Lüning.

Bestellt habe ich nicht irgendwas, sondern habe mich fachkundig von Kris beraten lassen. Somit sind es drei “Freunde” von der selben Gegend in Schottland geworden. Genauer gesagt, von der Insel Islay, welche vor allem für sehr rauchige/torfige Whiskys bekannt ist.

Ein Laphroaig Quarter Cask, ein Bowmore Darkest und ein Bruichladdich Peat. Ich habe alle bereits getestet und kann auch alle ohne grobe Einschränkung weiterempfehlen. Einzig für Einsteiger auf dem Gebiet (speziell Nichtrauchern) wird das rauchige/torfige anfangs etwas ungewohnt vorkommen.

Canon EOS 60D finally here!

Canon EOS 60D
Canon EOS 60D
As I was assuming a couple of weeks ago, the Canon EOS 60D is finally here. Canon just posted a press release and added a product walkthrough video as well as a sample video shot with the Canon EOS 60D. The interesting parts: The camera features an 18mp DIGIC IV processor which is capable of 1080p H.264 video. As a new feature for any Canon EOS camera, the 60D will have an articulating 3″ LCD screen. Specially for taking videos this could be a real enhancement. The rest of the features is more or less a mixture of the bigger EOS 7D and the smaller EOS 550D/T2i like the ISO range from 100 to 6.400 (plus H 12.800), in-camera video editing (who needs that?).

The EOS 60D will be available in September for roughly 900 Euro (Body) or 1.100 Euro (including an EF-S 18-135 3.5-5.6 IS lens).

UPDATE DPreview did a small but nice little preview of the EOS 60D. Also Philip Bloom mentioned the new 60D, and yes he is totally right: We will see, what time brings and the EOS 7D needs a firmeware upgrade immediately.

Automatic Anti-Pattern Corrections for PHP

During my computer science studies at the Vorarlberg University of Applied Sciences I wrote my bachelor thesis about “Automatic Anti-Pattern Corrections for PHP”. As a fan of the open source philosophy, I want to share my work with others. I invite everyone to contribute to the great lex-pass project and this approach to better PHP software. Please share your thought and ideas on this with me and others by leaving a comment or sending me a message. Continue reading Automatic Anti-Pattern Corrections for PHP

Canon EOS 60D coming soon?

Just last week Canon introduced the new EOS 550D (Rebel T2i) and this camera will soon be available. Anyone who – like myself – is playing with the idea to upgrade from a previouse three-digit EOS camera to the EOS 550D, will probably also checked out the Canon EOS 7D, which offers similar features but in some areas performs significantly better. The interesting thing about the EOS 7D and EOS 550D are, beside a lot of other outstanding features, the new HDSLR opportunities, ie HD movie recording with a digital SLR camera.

But, there are already 18 months in between the introduction of the EOS 50D, which has a body that is certainly at an equal level to the EOS 7D. This usually speaks for a quick upgrade from Canon’s site.

This means for me, that I will not immediately buy the new EOS 550D but wait a little for a hopefully soon comming EOS 60D. The 60D will for sure have a price tag positioned between the 550D (about 700 euros) and 7D (about 1,300 euros) and so get probably in the range of about 1,000 euros.

So let’s wait and see. Meanwhile the Canon Rumors website can be checked regularly.
[ad]