Thunderclap, the Newsletter of Rolling Thunder Computing

Volume 6, Number 3, Summer 2004

In this issue:

Feature Article: Self-Locating Brewpub Finder For Your Cell Phone. Really.

Blatant Self-Promotion:  MapPoint Web Service Technical Briefing in Boston Sept 13- 15, Semester-long class in ,NET at Harvard beginning Sept 20, Web Services in  Iceland Oct 11-14.

New Book: The Microsoft Platform Ahead, now available

A Song to Warm Your Hearts: I'm Just a Two-Bit Programmer on a Sixteen-Bit Machine 

Annabelle and Lucy's Latest

Subscription Information

 


Feature Article: A Self-Locating Brewpub Finder on your Cell Phone. Really.

This article is adapted from content in my new book, The Microsoft Platform Ahead,

Pocket PCs are completely, totally, and utterly useless as a mass market consumer product. They may fit small dedicated niches, such as wireless order entry for waiters in a restaurant, but outside of these, they're too large to carry around conveniently and too small to accomplish anything useful. On the other hand, every adult and teenager in the developed world already carries a cell phone, and so does any person in the developing world with enough money for us to care about separating him from it. That computing platform is lying fallow, waiting for us to write the killer application for it, as was the huge mass of 386 PCs running DOS in the late 80's and early 90's, just before Microsoft launched SOLITAIRE! (and that other thing you had to run to get it, what was its name? Oh, yeah, Windows.) There’s money here, if we can figure out a way to extract it.

Microsoft’s Smartphone operating system (this week called Windows Mobile 2003 Smartphone Edition, who knows what it’ll be next week), supports the .NET Compact Framework, which makes it surprisingly easy to write programs that run on cell phones that host it. Smartphone 2003 is a subset of the Pocket PC operating system, which in turn is a subset of Windows CE. It’s new to the market, and phones that support it aren’t expected to ship commercially until Q3 of 2004. The Motorola MPx220, which you can read about at this link here, picture shown below, is an upgrade of their popular MPx200. It's a very nice package, and I expect them to be hot gifts for Christmas 2004. (Shipping the first production device running the software named 2003, just shy of entering calendar 2005, is dumb. The Smartphones you'll see on Microsoft’s web site today run Smartphone 2002, which doesn't support the Compact Framework and is therefore much harder to program. If Microsoft can't get devices running their software shipped sooner, then they should change the OS name to something that makes the slip less obvious. “If you can’t learn to do something well, learn to enjoy doing it poorly,” goes the demotivator saying and poster. But we digress.)

As you can see in this picture, Microsoft is marketing Smartphones with the same misguided contacts–calendar–task list approach that hasn’t convinced users to buy Pocket PCs. Smartphones are not PCs, or even relatives of PCs. For example, marketing bullshit notwithstanding, surfing the web from your phone is essentially impossible on these devices. Just entering the address “google.com” took 21 clicks in triple-tap typing, and also required carefully timed pauses or lack thereof between clicks. And with a screen size of 176 x 180 pixels, about 4% of a 1024 x 768 VGA monitor, there’s almost no space for content, let alone ads to pay for it.

Microsoft can't seem to shake off its PC bias and realize that these devices are something fundamentally new and different, and they need to be thought of, designed for, and marketed as such. It reminds me of Digital Equipment Corp (remember them? They were at one time the second-largest computer company in the world. Now what few ashes remain of them are part of Compaq, itself now part of HP) in the mid 80's, unable to shake off their VAX mentality and recognize what the PC was starting to do their industry. But you and I, freed of the huge company’s institutional inertia, can think about what real people want their phones to do, and it’s not carrying their to-do lists. Nor is it the constant jangling of extraneous nonsense like the sports scores or stock updates so beloved by marketingbozos (a single word that I coined a few years ago) who lie to the press and believe what they read, who brought you the soon-to-be-late-and-unlamented SPOT watch, who don’t understand that their users aren’t themselves. Being immersed in a sea of this pushy noise is my idea of hell.

