warning: Creating default object from empty value in /home/pulsar/webroot/htdocs/modules/taxonomy/ on line 33.

Sony Ericsson's Software Quality

Float's Mobile AgentFloat's Mobile AgentI'm sticking with Sony Ericsson Phones for a while now. The phones had some issues in the first 2 generations, but after that they worked smoothly. The other reason was Float’s Mobile Agent – a lightweight sync & management application for the Kxx series. Unfortunately the software does not work anymore with my new P1 and does not seem to be developed any further. So I had to go with the shipped software – here is where my journey begins. (more after the link)

Export an Outlook Folder to a Filesystem-Folder

Here is a small tool I wrote (well, rather hacked) which might come handy for some of you. Sourcecode is included so you might want to make it even fancier and do whatever comes to your mind with it.

OutlookFolderExporter 0.3 Beta

What does it do?
Export an Outlook folder containing E-Mail Messages to a physical filesystem folder. Message by message.


  • Outlook 2007
  • NET 2.0 Framework
  • Visual Studio 2007 (optional)

Someone asked me if I knew a tool or a way to do this. From what I understand he was about to share such messages using a Windows-Share. I know there are better ways to achieve this, provided you are using an Exchange-Server - but for some reason it did not work out for them.

Plenty, this is a really quick hack:

  • Supports only mail messages (no contacts, appointments etc)
  • Can export only one folder (no recursion) at a time
  • Developed and tested against Outlook 2007 (12.0) - no idea if this will even work for previous versions of Outlook. I suppose not.
  • Won't cook any coffee yet.
Obligatory Screenshot?

You will need to know the path to your Outlook folder you would like to have exported. The root folder presumed by this applicationis the root folder of your default Outlook acccount. Beneath it you should have folders like Inbox, Contacts etc. To export all messages of the default inbox folder one would use "/Posteingang/" in the German version of Outlook. Must be something like "Inbox" for English Users I think. Another example would be "/Sent-Items/Archive" which would export the Archive folder which you have might created in the Sent-Items parent Folder.

Public domain, check the "License.txt" in the sources package for further details.


0.3 Beta: 2008-07-02 20:40 0.3

  • Inbox->first folder restriction removed - You can export any account folder now.
  • Target directory might be created on demand.

0.2 Alpha 2008-07-02 14:00 - 0.2

  • Added an installer (otherwise we are missing some interop-libraries)
  • Repackaged, Sources will be also installed.


Live Coding Session

I'll be doing some work in java for today. If you would like to peek across my shoulder -

Debug, Log and Tail on Steroids

Sometimes I do really wonder why some great tools remain silent and hidden from the public for such a long time. The guys over at codeproject featured an article about the "TraceTool". Describing it with "yet another log viewer" won't do any justice. Just head over to the article and glance over it. It's able to interface with the most common logging frameworks such as .NET's native, log4net/log4j, NT System Evenlog and plain files.

I must admit I did not try it yet. Will do next week when I'm back in the office - I don't really feel like I want to be coding this weekend. But just reading the specs and howtos on the codeproject site blew my mind. Looks like a jewel, smells like a jewel... might be one!

Setup Log4Net for a project in less than 2 minutes

Sometimes documentation is plain anoying. I've been using log4j since ... I don't know, maybe 5-6 years? The setup was as simple as dropping a log4j.xml into the class path and using the logger right away.

Log4Net ist not really much more complicated, but it requires a little bit more attention. Here is what you need to start logging via log4net in less than 2 minutes:

  • Grab the log4net zip over at:
  • Copy the log4net.dll (for instance bin\net\2.0\release in the zip archive) into your project. Ignore the other zip content if you don't care.
  • Add the library reference
  • Create an App.Config file using the big xml chunk provided below
  • Call log4net.Config.XmlConfigurator.Configure(); once to initialize the log4net stack
  • Done
  1. <?xml version="1.0" encoding="utf-8" ?>
  3. <configuration>
  5. <configSections>
  6. <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
  7. </configSections>
  9. <log4net debug="true">
  10. <appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender,log4net" >
  11. <param name="File" value="Debug.log" />
  12. <param name="AppendToFile" value="true" />
  13. <maximumFileSize value="10MB" />
  14. <maxSizeRollBackups value="2" />
  15. <layout type="log4net.Layout.PatternLayout,log4net">
  16. <param name="ConversionPattern" value="%d [%t] %-5p %c [%x] &lt;%X{auth}&gt; - %m%n" />
  17. </layout>
  18. </appender>
  19. <root>
  20. <priority value="ALL" />
  21. <appender-ref ref="LogFileAppender" />
  22. </root>
  23. </log4net>
  25. </configuration>
