Category Archives: microsoft

The new HTC 7 Mini or: How to fake WP Bench

I am so evil… Whoahahahahaha…

Earlier today I sent out the following tweet:

LMAO reading today's #wp7 news. I'll explain later... #wp7nl

LMAO reading today's #wp7 news. I'll explain later... #wp7nl

So I fired up this old blog of mine to tell you why I just had to laugh:

Last night I was playing with the latest version of the popular Windows Phone 7 benchmarking app WP Bench, made by Robert Varga. Some time ago Robert added the ability to upload your benchmark results to his server and compare them with others.

However, WP Bench does not only publish the benchmarking results. It also publishes information about the phone models and the Windows Phone OS versions that are used. And these two lists have become an important source for people to scout for new Windows Phone models and OS versions. In fact, every new device/OS version that is listed in those stats is sure to get some headlines at popular news sites like WMPowerUser.com.

That’s when my evil plan starting taking shape. What if I could alter some of the data that WP Bench uploaded to its server and pretend I was using some new, unknown (and fake) Windows Phone model? Surely WP Bench had built in some mechanism that would prevent this, wouldn’t they? But I just had to try. Maybe it was possible to generate some buzz amongst the Windows Phone community and even get featured on some news sites…

First thing to do was to actually inspect what data and in what format is being sent back to the server. So I quickly hooked my Windows Phone to Fiddler, the popular HTTP debugging proxy. I started WP Bench on my phone and ran a simple speed test. I then uploaded the results to the WP Bench server.

The Fiddler Web Sessions list showed that benchmark results are uploaded to the server by using a single HTTP GET request that has all relevant result data specified as query string parameters, like this (I’ve removed my phone’s unique device ID from the URL):

http://www.computemark.com/wpb/index.php?deviceID=...&deviceManufacturer=HTC&deviceName=7+Mini+T86861&
os=Microsoft+Windows+CE+7.11.1131&publishSpeed=true&cpu1=3%2c67&
cpu2=3%2c67&data1=14%2c98&data2=7%2c26&gpuFPS=18&speedScore=58%2c3

What was even more interesting was that there didn’t seem to be any verification mechanism in place, to make sure this data wasn’t tampered with. No verification hashes or any of that kind. So this meant I could easily tamper with such a request and pass my own, fake, data.

I activated Fiddler’s Automatic Breakpoints feature, so it would intercept each request and allow me to edit it, before it was passed on to the WP Bench server. I again ran the WP Bench speed test and uploaded the results. This triggered the Fiddler breakpoint and I made the following changes to the request:

  • I slightly changed the deviceID parameter, so the results wouldn’t be related to results I had previously uploaded using the same device.
  • I changed the deviceName parameter from ‘7 Trophy T8686’ to ‘7 Mini T86861’.
    The fun part of this was that I came up with the name ‘Mini’, because just days ago HTC had announced a new and very large Windows Phone device, called the ‘Titan’. I really didn’t know that HTC had actually once shipped a device called the ‘HD Mini’, which ran Windows Mobile 6.5. So I guess by accident this ‘Mini’ name added more credibility to my fake model name.
  • I changed the OS version from ‘7.10.7712’ to ‘7.11.1131’, hoping that a previously unseen change from 7.10 to 7.11 would generate some buzz. Also, the 1131 part refers to the birthday of someone very close to me 🙂

I didn’t change any of the performance scores, but of course could have easily done so. After that I allowed Fiddler to send the altered request to WP Bench’s server and went to bed.

Fiddler screenshot of the altered WP Bench request

Fiddler screenshot of the altered WP Bench request

So today I visited WMPowerUser.com and sure enough there it was: a nice new article titled ‘HTC 7 Mini running OS 7.11.1131 shows up in WP Bench’. It talked about the fact that WP Bench stats showed this mysterious new model, the HTC 7 Mini, complete with a totally new OS version in the 7.11.xxxx range. There was talk about the fact that this could be the first evidence of Windows Phone Apollo running on a handset. It was also mentioned by many other news sites and of course there was some buzz on Twitter.

WMPowerUser article

WMPowerUser article

So that’s how easy it was to create some fake Windows Phone news. Just to be clear: as far as I know the HTC 7 Mini does NOT exist. Also there is no Windows Phone OS version 7.11.1131 (yet…). It was all made up by me. Whoahahahahaha…

Lastly, as a suggestion to WP Bench’s creator Robert Varga, I would advice him to add some sort of protection scheme, so that uploaded WP Bench results cannot easily be tampered with. I also wouldn’t list a new device/model in the WP Bench stats, unless it has been seen more than once, preferably with result uploads coming from a variety of IP addresses. Remember it took only one little request to get my fake phone to show up in the WP Bench stats.