The major use that I see for cell phone programs is for location-based services, by which I mean services tailored to the instantaneous physical location of a roving user. Once you know a user’s latitude and longitude, it’s easy to provide a map of his locale or directions to where he wants to go. The inconvenience of entering the small amount of text needed to identify the destination is small compared to the convenience of instant directions from anywhere to anywhere else, on the box you already have in your pocket anyway for making phone calls. These directions can be to a particular location (“How do I get to 123 Maple St?”) or to a service whose location you don’t know (“How do I get to the nearest open gas station, or currency-exchanging bank, or hospital emergency room?”). Almost no one cares about carrying his task list with him electronically. But conversely, almost no one on planet Earth has not, within the past month, scratched his head and said, “Where the heck am I?” or “How do I get [somewhere] from here?”, often both together.

 Imagine the TV commercial—a woman driving alone, lost in the bad part of town, on a dark rainy night, with the gas gauge running low. Cut to a shot of the husband tucking the sweet six-year-old daughter into bed, smoothing her hair, saying, “Don’t worry, darling, Mommy will be home soon,” but looking out the window with worried face. Back to the car: she pulls out the Microsoft Smartphone that her loving husband or boyfriend (maybe both) paid a little extra for because she’s worth it, that doesn’t take much more room in her purse. One push of a button, and lo! The phone’s speaker activates and a soothing voice says, “Take the next left to the highway onramp.” A map appears on the phone’s screen, with a bright green arrow pointing the way home, and an outside shot shows her car accelerating up the ramp past a menacing bad-guy shadow, possibly dousing it with wheel spray. Final image: car pulls into comfortable suburban driveway, little girl’s voice shouts from upstairs, “Mommy! I’m so glad you’re home!” Close-up shot of woman’s face relaxing, she sighs, “Me, too.” Screen text and voiceover: “Microsoft. Where do YOU want to go today?” Did you manage to finish reading that description without yanking out your credit card to buy one? Think outside the box. These are new things.

Which brings us to this newsletter’s sample application. I travel a lot, bringing the good word to readers like yourselves. (Why not your company, and soon? Call me at 978-356-6377 and let’s set something up.) And I like a mug of good beer. I could use one right now, in fact. You probably could too. If this Smartphone thingamajig could point me at a good mug of beer, I'd buy one. So I wrote a program that makes it do exactly that it do that.

The sample program is a Windows Forms application that runs on my Smartphone. (I have a development model that supports 2003). It’s basically an intelligent client Microsoft’s MapPoint web service. I use the MapPoint Location Server to find the current location of my phone. Once I have that, I used MapPoint to fetch a map of my current location, find brewpubs in the area, and give me directions to the one I select. Because most of the brains are on the Web Service side, I’m astounded at how much useful functionality I was able to concoct with just a few lines of code. You can click here to download the working sample and source code.

You can write programs for the Smartphone using your current edition of Visual Studio. I downloaded and installed the Smartphone 2003 SDK from the Microsoft website. The free download SDK, available here,  contains the libraries needed to write code for that platform, the emulators needed to test applications on your development machine, and the documentation you need to understand it. The process looks and feels very much like writing a desktop application. I generated a Compact Framework project in Visual Studio and chose Smartphone 2003 from the target platform dialog box shown here:

The wizard then generated a form whose client area is 176 pixels wide by 180 pixels high, which is the size of the screen’s available client area, excluding the title bar and the menu buttons that I’ll describe next. You can see the Visual Studio environment displaying this form in this figure. It looks familiar, it feels familiar, it is familiar. Microsoft is following their classic strategy of making development for the new platform look and feel like developing for the old one. It's been very successful for them in the past, and I expect it to be again. They just have to get those darn phones out there for people to buy.

