Blog

Fare thee well, giants, fare thee well.

Today was the finale of Die Riesen Kommen, which saw them both waking up from the Brandenburg Gate. Obviously they did what I wished I had and had a sunday lie-in, so didn’t wake up until 90 minutes after the alarm clock was supposed to go off. It did mean I got a spot right down the front for the first part of the show and to join in chants with hundreds of Germans of which I *hope* was something along the lines of “why are we waiting?”, rather than “The French are almost as lazy as the Brits”. »

The Memorial to the Murdered Jews of Europe.

Field of Stelae

Field of Stelae

At first I thought it was a crazy art exhibit which got horribly out of control. As though the artist kept laying down more pieces, and just kept going because nobody told him to stop. It reminded me of the Anthony Gormley exhibit I saw back when he had the exhibition at the Hayward Gallery, and filled a room with person sized blocks which you could walk between and around.

Just south of the Brandenburg gate is the Field of Stelae, an almost 20,000m² field of 2,711 concrete blocks each with a pathway in between to find your own way through the memorial. Thousands of concrete blocks might seem like something out of a 60s nightmare, but the effect is stunning.

Walking from one side to another is a feat the will very likely find you meeting suited businessmen carrying coffee, tourists (such as myself) hunting for a clear stretch to take photos, young children tumbling and giggling as they twist and turn around aimless unknown corners, teenagers racing down the 1 metre wide passageways oblivious to pushchair dangers lurking behind the block, parents shouting names of lost young children still tumbling and giggling, and the best location in the whole world for a game marco polo.

The whole piece was designed by Peter Eisenman and you might be quick to suggest meaning behind the concrete blocks, the pathways and the shadows cast. The information leaflet I picked up is quick to disperse those ideas, and claims the memorial is unique in that it uses no symbolism. One of the FAQs at the back: “Why are there 2,711 stelae” is answered quite frankly that it is the result of “measurements chosen by the architect for the location”. Well, duh. It goes on to say that it bears no relation to the number of victims, or hold any symbolic significance. It is, just because it is. This is one of the most refreshing displays of both remembrance, and art that I’ve ever seen, and I love it.

The Bundestag. And it’s new spirally mirrory thing.

bundestag

Inside the glass dome on top of the Bundestag

The Bundestag sits on the western edge of Berlin, and is now the official home of the German parliament (again).  Back when it was named the Reichstag, a fire in 1933 was one of the events Hitler used as pretext to sieze power.  Seems pretty suspicious to me.  “Guten tag Herr Hitler.  Wie geht’s?”  “Ja, sehr gutt, und du?”  “Oh mein gott, was ist das?  Das Reichstag ist “… what’s German for ‘on fire’?  “…geblazen.” (???)  And while they were all distracted putting it out, Hitler seized power, eh?

Fitting that it’s the same way he left the world then.

Actually, that whole paragraph was just so I could show off how good my German has got in just 3 days here.  Four years of studying it, and I still can’t hold a conversation beyond “Ja, sehr gutt.  Und du?”  Even shopping is useless  I can go into any bakery and ask, “Ich mochte ein butterbrot, bitte”.  Except I don’t want the damn sandwich.  I want the cake.  Ich mochte cake.

So anyway, that’s kind of how Hitler came to power.  It was properly restored from 1990-1999 or so which also saw a new dome erected on top which houses a central funnel of mirrors and two separate spiral walkways towards the top of the dome.  It is without a doubt, really, really cool, and well worth the hours wait in the rain I queued to get in.  Can someone check for me – I can’t be bothered to research for my own blog, but – was he involved in the Mayors building on South Bank, too?  Probably not, but the design reminds me of that anyway.

Berlin – The hunt for Giants

The Little Giant on Day 2

The Little Giant on Day 2

Cut to this morning, and I’m in the search of giants.  Walking along Unter Den Linden (which roughly translates as “Tourists will buy anything”) is a lot like walking along tourist districts anywhere else in the world.  Huge imposing buildings filled with art and stolen treasures from all over the planet, and statues to fallen heroes scattered around wherever possible.  Alongside tourist (“I Love Berlin”) shops, and Starbucks are the expensive showrooms of Ferrari, and other “small c*ck” car manufacturers I can’t remember.  Some even have exclusive bars inside with bouncers on the door.  Walking boldly in, I was quite obviously turned away.

At either end of Unter Den Linden are the first sites for Die Riesen Kommen.  They’re really just teasers for the events that will follow tomorrow, and through the rest of the weekend much like the wooden spaceship that landed in London.  I finally found Schlossplatz to be the giant building site, opposite the giant cathedral I’d been using to shelter from the rain.  Schlossplatz, it appeared – was mostly a giant building site which would soon be home to the brand new Schlossplatz U-Bahn station.  Walking around it a couple of times I thought that maybe those crazy Royal De Luxe guys had caused this themselves.  Digging a giant cavern in the middle of Berlin seemed like just their sort of thing, but I was questioning whether they would have found city approval.

Then I heard screams of excitement off in the distance where I’d seen a small tent being built earlier – so rushed that way to find … another fenced off hole in the ground.  Taking their cue from the shows in Iceland, Royal De Luxe had engineered a geyser in the middle of Berlin spraying water 50-60 ft into the air every 5-10 minutes.  “Come stand over here for pictures” a helpful German student advised me.  “Hah”, I laughed, knowing it was right where the water had fallen minutes before.  “How about you stand here, I’ll just wait right here”.  As the water erupted high into the sky, I let loose on the camera, continuing to stay my ground as said water came crashing right down on top of me”.  Apparently the German student, found it particularly amusing.  “Never seen it go that way before”, he chuckled.  “Fuck off and die”, I thought.

