I have an MSI Wind on which I run both Windows 7 and Ubuntu. I rarely use the latter but I like to keep it around and with a 320GB hard drive its affordable. I have used both the Windows BCD loader and GRUB as my bootloader at various times (and for those using BCD I highly recommend EasyBCD as the way to configure it). Most recently I’ve been using GRUB.

Yesterday I installed Windows 7 RC and my boot sector got clobbered by BCD. I had a bit of a had time getting things working again. I first tried using EasyBCD but this time when trying to boot Ubuntu I ended up at a GRUB prompt, and I could not access my Ubuntu partition (more precisely, while "root (hd0,2)" worked, "kernel /vmlinuz" threw errrors and I could not boot).

In the end I got things working using the Ubuntu live CD and reinstalling GRUB. However, it required more than just doing a grub-install – for some reason the BIOS drive mappings seem to have been messed up. I did a web search and I found a lot of people have had this problem and very few found the solution so I thought it was worth mentioning what I did to make mine work in the hope it is useful to others.

In my case my primary Ubuntu partition is the 3rd partition; i.e. /dev/sda3. After booting the live CD and opening the terminal, here is the set of commands I used to get things working again:

sudo mount /dev/sda3 /mnt
sudo mount -t proc /proc /mnt/proc
sudo mount –bind /dev /mnt/dev
sudo chroot /mnt
grub-install –recheck /dev/sda
update-grub

Without the mounts of /proc and /dev, /dev/sda won’t be found after the chroot. The –recheck option is necessary because somehow the BIOS drive mappings have gotten confused. It’s possible the update-grub step is not necessary but I think it is safest to rebuild the grub config; I read at one web posting where someone omitted this step and after rebooting was left at the GRUB prompt again.

Hopefully by now you all have v3.0 of the Live Search client, and are enjoying the new features (web search, weather, and collections). I’d like to talk about collections in this post, but first it is worth mentioning a couple of changes in this version that are less obvious, and overcome limitations I have blogged about in the past:

  • we now have Outlook contact integration. From Outlook contacts you can select the "Show on Map" menu option to map a contact. Google Maps contacts integration is still broken, but we can’t let that hold us back any longer; we gave them nearly a year as well as explicit instructions on what their bug was; if they can’t get their house in order with all that then too bad for them. If you do want to use both GMM and Live Search, then install GMM last. Their bug will cause problems with any other software that installs menu extensions that is installed after them; if the other apps are well-behaved then you can install them before GMM and you should be okay.
  • we have put back the ability to enter addresses in the search box. We have a better geocoder now on the back end and are more confident that you will get the results you want when doing this.

Okay, on to GeoRSS. This was my pet feature that I originally built in September 2006 and it finally got shipped (and if you say ‘about time!’ then I have the names of the two people who kept trying to kill this to give to you; go blame them ;-))

image

The Collections feature is built around Virtual Earth collections, to make it easier for people who don’t know/care about GeoRSS to use the feature and get some value out of it. For the more hard-core, you can enter GeoRSS URLs directly:

image

The actual collections/feeds are stored in the application directory in a file called feeds.xml. You may find it instructive to look at that file.

The cool thing about the URLs is that they can contain metatokens, which will expand to location-specific values:

image

For example, the URL above:

http://www.homethinking.com/georss/@StateAbbrev@/@City@

has two such metatokens, namely @StateAbbrev@ and @City@. These will get converted into appropriate values based on your search location before the feed is fetched.

The supported metatokens are:

  • @StateName@ – state name, e.g. "Washington"
  • @StateAbbrev@ – state name abbrevaited form e.g. "WA" (outside the USA this will be the same as @StateName@)
  • @City@ – city name
  • @Zip@ – zip or postal code
  • @Location@ – the full text shown in the main view for the current location
  • @Latitude@, @Longitude@
  • @StartLocation@, @StartLatitude@, @StartLongitude@, @EndLocation@, @EndLatitude@, @EndLongitude@ – similar to @Location@ etc but for the start and end points of the last route you calculated. The idea being you could pass these up to a transit service to get, for example, a bus schedule
  • @MyLatitude@, @MyLongitude@, @MyLocationTime@ – the location and time (in UTC) of the last GPS fix

In a later post I’ll describe the GeoRSS schema that the client understands (it is a hybrid of GeoRSS, some Yahoo extensions, some KML and some OASIS xADR address stuff). For now I’ll just mention one interesting extension, namely pushpinurl, which can point to a .ico file. This file will be used as the pushpin icon on the map for that result. This can allow you to make custom pushpins.

I heard this proof a couple of days back and thought it was fun and elegant. If you draw a circle anywhere on the surface of the earth there will be at least two opposite points that have the same temperature.

The proof relies on Bolzano’s theorem, which is an instance of the Intermediate Value Theorem. Bolzano’s theorem says that if a continuous function defined on an interval is sometimes positive and sometimes negative, it must be 0 at some point.

