Author Archive

A look at Microsoft Tag

5 Comments »

Some days ago, Katrien De Graeve, a DE at Microsoft Belgium twittered

I want new full color business card with ‘attached’ vCard – http://www.microsoft.com/tag/ – no more typing over contacts!

Tag. Tag? Microsoft Tag? Business Cards? vCards? I had to check this out, so I popped the URL open in a web browser and took a look. I turned out to be a tag system that is currently in beta – developed by Microsoft. 2D Barcodes is nothing new, but until now, they have been composed by tiny black and white dots arranged in a rectangle.

Accompanying the new tag system is a mobile client – or more specific – mobile clients that enables you to just point your camera at at tag and it will automatically fetch the linked data, whether it is an URL, a vCard or some free text. You just point – you don’t have to press the camera button.  The current beta is free for personal usage, but Microsoft sees a commercial market for the system. When you have created an account and created your first tag – that you can render into PDF, WMF or XPS in different sizes and with different layouts, you will be able to track the usage of the tag with a reporting functionality located on the account page.

One of the render options is to add “Get the free app for your mobile at http://gettag.mobi/ ” a web site optimized for mobile clients, that sports the different kinds of mobile clients. The list of available clients are quite impressive;

  • Windows Mobile (of course)
  • Android
  • Blackberry
  • iPhone
  • Java 2 Micro Edition
  • PalmOS
  • Symbian S60 (incl. 1st, 2nd & 3rd edition).

 

So, I challenge you all to download the software to your mobile and see what’s underneath the following tag:Tag!

For extra credits, I challenge you to put up your own tag(s) on your blog (all of the Norwegian techie/twitter posse – consider yourself tagged) and optionally send me a link in the comments field below :-)


Microsoft Connected Systems MVP 2009!

1 Comment »

Microsoft MVP logo Yesterday, I received an email I have been hoping for (more than any of the Christmas gifts I got :-P ) with the subject:

Congratulations 2009 Microsoft MVP!

I’ve known for some time that I was nominated for the Connected Systems Developer MVP, so I have really been anticipating the arrival of 2009 – 01 – 01.

The mail didn’t show up before 1520-something in the afternoon, so I went around with butterflies in my stomach all day trying to keep my thoughts elsewhere; my son need a lot of attention, so we rolled out a gymnastics mat in the living room and had some fun.

Since I’ve now received the Connected Systems MVP award I feel quite humbled; If you check out the MVP awardees website (my profile isn’t up yet) you will probably notice a lot of hotshots in that category – to namedrop a few; Juval Löwy, Michèle L. Bustamante, Christian Weyer, Aaron Skonnard, Pablo M. Cibraro, Dan Rigsby, Brian Noyes (and the list goes on and on and on…)

Hopefully I’ll persuade my boss so that I can attend the Global MVP Summit in Redmond in the start of March. I believe that would be a really epic experience. I know a couple of other MVPs & RDs that probably will go – Einar Ingebrigtsen of Objectware being one of them (DirectX/XNA MVP) (Thanks man for mentioning my MVP before I got to blog about it myself :-) .

As a part of my continuing effort to put more time into community work, I would like to do more with this blog site, so I’ve decided to host it somewhere else, since my current host, wordpress.com, is quite limited. As of now, it looks like I’ll put up the site on one of my company’s servers.


Configurable PrincipalPermission attribute

1 Comment »

I while ago, a question came up in the WCF Forum about configuring the role and/or user name properties of the PrincipalPermission attribute. As I answered, it is possible to create a custom version of the attribute (deriving from the CodeAccessSecurityAttribute, since the PrincipalPermission attribute is sealed) and pull the property values from the {web|app}.config file.

I implemented a solution for this about a year ago and planned to put up a blog post about it, but it never made it out to the public (the main cause is probably that I experienced a blog-block period of my life :-P ).

The same requirement may be a viable solution i system I’m currently working on for a customer, so I dug through my archives and found the old code.

I’ve polished it a bit made it available here under the Apache License 2.0.

The extended version, PrincipalPermissionEx can be used in two modes; either as a “normal” derivable PrincipalPermission attribute or an attribute that uses the configuration system (or a combination of both).

Instead of using the generic PrincipalPermission attribute, you’ll make derived version for each system role with a sensible name – making it more reliable and resistant to typos; e.g.

[MustHaveSuperUserPrivilegesPermission]
public void PrivilegedOperation(…)
{
}

instead of:

[PrincipalPermission(Role = "MYDOMAIN\SuperUsers")]
public void PrivilegedOperation(…)
{
}


