Tuesday, December 8, 2009

Another book, another kata

This unit testing book by Andrew Hunt and David Thomas is better than the last one, but I made the mistake? to start reading The art of unit testing in parallel (when I've finished that book, a review will be posted as well). So, nothing bad about the pragmatic book, but nothing good either. It covers NUnit (already with "That") and only strives mock-frameworks. There are a plenty of tips how to write good unit tests, among them mnemonics like "Right BICEP", "A TRIP" and "CORRECT". There is even a Pragmatic unit testing summary in checkbox-format. As if I'll go through all the rules after writing a test *lol*
All in all, a good book - but I'm looking forward to "the art".

Staying by Dave Thomas, I've done his sixth kata "anagrams" a few times and I always learned a new shortcut, trick or whatever. I rarely use the mouse anymore and I've downloaded ReSharper (because we're using NUnit instead of MSTest now) and took benefit from the smooth integration of the refactorings. DevXpress had to go unfortunately.

Here, I've found a nice introductory-video in the principles of coding katas, if you're interested.

Here is a video about the randori-variation.

Uncle Bob takes this approach a step further and declares coding kata as an art. See him performing the prime factor kata to music! here.

Thursday, November 26, 2009

Code katas

I just finished my first code kata :) I did FizzBuzz, a very easy one just to get started. I wrote the last code-bit for the last test to past in a quarter of an hour. Therefore, I continued with "stage 2" of the kata.
I wanted to make it easy to extend and got lost half the way :( There was a point where I refactored too much without unit testing. This was bad because the bigger the steps the more likely it is you have to go a step backwards.
Luckily, I got my act together and accomplished my plan. The rest was fine and all tests passed.
On a second try, my goal is to don't use the debugger anymore (I needed it twice) and take baby steps.

Wednesday, November 18, 2009

PDC 2009

It's PDC again! Yesterday, I watched the opening-keynote. They spoke about the cloud and the new Visual Studio and how they can interact. A database store, codename Dallas, was shown which tries to unite data from all over the world - surely nice to play around with.
About half the time, when talking about the cloud, they showed this list:

1970s: Mainframe
1980s: Client-Server
1990s: Web
2000s: SOA
2010+: Cloud

We're just working on to get to the 90s, great...

One new feature of VS2010 is intelliTrace, which is a history of the program running via the debugger. I hope we switch to VS2010 soon, because that sounds interesting.

Last year, a lot of sessions were recorded and put online. I hope they'll do it this year alike. Nevertheless, don't forget to watch the second keynote today (17:30 CET) at the website with Scott Guthrie.

--------------------------------------------------------------------

The second keynote was great! Silverlight 4 beta available now! With trusted mode!! File system access!!! *download*

Monday, November 16, 2009

Test-Driving

The plan is to do a 2-week-bootcamp right before christmas to learn / get experience with test driven development (TDD). I already tried to practice it and I must say that it's hard. Though writing tests before you implement feels natural (I somewhere read "developing without testing is like driving a car without fastening your seatbelt"), it is so much contradictory to what I'm used to develop (test last development; if tests at all). Because of that I looked for some help in books.

From the first one I only read two chapters online: Test Driven: Practical TDD and Acceptance TDD for Java Developers by Lasse Koskela. You can find the chapters here. As I'm a .NET-developer, a Java-book is not worth purchasing, I think. However, I mention this book because these two chapters are really good. The first one is about beginning TDD. This is the usual stuff about red, green, refactor by example. The second chapter is the one that enlightend me. It talks about how to integrate the testing in the development-process (eXtreme Programming, that is) with acceptance TDD. The following picture is from Lasse's book and opened my eyes. Never before was the test-integration so clear to me. This is the only way how a developer will write good tests: write an acceptance test and make it green via several unit test driven development-cycles.
The other chapters sound interesting - maybe I'll find this book in a library.

Test-Driven Development in Microsoft .NET by James W. Newkirk and Alexei A. Vorontsov is the other book I recently read. I got this book from my good friend Uwe (*winkeWinke*). This book has a foreword by Kent Beck - so this has to be good, I thought. But actually: it isn't :( The first three chapters are OK - the standard-introduction section. Then, the book tries to write a whole example-application with TDD. I must admit, this is courageous - but it fails. I don't think that someone will work through all this code in order to understand how to test a database, a web-service, a web-client, etc. At the end, all tests are more or less the same. I think it is more helpful to learn TDD with your own little project than with this book. By the way, the technology used (ADO.NET instead of Entitiy Framework, ASP.NET Web Service instead of WCF, ASP.NET instead of Silverlight!?) is old...

Tuesday, November 3, 2009

2 agile books and one IOException

I just finished 2 books about agile development: User Stories Applied by Mike Cohn and Scrum and XP from the trenches by Henrik Kniberg.



Mike Cohn covers all about user stories. As we're just beginning Scrum with a new project, we will be doing a story writing workshop with some business people. So, User Stories Applied is probably the right book for that.
After not much blabla and good tips, page 49 describes what to do in such a workshop. He suggests to find the top epic stories and break each down. Page 182pp shows the place of a workshop within the path to begin programming:

1) Perform user role modeling
2) Trawl for high-level user stories <-- Start workshop
3) Prioritize stories
4) Refine high- and medium-priority stories
5) Organize stories into groups
6) Create a paper prototype <-- great if we'll reach that in the workshop
7) Refine the prototype
8) Start programming

