Last listened to Rhinestone Cowboy by Madvillain (on 5 Feb 2010, 19:28)

I bought a HP MediaSmart machine running Windows Home Server the other week and had my first problem with it tonight. For some reason, the client connector software wasn't working right on my Windows 7 laptop. After uninstalling the "Windows Home Server Connector" client software and reinstalling (I tried reinstalling from the CD and from the //SERVER/Software/ folder) it always failed on the bit that said "Configuring computer backup".

Hmm... that's strange. It's a brand new server, running the brand new Windows 7, I'm installing what must be the latest version of the client software from the server share... but it's failing.

A colleague had problems with the same thing and suggested installing Power Pack 3 on the Home Server to ensure I have Windows 7 support. I checked, and sure enough it was already installed. My server and laptop were all up to date.

After digging around for a while I saw that in the Event Viewer on my Windows 7 laptop it was logging an error each time the connector software failed:

"Windows Home Server protocol mismatch. This computer uses protocol version 6.0.2030.2, but partner computer SERVER uses protocol version 6.0.2423.0. A connection cannot be established."

There was another similar one in there too:

"Windows Home Server protocol mismatch. This computer uses protocol version 133038082, but partner computer bb328f67-0000-0000-0000-cd7e35e1d99f uses protocol version 158793728. A connection cannot be established."

Hmm, strange: it seems like the connector client software I'm trying to install isn't the latest version! After more digging around, I found a WeGotServed thread on a similar problem and one commenter mentioned finding a folder on the server (C:\WHS) with some connector software in it, which fixed it for him. But wait, that's strange. The latest connector software should always be in //SERVER/Software/ right? So I used Remote Desktop onto my Home Server and found the two folders and compared the installer files. The //SERVER/Software/ connector software was about 5 months older than the software in the hidden-away C:\WHS folder!

I installed the newest connector on my client machine and that solved my problem :-)

Selecting a contact from the Address Book with MonoTouch

This screencast shows how to programmatically select a contact from the address book in a MonoTouch iPhone application, in only 5 minutes.

The key bit of code is to create an ABPeoplePickerNavigationController, and then take advantage of its SelectPerson event. The brief idea is shown in this code snippet:

var picker = new ABPeoplePickerNavigationController();

picker.SelectPerson +=
    delegate(object sender, ABPeoplePickerSelectPersonEventArgs e) {
        ABPerson selectedPerson = e.Person;
        // do something with 'selectedPerson'
};

Hope you found this screencast helpful.

Deleting cells from a UITableView with MonoTouch

This screencast shows the end-to-end process of how to create a simple iPhone application with MonoTouch. The application displays data in a table, and gives the user the ability to delete cells from the table.

The application consists of a UINavigationController, a UITableViewController and of course some UITableViewCells which can be deleted from their containing table.

Some things I mention in the screencast are:

  • Just like in my UINavigationController RSS example, I am using a template for UITableViewControllers which is based on the one I found at Code Snack.
  • Swipe to delete is enabled simply by overriding the CommitEditingStyle method in your UITableViewDataSource class.

The key bit of code from this example is the CommitEditingStyle method:

class DataSource : UITableViewDataSource
{
    EmployeesTableViewController tvc;

    // ...    

    public override void CommitEditingStyle(UITableView tableView,
                                            UITableViewCellEditingStyle editingStyle,
                                            NSIndexPath indexPath)
    {
        if (editingStyle == UITableViewCellEditingStyle.Delete)
        {
            tvc.Employees.RemoveAt(indexPath.Row);
            tableView.DeleteRows(new [] { indexPath }, UITableViewRowAnimation.Fade);
        }
    }
    // ...

MonoTouch code snippet - Application Icon Badge Number

Another MonoTouch code snippet: how to set the "new items" number on your iPhone apps badge:

UIApplication.SharedApplication.ApplicationIconBadgeNumber = 11;

That will give you this result:

MonoTouch code snippet - Network Activity Indicator

The network activity indicator is in the status bar at the very top of the screen on an iPhone. You can see it just to the left of the time in this screenshot:

Network Activity Indicator in an iPhone app

In Objective-C, you can control when this is shown or not by this code:

// Show
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
// Hide
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;

With MonoTouch and C# the code is almost identical:

// Show
UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;

// Hide
UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;