Author Archives: Edward Wilde

Is Windows Live Writer failing to display your blog theme correctly?

Yesterday I changed my WordPress blog theme to use the K2 design. Diligently I asked windows live writer to ‘please go get this new style’ and ended up with some rather pleasant but unasked for Times New Roman in the edit pane.

WatiN supports Firefox! - Windows Live Writer

The preview pane also didn’t look anything like my blog, obviously the style sheet reference was missing. Graphics and content appeared, just no styling.

WatiN supports Firefox! - Windows Live Writer (2)

I fired up ol-procmon to find out where an earth wlw was downloading the templates too.

\Users\[user name]\AppData\Roaming
\Windows Live Writer\blogtemplates

\Guid (Each blog ?) *1
\Guid 1 (For edit) \Guid 2 (For preview)

This is on Vista and Windows Server 2008, I imagine it’s different on other OS’s.

*1In this folder you will find 2 index[*].htm files which represent your edit and preview panes. Once I found these html files it turns out wlw had download the k2 css file ‘core.css.php’ as ‘core.css.css’. Renaming fixed my problem, yay!

Tagged , , ,

WatiN supports Firefox!

Back in March I finished developing a release of the WatiN framework that enabled testing in Firefox in addition Internet Explorer (already supported). This was the first time I’ve been involved in collaborative open source development. I worked with Jeroen van Menen, the creator of the WatiN project using Basecamp for project management and sourceforge svn for source control. It was also my first time using Basecamp which worked out pretty well for us. It’s simplicity is what I like. You basically just manage a bunch of grouped lists:

WindowClipping (11)

WindowClipping (12)

Anyhow… It’s now pretty straight forward to make a unit test execute under both IE and firefox

[Test] public void SearchForWatiNOnGoogleVerbose() { using (IBrowser ie = BrowserFactory.Create(BrowserType.InternetExplorer)) { ie.GoTo("http://www.google.com"); ie.TextField(Find.ByName("q")).Value = "WatiN"; ie.Button(Find.ByName("btnG")).Click(); Assert.IsTrue(ie.ContainsText("WatiN")); } using (IBrowser firefox = BrowserFactory.Create(BrowserType.FireFox)) { firefox.GoTo("http://www.google.com"); firefox.TextField(Find.ByName("q")).Value = "WatiN"; firefox.Button(Find.ByName("btnG")).Click(); Assert.IsTrue(firefox.ContainsText("WatiN")); } }

It’s also quite trivial to collapse these two using constructs into a single chunk of code for better maintainability etc..

Check out the WatiN Firefox Community Technology Preview for more information.

Tagged , ,

SharePoint + picture frame = continuous monitoring

Inspired by Owen Roger’s recent appearance on Hanselminutes, I decided to pick up a picture frame and give it some SharePoint integration love. I went for the Samsung SPF-72V (Actually a birthday present from my brother – thanks!)

Samsung SPF-72V picture frame

Importantly this picture frame supports WIFI and viewing of pictures from any RSS feed. I almost bought the Kodak Easyshare however this does not support arbitrary photo feeds, only those from Kodak’s own picture site [sigh].

Business Key Performance Indicators

My first integration idea centered around the KPI capabilities built into the new version of SharePoint 2007.

SharePoint Kpi WebPart

Why would you want to display KPI’s them in a picture frame anyway? Perhaps to increase the visibility, share the responsibility of the KPI’s and to make the information more accessible.

Prototype

I decided to make a graphical representation of the SharePoint KPI list using GDI+, each time one of the lists KPI’s was updated. Then save the result in a SharePoint picture library. The picture frame would be pointed at the picture library’s RSS feed displaying the latest graphical representation of the KPI list.

sharepoint_continuous_monitoring_system_activiy

1. Updating the image

I extended the KPI base column indicator content type using a feature and hooked the ItemUpdated event

<Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <ContentType ID="0x00A7470EADF4194E2E9ED1031B61DA0884" Name="Common Indicator Columns"> <XmlDocuments> <XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/events"> <spe:Receivers xmlns:spe="http://schemas.microsoft.com/sharepoint/events"> <Receiver> <Name>KpiEventReceiver</Name> <Type>ItemUpdated</Type> <SequenceNumber>10000</SequenceNumber> <Assembly> KpiFrameSolution, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6ba389ff4c4c60ec </Assembly> <Class>KpiFrameSolution.Code.EventHandlers.KpiEventHandler</Class> <Filter></Filter> </Receiver> </spe:Receivers> </XmlDocument> </XmlDocuments> </ContentType> </Elements>

In KpiEventHandler I extract the KPI information for the list to which the item being updated belongs. Unfortunately this is where some of the madness began. The kpi status field which indicates red/yellow/green is always null i.e. field["KpiStatus"] = nada. To make matters worse if the column is not a static kpi the Value field is also empty.

Okay so fire up reflector and see how the SharePoint KPI WebPart is able to work out all these values.

Turns out there is a nice factory class KpiFactory that returns a Kpi class for a given list item:

public static Kpi GetKpi(SPListItem listItem);

Using the Kpi class we can obtain a reference to the KPIData class and finally get our grubby hands on the value, status and trend.

public KPIConsts.KPIData GetKpiData();

// Note requires HttpContext

Slight problem KpiFactory is marked as internal – doh. Oh well that’s why they invented reflection. Seeing as the out-of-the-box KPI WebPart is allowed to call into this factory class, why can’t I? So I do obtaining the type like so:

Type kpiFactoryType = System.Reflection.Assembly.GetAssembly(typeof(KpiDisplayFormControlBase)).GetType("Microsoft.SharePoint.Portal.WebControls.KpiFactory", true);

Once you’ve grabbed all of the KPIData it’s just a question of drawing some pretty pictures to represent the list. Because of my crap design skills lack of time, I just copied the HMTL version of the list using the System.Drawing classes to mimic the original.

Image2

System.Drawing representation of the KPI list

2. Publishing the RSS feed

What could be easier I thought? Just turn on anonymous access to the picture library, enable the feed – using enclosures of course 🙂 and we will be up and running on the picture frame looking at our glorious KPI’s

WindowClipping (7)

WindowClipping (8)

Didn’t work, the picture frame wouldn’t display my images, but flickr feeds worked fine, hmm. So I implemented a custom SharePoint feed that used the same media rss specification that flickr outputs. No joy. Still no image displaying.

Starting to get sick of this bloody picture frame… Suspecting that the picture frame couldn’t read the .net generated images I copied some of the flickr images into the SharePoint image library. Low and behold the flickr images appeared but mine still weren’t appearing.

Long and the short  it, after what felt like a day’s worth debugging (read couple of hours), the solution was embarrassingly simple. The picture frame ignores images that are of significantly lower size than the devices 800 x 480 screen resolution. And because this was a prototype, I hadn’t bothered to great a large complete image, rather I just created a 300×200 graphical representation of the list. Once I bumped the image size to 800 x 480 every thing worked fine, or did it?

sharepoint_continuous_monitoring_photo_frame_complete

Looks much better in real life –

sharepoint_continuous_monitoring_photo_frame_zoom

– as I’m rubbish at photography.

Final gotcha

The Samsung SPF-72V doesn’t seem to reload the RSS feed, unless manually prompted to do so. Even using my custom SharePoint RSS feed with a <ttl>1</ttl> had no effect. The device simply cached the initial pull from the RSS and looped those first set of images (also loading the images from cached memory).

Solution: Turn off the picture frame’s local storage – uncheck the tick box highlighted in red. Then always create two images with same names, the frame then cycles between the two images always requesting them from the server each time.

Note turning off caching does not cause the RSS to get reloaded just causes the images to be pulled from the server every time they are displayed. If you only have one image in the feed, this will not get reloaded, hence the need for two.

sharepoint_continuous_monitoring_photo_frame_storage

Next steps

  • Improve the image, make it larger, add more fidelity.
  • Make the source code more configurable, a couple of places were hard coded to get this up and running quickly

Source code

  • If you interested I’ve attached the source code used for this prototype. It’s not really fit for public consumption from an installation point of view (and some of the hard coded URLs)

SharePoint Picture Frame Continuous Monitoring Source Code (978kb)

Tagged , ,
Design a site like this with WordPress.com
Get started