Should I cycle: System design

I spent some time on the weekend thinking about Should I Cycle, the app I want to build. There’s two ways I could do it:

  • standalone iPhone app


  • build an API
  • iPhone app will call the API

Given the terms of use of most of the weather APIs out there, I wouldn’t be able to call them directly from my iPhone app. So I should build my own API which the iPhone app will call. OK then.

What should my API look like and what will it do? It’ll be pretty simple – when invoked, all it will do is call the other web services it’ll use – weather, air quality, pollen levels, convert the results into a succinct format, and probably cache the results.

Here’s a simple diagram (created using

Should I cycle (1)

A custom tool ‘PublicResXFileCodeGenerator’ is associated… compiler warning

If you ever have a compiler warning saying

A custom tool ‘PublicResXFileCodeGenerator’ is associated with file ‘blah’, but the output of the custom tool was not found in the project. You may try re-running the custom tool by right-clicking on the file in the Solution Explorer and choosing Run Custom Tool.image001

To remove the compiler warning you can just remove the Custom Tool by clicking on the Resource file, pressing F4 to bring up the Properties and then removing the entry for Custom Tool. Easy.


App idea: Should I Cycle?

I’ve come up with an idea for an iPhone app which I’m going to implement if I have time. I don’t expect to make any money off this app, and I’m only going to build it for an audience of one – me! But if it works well I’ll see if I can be bothered putting it on the app store.

The app is pretty simple – at a set time each day (i.e. in the morning) it should send me an alert (i.e. a push notification) as to whether I should cycle to work or not.

As a fair weather cyclist, the criteria on whether I should cycle to work or not are:

  • Weather – likelihood of rain in the next hour
  • Weather – wind direction
  • Air quality – pollution levels
  • Air quality – pollen count

additional criteria in the future could be:

  • Traffic conditions (doesn’t really bother me)
  • Tube conditions (i.e. if there’s tube or train delays then you should probably cycle)

Anyway, here’s a mockup of what I want the app to do (using

Screen Shot 2014-08-25 at 17.43.15

Creating a slot machine game using VB

Visual Basic may not the best option for coding games, but it’s possible to create them using it. In fact, there are a lot of simple games on the web created using Visual Basic such as slot machines.

Slot machines may have been around for a long time, but they’re still one of the most popular games around the world. Cryptologic, the company that first offered casino gaming services to the public in the 90s through its InterCasino brand, is still in operation, particularly because slot machines are a very lucrative business. Data by the American Gaming Association reveal that electronic gaming machines yield at least 62% of a casino’s annual revenue.

To the developers who think that games can’t be made using Visual Basic, think again. Here’s a simple one posted on by coder Yorkiebar:

Done! It’s a very simply slot game but it works. The window is small, the numbers on the reels aren’t really very appealing, and the user interface is plain at best. However, this should give you the framework on how to create a simple slot machine game using Visual Basic.

This post is a guest post.

Browse a local Azure Web role from another computer

So, you’re developing an Azure website that runs as a web role, which means you use the Azure Compute Emulator when running it locally. And now you want to test or debug that local website in an older browser, such as IE8.

In this situation I have IE8 running on another computer (or maybe a VM), so I need to open up access to my website which is running locally.

Step 1. Find out your IP address – ipconfig. Mine is (NB. I’ve highlighted the wrong field in the screenshot).

Step 2. Find out which IP address and port the compute emulator is running on, by looking in the System Tray at the IIS Express icon. Note that even though I access the website locally on in my browser, it runs on a different IP and port in the emulator, I don’t know/care why.

Step 3. Download and install Pass Port from Yes it’s old but it does the job of forwarding ports nicely, which is what we need to do.

Step 4. Set up a Pass Port port forwarding rule with your IP address and any port (I’m using 800) to the IP address and port of the emulator. N.B. you may need to run PassPort as an Administrator if it doesn’t seem to be working.

image004Step 5. Open up that port (800) in the Windows Firewall:


That should be it. Now you can connect on the remote computer to your Azure Emulator running locally. Obligatory screenshot of my site running in IE8:


Beginner’s guide to add a toolbar to an iOS iPhone app with a Storyboard

I’ve been playing around with iPhone apps a little bit. I’m certainly no expert though, I’m still a beginner myself.

A basic task is to add a toolbar with buttons to your application using XCode.

Lots of samples online are using old versions of XCode. Allow me to demonstrate how to add a toolbar to an app, using XCode 4.2 with Storyboards.

Create a new Project

In Xcode, File -> New Project. Choose Single View Application. I named my application com.mattfrear.toolbars.

Add a toolbar

If you can’t see it, choose View -> Navigators -> Show Project Navigator.

If you can’t see it, choose View -> Utilities -> Show Object Library.

Open the MainStoryboard_iPhone.storyboard. Click on the View.

In the Object Library (which should be in a window at the bottom right of your screen), scroll to the bottom and choose Toolbar. Drag it onto the View. Your screen should look like this:

Screen Shot 2013-08-29 at 16.05.42

Wire up the button

Now we need to add some code which will be fired when the button is clicked.

Open ViewController.m. At the end of the file, before the last @end, paste the following:

-(IBAction) buttonClicked
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Hello world"
                                                    message:@"You clicked the button"
    [alert show];

This is the code which will execute when the button is clicked, and it will display a simple Hello World popup.

Our final step is to wire up the button to this method. To make this easier we can use the Assistant Editor.

In Xcode, go View -> Assistant Editors on Right. Then View -> Show Assistant Editor.

If your screen is small, you might want to go View -> Utilities -> Hide Utilities.

The Assistant Editor should have ViewController.h open. In the Assistant Editor toolbar at the top, it should say Automatic > ViewController.h > No Selection. In that toolbar, click on ViewController.h and choose ViewController.m from the dropdown.

Screen Shot 2013-08-29 at 16.30.55

In the main window, click on the toolbar we added to our View, then on our “Item” toolbar button. Now right click it to bring up the “Bar Button Item – Item” menu.
Under Sent Actions, next to selector there is a + button. Click that and then drag it to the buttonClicked method in ViewController.m.

Screen Shot 2013-08-29 at 16.34.40 (2)

Hooray! Now our toolbar button is wired up to the method. Let’s run our app to test it.

In XCode’s toolbar, next to the big Run and Stop button you should see a drop down. Choose iPhone Simulator, then click the Run button.

Screen Shot 2013-08-29 at 16.40.16


Upgrading a Haswell Macbook Air (mid-2013) to Windows 8

I recently bought a new Macbook Air for work – a mid-2013 Haswell one. I got all the optional upgrades which means it’s an i7, 8Gb of RAM and 512Gb SSD. The main reason I upgraded from my mid-2011 Macbook Air was that I wanted more RAM – with 4Gb it was struggling to run Azure VMs in Windows. Also the 256Gb SSD was stretched, I was constantly having to fight to free up disk space in both Windows and OSX. Finally, I wanted USB 3.0, so that I could use an external HDD at full speed should I need more disk space. And the new PCI-based SSD sounded tasty.

macbook air

My Windows 8 Pro license is an upgrade only license, so in order to get Windows 8 on it I first had to install Windows 7 using Boot Camp. Which went fine.

Once Windows 7 was installed I ran the Windows 8 upgrade installation. It would go through the whole process but then after a few reboots and at the end of the setup process it would hang at the “Personalise” screen, where you choose a colour scheme and a name for your computer. It wasn’t actually hung, it was just that the keyboard and mouse didn’t work so I couldn’t click next. Neither the built in keyboard nor a USB keyboard would work.

So then I tried downloading and making a Windows 8 ISO and installing from that via Boot Camp (instead of installing Win 7 first), which worked fine, but then when I Activated Windows it wouldn’t let me because I have an upgrade only Windows 8 license. Poo.

So my third attempt, and this time I installed Windows 7 first, and the Boot Camp drivers in Windows 7. Then when I ran the Windows 8 upgrade install I elected to choose to Keep Windows settings, personal files and applications – the idea being that it would keep the Boot Camp drivers installed.


Well, third time lucky anyway cos that worked.

Update: it looks like this is a known issue – see this solution.

So, how does the new Macbook perform compared to my older mid-2011 Macbook Air?

Here’s 2011’s Windows Experience Index:


And here’s 2013’s. Not really much faster!
win 7 experience

Finally, here’s 2013’s again under Windows 8:win 8 experience

The only thing worth noting is the decent hard disk rating.

Another advantage of the Haswell chipset is longer battery life – up to 12 hours according to Apple, and the reviews seem to confirm that. BUT I bought the i7 version which is a bit more of a power hog, as confirmed by AnandTech – so I only get about 6 hours of battery life, a slight improvement on the 4 hours I was getting on the 2011 i7 version.

So overall, the 2013 Air is not much of an upgrade on the 2011 version really. Which is a bit of a disappointment.