some hints and tips to make your life easier:

Here is a pretty elegant way to obtain a logger with the category automatically set to the current class - (there is no equivalent to this in Java by the way - at least not for static fields)

  1. private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

The Logfile will be created next to the executable. Oh, and just in the case you did not know, you can use system envoronment variables in the App.config. For instance you could be foolish (or lazy if you prefer) and log directly onto the Windows system drive:

  1. <param name="File" value="${SystemDrive}\Debug.log" />

Using native SQL in nHibernate

Today I ran into a situation in a nHibernate based project where I needed to execute a very specialized query. Using HQL was rather not practical since I had to query tables which were not "directly" mapped to entities.

So, if you need execute queries behind nHibernate's back and map the results to a Bean / Object not specified in the mappings, You might come up with a solution like this:

  1. string someComplexQuery = @"select ... from ...";
  3. IQuery sqlQuery =
  4. sessionFactory.GetCurrentSession().CreateSQLQuery(someComplexQuery).
  5. AddScalar("Id", NHibernateUtil.Int32).
  6. AddScalar("Firstname", NHibernateUtil.String).
  7. AddScalar("Lastname", NHibernateUtil.String).SetResultTransformer(
  8. Transformers.AliasToBean(typeof(Person)));
  10. IList<Person> people = sqlQuery.List<Person>();
  11. foreach (Person person in people)
  12. {
  13. // ...
  14. }

For a good measure, here is the Person class:
  1. class Person
  2. {
  3. private long id;
  4. private string firstname;
  5. private string lastname;
  7. public long Id
  8. {
  9. get { return id; }
  10. set { id = value; }
  11. }
  13. public string Firstname
  14. {
  15. get { return firstname; }
  16. set { firstname = value; }
  17. }
  19. public string Lastname
  20. {
  21. get { return lastname; }
  22. set { lastname = value; }
  23. }
  24. }

Works like a breeze, /me likes!

Using Spring.NET's PropertyPlaceholderConfigurer

I found the documentation on this topic rather confusing, so here is my cheat-sheet:

Choice 1:

If you store the Configuration-Keys in the Web.config:

File Web.config / App.config

  1. <configuration>
  3. <configSections>
  4. <section name="MyConfigSection"
  5. type="System.Configuration.NameValueFileSectionHandler, System,Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
  6. </configSection>
  8. <MyConfigSection>
  9. <add key="ParameterName" value="ParameterValue"/>
  10. </MyConfigSection>
  12. </configuration>

File spring-whatever.xml

  1. <objects ...>
  3. <object type="Spring.Objects.Factory.Config.PropertyPlaceholderConfigurer, Spring.Core">
  4. <property name="ConfigSections" value="MyConfigSection"/>
  5. </object>
  7. <object id="SomePOJO" type="SomeType">
  8. <property name="Foo" value="${ParameterName}"/>
  9. </object>
  11. </objects>

If you use more than one config section in the App.config / Web.config file, you will need to register all the sections in the Spring's PropertyPlaceholderConfigurer object by adding them to its ConfigSection property. The values should be separated by a comma.

Choice 2:

Don't use web.config at all, define everything in in spring's object xml only:

File: spring-whatever.xml

  1. <objects ...>
  3. <object id="appPropertyConfigurer"
  4. type="Spring.Objects.Factory.Config.PropertyPlaceholderConfigurer, Spring.Core">
  5. <property name="MyConfigSection">
  6. <name-values>
  7. <add key="Foo" value="ParameterValue"/>
  8. </name-values>
  9. </property>
  10. </object>
  12. <object id="SomePOJO" type="SomeType">
  13. <property name="Foo" value="${ParameterName}"/>
  14. </object>
  16. </objects>