I think the hardest thing is to gather the top 25 epics. This will be difficult with people discussing each and every detail don't focusing at the higher level. But as this will be the first workshop, we can still learn if things go astray :)

Here's a passage I liked (about 'why user stories'):
"Humans used to have such a marvelous oral tradition; myths and history were passed orally from one generation to the next. Until an Athenian ruler started writing down Homer's The Iliad so that it would not be forgotten, stories like Homer's were told, not read. Our memories must have been a lot better back then and must have started to fade sometime in the 1970s because by then we could no longer remember even short statements like "The system shall prompt the user for a login name and password." So, we started writing them down." (cf. IEEE 830)

So, good book, nice to read and great for looking up user-story-things.



The second book I finished is Scrum and XP from the trenches which is a war story on doing scrum. Lots of hands-ons and lessons-learned stuff. Some parts are interesting like how to handle multiple scrum teams but the most part I heard or read already. If you're new to scrum and agile methods, this is amusing to read (like how to negotiate with the PO). If not, you can scroll over it (as I read it as a free eBook).

And now for the IOException. I made some debug-sessions lately and now and then I came across an IOException just reading "the file exists" when calling GetTempFileName. I loaded old, already released code and even with this *cough* high-quality-code the exception will be thrown. Luckily I found this blog-post dealing with the same problem. Just delete some temp-files (approx. 100,000) and everything works fine now :)

Thursday, October 22, 2009

Sketchflow

We're started a project and are now in gather-requirements-phase. I sketched some UI-views for my module and Alex said: great - can you scan them in so we can discuss them with Uwe from Hamburg?
I remembered that I've heard something about Sketchflow which is build into Expression Blend. Sketchflow is a rapid prototyping software which lets you design new UI-sketches very fast. So I surfed to Sketchflow overview and thought "well, I'll give it a try". So I downloaded Expression Blend 3 and a Starterkit with some neat videos. While installing, I watched the first one and was impressed what you can do with that piece of software: build your UI using predefined toolsets, add navigation to your sketched application and even gather feedback from various persons via a Sketchflow-player.
After 3 and a half hours of work, I sketched all paper-sketches into Sketchflow and showed it to Alex and Reinhard. Gosh, they were impressed. Here are two screenshots:

This will be the first screen after a import has finished. They suggested to delete the buttons and integrate the navigation into the colored labels.

This shows how easy it is to create a rich screen in just a few minutes. If you wish, you can even use real data imported into Expression Blend! And best of all: it makes a lot of fun ^^

