The TagCloud in practice

Yes it took me some time to get the TagCloud I created in Silverlight to work with WordPress. It's very easy It isn't that it's difficult to set up the tagcloud but the documentation of WordPress isn't very clear in my opinion. I found out I needed the functions get_terms and get_tag_link and the properties of a term. I used a small section of php code to assemble xml that I needed for the TagCloud.

<?php $posttags = get_terms('post_tag', $args); $outputTags = "<tags>"; if ($posttags) { foreach($posttags as $tag) { $outputTags .= "<tag count='"; $outputTags .= $tag->count; $outputTags .= "' tag='"; $outputTags .= $tag->name; $outputTags .= "' link='"; $outputTags .= get_tag_link($tag->term_id); $outputTags .= "' />"; } } $outputTags .="</tags>"; ?>

This would essential output xml like:

<tags> <tag count='46' tag='.NET' link='' /> <tag count='3' tag='Astoria' link='' /> <tag count='8' tag='Blogging' link='' /> </tags>

This resulted in the Cloud page, click on a tag to see all posts belonging to the tag. I probably move along with this and write a Wordpress Widget to also replace the TagCloud in the sidebar with a Silverlight one.

Upgrade failure from WordPress 2.2.1 to 2.6

I thought why not upgrade the WordPress since I was a lot of versions behind. I first looked at the different steps that are required to upgrade to the new version. Just four steps:
  1. Delete your old WP files, saving ones you've modified.
  2. Upload the new files.
  3. Point your browser to /wp-admin/upgrade.php.
  4. You wanted more, perhaps? That's it!
Yes just four steps. You didn't even need to make a backup first it seams. I'm glad I did make a backup, specially of the database. So which are the troubles I had to overcome. The white page I just went to the blog's homepage, but saw nothing, yes just nothing. The management interface did work though. So when I went to the Design section I found out the theme doesn't work anymore. Not only this, it was also removed from the blog. Very strange, so I selected the WordPress default theme to have at least something online. The categories I though a not supported theme, that can happen. But when looking at the default page I saw a list of empty categories, yes empty categories only the amount of posts in each category was shown. This did make me feel a little bit angry, where are categories gone to? After some Googling I found out people who have the same people including this by hand solution. Beside the missing of the category names also the hierarchy is lost. I didn't fix the hierarchy because my new theme doesn't support hierarchical categories. The theme transition Because the failure of my old theme I got looking into a new one. So goodbye Connections Reloaded. Connections Reloaded Theme Welcome Dreamplace. Dreamplace Theme

What needs to be done to make DynamicProxy work in Silverlight?

.NET CLR to Silverlight CLRSome time ago I sort of complained there's no Mocking Framework available for Silverlight. This has a lot to do with the not being available Castle's DynamicProxy for Silverlight. So I did some analyzing on DynamicProxy if it's possible to make it work under Silverlight.

The Castle.Core project

I did some analyzing by just counting the error's. It's about 130 errors that needs to be solved. Most of those errors are the usage of:

  • Serializable
  • MarshalByRefObject
  • ArrayList
  • Hashtable
  • ReadOnlyCollectionBase

I think that some of those error's that have to do with the collections can be solved like the missing classes: ArrayList, Hashtable and ReadOnlyCollectionBase.

I'm not sure about things like Serializable and MarshalRefByObject. I don't think we can solve them, they probably need to be omitted, but will this break basic features of the Castle Core?

The Castle.DynamicProxy project

The Castle.DynamicProxy project has a lot more errors that occur, around 210. Although while navigating through the source code I found out that nothing in the namespace Castle.DynamicProxy.Generators.Emitters needs to be changed. So does this say that Reflection.Emit has enough to do everything needed for the Mocking frameworks? Most of the errors are in the usage of:

  • Serializable
  • ISerializable
  • SerializationInfo
  • StreamingContext
  • MashalByRefObject
  • Hashtable
  • ArrayList
  • CollectionBase
  • ReaderWriterLock
  • FormatterService

Again some of those usages can be rewritten, but the things about serialization probably won't and what about the ReaderWriterLock and the FormatterService? Those are very internally implemented classes. Maybe it's possible to recode things to work without ReaderWriterLock and the FormatterService.


So there needs to be changed a lot in each of the DynamicProxy libraries about 340 lines. That's a lot I would guess. But what if we would solve all these incompatible lines by removing them sort of? I'm afraid this would leave DynamicProxy sort of handicapped. Maybe it's too much so there won't be any mocking frameworks that can make use of the handicapped DynamicProxy. Maybe it's because I've got too little knowledge on the inner workings of DynamicProxy and mocking frameworks like Moq and Rhino Mocks.

