.NET

Curly braces and String.Format() in C#

Ever wanted to use String.Format on, say, a javascript function? Those include curly braces ( { or } ), but those curly braces are reserved as placeholder marker in String.Format() (i.e. for {0}). Escaping the braces with a backslash does not work.

The solution is pretty simple: You need to double those curly braces to escape them.
String.Format("function test() {{ return calcSomething({0}); }}", "123");

ASP.NET Ajax and validators

Just a sidenote for myself, because I had to struggle with this today:

You need additional assembly for making asp validators work with ajax.

The solution and it’s explanation of it.

Pre-Fill password fields in ASP.NET

Via .NET Student Blog:
You can pre-fill password fields using the .AddAttribute(“value”, password); method on the control.

However, you should try to avoid this. But in some cases (i.e. display password strength / weakness during initial password entry on a “new user” page) this totally makes sense.

TFS – The long way to success??

First of all: I finally did it.
I managed to install a Team Foundation Server 2008. But it was a tricky thing to do – even when sticking literally to the documentation.

It was not a straightforward installation, since the TFS has some requirements you have to prepare manually. Especially when you’re trying to work in a ’2008 only’ environment. Beta operating systems and beta databases are sort of a moving target for infrastructure ;-)

So what are the things you really need?
1.) Microsoft Windows Server 2008 (Codename Longhorn) Beta
2.) Microsoft SQL Server 2008 (Codename Katmai) November CTP
3.) Microsoft Team Foundation Server 2008 (release version from this week ;-) )
4.) Some hours of spare time
5.) Strong nerves ;-)

You begin with installing the – guess – Windows Server. Thats the only really straightforward thing… Mehr >

VS 2008 ‘Orcas’ release in this Month

It’s official: Visual Studio 2008, Codename ‘Orcas’, will be released together with .NET Framework 3.5 this November.
I just hope, Chrome is working really well with VS 2008 with the next official update after release. I can’t stand buggy software in production :)

MVC in ASP.NET?

Frank Fischer (some Microsoft guy- the only person I would sign a working contract for if he would like to have me as an evangelist *g*) just posted a blogpost about a MVC (Model View Controller – Pattern) Framework for ASP.NET. A thing where ASP.NET is going to follow the Rails framework in Ruby.

Well, is MVC the right way? Especially in ASP.NET applications?
I’d say: No. MVC is nice in client applications, but on the platform ‘Web’, where all is about really dividing between UI and logic, where you even should be able to exchange the UI of an application without changing a line of code, the MVC is not the best thing – in my eyes. That is, because in the MVC pattern the controller has knowledge about the model and the view. If you alter either the model or the view, you need to modify the controller. Exchanging the view forces you to hold a seperate controller for each view and altering all controllers if you need change the model later.

But what then? Well, here it is: The “Model – ViewModel – View” Pattern.
See here for a very good german article about that pattern.

Using that pattern, the ViewModel knows about the model and gives an interface to the controllable elements on the view. The view itself is coded against that interface. So exchanging a view is creating a new view databinding against the viewmodel, and that’s it. Changing the model possibly results in changing the modelview part, but usually without the need to change the interface to the view(s).

So sorry Frank, but like MVVM is the better approach than MVC in the WPF world, it is also the better one in ASP.NET. ;-)

A Dark room for my content…

Some time ago Marc Hoffman introduced a Mac *brrr* ;-) Software called WriteRoom. The concept is nice: It just presents a black screen, covering your complete working area, and displaying your text in a way that remembers one of the old monochrome green monitors of the first personal computer days. 

The point is: Everything else distracting you from you and your text is hidden.

Another Microsoft Student Partner postet a link to a great acrticle about developer tools, and there ‘Darkroom‘ was presented. It’s nearly the same as writeroom, but written for the .NET platform.

Have a look at it.

Moving (slightly) to ChromesVille

Chrome? Ist das nicht das blitzende Zeug an Autos, Computergehäusen und Motorrädern?

Ja. Ist es. Es ist aber auch was anderes: Nämlich eine Programmiersprache.

Chrome ist ein Object Pascal-Dialekt für .NET. Genauer gesagt nicht nur für das Microsoft .NET Framework sondern auch offiziell für Mono. Und ich werde mich in der nächsten Zeit etwas stärker mit Chrome beschäftigen, weil ich damit etwas vor habe ;-)

Zum einen mal will ich von EveMon einen kleinen Errinerungs-Timer für Windows-Mobile -Geräte wie meinen HTC Touch schreiben. Und dazu muss ich Chrome überreden gegen das Compact Framework zu linken.

Dafür gibt es einen kleinen Artikel auf der Seite von RemObjects und da werde ich mich die Tage mal dran versuchen – und das Ergebnis hier freilich präsentieren. Und damit ich den Link nicht wieder vergesse poste ich den hier und biete Euch damit die Gelegenheit, Chrome auch mal kennenzulernen.

Ps: Kennt jemand einen Syntax-Highlighter für WordPress, der Object-Pascal Code versteht?