Monday, October 12, 2009

Pair Programming

Puh, just finished a pair programming-session with Artem. This was hard work!
We started at about 14:00 and wanted to add some unittests for a class Artem wrote. I already reviewed his code, so I knew it quite good. By the way, one result of the review was "where are the unittests?" - so I maneuvered myself in this position. Anyway, good quality-code needs some sacrifices *heroic*
I took the keyboard and Artem the mouse... No, just kidding. He was sitting beside me keeping an eye on my cursor. So we began with the first function and let Visual Studio build a test-stub and an accessor (yes, I love that!) for us. We discussed what to test for this method and I began to write code for it - easy. Not long afterwards, we found the first inconsistency which wasn't visible in the review and in the productive code either. Fixed it and continued. This went on and on, one unittest after the other. We discussed the relevant parts of the code and enhanced a few places.
But as time goes by, I noticed how unconcentrated I was and that I made more and more typos. What a luck that we almost had all unittests we longed for. So we created the rest and finished that session. It was 16:00 and I was exhausted like never before when writing some code.
I must say, that this was hard, but it was worth for it. You can't get such a tight feedback-loop when doing reviews and you can't produce code just by discussing it in a normal meeting. So, pair programming is great but exhausting!

Friday, September 4, 2009

CodeRush Xpress

Some time ago, I tried ReSharper, but wasn't totally convinced to spend > 100 Euro - so I forgot about it. As I'm doing more and more refactorings (you know, I'm on my way...), I really felt that there could be tools to help me. I read some forums and found CodeRush Xpress. Just have a look at the introductory video here and you want to work immediately with it.
I discovered that tool the day before I went on a 1-week-no-pc-holiday-trip. As I came back, I was eager to try it and it held all my demands.
I'm using + + <+ / -> (Selection increase / decrease), the camel-case navigation and on a variable (show appearance). And of course I'm using + <ö> (german layout) to call the refactorings. It's nice how you get a visual feedback for an upcoming refactoring:

There's so much so discover for me. There's also a kind-of mod-community, because the API is open (DXCore) to extend. Great tool!

Wednesday, August 5, 2009

How to build a collection of Interfaces

Here’s the problem: we have some files and some devices which operate with signals. As a signal is one of our main objects, we want to return a collection of signals when opening a file or beginning a communication with a device:

But of course, we want to handle each signal the same, so a signal from an EDF-file should be from the same class as a signal from a device. We could define a signal-class in the Main-library like this:

But this constructs a circular reference. We could create a converter for each special signal and build a collection in the main-library of all signals:

Ouch – ugly. For every signal-type we need one converter. What happens when DeviceSignal changes? Hopefully, we update the corresponding DeviceSignalConverter... Here’s my solution:

We implement all interfaces a signal could be loaded / imported from in the main-signal-class and use generics to simulate a factory. A EDF-dll could have:


public interface ISignal {
int SamplesPerRecord { get; set; }
}

public class SignalReader where T : ISignal, new() {
public override ICollection GetSignals() {
List signals = new List();
var signal = new T();
signal.SamplesPerRecord = 3;
signals.Add(signal);
return signals;
}
}

The signal in the main-library implements that interface:


public class Signal : ISignal {
public int SamplesPerRecord { get; set; }
}

We can now call the SignalReader and it returns us a collection of signals we can use:


public ICollection GetSignals() {
SignalReader reader = new SignalReader();
return reader.GetSignals();
}

We can implement further signal-readers just by implementing the necessary interfaces into the main-signal-class. In fact, for each reader we created from Signal inherited classes implementing the interface the reader defines. With that construct, we can work without circular references and get a collection of objects we can work with.

Wednesday, July 8, 2009

Benefit for unit tests

From today on I’m absolutely convinced that unit tests are great.

The last three days I refactored my current project a lot – in fact I added 10 classes, deleted 6 and changed 25. If I would have done that in the past without unit tests, I a) wouldn’t have done that and b) if I really would have done that, it would have probably taken me 2 weeks to realize that my uncontrolled changes aren’t working and I wouldn’t get it to work in a reasonable amount of time.