The Smartphone requires a different user interface than the Pocket PC, because it lacks a touch screen and stylus for entering data and commands. Instead, the user enters commands via the two buttons that you see in the figure just below the screen. They’re called softkeys even though they are quite hard, because their actions change with the menu item labels shown above them by the application. The left-hand softkey is generally used for one-touch activation of the most important command. For example, in Solitaire, it’s draw from the pile. The right-hand one generally provides access to a list of context menu items, as does the right-click on the desktop, although in this sample application I only had one other command at any given point. The user can navigate with the arrow keys and the home and back buttons. Alphabetic and numeric data is entered on the numeric keys, using repeated keystrokes for letters. This is annoying and difficult, so it’s best to minimize the amount of it you need. I didn’t use any in the sample application.

This program starts by simulating the phone finding its own location via the MapPoint Location Server (MLS). I’ll be writing an article on this for MSDN magazine as soon as I finish this newsletter, so I can’t go into too much detail here. It’s a web service that talks to a cell carrier to get the location of a specified cell phone. It abstracts away the differences between the location technologies, so you don’t know or care if the phone is using assisted GPS, or triangulating off the cell towers, or whatever. The owner of the phone has to explicitly grant permission to users to know its location. MLS is an officially released product from Microsoft, which you can read about and download here. It requires a business relationship with the cell phone carrier, which is available today through Sprint in the US and Bell Mobility in Canada. Discussions are ongoing with other carriers, and while nothing has been announced yet, I’d be surprised if most of them didn’t come on board soon. I’ll be covering MLS in detail at the MapPoint Technical Briefing in Waltham MA, this September 13-15. In this case, I’ve hardwired a location to Harvard Square in Cambridge, which those of us who work there modestly admit is the Hub Of The Universe.

Once I have my phone’s location, I need to access the MapPoint Web Service to fetch maps, locations, and directions. I downloaded the MapPoint SDK from the Microsoft website. It contains documentation and samples, but no DLLs or other code. Since MapPoint is a Web Service, you access it by means of a client- side proxy. I generated this proxy, as for any other Web Service, by right-clicking the project folder and selecting Add Web Reference from the context menu. I gave the proxy generator the address, specified in the SDK, for the service’s WSDL file, and it generated the proxy. You can see the Web reference if you look carefully at the previous figure. Since I needed to make Web Service calls from various points in my program, I added a class called “Globals” that contains methods for accessing the MapPoint service. That’s also where I store the user ID and password for sending with the MapPoint requests, and other data items that are potentially useful at different parts of the application, such as the latitude and longitude of the phone itself. The sample program comes with a working ID and password for the purpose of this demo only. It’s in the sample code if you download it, but I won’t show it in the listing. If you’re going to do any serious work, contact MapPoint and get your own.

I use MapPoint’s Render service to render a map of the area around the phone’s current location. Here’s a code listing of my method Globals.GetMap( ), which is the connection between my application and the web service proxy:

