Thursday, March 26, 2009

Pack:=1 and ASP.NET: The beginning

Uff, just fighted for two days of getting that byte-array into a structure. There were always strange values starting from a specific property. After a few hours, I found out that there was a off by 1 byte error: if I shift every byte back one byte, I will reach the right result. Code tells more than 1000 words:


Structure Test
Dim a As Byte
Dim b As Int16
Dim c as Byte
End Structure

Dim handle As GCHandle = GCHandle.Alloc(byteArray, _
GCHandleType.Pinned)
Dim t As New Test
t = CType(Marshal.PtrToStructure(_
handle.AddrOfPinnedObject(), _
GetType(Test)), Test)


This will give you false values for b and c. This is why: "The default behaviour in the framework is for values in the structure to be aligned at 4-byte boundaries, so values start at FieldOffset 0,4,8,12 ..." (see forum). To avoid this, use as a structure-attribute and everything's fine now :)

Another bad book read: Programmieren mit ASP.NET AJAX. The first chapter is good - everything else just confusing. No good examples. Maybe I didn't get the point - I haven't done anything in ASP.NET yet. I'm watching now and the first 6 videos were fine :)

Ah, I forgot to mention the free first chapter of Professional ASP.NET MVC 1.0 from Rob Conery, Scott Hanselman, Phil Haack and Scott "ScottGu" Guthrie - famous bloggers writing a book. I'm curious to read it :)

Friday, March 20, 2009

Mix09 and "The Guide"

Right now, Mix09 is on air. This is a Microsoft developer conference focusing on web development. I bet, you want to see some videos from here.

I recently finished The Application Architecture Guide 2.0. Now I can design every system from a mobile app up to a RIA :)

Thursday, March 12, 2009

log4net and SnippetEditor

I recently searched a logging-framework ("there must be some logging-frameworks out there, you must not write your own" - I thought) and stumbled across log4net. It is a port of the log4j logging framework of Apache. It is configurable via xml or via code, claims that it's super-fast and has tons of various output streams. I will use it from now on in my private code-projects, because I haven't got the time to write a Message.dll (our logger here at MCC) for my own.

I'm already using "prop " and "dp " (dp only for C#) frequently and by using Entering and Returning of Message.dll, I wished to have a shortcut for this too. Et voilá, I googled a bit and found the great Snippet Editor. Veeeery handy. Now I've got "logstart " for setting up the logger and "loger " for generating the Entering- and Returning-code for the Message.dll.

Friday, March 6, 2009

MSDN magazine and Unity

οἶδα οὐκ εἰδώς, oída ouk eidós!

Thank you wikipedia for helping me with my greek. In the last few weeks, I learned so much while considering this and that for the new architecture; my programming-knowledge seems to duplicate with every line I read. Was I completely dazzled all the time?

Well, I'm reading the MSDN magazine now (in fact, I'm trying to manage to read a tiny part of it) to keep me up to date at least with the MS-world. By the way, in the february-issue, there is a great article about MVVM by Josh Smith.

One cool new think I learned is IoC of famous Martin Fowler. So I looked at Unity, a relatively new dependency injection container. Imho a great way for spreading logging and parts of our MCC_Aufzeichnung. Works fine with MVVM as Jason Dolinger demonstrates. This video was kind of an eye-opener in the matter of WPF for me.