WCF, XStream, Serialization Issues and Debugging

Maybe you are familiar with the XStream Serializer which was initially available for Java and ported later on to .NET. If you aren't - its worth checking out. Its a very simple XML serializer able to handle complex objects with cyclic dependencies. It has some minor issues though. If you are aware of them, you most probably won't shoot yourself into the foot. ... Yeah, most probably ... I did!

Lets take one step back. I've been consuming a method (lets call it GetFoo()) exposed over WCF Service by an ASP.NET Client. The method would look like this:

  1. public SomeComplexObject GetFoo(long id)
  2. {
  3. String xml = DAO.GetSerializedObjectById(id);
  4. return (SomeComplexObject) XStream.fromXML(xml);
  5. }

SomeComplexObject would be a class properly annotated with the DataContract and DataMember Attributes. Calling this Method over the WCF Service would bail out a generic error message on the ASP client, basically telling you that the remote side of the connection has quit abruptly.

I must admit that I am still new to the WCF / ASP.NET development so I had no clue where to look for the exception generated by the WCF layer. After hitting Google with this question, I have figured out how to use Microsoft Service Trace Viewer to investigate the SOAP Messages passed around- and more importantly the Exception which occured somewhere deep inside the WCF stack.

The Exception type has been "System.Runtime.Serialization.InvalidDataContractException" and basically said that ".xsdyn~SomeComplexObject" has not been annotated with the DataContract Attribute and thus could not be used in a WCF Call.

.xsdyn? It turns out that XStream will create a fake assembly and create a dynamic instance of the "SomeComplexObject" in case one would not provide a default constructor for the class to be deserialized. Gee! Thats dumb! I mean, not only the way of handing the lack of an default constructor, but also my own dumbness making this mistake.

To sum it up, if you are going to use XStream for .NET, pay attention to include a) the default constructor in each class you wish to deserialize, b) use protected and not private modifiers to class variables if you are going to derive from that class. Otherwise you will be missing the fields in the serialized output. It does not matter if the properties would be public or not.

Oh, and by the way... Setting up the WCF logging was fun. The trace log generated is pretty useful if you need to inspect the SOAP messages / headers and the call history. But if you just need to check the Exception generated by the WCF Stack - take a look into the Windows EventViewer - way more convenient!

Eclipse Vs SetPoint 4.4 on Vista 64

Broken "Colors and Fonts" DialogBroken "Colors and Fonts" DialogThis was bugging me for about 2 days by now. After I've installed a fresh copy of Eclipse (3.3.something, stable) I was kinda surprised that some of the dialogs were not rendering correctly. It took me several hours to test various JVMs among 32 and 64 Bit versions of the SWT / Eclipse package - no luck. Still could not access the "Colors And Fonts" dialog for instance.

It tuns out that the Logitech Setpoint 4.4 software is interfering in  some way with the way SWT works. I think there might be some shell hooks involved into this problem. I have noticed similar issues with Shell Enahncer which is also hooking into the window and mousemanagement of Windows to provide some nice features like X-Windows-like window moving and resizing.

For those who cannot believe, check the Screencast (SWF File) I have attached!

Now I can get rid of the SetPoint Tray-Application to remap my mouse buttons: - Thaks mate!

Port Redirection with Windows

Today I have been asked for a copy of a discontinued port-forwarding and proxy tool I have been once recommending. Unfortunately the program page did disappear quite a few years ago and I was not able to find that tool (bouncer from in my backup files.

After poking a few minutes at google I came across a Port of "rinetd" which I use a lot on my linux boxes: - a very simple daemon for port redirections. Just feed it with a config file like this:

  1. #bindaddress bindport connectaddress connectport
  2. 80 8080

Obviously, the config above will redirect all traffic arriving at the "" to "". Unlike the bouncer tool, rinetd can handle more than one redirection per process. You can define as many forwarding rules in that config as you like.

Last but not least, I have made a tiny change to the source by altering the default location of the config file. Hardcoded location was "/etc/rinetd.conf" which does not make much sense on windows. The attached binary will look for the rinetd.conf next to the executable itself. I have also provided a sample config for that matter:

Imprint Datenschutzerklärung