public static void BeginGetMap (LatLong center, AsyncCallback callback, object state) 
{
	// Set up the map specification object

	MapSpecification mapSpec = new MapSpecification ();

	// Set the data source name in the map specification

	mapSpec.DataSourceName = "MapPoint.NA";

	// Create an array of MapView objects, which
	// contains one member, of class ViewByScale
            
	ViewByScale[] views = new ViewByScale[1];
	views [0] = new ViewByScale ( ) ;
	mapSpec.Views = views ;

	// Set the center point of the view to the
	// lat/long the caller has specified

	views[0].CenterPoint = center  ;
	views[0].MapScale = scale ;

	//Set the map options
            
	mapSpec.Options = new MapOptions ();
	mapSpec.Options.Format = new ImageFormat ();
	mapSpec.Options.Format.Height = 180; 
	mapSpec.Options.Format.Width = 176;
	mapSpec.Options.Zoom = 1.0;
	mapSpec.Options.PanHorizontal = 0.0;
	mapSpec.Options.PanVertical = 0.0;
	mapSpec.Options.Style = MapStyle.Phone ;

	// Create the pushpin array and put it in the map spec
	// This one places the user at the center

	mapSpec.Pushpins = new Pushpin[1];
	mapSpec.Pushpins[0] = new Pushpin ();
	mapSpec.Pushpins[0].PinID = "0";
	mapSpec.Pushpins[0].Label = "You";
	mapSpec.Pushpins[0].IconName = "0";
	mapSpec.Pushpins[0].IconDataSource = "MapPoint.Icons";
	mapSpec.Pushpins[0].LatLong = views [0].CenterPoint;
	mapSpec.Pushpins[0].LabelNearbyRoads = true;

	// Create the network proxy, set user credentials
	RenderServiceSoap prx = new RenderServiceSoap ( ) ;
	prx.Credentials = new NetworkCredential (userID, password) ;
	prx.PreAuthenticate = true ;

	// Make the asynchronous web service call to start getting the map

	prx.BeginGetMap (mapSpec, callback, state) ;

}	

Within it, I allocate and set the parameters required by MapPoint. The call requires an object of class MapSpec. This contains an object of class MapView, which tells the service which portion of the world to map. In this case, I specify a center point (the latitude and longitude of the phone) and a scaling factor. There are several other ways to specify the extent of the map, as we’ll see in later cases. I also specify a MapOptions object, which describes how I want the map to be rendered. In this case, I specify the size of the bitmap that I want in return, along with zooming and panning factors I don’t use in this sample. Finally, I specify an array of PushPins objects, which specifies the markers I want added to the map. In this case I put in only one, indicating the user’s current location on the map. When the MapPoint request is complete, I convert the bits into an actual Bitmap object and display the bitmap in the PictureBox control that the form contains for this purpose. That’s all I have to do to display a user’s location. Here’s a picture showing the map on the phone:

 

           

Now that I have my location, I want to find the brewpubs around it. MapPoint provides access to a number of business locator databases. In this example, I show the user a form offering a choice of gas stations, ATMs, or brew pubs, establishments offering all the types of fuel a guy could need. When the user makes his selection, I call the FindService’s FindNearby method, which provides a list of those types of establishments. You can view the code by downloading the samples. The screen shot above shows the list. Each comes with name, address, phone, and LatLong.

Once I select the one I want to drink at, I can get directions to it through MapPoint's Route service. You call the method CalculateSimpleRoute, specifying an array of latitude and longitude points through which you want to travel. In this example, they’re the phone’s current location and the location of my desired watering hole. The service returns an object of class Route, containing human-readable directions and information for rendering a map of the route. I display the latter in the right-hand screenshot below. You can also use the route object to generate a map, displayed in the left-hand screenshot below. The route is so convoluted because of the maze of one-way streets in the area. It is, in fact, accurate.

           

 That’s all I have to do to make a working brewpub finder. It’s surprisingly easy to do. Although I couldn’t provide you with one that does find its own location, I assure you that mine does, and I carry it around, and use it whenever I’m thirsty. Like now. Until next time,  as Red Green  would say, "Keep your stick on the ice." And now I’m going for a cool one. As soon as my phone shows me where it is.


Blatant Self Promotion: Would you buy a used car from this guy?

MapPoint Web Service Technical Briefing, Sept 13 - 15 in Boston

 

I'll be teaching a three-day public class on Microsoft MapPoint Web Service, including the MapPoint Locator Service, this September 13-15, at the Microsoft Technology Center in Waltham MA. This is the web service I wrote about in the feature article above. If you'd like to learn how to make it tick, you can view the syllabus and register online at this link here. Special introductory pricing of $1000. Limited to 30 participants, so register soon. It's also available in-house at your company.

At Harvard Extension This Fall -- Hard-Core .NET Programming. Meets Mondays at 7:35 beginning Sept 20, Harvard University (location TBA)