But with my 250 unit tests, I checked every refactoring-step if my code still does what it has to do. And with that, I was absolutely sure about my changes. So, thank you, unit tests!

Monday, July 6, 2009

Clean Code


I just read the german edition of Clean Code from Robert C. Martin. The introduction made me love this book immediately by a simple drawing. There are two things I’ll take along from this book:

1) For each function f let f.LinesCount < 20

2) Comments are evil

These two rules need some clarifications of course. In fact, the demand to keep functions below 20 lines is a result of another rule: Don’t mess with abstraction-levels. If you see a function with more than 20 lines, this should be a good indication for a mix of different levels of abstraction.

The second rule points in the opposite direction of what I’ve learned at university: one tutor said to me that there should be more lines of comment than lines of code, so that another person could easily understand what you wanted to say. Today with C# and Java, this isn’t true anymore. The code itself became the comment. No more cyptic function-calls or Hungarian notation but intuitive named functions and variables telling what they’re doing.

Although I’m still feeling awkward without any function-header-comment, I slowly try to reduce unnecessary comments like this:

‘ iterate through all alarms
For Each a In m_colAlarms

And transform it into this

For Each alarm In _alarms

The difference is not big but the sum of all changes generates a nice picture.

So, the first dozen chapters are truly inspirational. After that, the book takes a look on bigger examples how to refactor whole classes. This is done step-by-step and after some steps, it’s getting boring. My advice: just read the first 12 chapters and start coding!

Wednesday, June 10, 2009

What a wonderful world

Recently I read a lot about the M-V-VM pattern and I wanted to try it out. So I started small with a WPF-application implementing a listview showing some events related to sleep medicine. I’ve created a simple model with a collection of various data. This model is the data-provider for a ViewModel which is databind to this view:



So far, so good; worked pretty easy. I then read something about the graphical ability of WPF, which should be very bad in displaying a lot of graphical objects. Again, I wrote a sleep-medical-application, but this time showing some random biosignals with events:



The problem here was the very long signal build of thousands of Polyline-segments. And indeed, this brought WPF to its knees. You can’t show some signals with the pure use of WPF-technology. I instead used GDI+ inside of a Canvas-element for the signal and the VirtualCanvas-technique for the events (read here about it). With that I managed to preserve databinding on the modifiable objects (the events): you can move them around and change their duration by dragging their border.

In a second step, I combined the model of the ListView with that of the biosignals and injected it into its ViewModel. Of course, every ViewModel is being unittested – what a wonderful world:


Thursday, June 4, 2009

C#-For and VB.NET-For

Yesterday I wondered why on earth my simple VB.NET-For-loop produced an error:

Dim collection As New List(Of Integer)
collection.Add(1)
collection.Add(2)
collection.Add(3)
collection.Add(4)
collection.Add(5)

For i As Integer = 0 To collection.Count - 1
Console.WriteLine(collection(i))

If collection(i) = 2 Then
collection.RemoveAt(i)
End If
Next

I’m coming from a Java / C#-background, so I tried the same loop in C#:

var collection = new List<int>();
collection.Add(1);
collection.Add(2);
collection.Add(3);
collection.Add(4);
collection.Add(5);

for (int i = 0; i < collection.Count; i++) {
Console.WriteLine(collection[i]);

if (collection[i] == 2) {
collection.RemoveAt(i);
}
}

Et voilá, the result is what I wanted. So I made my discovery of the day: C#-For isn’t VB.NET-For.

In the cold light of day and using the debugger, it seems obvious that the VB.NET-For doesn’t check the condition on every iteration. It just duplicates the loop as often as it is stated in the For-statement.

The C#-construct is smarter as it checks in every iteration if the condition is true. But if it’s true that this is the difference between the two Fors, then the C#-loop must be slower. So, let’s check it out:

