Create Twitter-like REST API endpoints with IIS URL rewrite

Twitter’s REST API uses endpoints that look like this:[object]/method.json

In addition for GET request you can append parameters like this:[object]/[method].json?param1=a&param2=b

So for example a call to the Twitter REST might look like this:

I wanted to try and reproduce this format with a REST API I’ve been playing with, so I spent some time figuring out how to configure IIS URL rewrite to handle these URLs and deliver the parameters to an ASP page.

You’ll need IIS rewrite installed, in IIS Manager you should see the ULR rewrite icon if you click on a website, for example:

Screen Shot 2013-09-23 at 11.30.31 AM

If the icon is not there download and install URL rewrite extension from the Microsoft website, then open URL Rewrite and add a new Inbound Rule.

Here’s the regular expression pattern I came up with:


With the Rewrite URL of:


This means that a URL like this:

Will pass the parameters into my ASP page like this:

objectTypeName = myObject
objectMethod = myMethod
param1 = a
param2 = b

You need to make sure you have the “Append query string” option checked for the Rule so the additional parameters (eg param1 and param2) are passed through the rewrite.

If Kim Kardashian’s baby with Kanye West is called North West I’d improve my search engine rankings

If Kim Kardashian's baby with Kanye West is called North West I'd improve my search engine rankings

My random thought for the day was, if I stuff my blog post title with lots of interesting words and terms, just how many people would turn up. Sadly (perhaps promisingly) I did then have to go and check several key facts:

  • How to spell Kim Kardashian
  • Who her boyfriend is today
  • The name of Kim Kardashian’s baby (who calls their child North West? All that pops into my head is North By North West, a really rather good film from the late 1950s directed by Alfred Hitchcock).

Finally I had a quick look at the Google Trends site which gives you an idea of what lots of people are searching for at the moment. Today it turns out the top of the hit parade is:

  • NFL
  • Julius Thomas (had to look him up as well)
  • Anthony Weiner (will that man never give up?)

Which means I probably should write something like how I went to watch an NFL game with Anthony Weiner and Julius Thomas scored a goal/basket/point. Yes, just realised Thomas plays basketball and the NFL is American Football, but hey, who cares when you’re just a search engine traffic moll.



Time Machine: The problem may be temporary. Try again later to back up. If the problem persists, use Disk Utility to repair your backup disk


Yesterday Time Machine on my MacBook started to fail with the message:

“The problem may be temporary. Try again later to back up. If the problem persists, use Disk Utility to repair your backup disk”

It kept erroring after each hourly backup attempt. So I tried the obvious and unmounted the external HDD, turned off/on, remounted, ran backup again, no dice.

I ran Disk Utility to repair the disk, no dice.

I then found this forum post , which led me to the absolutely fantastic Pondini site (the link on the forum post is old, you need to go here) and smacked my head because I’m an idiot, I already have the Time Machine Buddy widget on my Desktop, just been so long I had forgotten.

That showed me:

“Starting standard backup
Backing up to: /Volumes/2TB/Backups.backupdb
Waiting for index to be ready (101)
2.52 GB required (including padding), 1.18 TB available
Indexing a file failed. Returned 1 for: /Library/Spotlight, /Volumes/2TB/Backups.backupdb/Apple’s MacBook Pro (2)/2013-09-03-071009.inProgress/C981E713-FC42-4A7D-BDD5-C83709DF0D5B/Macintosh HD/Library/Spotlight
Aborting backup”

Which shows that Time Machine has been choking on a Spotlight search file, which in turn led me to notice that my Spotlight seemed to be taking forever to complete an index (you can tell Spotlight is indexing, there’ll be a tiny black dot in the circle of the Spotlight magnifying glass top right of your screen).

Screen Shot 2013-09-04 at 11.01.28 AM

In fact, the hours remaining at one point said “About 11 MONTHS” remaining. Not encouraging. I know there’s a way to force Spotlight to reindex your Mac:

  • Open System Preferences
  • Click Spotlight icon
  • Click the Privacy button
  • Add your HDD to the list “Prevent Spotlight from searching these locations”
  • Close System Preferences
  • Re-open, click Spotlight icon, click Privacy button, remove your HDD from the list, close System Preferences

This should kick off a fresh index, it’s much easier than one method I figured out a while ago where you manually delete the Spotlight index file (at one stage my Spotlight decided it didn’t want to index my local hard drive, just my external drives).

So far so good. Time Machine successfully completed its last backup. Spotlight has been sporadically re-indexing, but appears to be returning correct search results when I try a few tests.

Source Control Window disappears in Visual Studio 2012


A little weirdness with Visual Studio 2012 – the Source Control Window disappeared and nothing seemed to bring it back. I could open a solution from the Recent list, and open a file from the Solution, but still no Source Control Window would launch or display. And View -> Other Windows -> Source Control Window did nothing.

All until a colleague pointed out that, if you watched closely, it seemed like the window was loading, just not visible. So we tried Window > Reset Window Layout and all was well.

Drove me crazy for 15 minutes – and the simplest solution turned out the right one.

3G icon does not display on Telstra iPhone – no internet access

My son’s been moaning something about no 3G access on his Telstra iPhone for the last week or so, finally sat down to look today. He was right – the signal strength is fine, but no ‘3G’ symbol. And if you try to open a web site in the browser you see a ‘no internet access’ message.

I hunted around online and finally found this forum post. One of the remedies suggested is:

“go to settings – general – cellular – Cellular data network -and change APN from telstra.wap to telstra.iph”

I checked the settings and lo and behold:


I changed the setting to telstra.iph:


…then rebooted the phone. Now have the 3G symbol displayed, and data access when not connected to our wifi.

Son now much less grumpy with me.


How to syncronise bookmarks across different browsers on your computer


This is a perennial problem for me, I often have multiple browers open – Firefox, Safari, and Chrome on my Mac, Internet Explorer in Windows (via Parallels), often because I need to be logged into the same website as different logins; or because I’m testing browser compatibility.

Chrome is my default browser – a major change I made a while back after Firefox just became too slow, although I still use it for debugging because of the indispensable Firebug.

I have several bookmark folders with lists of web site addresses I access constantly. But of course that’s in Chrome, so when I open up another browser I have to go back to Chrome, grab the URL, and paste it into the new window. All a bit tedious. Once or twice I’ve exported my bookmarks out of Chrome and imported them into the other browsers, but that’s not much chop as a plan.

The other day I came across Xmarks, software designed to keep your bookmarks in sync across all your browsers and devices (eg your computer, tablet, phone and so forth). I’ve installed the software in all my browsers, and it quietly syncs my bookmarks. If I add a bookmark in one browser, after a while it turns up in the other browsers – or if I’m impatient I can manually trigger a synchronisation.

I love tools like this, it might not be a problem for everyone, but for those of us who do need this functionality, Xmarks is the perfect solution.

Image: Enokson

Video: Wangaratta beer fridge animation

I received a lovely email overnight from the guys at TomoNews US – they’re part of Next Media Animation, the company that makes the fun Taiwanese animations.

They noticed my blog post about the beer fridge in Wangaratta interferring with the mobile phone network, they’ve made a cute video about the story!