Posted: July 21st, 2010 | Author: Duncan McDougall | Filed under: Code Samples | Tags: c#, ordinal suffix | No Comments »
Yesterday I needed to add the ordinal suffix to a number in C# and was amazed nothing is built into .net. Thanks to Google and SO I found a nice solution that looks pretty nippy. Basically for any number this with output a string with the suffix e.g. “1st”, “13th”, “22nd”
public static string[] SuffixLookup = { "th","st","nd","rd","th","th","th","th","th","th" };
public static string AppendOrdinalSuffix(int day)
{
if (day % 100 >= 11 && day % 100 <= 13)
return day + "th";
return day + SuffixLookup[day % 10];
}
Posted: May 21st, 2010 | Author: Duncan McDougall | Filed under: Android | Tags: FroYo, iPad | 1 Comment »
Here’s one for Android phone owners about to splash out on an iPad 3G. According to former Android engineer, Cédric Beust, an Android phone running version 2.2 of the OS, nicknamed FroYo, introduces 3G tethering capabilities which can supply on the go internet to an iPad. So rather than splashing out an extra £100 on the iPad 3G, save on the cheaper option whilst still enjoying internet access on the bus, in the park or half way up a hill.

Source: One Steve Jobs down, one to go
Posted: May 20th, 2010 | Author: Duncan McDougall | Filed under: Umbraco | Tags: Umbraco | No Comments »
Umbraco 404 was released today fixing a number of load balancing and date bugs. Not much packed into this release, most likely due to the fact Umbraco 4.1 is just around the corner. Check out the step-by-step upgrade guide in the downloads section.

Read the rest of this entry »
Posted: May 19th, 2010 | Author: Duncan McDougall | Filed under: Code Samples, Performance | Tags: Caching, CSS, Google, Web Fonts | No Comments »
Jack of all trades, Google, have announced today the Google Font Directory and the Google Font API, allowing you to easily add web fonts to your web pages. In short, the API allows you to easily use any font in the font directory in your web page and it should work in all modern browsers and a couple of prehistoric ones still kicking about (I’m talking to you, IE6 users). At launch the font directory includes 18 fantastic open source fonts but I’m sure this will rapidly expand into a much richer collection.
Here’s an example of how easy it is to get to embed a font from the directory into your webpage.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Google Fonts API Test</title>
<link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'>
<style>
body
{
font-family: 'Lobster', arial, serif;
font-size: 2em;
}
</style>
</head>
<body>
Check out this funky font!
</body>
</html>

A big advantage of this is since the fonts are served from Google server’s it saves you on bandwidth, provides optimized caching and is served from a CDN.
It’s not only fonts Google offer this kind of service. The Google AJAX Library API allows you to pull libraries such as jQuery, jQuery UI and MooTools from Google servers. See my post The Benefits of Google AJAX Libraries API
Update: This site is now using the Lobster font for the header which is served up by the Google API.
Posted: May 13th, 2010 | Author: Duncan McDougall | Filed under: Android | Tags: Flash, FroYo | No Comments »
The next installment of Google Android is just around the corner and comes bundled with it a bunch of new features and improves.
Android 2.2, nicknamed Froyo, adds Wifi and 3G tethering, meaning phone owners will now be able to hook there phone up to their laptop and surf the net on the train, in a field, hell anywhere with a decent signal. Potential bad news is this feature is dependant on whether or not your network carrier permits this.
Another exciting new addition is full Flash 10.1 support. Take that iPhone! This has been achieved partly down to huge speed improvements to the OS, meaning the CPU hungry platform will run painlessly. Early testers AndroidPolice, are reporting about a 450% performance improvement.
I’m not getting too excited yet though as official updates roll through your manufacturer first and I’m still waiting on an upgrade from my HTC Hero’s, now ancient, Android 1.5.