Take a look at the supplied sample code to see how this is implemented.

The usage of PrincipalPermission-based authorization is useful in a variety of scenarios; it can be applied to WCF services, ASP.NET & Smart Client applications. Note that if you put the user name/role in the configuration file, you will need to ensure that the file is locked down with an appropriate ACL to prevent tampering by malicious users. This might not apply to solutions hosted on a locked down server (i.e. IIS-hosted web applications and services) but for smart / desktop clients where the user might have higher privileges to files on the local file system it is necessary to be aware of this.

As always, feedback is welcome :-)

kick it on DotNetKicks.com


LINQ to XML: XPathSelectElement Annoyance

No Comments »

It may be me – since I’m no XPath (or XSLT) pro, but the following is in my book a bug – or at least an annoyance category 3:

Given the following XML document loaded into an XDocument:

<?xml version="1.0" encoding="utf-8"?>
<Elements>
  <Element Id="1" />
  <Element Id="2" />
  <Element Id="3" />
  <Element Id="4" />
  <Element Id="5" />
</Elements>

The following XPath should  yield the first element of the list:

"//Element[@Id = '1']"


Guess what? If use the .XPathSelectElement() extension method, the result will be null – nada!

"//Element[@Id='1']"


The same query without the whitespace around the equal sign will give you the right result.

If you’re an XPath pro I would like your opinion on the matter – or else I’m turning this issue over to http://connect.microsoft.com/

Sigh.


Codename “Velocity” WF/WCF Persistence Provider

4 Comments »

So, it’s been a bit quiet here lately. The natural cause of it is (in no particular order):

  • A lot of work
  • Spending quality time with my son
  • Hacking on different kinds of technology bits (mainly pieces released at the PDC 2008)

I’ve also tried to get a clear picture of my “blind spots” when it comes to WCF. Even though I feel quite competent, there are still tons of stuff that I don’t touch daily so I still have to “rehearse”.

Since I have “Get to know Workflow Foundation – for real” on my TODO list I spent some time playing with durable services.

The persistence provider mechanism that is located in System.WorkflowServices is not exclusive to to Workflows / Workflow services. It can also be used with “vanilla” WCF Services.

The idea is that the framework can persist the service instance after you have invoked a method and when a future method invocation comes down the wire, it can pull it from the persistence store – revive it and pass the call to the “same” instance. A perfect fit for the scenario of long running services.

So how do you enable durable services? It is quite easy. First, you decorate your service implementation with [DurableService] and one of the mechanisms that specifies that the type is serializable (I chose [Serializable] for the sake of simplicity).

image

In this code snippet we also see that there is another attribute that can be used to tell the persistence mechanism that a call to an operation creates the instance or tears it down; [DurableOperation].

The next thing you have to do is to wire up a persistence provider using either configuration or programmatically.

Out of the box there exists only one Persistence Provider; One suited for persisting the service instances to SQL Server – System.ServiceModel.Persistence.SqlPersistenceProviderFactory. You will have to set up a SQL Server Database instance with the schema located in C:\Windows\Microsoft.NET\Framework\v3.5\SQL\EN.

But that was a digression – now back to my custom “Velocity” Persistence Provider. If you don’t know what Codename “Velocity” is, I suggest that you head over here and read more about it. The short description:

It is Microsoft’s attempt to create an in-memory, high-performance, distributed caching supporting different scenarios that can suite many needs in both a web farm or other places where caching is needed. The current version that is publicly available is CTP2. We should expect a new CTP in March (around the time of MIX’09) and the RTW/RTM in the mid of 2009.

To implement a custom persistence provider, you will have to create two classes; the persistence provider implementation and its factory. It is the fully qualified type name of the factory that is specified when you set up the configuration.

The following configuration snippet shows how a custom service behavior is set up. You will have to set the behaviorConfiguration attribute on the service element to “defaultServiceBehavior” in this case.

image

The code for the provider is available here (Licensed under the Apache License 2.0).

Cheers :-)
kick it on DotNetKicks.com


Zune Marketplace: Playlists – a Word of Warning

No Comments »

I’m still very satisfied with the 120GB black Zune that I bought during my trip to the Microsoft Professional Developers Conference 2008 in the end of October. I found a way to use my own Norwegian credit card with the combination of the regional settings in Windows set to “USA” and a borrowed, real address in … LA :-) I first signed up for the 14 day Zune Pass trial – and I was definitely sold.