We assume that temperature on any path on the earth’s surface is continuous. If f(x) is a continuous function, and g(x) is a continuous function, then f(x)-g(x) is also continuous.

So, choose some starting point on the circumference of the circle, and let f(x) be the temperature at the point at offset x clockwise from the starting point, and let g(x) be the temperature at the point opposite that point. If the temperature at some point x is warmer than at its opposite point x’, then f(x)-g(x) is positive, while f(x’)-g(x’) is negative. So, by Bolzano, there is a point where f(x)-g(x)=0, i.e. f(x)=g(x).

 

"Assertions are the only reliable form of program documentation" (Charles Hoare)

While I wait for the next release of Live Search for Mobile, I will fill in the time with some posts on tricks I have used in the dim and distant past, before I became a mostly C# programmer. I love C#, but I really don’t like the way the C/C++ preprocessor was not included. While preprocessors can be abused, they are also extremely useful (think of __FILE__ and __LINE__, just for starters).

In particular, the preprocessor in C and C++ provides a very flexible assertion mechanism that is much more useful then System.Diagnostics. I’d like to cover some useful ways of using assertions in C and C++. Of course if you’re an Eiffel programmer, you can probably stop reading ;-)

In the code below, I will assume the existence of a library function HandleAssert(char* message), which does appropriate assertion handling (for example, in a GUI app it might pop up a message box, display the message, and give a Continue/Abort/Debug choice).

Obviously, the first thing we need is a basic ASSERT macro:

#ifdef DEBUG

#define ASSERT(condition, message)               do { if (!(condition)) HandleAssert(message); } while (0)

#else

#define ASSERT(condition, message)

#endif

The first rule of asserts is, of course, never put them in production code, hence the DEBUG conditional. The use of a do/while above eliminates any possible dangling else issues that might otherwise crop up if for some weird reason you put your ASSERTs in if statements.

The above is often the only form of ASSERT that most C/C++ programmers encounter. But there are quite a few useful variants on the idea. Sometimes, just an alias is already a useful distinction:

#define PRECONDITION(condition, message)            ASSERT(condition, message)

#define POSTCONDITION(condition, message)         ASSERT(condition, message)

It can be useful to be able to define code that only exists in assertional builds:

#if DEBUG

#define ASSERTIONAL(code)      code

#else

#define ASSERTIONAL(code)

#endif

Putting all of the above in an example:

int AdvanceIndex(int index)

{

    ASSERTIONAL(int save_index = index);

    PRECONDITION(index >= 0, "Index can’t be negative");

    ….

    POSTCONDITION(index > save_index, "Index must advance");

    return index;

}

 

If we have class invariants, it is useful to define these as methods in the class that we can call from our asserts:

class foo

{

#if DEBUG

    bool invariant() { … }

#endif

}

During early development, we could confine ourselves to DEBUG builds. In this case we may want to skip over handling of bad input, etc. We can do this safely using simplifying assumptions:

#if DEBUG

#define SIMPLIFYING_ASSUMPTION(condition, explanation)      ASSERT(condition, explanation)

#else

#error SIMPLIFYING_ASSUMPTION not allowed in release code

#endif

For example:

void Insert(node* n)

{

    PRECONDITION(n != 0 && invariant(), "Can’t insert null");

    SIMPLIFYING_ASSUMPTION(find(n) == 0, "Not handling re-insertion of existing node yet");

    …

    POSTCONDITION(find(n) != 0 && invariant(), "Node must be inserted");

}

Note, when writing unit tests for code that has pre- and post-conditions, you should be striving to write tests that pass the precondition but fail the postcondition. Thus assertions can provide very useful test case selection guidance. Pre- and post-conditions also tend to be more stable than the code inside methods, reduce the need to examine the internal code, and, for the hard-core, support proving correctness.

Sometimes we may find it useful to always fire the assert:

#define UNREACHABLE(why)      ASSERT(0, why)

We can have compile-time assertions on simple expressions:

#define COMPILE_TIME_CHECK(b)    extern int dummy[(b)?1:-1]

As you can see from all of this, the lowly ASSERT can be quite flexible!

Today is my last official day on the Live Search for Mobile team. I am moving over to a new team working on some incubating new mobile initiatives in emerging markets (as a South African ex-pat I can relate to this). It has been a fun ride and it is hard to let go of the Windows Mobile client which I think of as ‘my baby’ (with co-parent Ashley). There is still so much to do. However, some of the things that I have been trying to get shipped since September 2006 are finally going out the door in the upcoming release so I can feel that I have achieved at least some of what I set out to do.

I’ll continue blogging here of course, and I expect to blog quite a lot about the new release once it is out.

We started the WM client team in July 2006, after the MOJAX (mobile AJAX) project got killed. That left the core group – the Barrel of Monkeys – without a home. There were five of us – Steve (PM), Ashley and I (dev), John (test) and Danny (architect). Rather than each go off to different jobs we decided to try stick together, and managed to find a home in local search. We had three months to get the v1.0 product out, and it was a hit! We got an awful lot of fan mail from that (and if you were a sender, thanks! We’ve always appreciated the love :-) ).

