Skip to content
/ Michaël Hompus

I am invited to speak at the Techdays 2013 in the Netherlands. The event is held on the 7th & 8th of March at the World Forum in Den Haag.
Techdays 2013 Netherlands

I am invited to speak at the Techdays 2013 in the Netherlands. The event is held on the 7th & 8th of March at the World Forum in Den Haag.

My session, in Dutch, is called “Serious Request met Windows Azure” and I will be talking about my experiences using Windows Azure to build a high available and scaling platform for the various applications used during “3FM Serious Request”, the annual charity event organized by the Dutch radio station 3FM for the Dutch Red Cross.

If the schedule does not change, I will be speaking in the Africa Room on Friday between 13:15 - 14:30.

Update

I have uploaded my slides for this session (PowerPoint PPTX, 6,83MB).
You can also view my presentation on SlideShare (but the fonts get messed up):

Filed under Azure
Last update:
/ Michaël Hompus

dotNed is the Dutch .NET user group and organizes several meetings each year for the .NET community. Maurice de Beijer interviewed me about my experiences using Windows Azure to build a high available and scaling platform for 3FM Serious Request.

DotNed is the Dutch .NET user group and organizes several meetings each year for the .NET community. They also run a regular podcast covering several .NET development related topics like Visual Studio, Mono, ASP.NET MVC, Windows Phone and Windows Azure.

Triggered by my scheduled TechDays 2013 presentation, I was interviewed a few weeks ago by Maurice de Beijer about my experiences using Windows Azure to build a high available and scaling platform for the various applications used during “3FM Serious Request”.

Filed under Azure
Last update:
/ Michaël Hompus

When writing .NET code to access a SQL database we often rely on the Entity Framework (EF). The EF makes it very easy to retrieve data from the database by generating a SQL Query for us. But we should not trust it blindly, as the EF can also generate a bad query. It will return the correct data yes, but at what performance cost?

When writing .NET code to access a SQL database we often rely on the Entity Framework (EF). The EF makes it very easy to retrieve data from the database by generating a SQL Query for us. But we should not trust it blindly, as the EF can also generate a bad query.

It will return the correct data yes, but at what performance cost?

read more…
Filed under C#, SQL
Last update:
/ Michaël Hompus

Recently I was challenged with the task to set the layout and content of a wiki page when a new page is added to a team site. As I'm used to work with SharePoint publishing the task sounded easy, but I was wrong.

Recently I was challenged with the task to set the layout and content of a wiki page when a new page is added to a team site. As I am used to work with SharePoint publishing, the task sounded easy, but I was wrong.

Text Layout

Image showing the Text Layout option in the SharePoint ribbon

My first path was to figure out where SharePoint puts the wiki “text layouts”. I discovered this is not how it works. The layouts available for wiki’s are not configurable anywhere.

But using some PowerShell it was easy to get and set the layout as it is the HTML content of the “Wiki Field” column in the list.

Terminal window
$web = Get-SPWeb http://server/teamsite
$list = $web.Lists["Site Pages"]
$listItem = $list.Items[2] # My test page
$listItem["Wiki Content"] # Returns HTML

The HTML content consists of two parts. The layout table and the layout data.

<table id="layoutsTable" style="width: 100%">
<tbody>
<tr style="vertical-align: top">
<td style="width: 100%">
<div class="ms-rte-layoutszone-outer" style="width: 100%">
<div class="ms-rte-layoutszone-inner"></div>
</div>
</td>
</tr>
</tbody>
</table>
<span id="layoutsData" style="display: none">false,false,1</span>

The layout data describes visibility of the header and footer and the number of columns.

Event receiver

To set the content the first thing in my mind was to add an ItemAdding event receiver, associated with ListTemplateId 119 (WebPageLibrary).

I deployed the solution and added a page and 🎉: no content!

Using the debugger to verify my event receiver was triggered, I went to the next option: adding an ItemAdded event receiver. This time I got an exception the page was already modified by another user. Refreshing the page gave me the default content.

So, this told me 2 things:

  1. It is possible to set default content
  2. I forgot to set the Synchronize property

So, after fixing the second thing, I deployed once again and got: no content!

As I used ListItem.Update method in my receiver, I got a version history where it showed the content was set, but the final version still ended up empty.

When faced with utter desperation, working with SharePoint has taught me you always have an escape: launch Reflector.

There I found this gem of code in the SubmitBtn_Click method of the CreateWebPage Class:

SPFile file = SPUtility.CreateNewWikiPage(wikiList, serverRelativeUrl);
SPListItem item = file.Item;
item["WikiField"] = "";
item.UpdateOverwriteVersion();

So, no matter what I do in ItemAdding or ItemAdded, the content always ends up empty!

After this discovery, the fix was removing the code from the ItemAdding and ItemAdded events and moving it to the ItemUpdated method (synchronous) and added a check if the WikiField content is an empty string.

public override void ItemUpdated(SPItemEventProperties properties)
{
base.ItemUpdated(properties);
var listItem = properties.ListItem;
if (!string.IsNullOrEmpty(listItem["WikiField"] as string))
{
return;
}
this.EventFiringEnabled = false;
listItem["WikiField"] = html;
listItem.UpdateOverwriteVersion();
this.EventFiringEnabled = true;
}

Now every wiki page I add to the team site contains the correct text layout and contains the default HTML.

Filed under SharePoint
Last update:
/ Michaël Hompus

I've been running my own mail server at home for years. But it requires a reliable connection and some maintenance once in a while. And of course it always breaks when I'm on the other side of the world. To free myself of that burden I decided to make the move to Office 365. However I discovered there is no way to set my account as a catch-all account. This is not possible at all! So I made my own scripts to add all email addresses I used in the past as an alias on my mailbox.

I have been running my own mail server at home for years using Postfix, dovecot, amavisd-new, ClamAV and SpamAssassin. But it requires a reliable connection and some maintenance occasionally. And of course, it always breaks when I am on the other side of the world.

To free myself of that burden, I decided to make the move to Office 365. I got myself a P1 subscription and started to browse through the configuration screens. The migration of an account from IMAP to Exchange Online was amazingly fast and easy.

Happy with how everything looked, felt, and connected, I was ready to make the switch.

Just before I wanted to change the MX record to point to Office 365, I double checked the configuration of my account. I discovered I could not find any way to set my account as a catch-all account. After some research I found out this is not possible at all!

read more…