I hope somebody with a lot of knowledge can tell if things like Serializable, MarshalByRefObject and... are really necessary. Maybe the founder of the Castle Project, Hamilton Verissimo can help out.

Become Fit with the Wii Fit

wiifit How can you combine sporting with entertainment? Yes I'm not really a sportive guy. But playing a game on the Wii every once in a while is something that's more my thing. A few months ago I ordered the game Wii Fit. This game is a very strange game, because are we sure it's a game? It helps you do some yoga, strength training and aerobics. This is more like sport isn't it? But yes one of the four categories you can sort of do/play is a game category, it's about balancing. I tried this category first off course. Its exactly what it says its all balancing games.

I'm not entirely sure how the game works internally. But the game comes with a board that looks like an ordinary scale but has the intelligence to determine where your balance is. It's just perfect for all the things you don't want to know, like your BMI. I've just played the game for half an hour, but I really like it.

Experiencing Workflow Foundation - Persistence Service and Tracking Service

Just at a new client and investigating if Workflow Foundation will suit their needs. I'm pretty new to Workflow so it's a nice learning step for me. I already stepped into the Persistence and Tracking features of Workflow Foundation.

Combining the Persistence Service and Tracking Service in one Database

It's very easy to add the Persistence Service or the Tracking Service to the WorkflowRuntime. To add the Persistence Service you can configure this like:

<Services> <add type="System.Workflow.Runtime.Hosting.SqlWorkflowPersistenceService, System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" UnloadOnIdle="true" LoadIntervalSeconds="5" /> </Services>

You can add the Tracking Service by doing something very similiar:

<Services> <add type="System.Workflow.Runtime.Tracking.SqlTrackingService, System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> </Services>

The next step for me was very simple. At least I thought so, just combining the two services like this, didn't work:

<Services> <add type="System.Workflow.Runtime.Tracking.SqlTrackingService, System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> <add type="System.Workflow.Runtime.Hosting.SqlWorkflowPersistenceService, System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" UnloadOnIdle="true" LoadIntervalSeconds="5" /> </Services>

I didn't really get an Exception of some kind. I even listened to the WorkflowRuntime.ServicesExceptionNotHandled event but nothing happened. It only seemed the Workflow didn't end with Completed but with Aborted. Yes alright but what's wrong? Tell me, please.
So again Google is my friend, and led me to the blog of Bruce Bukovics. So in the end it doesn't seam to be very difficult, it's just something you need to know. Just add the "SharedConnectionWorkflowCommitWorkBatchService" service in the config so you have a combined config like this:

<Services> <add type="System.Workflow.Runtime.Hosting.SharedConnectionWorkflowCommitWorkBatchService, System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> <add type="System.Workflow.Runtime.Tracking.SqlTrackingService, System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> <add type="System.Workflow.Runtime.Hosting.SqlWorkflowPersistenceService, System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" UnloadOnIdle="true" LoadIntervalSeconds="5" /> </Services>

User Event Tracking

It's possible to do some UserEvent tracking by calling the Activity.TrackData method. This method accepts a key and a value. The Tostring() method is called on the object, so there's no real serialization of the data in the object. We can off course manual serialize the data in an object. So I did some coding to make the Tracking of complex objects possible. I first thought about creating an Extensibility Method for the Activity class, but I won't be able to call the original TrackData method because it's protected. So I have the code that you can add to your custom activity to track the user event data easier.

1 public void TrackObjectData<T>(string userDataKey, T userData) where T : class, new() 2 { 3 this.TrackData(userDataKey, userData.SerializeObject()); 4 }

The code makes use of the following SerializationHelper extension methods.

1 public static class SerializationHelper 2 { 3 public static string SerializeObject<T>(this T obj) where T: class,new() 4 { 5 string result = string.Empty; 6 StringWriter stringWriter = new StringWriter(); 7 try 8 { 9 XmlSerializer xmlSerializer = new XmlSerializer(obj.GetType()); 10 xmlSerializer.Serialize(stringWriter, obj); 11 result = stringWriter.ToString(); 12 } 13 catch 14 { 15 } 16 finally 17 { 18 if (stringWriter != null) 19 stringWriter.Close(); 20 } 21 return result; 22 } 23 public static T DeserializeObject<T>(this string xmlString) where T : class, new() 24 { 25 StringReader reader = new StringReader(xmlString); 26 T deserializedObject = default(T); 27 try 28 { 29 XmlSerializer ser = new XmlSerializer(typeof(T)); 30 deserializedObject = (T)ser.Deserialize(reader); 31 } 32 catch 33 { 34 } 35 finally 36 { 37 reader.Close(); 38 } 39 return deserializedObject; 40 } 41 }

More will follow soon
Besides this I will be looking at a few other features of Workflow Foundation that I will probably blog about. Things like implementing a workflow host and communicating with the workflow from the outside.