Dim start = DateTime.Now

For i As Integer = 0 To 1000000000
' nothing
Next

Console.WriteLine(Now.Subtract(start).ToString())

Vs.

var start = DateTime.Now;

for (int i = 0; i < 1000000000; i++) {
// nothing
}

Console.WriteLine(DateTime.Now.Subtract(start).ToString());

And indeed, the VB.NET-For-loop wins on my system with 3.734s to 4.687s!

Sunday, May 17, 2009

Thread-Threat

At work, I'm trying to get a software-feature faster by introducing multithreading. We import data from a device and convert it into our format. This is done sequentially at the moment, first importing, then converting. First tests have shown that we can get a benefit of about 30% if we do that in parallel. So I developed a wonderful producer-consumer-queue with a producer-thread and a consumer-thread which gets its data from the producer-thread. So far, so good: all unit-tests with that queue ran successfully.

However, as soon as I plugged that code into the import-conversion-piece to make it multithreaded, I got System.Runtime.InteropServices.COMExceptions with HRESULTs of -2147467259 (RPC_E_SERVERCALL_RETRYLATER, Unspecified error) or -2147417856 (RPC_E_SYS_CALL_FAILED, System call failed) - (here is a list with automation errors). These errors occured randomly on different parts of the code. But all code-parts had in common that they're calling a VB6-COM-object (well, it's a COMException - what should I expect...).

Some googling brought me similarities with Office-automation (see here and here for example). My picture about that problem became clearer and clearer and I sketched that diagram to understand it:


Thread A and B are accessing the same COM-object. This access is provided via a RCW (runtime callable wrapper). There is only one RCW for all accesses to that COM-object (read the great article series "Beyond (COM) Add Reference: Has Anyone Seen the Bridge?" of Sam Gentile for a deeper dive into COM-interop). This means multithreading and COM-interop is no fun.

What about protecting the access to that COM-interop with a lock? I designed a little construct so that I won't forget to protect any calls to that COM-interop:


The wrapper for the COM-interop, ThreadSafeComInterop, offers the COM-interop via a Lock-class. Each time you want to access the COM-object, you acquire the lock. With that, a Monitor enters the lock and exits it not until the lock is disposed. It's neat with the using-construct:

Using lock = _interop.Lock
' do something with lock.ComInterop
End Using

See that sequence-diagram for further information:


The provider creates the ThreadSafeComInterop by passing the COM-interop to the constructor. The recipient can call the Lock via the using-construct and access the COM-interop via lock.ComInterop. By creating the ThreadSafeComInteropLock, a Monitor.Enter is established on a static lock-object. When finished using the COM-object, the Lock is being disposed and Monitor.Exit is being called to allow other components to access the COM-object.

This sounds great and tests are showing that the exception-rate is degreasing from 10 tries - 9 exceptions to 10 tries - 1 exception. But unfortunately, this exception is one exception too much. Reading "Lessons Learned Automating Excel from .NET" finally convinced me to write the needed parts of the COM-component in .NET.

Friday, May 1, 2009

BendingStackPanel

I just finished a nice little tool for our Message-module: Message.dll for dummies.

On the right is a ListView with various components of which the trace-level can be altered. In the center of the dialog are 3 Buttons to vary the debug-mode. These buttons are on a StackPanel with a custom-made property "Bend" and overrides to Measure and Arrange. You can bend the StackPanel up to 180 degrees. Here is a picture with more buttons and an ellipse (any UIElement can be added):

The slider and the TextBlock binds to the BendingStackPanels Bend-property so that you can interactively bend and unbend the panel - looks really cool :) I was amazed how straightforward the development was: it took me just a few hours! Here is the envelope of ideas - nice, eh? ;)

The whole bending-stuff is just class-10 (yes, I looked it up...) sine- and cosine-trigonometry. You can have a look at the code here.

Tuesday, April 28, 2009

LoC and FxCop

