Pictures from Milan Part 3

After part 1 City Center and part 2 Modern Architecture, here is part 3 with the remaining pictures from last week’s trip to Milan.

Pirelli HangarBicocca

HangarBicocca is an old factory that a few years back was transformed into an impressive exhibition space. It features a permanent installation by Anselm Kiefer called The Seven Heavenly Palaces.

Hangar Bicocca Entrance

These pictures really don’t do it justice. It’s just so impressive to be standing in a huge darkened hangar amid these 14-18m high houses. Interestingly, the paintings work both from afar, when you can take them in as a whole, as well as from up close, when they reveal a totally different layer of detail.

Hangar Bicocca Bild Klein

Central Station

Despite the massive size of Milan’s Central Station, a lot of attention was paid to getting the details right as well.

Central Station Klein

Central Station (4)

Central Station (2)

Central Station (3)

Central Station (5)

Pictures from Milan Part 2: Modern Architecture

The part of Milan that made the biggest impression on me was no doubt the Porta Nuova district consisting of modern skyscrapers and high-rise residential buildings such as Bosco Verticale (“vertical forest”) and the UniCredit Tower.

We first went there on Saturday evening as the sun was setting and live-music was playing on the Piazza Gae Aulenti. It was a wonderful scene. I came back on sunny Monday morning to capture these beautiful shots.

Bosco Verticale & UniCredit Klein

UniCredit Tower Klein

Piazza Gae Aulenti Skyscraper Klein

Porta Nuova Park

The elegant Grattacielo Pirelli (Pirelli Tower) reflecting the morning sun.

Grattacielo Pirelli

Pictures from Milan Part 1: City Center

First up in a series of pictures from my visit to M in Milan are the classics in the city center, starting with the must-see Milan Cathedral.


The Cathedral, the highest building in central Milan, seen from Piazza San Babila, a few blocks away.

Cathedral from afar

The luxurious Galleria Vittorio Emanuele II shopping mall.

Galleria Vittorio Emanuele II Klein

Galleria Vittorio Emanuele II Innen

For a second, I thought I was in the wrong Italian city when I saw this mosaic.


Torre Branca feels a little out of place among the classic building of Parco Sempione.

Torre Branca

Watch out mixing String and PChar in Delphi

Rudy Velthuis has written an excellent article about PChar in Delphi. Whenever someone comes up to me with a PChar/string question, I refer them to that article.

There are, however, a few caveats one needs to be aware of when mixing string and PChar that he does not mention. This is what I want to cover in this brief article.