Update: It appears Surur from WMPowerUser.com wasn’t happy about this and has banned me from posting comments to WMPowerUser. This is a JOKE, guys! Why so serious… !?

Update 2: WMPowerUser.com today has posted an article about another new phone. This one is probably legit, but notice the screenshot that accompanies the article. There is a device called ‘NA NA’ in the list. I know for sure that device was already present before I conducted my little experiment. So I have a strong feeling I wasn’t the first to submit fake data to WP Bench…

A device called 'NA NA'!?

A device called 'NA NA'!?

SharePoint 2009 Comes With Ribbon Interface?

The next version of SharePoint, aka SharePoint 2009 or Office Server 14, is scheduled for release sometime during the second half of 2009. Various blogs have already listed some of the presumed new features, like these:

  • 64-bit only
  • Silverlight UI / Web Parts
  • Better support for dealing with large lists (must-have!)
  • Groove integration

Recently I heard of a new feature that I hadn’t seen on any of these lists: SharePoint 2009’s default web interface will be using the (in)famous Ribbon interface. I was told this information comes from a SharePoint Product Manager at Microsoft, so it should be reliable.

Now I don’t really know what to think about this. I still have a love-hate relationship with the Ribbon ever since Microsoft released it with Office 2007. For basic Office usage it works very well, but for some tasks it find myself scrolling between Ribbon tabs like a madman.

On the other hand, SharePoint 2007’s UI isn’t that good either. The menus are all over the place and rather complicated, especially for first time users. Use of a Ribbon could improve on this. And considering the fact that SharePoint (i.e. Microsoft Office SharePoint Server) belongs to the Office family, it makes perfect sense to give it an Office-like interface. This would definitely enhance the integrated experience.

Now that I think about it, Microsoft’s Office website has been using a Ribbon-like interface for some time now and I must admit it looks nice. Maybe that’s the exact same Ribbon that’s going to end up in SharePoint 2009? Who knows… Maybe they’ll even implement it using Silverlight, so it will respond to my mouse’s scroll wheel, so I can continue that scrolling between Ribbon tabs like a madman 😉

Update: I’ve received several e-mails from people claiming they already have the Office 14 alpha bits and they all confirm SharePoint 2009 / Office Server 14 is using the Ribbon for its menu’s.

Finally arrived: “Concurrent Programming on Windows”

Last June Joe Duffy announced that he had submitted the final manuscript for his (then upcoming) book Concurrent Programming on Windows to his publisher. Since then I had been anxiously waiting for it to arrive. Well, yesterday was the big day. The mailman delivered a big package and to my surprise it was Joe’s book. I had it on pre-order for some time and hadn’t expected it to be such a big book. OK, I knew it was going to have around 1000 pages, but still…

Ofcourse I haven’t been able to read the whole book yet, but I’ve scanned through it and I must say that I’m really impressed by it. It really covers many, if not all, aspects of concurrent programming on Windows. Joe has divided his book into four parts. In the first part he explains what concurrency is at a high level, which is great to get you started. In the second part he then thoroughly discusses fundamental platforms features, inner workings and API details. Here you’ll read everything about threads, thread pools, synchronization, asynchronous programming models and the lesser-known subject of fibers.

Actually, one of the chapters that immediately caught my eye was the one in which he discusses why fibers aren’t supported in the .NET Framework. As it turns out Microsoft planned to add fiber support to the CLR 2.0 so SQL Server 2005 could continue running in its "lightweight pooling" mode (a.k.a. fiber mode) when the CLR was hosted in-process. However they decided to completely remove it due to difficult bugs and schedule pressure. Joe gives some nice background info on this and tells you why it isn’t a good idea to try to use fibers from managed code yourself (i.e. by using P/Invoke).

The third part of the book then covers common patterns, best practices, algorithms and data structures that emerge while writing concurrent software. Here you’ll read about concurrency hazards like deadlocks and race conditions, data and task parallelism and performance and scalability. The final part of the book then discusses overlapped I/O, I/O cancellation and GUI threading models. All in all a very complete and thorough treatment of the subject of concurrency.

As a bonus Joe added two interesting appendices. The first one focusses on designing reusable libraries for concurrent .NET programs and the second one discusses the Parallel Extensions to .NET. Although this last appendix is very interesting and extensive I’m still a bit disappointed by it. I had expected the development of Parallel Extensions to go a bit faster and had hoped they would be released by now, so Joe’s book would include full coverage of this subject. Because of the current state of the Parallel Extensions (currently only some CTP’s have been released, although some of it is scheduled to appear in .NET Framework 4.0) the appendix might (well… most probably will) be outdated very soon. Considering the popularity and importance of the .NET Framework and the multi-core future I expect these Parallel Extensions to become very popular. So coverage of them has to become an essential part of this book. So expect a second edition of Concurrent Programming on Windows to arrive in the near future 😉

