Storage Helper for WinRT (Win8 Metro) in C#

Windows 8 Metro Storage Helper I’m currently coding a Windows 8 Metro app version of a Windows Phone 7.5 Mango app I previously made. There are quite a few differences in the code and one of the first stumbling blocks I hit was the lack of Isolated Storage in WinRT. There are some ways of making shared libraries compatible,  but I wanted to learn the new ways of doing things. One of the things I need to do is store POCOs to storage for caching and while having a quick search to see if someone…

Read More

Never to be caught out again...

Posting this here so as to reinforce my memory, so I never miss this again. LINQ errors that make no sense and the build error: “Cannot convert lambda expression to type ‘string’ because it is not a delegate type” = missing "using System.Linq;"…

Read More

Getting an Alexa Rank programmatically in C#

As part of a project I’m working on, I needed to lookup the Alexa Traffic Rank for a domain programmatically. I found the URL the toolbar uses and wrote function to parse the XML and return the value, which I thought I’d share in case it saves someone else 15 minutes of their life… private int GetAlexaRank(string domain) { var alexaRank = 0; try { var url = string.Format("http://data.alexa.com/data?cli=10&dat=snbamz&url={0}", domain); var doc = XDocument.Load(url);…

Read More

Making BackgroundAudioPlayer on Windows Phone 7 work with a Shoutcast stream

Starting with the Microsoft example code for the Background Audio Player, it was less than obvious how to make it work with a Shoutcast stream. If you go to a Shoutcast stream with using a standard HTTP GET request (i.e. from a web browser), you’ll get a web page, giving some details on the stream. The trick to making it actually stream the audio is adding a slash then a semi-colon followed by a MP3 filename. Here is an example using a BassDrive.com stream (paste the full url without the quotes…

Read More