do { Engine.BlogAbout(".NET","Silverlight"); } while ( alive );  

Mark Monster

Mark Monster  

Archive for August, 2008

DependencyProperties the easier way

After working with Workflow Foundation at a customer I had to admit: I hate DependencyProperties. Yes I hate them. They exist because Workflow Foundation, Windows Presentation Foundation and now also Silverlight needed some way to add features to properties. I must admit I would have liked a different approach by using some kind of Aspect Orientation with PostSharp or so. But I still have to make use of them, so let’s make the creation of DependencyProperties easier, an Resharper Live Template. Just a few words (Property Name, Property Type, Activity Type and PropertyDescription) and you’ll have a full DependencyProperty. I made the Live Template start with word "dprop" and also made the Activity Type be selected by the containing class type.

1 public static DependencyProperty $PROPERTYNAME$Property = 2 DependencyProperty.Register("$PROPERTYNAME$", typeof ($PROPERTYTYPE$), 3 typeof ($ACTIVITYTYPE$)); 4 [Description("$PROPERTYDESCRIPTION$")] 5 [Browsable(true)] 6 [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] 7 public $PROPERTYTYPE$ $PROPERTYNAME$ 8 { 9 get { return ($PROPERTYTYPE$) GetValue($PROPERTYNAME$Property); } 10 set { SetValue($PROPERTYNAME$Property, value); } 11 }

Have fun with it.

The advantage of the TagCloud

While looking at the TagCloud below I thought, there are some things that can be done better. The article on the original TagCloud can be found here.Like:

  • A middle alignment for all items in a row
  • An equal divided space between items in a row

The old TagCloud.

So what I did is take the original code from the WrapPanel and did some refactoring first. I changed the ArrangeOverride method to become a two phase step. The first step is to determine which items become in which row. I put those items in a two-dimensional collection. The next step is the actual arranging of the elements. One of the pieces of code for the arrange does determine which element is the largest in Height in a specific row. Besides this it also measures the total width of the elements in the row which is use to calculate the space needed between the elements.

1 double largestHeightInRow = elementsRow.Max(element => element.DesiredSize.Height); 2 double widthOfRow = elementsRow.Sum(element => element.DesiredSize.Width); 3 double betweenElements = (finalSize.Width-widthOfRow)/(elementsRow.Count + 1);

This all combined results in the following TagCloud.

The new TagCloud.

The updated source can be found here.

Aspect Oriented Programming article

.Net Magazine #21In June this year an article from my hand about Aspect Oriented Programming (AOP) was published in the Dutch .NET Magazine. It’s about partly about AOP in general and partly about the usage of PostSharp. You can download the article here. You can read about my other articles here and here. Let me know what you thing about the article.

Maren Anne Hilany Monster

YES! It’s a girl and we have given her the name Maren Anne Hilany. She’s born on August 11th at 15:06. She weights 3955 g and is 52 cm long. I’m feeling so much love for her no one can possibly understand. Time for some photo’s taken from my beautiful daughter Maren.

Mark-Maren-Yvonne Maren  Her weight on 13-08Taking a little bit of bathHands Up

Isn’t she beautiful?

It’s time for a little bit of prioritizing so I might be blogging a little bit less. But I’m sure everyone understands this.

Something about Sashimi

No it’s not about the  Japanese delicacy that consists of raw seafood. It’s about the definition of "Done". A former project-college Michel has written (in Dutch) about estimating in Agile projects. It’s an interesting read for everyone because what he writes is what we call in Dutch "de spijker op de kop slaan".

I’ve had a lot of interesting talks and discussions with Michel on Agility. He recommended the book I am currently reading called Agile Project Management with Scrum, an interesting read for people wanting to learn more about Agile projects and scrum. This book actually picks real world cases and explains the problems they had and what solutions they used to overcome their troubles. One of the things the book talks about is Sashimi.

So what’s Sashimi?

It actually has something to do with the Japanese delicacy because Sashimi is more like some kind of art with food. Sashimi are thin slices of raw fish that are all complete in the way they have the same taste. In scrum Sashimi is used to require every ’slice’ of functionality is complete in itself. Yes but what is complete? It’s about the following things that are all done:

  • Requirements gathering
  • Analysis
  • Design
  • Coding
  • Testing
  • Documentation

So when doing scrum it’s important that every member of the scrum team has the same definition of "done". It seams to be logical when reading, but I know a lot of you have experienced the differences in the perception of done during a project.

I’ve got a whole bookshelf to read on Agile Projects. So probably more on this later.

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='http://mark.mymonster.nl/tag/net/' /> <tag count='3' tag='Astoria' link='http://mark.mymonster.nl/tag/astoria/' /> <tag count='8' tag='Blogging' link='http://mark.mymonster.nl/tag/blogging/' /> </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.

Read the rest of this entry »

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.

Read the rest of this entry »