The D90 rose to the challenge however, and after having a (cold) geyser thrown over it, I’m now sure it can perform well in almost all wet weather conditions.  The same can’t be said for my coat.

Berlin, city of culture for the bizarre

Gorilla outside the gallery shop

Gorilla outside the gallery shop

I’m in love with Berlin already. There’s graffiti all over the place, art galleries of the bizarre and obscure, fantastic displays of architecture, restaurants to cater for anyones taste the world over, and enough to keep you busy for a very long time.

Just as the tube map looks remarkably similar, Berlin looks and feels like it could be London’s long lost brother. Hopefully I feel this way after 5 days here. I found one free art gallery hidden away down a side street off of Friedrich Strasse which left me wanting to buy everything. I’ll most likely compromise and buy a postcard instead. Iron exhibits both huge and small fill the central courtyard and various huts off to the side as bunch of those artists responsible sat around making more.

It felt like I’d walked into some sort of rennaisance fraternity in gotham city – they had their own bar, which nobody seemed to be interested in using, a group huddled around an open fire, and a small burger van tucked away in the corner.  If the rest of Berlin stays like this (and first impressions indicate it will), I might not even mind staying in a city for longer than days.

C# Joins with Linq and Lambdas

I’m always forgetting the syntax for lambda joins in C#, because I never use them enough and get bored looking for reminders enough that I just revert back my old ways and use the query expression instead. So rather than find a good tutorial and bookmark it, I’ll post it here instead. By the time it falls off the front page, I’ll just about have remembered how to do it without needing this anyway 🙂

Query Syntax

[codesyntax lang=”csharp”]var products = from audio in DbContext.DataContext.ProductAudios
join product in DbContext.DataContext.ProductAudios on audio.ProductId equals product.ProductId
select new { Product = product, Audio = audio };
[/codesyntax]

Lambda Syntax

[codesyntax lang=”csharp”]var products = DbContext.DataContext.ProductAudios.Join(
DbContext.DataContext.Products,
audio => audio.ProductId,
product => product.ProductId,
(audio, product) => new { Product = product, Audio = audio });
[/codesyntax]

It might look like more code because of my formatting, but I find the lambda syntax much convenient when chaining queries together with other where’s and groupby’s, especially when that might be split across different methods. It also isolates your join nicely, whereas I find the query syntax will start to get particularly unreadable with more complex queries.

Last but not least, another piece of linq-join-related syntax I’m finding myself always having to look up a lot is for left outer joins. Fortunately I always end up at MSDN for that one, so I’ll just link to it here:
How to: Perform Left Outer Joins

Running Ruby methods within C# / .NET

The last example might have been a little too trivial, even by my standards. Even I struggled to imagine a scenario where I might ever need to use it. So hopefully this one will be a little bit more interesting and demonstrate something more useful.

Useful, but still just as simple as the previous examples, that is. Again – you’ll need your references from the downloaded IronRuby bin/ folder. And as you’ve come to expect, a very simple ruby script defining a lambda function.

[codesyntax lang=”ruby”]$m = lambda {
a = Array.new
a.push(2, 3)
(4..50).each do
|i|
(2..(Math.sqrt(i).ceil)).each do
|thing|
if (i.divmod(thing)[1] == 0)
a.push i
break
end
end
end
return a
}
[/codesyntax]

From this, we’ll get an array of the prime numbers. The function can then be executed rather nicely from within your .NET code like this:

[codesyntax lang=”csharp]var ruby = Ruby.GetEngine(Ruby.CreateRuntime());
ruby.Execute(@”
$m = lambda {
//.. snip..
return a
}
“);
var rubyContext = Ruby.GetExecutionContext(ruby);
var m = (Proc)rubyContext.GetGlobalVariable(“m”);
var rubyArray = (RubyArray) m.Call();

foreach (var o in rubyArray)
{
Console.Write(string.Format(“{0},”, o));
}
[/codesyntax]

Now we’re really starting to leverage that syntactical beauty of ruby within .NET and jumping (almost) seamlessly between the two. Now, I really should do some demos on something more useful than prime numbers, and perhaps get into one of the big areas of interest of Ruby – testing frameworks. Not tonight though 🙂

Demo project available as usual:

Executing complete (Iron)Ruby scripts from within native C# / .NET

Running Ruby code as-is within .NET is almost too simple to even write home about. In fact I almost didn’t, but after I wrote it the solution stared up at me with its big brown eyes, and I couldn’t resist. I’m not totally sure when I’d ever need to use this, but perhaps taking some legacy Ruby scripts where I don’t really care about the results, and still want to run them amongst some other .NET tasks. It might come up in some obscure unit testing one day. You never know.

So, this still serves as an example of how simple it can be to run ruby scripts within .NET. We’ll get to making use of some return values, and running individual methods in the next post.

Following on from the last example, the following ruby script prints all the prime numbers between 1 and 50.

[codesyntax lang=”ruby”]state = Numeric.new
print “2,3,”
(4..50).each do
|i|
(2..(Math.sqrt(i).ceil)).each do
|thing|
state = 1
if (i.divmod(thing)[1] == 0)
state = 0
break
end
end
print “#{i}\,” unless (state == 0)
end
[/codesyntax]

With the ruby script complete (you can also run this with the ir.exe that ships with IronRuby if you like)… Next start up a new project within Visual Studio, and add some references from your downloaded IronRuby bin folder (IronRuby.dll, IronRuby.Libraries.dll etc…).

You only need a few lines of code to execute your ruby script.

[codesyntax lang=”csharp”]using IronRuby;
// ..
var runtime = Ruby.CreateRuntime();
runtime.ExecuteFile(@”ruby/run.rb”);
[/codesyntax]

As before, you can download the full example to check it and run for yourself. And also as before, you will also need IronRuby.