Well, to conclude things: Concurrent Programming on Windows is a definite must-have for anyone having an interest in concurrent programming on Windows and can be considered an instant classic. No other book out there has such an extensive coverage of the matter. Just get it!

SharePoint Frustrations #1: The undocumented “IncludeTimeValue” CAML attribute

I’m planning on doing some posts about frustrating things I have encountered (and still do!) during my SharePoint development efforts. Here’s the first one:

Last year while working on a MOSS 2007 project for one of our customers I stumbled on what I thought was a bug in SharePoint 2007. I had created a custom list that was filled with Electronic Program Guide (EPG) information for the streaming video media that that site contained. I then created a Webpart that used ASP.Net AJAX to continually show the actual EPG information below the video stream.

In order to obtain the EPG items I used a CAML query to query the EPG list. The list was simply a custom list containing amongst others a column of type DateTime that was called "ProgramEnd". As the name suggests it contained the time the program ended. I then used the following code to create a query that was supposed to obtain the currently broadcasted item and all future items.

   1: const string EPG_QUERY_TEMPLATE = @"
   2: <Where>
   3:  <Geq>
   4:   <FieldRef Name='ProgramEnd' />
   5:   <Value Type='DateTime'>{0}</Value>
   6:  </Geq>
   7: </Where>"; 
   8:  
   9: SPQuery query = new SPQuery();
  10: query.Query = String.Format(EPG_QUERY_TEMPLATE,
  11:     SPUtility.CreateISO8601DateTimeFromSystemDateTime(DateTime.Now)); 
  12: // ...

To my surprise this query always returned too many items. Further investigation showed that time part of the query seemed to be ignored completely, so it returned the items as if no time was specified! So instead of getting the current item and all future items it returned all items broadcasted for that day.

After wasting a lot of time debugging, using the U2U Caml Query Builder and looking for an answer / solution on the internet I gave up and wrote a quick hack around it, which fortunately wasn’t very difficult. It would just run the query and run the results through some additional code that checked the ProgramEnd DateTime field and filter out the wrong items, like this:

   1: SPListItemCollection results = ...; // The results from the query mentioned above
   2: // Trim the results to only include the current and future items
   3: List<SPListItem> trimmedItems = new List<SPListItem>();
   4: foreach (SPListItem result in results)
   5: {
   6:     DateTime programEnd = (DateTime)result["ProgramEnd"];
   7:     if (programEnd >= DateTime.Now)
   8:         trimmedItems.Add(result);
   9: } 

Fortunately this worked just fine and the customer was happy. I was not… 😦

Today while surfing the Net I stumbled on this entry in the MSDN forums, from which I learned it wasn’t a bug, but that you need to included the "IncludeTimeValue" attribute to the CAML query, like this:

   1: <Where>
   2:  <Eq>
   3:   <FieldRef Name='programEnd' />
   4:   <Value Type='DateTime' IncludeTimeValue='TRUE'>
   5:    2008-07-30T12:00:00Z
   6:   </Value>
   7:  </Eq>
   8: </Where> 

If only I had known it was this simple… What bothers me is that this little, but very important attribute seems to be totally undocumented. I couldn’t find any information about it in the WSS / SharePoint SDKs.

Ofcourse once I knew what to look for I found some other blogs and forums mentioning this issue. It turns out the UCSharp blog had already blogged about this way back in October 2007, only a few months after I searched for it. Even Karine Bosch, U2U’s "CAML Girl" and author of the famous U2U CAML Query Builder, says she only recently found out about this. Fortunately she has included support for the "IncludeTimeValue" attribute in her latest version of the U2U Caml Query Builder, which I know a lot of SharePoint developers use to construct and test their CAML queries.

I also noticed that someone called puneetspeed has added some Community Content to the online SharePoint SDK’s SPQuery docs explaining this issue. So hopefully Microsoft will add information about the "IncludeTimeValue" attribute to the official SDK text in the near future.

Back from the DevDays 2008

Just arrived back from my visit to the Microsoft DevDays 2008 in Amsterdam. It was a great day and I’ve attended some interesting sessions.

I’ve uploaded the photos I took to my Flickr account, so check ’em out. I’ve also uploaded a small video of the “Holland Sport” bicycle race track we had at our booth. Check it out:

It was a very tiring day and I’m going to get some sleep now. I’ll blog about some more about the DevDays later on…

Attending Microsoft DevDays 2008

