Quick and Simple list paging in WCF

I had to come up with a quick way to do paging of a List of objects today as we have been hitting the packet limit on WCF – we could have easily increased the limit, but in my opinion this just masks the error and doesn’t actually fix it.

Anyway, the quick solution that I implemented is roughly as follows:

Change the interface definition on the WCF to allow you to pass in a page number

In your Data Access Layer code, take the page number and do something like:

int skipCount = (pageNumber - 1) * pageSize;

foreach (Signup alpha in webDal.Signups.Skip(skipCount).Take(pageSize))
{
// Do something else where
}

As you can see – very simple, no fuss and uses Linq. And in theory it shouldn’t load SQL either thanks to the Skip function.

I believe the RIA Services toolkit is going to have paging in there, but I don’t want to switch everything over right now ;)

SmartStamp: Royal Mail missing a trick?

Almost three years ago I wrote a piece about the fact that Royal Mail did not provide any means of integrating with their “business class” SmartStamp postage printing software.

In three years nothing has changed.

But, something has.

More people are now using CRM solutions, such as Sales Force, or even self hosted solutions such as Microsoft Dynamics.

Even more are running SugarCRM or any of the other million open source offerings.

Ebay / Paypal have a deal to allow you to print off shipping labels, with postage, via Royal Mail (through their online service, a bit like SmartStamp).

Hey, but you have guessed it. Still no SDK for SmartStamp.
Personally, I find it slightly nuts that a team of developers can write something like this, and not consider the fact that third parties will want to integrate. I’m even more amazed that the architects, managers, and so forth have not realised there is probably an untapped fund stream there!

Facebook Applications - Should we be concerned about privacy?

With the proliferation of Facebook applications, and people starting to install (even if they don’t use!) them, should we be getting concerned about them?

I mean, would we install a desktop application that promised to give us 30 seconds of entertainment if it wanted access to all our personal details – such as name, address, phone number, list of friends, etc?

I don’t about everyone else, but I have a habit of allowing applications that friends are using – experimenting with them for a bit, then removing them when I get bored. The key thing being, I remove them. How many other people do the same thing, but don’t remove them – leaving the application with access to your details?

Thankfully the data handling engine (and storage) is all on the Facebook system, but from what I can see there is nothing stopping the developer from adding offsite calls to push the information out of Facebooks system into their own – and would we really know? I’ve checked a couple of games quickly with the Web Developer Helper tool for Internet Explorer, and noted that some do appear to push information out – although the majority only download static content from external servers.

Perhaps we need to reconsider what information that we allow these applications to access? Might be nice if Facebook allowed you to see a summary of the information that is being exposed to the third party applications, and perhaps allowed us to anonymise some of the data?

What I would also like to know is what happens when we remove an application? There doesn’t appear to be a nice obvious indication that any data the application has collected while you have been using it has been purged (which SHOULD happen)…

Some of you will probably have noticed that over the past few months I’ve become rather interested in privacy on the net, in applications and of course with social networking (what better target – everyone has it in their life these days in one way or another). The reason behind this is that at my day job (plug … Money Dashboard Ltd … /plug) we are working on some pretty nifty software, and one of the aspects we are taking exceptionally seriously is data access and privacy. After exploring the required steps internally, I am amazed at how much information we divulge in our day to day lives, which could be construed as sensitive, to unknown third parties.

Maybe it’s time we started questioning it.

Virus infecting Delphi apps

Sophos have announced a virus has been found (that has potentially been lurking for some time) which is able to infect Delphi apps by changing a key (Delphi installed) source file for the VCL.

If you are a Delphi shop, it might be worth checking into this and making sure you are running AV, and are not hit.

Details: http://www.sophos.com/blogs/sophoslabs/?p=6117 and http://www.sophos.com/blogs/gc/g/2009/08/19/w32induca-spread-delphi-software-houses/

Silverlight 3 changes networking stack

One thing that might have managed to slip under people’s radar (and certainly did mine until this morning) is that Silverlight 3 changes the network stack options.

No longer are we tied to having the host browser carrying out the HTTP communication for us (and the subsequent issues with browsers such as Chrome and Firefox) – now Silverlight can natively handle the communications.

This also opens up the use of REST services.

Interesting development – I haven’t had a chance to test it yet, but I’m hoping that it does actually work, and fixes some of the compatibility issues that we have seen.

For more information, checkout http://blogs.msdn.com/silverlight_sdk/archive/2009/08/12/new-networking-stack-in-silverlight-3.aspx

Windows Installer pain ..

I’ve been having a bizare problem with Windows Installer on a fresh install of Windows 7 – I’ve been unable to get MSI installs to work with the constant error that another install is already running.

After a quick bit of diagnostic hunting in the event log I came across a recurring install “Microsoft Visual Studio Tools for Applications 2.0 – ENU”. Hmm. It was failing as it was unable to find the directory “”. So I created it. And amazingly the install completed successfully and I can finally install app again.

Very odd.

Exceptions In Blend

I am sure that everyone reading this (who has used Microsoft Expression Blend at least) has encountered the following error message:

image

 

You probably groan too when you see it. Where do you start looking … is it XAML related, or is it code …

Well, the answer is actually fairly simple. Debug blend.

Load the project in both Visual Studio and Blend.

Compile it in Blend.

In Visual Studio – attach the debugger to the running process of Blend – click Debug, Attach to Process and select Blend.

Now open the rough control / page / whatever in Blend.

And witness the exception (complete with details!) in Visual Studio.

Happy debugging :)