Thursday, April 9, 2009

Public Property Get IntValue() As Long


I'm reading Framework Design Guidelines from Microsoft at the moment. Great book, similar to Code complete, but one layer above. All brilliant people of Microsoft have contributed to these guidelines, among them are Anders Hejlsberg (Mr. C#), Paul Vick (Mr. VB.NET) and Phil Haack (Mr. ASP.NET MVC). Anyway, as I'm reading it, I get a different look on our sourcecode. For example, I stumbled over:

Public Property Get IntValue() As Long

Great, isn't it? The more you think about it, the more abstruse it gets. I'll better stop it, I almost feel dizzy ;)

Thursday, April 2, 2009

TimeSpan and EDF

I noticed two things while playing with EDF. TimeSpan.TotalSeconds is inaccurate on some computers. Probably the value is calculated by using the ticks-property. Unfortunately, this leads to a double which can have the wrong number. I made a t = TimeSpan.FromSeconds(3.2) and got t.TotalSeconds = 3.1999999999997. When using that in a calculation and casting the result to an Integer, you can get a wrong number - like me...

Speaking of wrong numbers brings me to my 2-day-EDF-problem. I desperately tried to create a sup-file made of dummy-EDF-files. The code is actually quite simple: new clsAufzeichnung, Meas_Sections.Add(dummy-EDF-file), SaveAufzeichnung, done. This works when you have set the HeaderLength of the EDF-file - unlike me...

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.

Friday, February 27, 2009

WPF too slow?

I'm just looking for a new VSE (= Visual-Control-Element)-design. Using DirectX will propably be overdone but WPF is too slow in a first approach showing 10 signals with 1000 line-segments per Polyline. The overhead is truely too big. So I googled a bit and found a comment of Marco Zhou (Zhou Yong) who proposes using a WriteableBitmap for WPF-GDI-access. Unfortunately, this throws away all the cool stuff of an UIElement, but who needs databinding a static signal anyway?

Using the aforementioned technique, my sample runs at least as smooth as SOMNOlab :)

Now let's try to put some UIElement-biosignal-events atop of it and the weekend is near ^^

Friday, February 20, 2009

SOA again, 2 new blogs to read

On wednesday, I had to return SOA und Webservices in der Praxis of Herbert Burbiel to the bib. Unfortunately, there was a reservation on this book. Anyway, I wouldn't have the time to test this promising ASP.NET-world. I'm really astonished how easy it is to write a webservice or -client with .NET - not a great difference to a normal windows forms application. So, the book is great; however, it uses examples of .NET and Java and makes every step (write a client, write a service, make a db-connection) twice, if not thrice (Java, C# and VB.NET). Actually that showed me that the .NET-way is the right one for me ;)

On my journeys in the web, I recently found two great blogs about WPF (Windows Forms - someone needs that anymore?), or better say two great minds writing about WPF: John Gossman and Josh Smith. See Karl Shifflett (not John Gossman...) talking about MVVM here - I love that guy :) (more to come about MVVM soon!).

Monday, February 16, 2009

Linq in Action, Toolbar

Last week I finished Linq in Action. It's a great primer on Linq: it covers Linq to Objects, Linq to SQL, Linq to XML and a bit of Linq to DataSet - i.e. everything ;) I read it from the start to the end and I assume this book isn't supposed to be read like this, because in the three main chapters (to Objects, SQL, XML) some basic queries are described again and again. Well, just turn that over :)

I really liked the chapter about Linq2Sql. It's so easy to use a database-access with Linq. Just make a connection and raise your queries. If you're working with small databases, take that. Although the Entity Framework has the favour of Microsoft, I hope, Linq2Sql will survive to make life easy.

In the book there are a lot of good examples going beyond the ordinary book-examples. For instance, there are performance-considerations in which cases Linq is significantly slower than "old style" for each and how to overcome the performance loss.

I read it in German - don't do that if you're tetchy in things of misspellings like me. If you're getting a paycheck for every found mistake like for a Knuth book, you will get rich :/

One thing I missed are ExpressionTrees. They are mentioned only in a small paragraph :(

And now a big discovery which I haven't seen in all the years I work with Win XP: "Symbolleisten". I accidently dragged my CVS-folder-link from my desktop to the top of the screen and released it. I never ever did that before. Now I have on the right of my desktop a toolbar for the CVS-DotNet-folder and on the left a CVS-ActiveX-folder. Fast access to the components :)

Wednesday, February 4, 2009

87.24%

We recently did a PRC1 (= post release candidate...) survey amongst serveral MCC-coworkers. They were asked to install the setup on their private PCs and do a quick test. We did learn two things:

1) NTFS isn't the only filesystem. Two of our students used FAT32 to be able to mount the harddrive to their parallel linux-installation. Unfortunately, FAT32 doesn't support hardlinks so that our hardlink.bat fails. The next version will put all dlls and exes into one directory *puh*

2) Arial Narrow resides only on about 87.24% of Windows-Installations. I changed the one usage of Arial Narrow to Arial - at least 97.13% coverage...