Tomorrow (well… in a couple of hours actually) I’m off to Amsterdam for the Microsoft DevDays 2008. This year I’m only going to attend the first of the two days. My employer, Atos Origin, is a Platinum sponsor for the event and we’ll be there with a big booth.

At our booth you’ll be able to compete in a fun bicycle contest and perhaps win one of the six XBOX 360 consoles we are giving away! Hope to see you there. I’m scheduled for booth duty on thursday morning. Yes, that’s during David Platt‘s great keynote on “Why Software Sucks”. Fortunately I’ve already seen this one during TechEd Developers 2007 in Barcelona last year and I also own an autographed copy of his book on the topic. But still I’m going to try to sneak away from the booth for a while 🙂

As for my SharePoint interests I’m hoping to get a chance to speak with Jan Tielens and Patrick Tisseghem, who are both scheduled to speak at the event. I’ve got some burning questions about Custom Security Trimmers that I hope Patrick can answer.

Oh, and ofcourse I’ll take my digital camera and see if I can take some nice pictures of the event and post them here.

No More *BEEP*

I might have happened to you too: make some error in a Windows virtual machine and your system will *BEEP* out loud. Not some nice and fancy WAV/MP3 sample, but a raw *BEEP* coming straight from your system’s motherboard. This *BEEP* does not respect your speaker volume and mute settings. And it will probably irritate most people who sit near you.

Fortunately getting the beep to shut up forever is relatively simple. Here’s how to do it:

  1. Open a Command Prompt window (in Vista make sure you open it using the “Run as administrator” option).
  2. Use the following commands:
    • To stop the Windows Beep Service:
      net stop beep
    • To make sure it never gets started again:
      sc config beep start= disabled

That should take care of them BEEPs 🙂

.NET 3.5 Enhancements Training Kit

The Visual Studio & .NET Framework Evangelism team did it again. After their cool .NET 3.5 Training Kit they are now working on the follow up: the .NET 3.5 Enhancements Training Kit. It’s not final yet, but still very interesting!

Currently, the training kit contains six hands-on labs, made up of the following technologies:

  1. ADO.NET Data Services
  2. ADO.NET Entity Framework
  3. ASP.NET AJAX History
  4. ASP.NET Dynamic Data
  5. ASP.NET MVC
  6. ASP.NET Silverlight controls

Read more about it on Jonathan Carter’s blog.

Beware of the SharePoint Memory Leaks!

Beware of the SharePoint Memory Leaks!

You might not know it, but when developing for SharePoint (either WSS 3.0 or MOSS 2007) it is very easy to cause memory leaks, which can ultimately thrash your SharePoint server’s performance. The reason for this is that even though your own code might be written using only managed code, the SharePoint API still uses unmanaged code in some places. These unmanaged resources have to be explicitly disposed of, especially considering the fact they are living inside an ASP.Net web application (SharePoint) and potentially can have a long lifetime.

The problem is that the SharePoint API doesn’t always make clear when exactly you have to dispose of objects explicitly. Sometimes it may look like you’re just inspecting a value of a property, while in the background a whole new object is instantiated, which holds valuable unmanaged resources that should be freed by the caller (you!). Other times you might find yourself disposing an object, only to find out you weren’t supposed to…

Way back in June 2006 Microsoft employees Scott Harris and Mike Ammerlaan released their article Best Practices: Using Disposable Windows SharePoint Services Objects on MSDN, which can be regarded as the mother of all articles on this subject. I think this article is often overlooked and should be considered essential reading material for every serious SharePoint developer out there. Also read their more recent article called Best Practices: Common Coding Issues When Using the SharePoint Object Model, which also handles topics like data and object caching and writing scalable code.

Recently two other Microsoft employees also wrote interesting pieces on this subject. Stefan Goßner did a piece called Dealing with Memory Pressure problems in MOSS/WSS, in which he explains what a "Memory Pressure Situation" is and he lists some common causes and solutions for it. The other interesting read came from Roger Lamb. His entry is called SharePoint 2007 and WSS 3.0 Dispose Patterns by Example and in it he shows some very clear code samples and patterns on how to properly handle SharePoint objects.

Very cool material, guys!

Return of SmartPart V1.3 released

Yesterday Jan Tielens released a new version of his famous SmartPart to the community. It is now at version 1.3 and here’s the changelog:

  • Added a setup wizard to install the Return of SmartPart.
  • Added sample user controls (including connectable user controls and AJAX user controls).
  • Added localization support for ASP.NET AJAX user controls.
  • Various minor bug fixes.
  • Nice 2-minute screencast on how to deploy and test the SmartPart.
  • 64 bit version available.

Great work, Jan! I also like the fact you’ve used Lars Fastrup‘s SharePoint Solution Installer for deploying SmartPart.