The problems mixing string and PChar described here are caused by null characters (or #0 in Delphi syntax). Since Delphi strings have a length counter, It is perfectly legal for them to contain #0. Since PChar are null-terminated, by definition they cannot contain #0.

However, a few Delphi routines that seem to operate on strings internally actually operate on PChar. They will therefore not work as expected when the string they are given contains #0.

You cannot replace #0 in a string

If you call StringReplace to replace #0, it simply won’t work.

function RemoveNull(AInput: string): string;
  Result := StringReplace(AInput, #0, '', [rfReplaceAll]); // Won’t work

It seems that all replacing routines internally cast to PChar making them useless for this. Instead you will have to do a character by character comparison as in this routine by David Heffernan.

StrPCopy stops at #0

The StrPCopy routine takes a string as an input and copies it into a PChar. I used to use this routine in a TStringBuilder-like class which used a PChar to refer to an internal buffer containing the string being built. It also had a length counter, so one would not have to scan the PChar to figure out its length.

But even though StrPCopy takes a string as its input and could thus have access to its length, it does not copy all character, but stops at the first #0.

If you really want to copy all characters, you’ll have to use a routine such as Move that copies bytes not characters as in this example (again by David Heffernan).

Beware of implicit conversions

Since the compiler supports implicitly converting between PChar and string, you will often get away with passing a PChar where a routine takes a string parameter. The compiler will just generate a temporary string from the PChar and pass that instead.

Hence, this code will compile and work just fine:

function GetSubstring(AInput: PChar; AStart, ASubstringLength: Integer): string;
  Result := Copy(AInput, AStart, ASubstringLength); // Works, but is slow

Unfortunately, it has horrible performance, because the compiler needs to know the length of the PChar in order to built that temporary string. And the only way to figure out the length of a PChar is to check every character until the first #0.

See this question I asked on Stack Overflow how to fix this with a PChar-equivalent for the Copy routine.

Day-Trip to Lingen

Yesterday I spent the day in Lingen to attend the CIM Lingen. The conference starts at 09:00, meaning I had to catch a train from Düsseldorf around 06:00.


The train consisted of old cars from many different eras, including this kind I remember travelling in as a kid in the 1980s.


At the conference

CIM Lingen is a conference with a special focus on Microsoft solutions and thus perfect for me. A lot of MVPs from Germany went there, presenting on Azure and Internet of Things among other things.

Best of all, the conference is entirely free to attend.

CIM Lingen Klein

It is held on the campus of Osnabrück University of Applied Sciences whose building was formerly a locomotive factory. And although it was equipped with all the amenities of a modern university, it still has a nice industrial flair and wide open interior spaces where there once was the factory floor.

Osnabrück University of Applied Sciences


Around town

Before and after the event there was some time to walk around and take in the sights. What a beautiful small town.

Anno Haus Klein

Einmal Welfe Immer Welfe



As the sun sets I have to catch my train back home.

WP_20160827_18_50_47_Rich (2)


This was my first time at CIM Lingen, but I know that I’ll probably go again next year 09-Sep-2017.

Reading up on Bitcoin, Blockchain and Beyond

Digital Gold by Nathaniel Popper is neither a tech nor a finance book, but it provided me with a great introduction to Bitcoin. It describes at length the varied backgrounds and motivations of the people that were instrumental in getting it off the ground.

After you’ve read the book and learned the basics, Coindesk is a great source of current news on all things blockchain, cryptocurrency and so on. For specific questions, there is also a Bitcoin Stack Exchange Q&A site.

Of course, one of the most interesting things to come out of Bitcoin is not the cryptocurrency itself, but the blockchain, a distributed alternative to the centralized ledgers used in finance everywhere, it is built upon.

Blockchain, Distributed Ledgers

Unfortunately, a blockchain as used by Bitcoin has features that make it unsuitable for certain uses; poor scalability and slow speed of processing and confirming transactions being two of them.

There are, however, several projects that try to address these issues, such as Juno which specifically targets greater throughput performance.

Microsoft even has a blockchain project for its cloud computing service Azure called Project Bletchley.

But, the most interesting, in my opinion, distributed ledger project right now is R3 Corda. This is a joint venture between a number of banks aiming to built a distributed ledger specifically for financial transactions. What makes Corda stand out among the many blockchain/distributed ledger projects is that it is not a technology project looking for applications. Instead they are taking real requirements from the world of finance and try to mold the technology to fit them. As Richard Gendal Brown, R3’s Chief Technology Officer, writes in their introduction:

Every successful project I’ve worked on started with the requirements, not some cool piece of technology.

Richard Gendal Brown, by the way, also has his own blog Thoughts on the Future of Finance, on which he discusses technology in the financial sector in general (e.g. Apple Pay), not just distributed ledgers. Highly recommended.

Smart Contracts

Looking beyond finance, there is Ethereum which has built a smart contract platform on its blockchain. One example of such a smart contract is The DAO, a kind of investment company bound by bylaws written in code instead of legal prose. Since the company exists only virtually, it’s still unclear which country’s laws govern it. Its creators say a DAO is self-governing, i.e. its actions determined only by its coding and thereby not subject to outside influence such as a regulator.

Because of a coding error in the code of The DAO, an attacker was (almost) able to rob it of millions of dollars on 17-Jun-2016. This article has a good summary of how it happened. The blog also has a number of articles worth reading on the attack and its aftermath. On the topic of entrusting your investment money to an autonomous organization bound only by smart contracts, their COO Stephan Tual writes:

[I]t is very challenging to write smart contracts that are both complex in nature and 100% safe. Therefore, it’s fair to say that the discussion of any Ethereum-based project should be handled with the great care it deserves.

Speaking of they have used the Ethereum blockchain as the backbone of a neat IoT project: the Ethereum computer powering smart locks called slocks.