After that the original monkey team gradually split up until only Ashley and I were left, but since December the team has been growing considerably in size and charter and there are lots of exciting things in store in the future for the product.

Back in September 2006 I added a couple of features that I thought were killer, but that never made it into the product. One of those was cell tower geolocation, which Google since did and which they got a lot of credit for (damn!). Another will be revealed soon and I’ve always been really excited about it; I’ll definitely blog about it the moment it ships publicly. I’m glad to be able to say that I’m leaving Live Search with all my pet features finally on a ship schedule (in fact I’ve offered that as my excuse for being able to leave).

Over the past 1.5 years through what is about to be our fourth release (almost unprecedented at Microsoft) I’ve had a lot of fun and worked with some great people. Live Search for Mobile, in the words of one of our users, "kicks serious ass"! My new group is almost a spin-off though, at least in terms of people, so it’ll be an easy adjustment. It will be nice to start with a blank slate again.

Thanks to everyone I’ve had the pleasure of working with – the Monkey’s, Don and Xuehai on the server team, our incredible tester and soon to be incredible mom Jenny, our chilled PM Gary, the rock stars over in the Speech Components Group, all our wonderful dogfooders and users, and all the new recruits. In particular working with Ashley has always been fantastic – we are almost of one mind – I’ll miss you bud. Remember the monkey. Aluta continua!

Monkey n518212678_346173_5952

We get gas price data from a 3rd party provider. They in turn get the data from credit card companies. ARCO does not accept credit cards.

This is a great example of where user-contributed data would be valuable, and I hope that one day we will be able to extend the feature to include that.

My team is hiring. The job descriptions are below. PM me if you’re interested:

Windows Live Mobile Search team is focused on delivering outstanding search and local navigation experience on mobile devices.  Our goal is to put the power of Windows Live Services right in your pocket. We own creating addictively useful experiences for folks trying to search from their cell phones. Our mission is to get every one of the mobile queries. We do this by building best-of-breed browser and full-client experiences along with a high-performance platform, and by creating opportunities for users to experience the value through carriers or direct distribution. We are enabling experiences on your mobile devices such as Driving directions, 2D maps, GPS based navigation, category search, product search, browsing detailed maps, finding movie times & gas prices or just searching anything on the web your are remotely curious about.  The field is full of stiff competition, but the battle is far from won for anyone. We delivered award winning Mobile Search (Live Search) client on Windows Mobile & Blackberry and outstanding browse experience (m.live.com) that gets consistent praise. We consistently win reviews against Google and Yahoo.  There is lot more to do.

In Windows Mobile 7, we are building a world class, rich, immersive and exploitive app using latest and greatest technologies such as Silverlight & XAML.  We will enhance Browse experience by leveraging best of breed technologies available in the industry today.  We are also building highly scalable backend and high performance developer platform. Our mission is to get every one of the mobile queries and be the developer platform for search and local information.

We are looking for developers with the passion to stretch the boundaries of how people connect with local information.  We’re looking for people who understand the special constraints of the mobile world and have experience building dynamic applications for mobile devices. We are looking for developers who can work on problems unique to mobile computing, from inception through the end of the product development life-cycle. This is an excellent opportunity to help drive the flow of information into users’ hands.  The team offers an energetic environment, solid growth potential, and a great set of people to work with.

We have Senior SDE and SDE II positions.  

SDE II (2 Positions)

We are looking for SDEs to work on our next generation rich client, to create high performance platform and highly scalable backend.  You will be leveraging best-of-breed technologies such as Silverlight, WPF, XAML, .NET CF and IIS7.

A successful candidate will have:

· Passion for technology and UX

· Experience with the latest mobile technologies

· Solid experience designing, implementing and testing applications written using C#/C++, .NET CF, ASP.NET. Experience with WPF or Silverlight is a plus.

· Good communication skills and the ability to approach problems from the customer’s perspective

· Experience developing and shipping multi-threaded server solutions.

· Commitment to Engineering Excellence

· Bachelor’s degree in CS or equivalent industry experience

· 3+ years of software development experience required.

Senior SDE

We are looking for a Senior SDE to work on our next generation rich client, to create high performance platform and highly scalable backend.  You will be leveraging best-of-breed technologies such as Silverlight, WPF, XAML, .NET CF and IIS7.

A successful candidate will have:

· Passion for technology and UX

· Experience with the latest mobile technologies

· Solid experience designing, implementing and testing applications written using C#/C++, .NET CF, ASP.NET. Experience with WPF or Silverlight is a plus.

· Excellent and pragmatic judgment, good communication skills and the ability to approach problems from the customer’s perspective

· Experience developing and shipping multi-threaded server solutions.

· Ability to work in cross-collaborative environments with commitment to Engineering Excellence

· Bachelor’s degree in CS or equivalent industry experience

· 6+ years of software development experience required.

Follow

Get every new post delivered to your Inbox.