My class at Harvard Extension is coming up this fall. Two years ago I left my roots and taught a cream puff class, a few easy homeworks and a project the students chose themselves. While the evaluations were positive, I felt empty. The students hadn't gotten the best from me, from Harvard, or from themselves, and most of them didn't know it. But I did, and I do, and I know how to do it better, because I've done it. Last year, I returned to my hard-core programming class, featuring a cumulative project, the approach I pioneered with my SDK class back in 1992. Students from those years still come up to me at conferences and tell me how that deep, persistent knowledge of how things really tick under the hood, not just clicking wizard buttons and saying, "Gee, whiz!", put them ahead of their competitors then and now. If you really want to get your hands dirty and don't mind working hard, this is the class for you. We'll cover the .NET Framework in depth, do a lot of Web Services, and even get into compact portable devices. See the syllabus online, then come on down the first night and check it out.

Web Services in Iceland, Oct 11-14

For my annual pilgrimage to Iceland, I'll be teaching a 4-day class on Web Services, including Service-Oriented Architecture and the latest Web Service Enhancements from Microsoft. The class is presented by the University of Iceland in Reykjavik. I don't have a link for this class yet, but you can e-mail Júlía Pálmadóttir Sighvats  at sighvats@hi.is for details.

NEW! 5-day In-House Training Class on Web Services

The main article in this newsletter describes Microsoft's new extensions to XML Web Services that actually make them useful for something besides saying, "Hello, World." They security pieces, in particular, are well thought out. Web Services are now sophisticated enough to warrant a topic in themselves, so I've written a 5-day class to do just that. It uses Microsoft's WSE version 2.0. See the syllabus online here, then call me to schedule yours.

5-day In-House Training Class on .NET or .NET for Insurance

.NET is here, and it's hot. It changes everything in the software business, and you can't afford to be without it. Rolling Thunder Computing now offers in-house training classes on .NET, using my book as the text. I've split it up into customized offerings, such as .NET for Existing 3-tier Microsoft Programmers, .NET Framework Serious Geekery, .NET Web Programming, and .NET for the Insurance Industry. See the syllabi online here, then call to schedule yours. 

ACORD XML for Insurance In Depth 

Insurance carriers, learn ACORD XML from David Platt. This 5-day class will give you everything you need to know to jump-start your application development. Learn about security and plug-and-play. See the syllabus online here. It can be customized to your needs. 


New Book: The Microsoft Platform Ahead

Published by Microsoft Press

ISBN 0-7356-2064-4

 

Like idiots, Microsoft asked me to keep on updating my .NET book, and like a bigger idiot, I agreed. It isn't really another edition of my Introducing Microsoft .NET. Instead, it takes the same high-level approach to the emerging technologies now shaping the .NET computing world and talks only about what's new. The chapter list is:

Chapter 1: Introduction

Chapter 2: .NET Framework v2.0

Chapter 3: ASP.NET version 2.0

Chapter 4: Web Service Enhancements, version 2.0

Chapter 5: Compact Framework, Smartphone, and MapPoint Web Service

Chapter 6: Contradiction [sic]

It's the same high-level approach I've used with my earlier MS Press titles, but I've made one big change. By popular demand, the code samples shown in the  book are in C#. However, I wrote all the downloadable samples in both C# and VB. You can get them from the book's web site, which is www.microsoftplatformahead.com

According to amazon.com, it is today their #57 seller in the Early Adopter - Computers and Internet category. You can buy it online at this link here.


Lamentation: I'm Just a Two-Bit Programmer on a Sixteen Bit Machine

We've been hearing a lot lately about the switch to 64-bit computing, and I'm not quite sure why. I know of very few applications, some, but not many, that need it.  But it reminds me of the word-length changes I've seen, from 16 bits to 32, and from 8 to 16 (dating myself here).