I was curious on how many lines of codes we are working. There were only nebulous guesses of around 100.000 locs – but no official ones. So I googled a bit and found CLOC, a counting tool for lines of code. I ran it on my ActiveX- and DotNet-folder and it calculated:

·         80,000 loc VB.NET and 40,000 lines of comments in VB.NET

·         410,000 loc VB6 and 310,000 lines of comments in VB6

·         20,000 loc C++ and 5,000 lines of comments in C++

The good number of comments in VB6 might result of the huge header we gave each file and a rather big header for each method. In VB.NET this is more dense.

 

Another tool on my way to a great developer is FxCop. This program can examine a dll if certain rules are broken. You can select and deselect single rules or whole rule-sections. The rules are made by Microsoft but you can build your own rules and add them. When you run the program, it lists all violation and you can either try to fix them or if you disagree, you can exclude them with a comment.

FxCop

Wednesday, April 22, 2009

Moving to blogger

I decided to move this blog outside of the MCC-wiki. The content isn't MCC-specific (actually, I deleted the 'hot'-company-stuff) at all and I want to write something about my private projects too.

So, here it comes: after working a bit with WPF (approx 4 months) and trying ASP.NET (approx 1 month), I started a ASP.NET Silverlight project with the brand new Virtual Earth Silverlight Control. You can add UIElements to the map and give them coordinates so that they will move with the panning of the map. This means a way of possibilities:

'todo: upload Picture

Monday, April 20, 2009

Unit tests and how to trick ExpertsExchange

I'm glad I got accustomed to writing tests. It's not fully TDD, but I try to write a test as soon as possible (at least I'm not doing test-last). To never forgot writing a test I divided my IDE into two codeviews:



In the upper view is the productive code, in the lower view the corresponding unit tests. If a tests fails, I open the test result in the lower section and can navigate through the error-proven code easily.

One word on testing events (as I stumbled over it last week): with C# and anonymous methods it's quite easy to write tests for throwing events. With VB.NET not supporting anonymous methods, you have to find another way: I'm using TestContext.Properties(TestContext.TestName) = True at the moment. This code is in my event-handler and changes a TestContext-Property. I think it looks better as using a global variable.

You know ExpertsExchange? Every time I search something related to coding via Google, I get a hit for ExpertsExchange. But unfortunately, you have to pay for an answer: you only see empty boxes instead of the answer if not being a member. But thank god there is Google cache which has access for a free answer: just scroll down all the way and voilá, the boxes are filled:



By the way: I know now how to embed pictures. Google chrome doesn't show the 'upload picture'-frame immediately :/

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...

Wednesday, January 21, 2009

Black and short

Did you see the Shortcut Poster for Visual Studio? It fits nicely on a Din A4-paper (ok, you should have sharp eyes) and it lays now in front of my monitor. For example, do you know CTRL-Tab? Browsing open documents inside VS. Or CTRL-K, CTRL-C: comment the selected lines. Veeeery helpful!

And now finally I'm cool: I use a theme for my Visual Studio. I wanted to try a black background and ended up on the VibrantInk-theme. I use it for about 3 days and I think it's great :)

Tuesday, January 13, 2009

What Great .NET Developers Ought To Know

Recently I browsed a bit in Scott Hanselman's Computer Zen and found a blog-entry reading What Great .NET Developers Ought To Know. I think this is a fine place to start knowing what you don't know (yet).

Also look at BabySmash! by Scott Hanselman - a great introduction to WPF and the way to it.

Friday, January 9, 2009

Happy new Year, OpenXDF and Compression

We're looking for a better and smarter way to save our data. We discovered the OpenXDF-format which just turned to version 1. The quintessence of the format for me is the differenciation of the signal data, the video data and the rest. So you can use ISerializable to easily serialize all the data (events, patient data, etc.). OpenXDF proposes to add all the files to a compressed file.

In .net, you can use System.IO.Compression to compress a file but you need extra work to handle files like in a zip archive (see the Compression Application Sample for how to do that).