Luckily, the tricks worked with the real Zune Pass subscription too – so now I’m in my first month of using the Zune Marketplace for for real. I’ve download a great deal of the music I own from before since I’m lazy and haven’t hooked up the external hard drive with the backup of all my music (I’m a recovering CD junkie, so my shelves are filled with albums) so it is a bit weird not having the physical media for some my newly-acquired music.

Here the other day some ads for “The very best of 199X” hit lists turned up on the front page of the Picks section of the Marketplace. Guess what, the summer of 1996 I was 18 and could legally get into pubs and drink beer, so there is a lot of the music from that year that awakes good memories. A good example is The Fugees, that had at least 3 or 4 big hits during the spring, summer and fall.

Back to the playlist. When I saw this “The very best of 1996” playlist I immediately added it to my Downloads list and went to bed. The morning after it was all sitting on my local disk, so I synchronized the Zune and head off for work.

At the train I picked up the Zune, plugged in my Bose QC2 headphones and navigated to the 1996 playlist.

Guess what?

My Zune was infested with crap. Crap. More crap. Unmentionable crap. Boring crap. Boyband crap. Dull drama crap. Crap.

Some example crap artist & songs:

  • Celine Dijon – err. Dion
  • Los del Rio – Macarena
  • Maxi Priest
  • Coolio
  • Barbra Streisand
  • Toni Braxton
  • Hanson

And the list just goes on and on and on and on.

And I forgot to mention that I also downloaded the list for 1997 & 98. sic.

So, what is the morale of this story?

DON’T – I REPEAT DON’T – DOWNLOAD PLAYLISTS FROM OTHER PEOPLE / BEST OF / HIT LISTS WITHOUT CHECKING THE CONTENT OF IT FIRST.

It really garbles the navigation system of the Zune so I have a major cleanup in front of me.

I kept the worst part to the last: Guess what? Since the fine piece of hardware (and the SW player too) keeps tracks of all the tunes you’ve played – the crap may show up on your Zune Tag and possibly affect the content that turns up in the Picks section.

Urgh. Sorry for bothering you with this rant – but the warning is well-meant. Have a nice weekend :-)


What’s new in WCF 4.0

No Comments »

Tonight I held a talk for the Norwegian .NET User Group Oslo on “What’s new in WCF 4.0”. The feedback was good and I think it went fairly well, especially considered the time I’ve had to prepare.

There should probably have been more time allocated for demonstrations but to cover all the areas of improvements in WCF (and related technologies) I really need (at least) 45 minutes. If I’m asked to do this talk for other NNUG chapters (or internal for other companies/clients) I think it would be wise to either cut down on the content – and only mention the left out parts briefly – or extend it to a two hour talk.

If you attended the talk, I would love feedback (both positive & negative), comments, questions, speaking & consultancy offers. Contact me at lw at miles dot no

You can download the slides here.


Where are the System.ServiceModel .Discovery bits?

No Comments »

I’m currently preparing my talk for next Tuesday – “What’s new in WCF 4.0” and one of the features I want to talk about is the new WS-Discovery implementation. My only problem so far (until today) was that I couldn’t find the bits on the Virtual PC Image! I have been searching high and low with .NET Reflector – to no luck.

So I wrote a post in the WCF forum and asked if anyone knew where I could find it. No good answers, so I sent the question to a couple of the PM’s in Connected Systems Division that I know work with WCF. No answer. Finally I turned to the Email form on Nicholas Allen’s blog – and he was kind enough to mail me back.

Turn out that the bits is in the System.WorkflowServiceModel – one of the assemblies I didn’t bother to search since I thought they only contained Workflow-specific bits…

The invitation to the talk on Tuesday can be found here (In Norwegian). I’m hoping for at least 70-80 attendees.


Can’t sign in to Zune…

No Comments »

Zune sign in dialog

Hmm, strange thing. Tried to sign in to Zune now, but I get an error message telling me that their server certificate is expired. If that is true – how unprofessional is that!?

Not to mention the cost of it; for every hour people can’t log into their marked place they must be loosing tons of money…


Preparing a WCF talk for the next NNUG meeting

No Comments »

On Tuesday the 25th November, I will be speaking at the NNUG Oslo meeting (hosted by NITH @ Galleriet, Oslo).

My inital idea was to do an advanced extensibility talk, but after I attended the PDC in LA a couple of weeks ago I’ve changed my mind; the talk will be about the new features in WCF 4.0 (and I will probably touch WF 4.0 as well).

If there are anything special you want me to shed light on, please leave a comment or drop me a mail.

Thanks.