Back in the old days of 1983, when I was having trouble with my old CP/M Z-80 system (with 64 kbytes of RAM and 2 8-inch floppy drives, because my boss was a free spender), I started getting annoyed at these new PC thingies with their weird 8088 chip that both was and wasn't a 16-bit architecture. And I poured my heart out in song, that I actually got published in the Journal of Irreproducible Results. Technology has changed drastically since then. But I don't see one word of it  that doesn't apply equally well to the computing worlds of then and now. And of  how many other technology writers can that be said?

To the tune of "Stuck Inside of Mobile with those Memphis Blues Again" (original lyrics)
With apologies to Bob Dylan


Well, I sit at my computer, staring at the screen
Like a chloroformed iguana. My brain has got gangrene.
And while my mind is rotting, I feel like such a jerk
I caused a disk crash wiping out my last two decades' work.
Oh, mama, who could have foreseen
I'd be a two-bit programmer on a 16-bit machine?

I go on dates with women, and I talk of bits and bytes
So is it any wonder that I sleep alone at night?
To think, I could be human, 'stead of the nerd I am
But then again, lets face it: who really gives a damn?
Oh, Mama, it's just too obscene
I'm just a two-bit programmer on a sixteen-bit machine

I get these crazy visions, I dream I run amok
And murder my computer, smash it with a rock.
Or toss it in the harbor, and giggle while it sinks
But I wake up, and it hasn't happened. It's driving me to drink.
Oh, Mama, douse me with gasoline
I'm just a two-bit programmer on a sixteen-bit machine

My sanity's dissolving, my mind's a total loss
It hangs around my neck like a decaying albatross
I'll have sex with my computer, instead of with my hand
I'm cranking up the voltage. I know it will be grand.
Oh, Mama, how could life be so mean?
I'll die a two-bit programmer on a sixteen-bit machine


 Annabelle And Lucy's Latest

And now, the moment for which I know you've all been waiting -- the pictures of my two girls.

Annabelle is just turning four years old. Who could have ever imagined this day, back when I was writing the first edition of this newsletter with her newborn picture in it.  Here she is at her fourth birthday party. As you can see, it had a sea creature theme. On the right, you can see her at a different party that featured face painting. She asked for her favorite animal of all, the octopus. She wants to be a vet when she grows up, working at the New England Aquarium and taking care of sea creatures.

      

Lucy Katrina is now eighteen months old. Here she is doing an art project in our living room, and chowing down at Annabelle's fourth birthday party. She's gone past walking, now running around ,jumping and climbing so well we had to install window guards. She's starting to use words like "Cat",  "Poop", "My", and the all-powerful "NO!". (I hope she remembers the latter when she's 16. Or 12, or even 10, according to what some other fathers of daughters are telling me.) And she's starting to put them together into sentences. When my wife attempted to clean up her chubby hands after a recent exploration of Simba's litter box, she said: "No! My cat poop." Ah, God bless them all. And yours too. And everyone's.

   


Subscription Information

Thunderclap is free, and is distributed via e-mail only. We never rent, sell or give away our mailing list, though occasionally we use it for our own promotions. To subscribe, jump to the Rolling Thunder Web site and fill in the subscription form.


Legal Notices

Thunderclap does not accept advertising; nor do we sell, rent, or give away our subscriber list. We will make every effort to keep the names of subscribers private; however, if served with a court order, we will sing like a whole flock of canaries. If this bothers you, don't subscribe.

Source code and binaries supplied via this newsletter are provided "as-is", with no warranty of functionality, reliability or suitability for any purpose.

This newsletter is Copyright © 2004 by Rolling Thunder Computing, Inc., Ipswich MA. It may be freely redistributed provided that it is redistributed in its entirety, and that absolutely no changes are made in any way, including the removal of these legal notices.

Thunderclap is a registered trademark ® of Rolling Thunder Computing, Inc., Ipswich MA. All other trademarks are owned by their respective companies.