Commuting

Wed, December 21, 2005, 01:56 PM under Personal
Daily commuting is a part of most people's lives these days. If you are one of the few that doesn't have to do it, you are one lucky [insert expletive here].

In the past 6 years, my commuting consisted of driving to the office (from garage to parking space). I would only have to do that 3 times per week (2 days worked from home), and I arranged it so I arrived at work around 10 (this meant I would avoid all traffic and hence the journey took 35-40 minutes - not to mention getting up at 08:00 which is my natural waking up time :-).

Fast forward to a couple of months ago when I changed jobs, and now my commuting is defined by the location of the client. The project I am working on now is very close to our office (devcentre) in London. Whether I have to go to our own office or the client's office, my commuting (ordeal) is the same:

+ 06:30 my alarm clock scares the shit out of me. If you haven't gathered, I am not a morning person. Waking up at this time requires me sleeping the previous night at 22:00. This contrasts with my lifelong habit/conditioning of working in the small hours where by brain has been trained to be at its most active.

+ 07:20 leave my flat to walk to the Hove train station. I am not a walking person either (from the age of 14, back in Greece, I've owned a moped and used it for anything taking longer than 10 minutes). Walking to the station is especially fun when it is raining and, for those of you that don't know, all of this takes place in England (enough said on the weather front). The only time it is even more fun is in icy conditions (try running on ice while wearing smart shoes with shiny soles).

+ 07:40 depart on train for London Victoria (if I miss this one, the next one is in 31 mins). This is where you sweat since you were running in the cold, just seconds ago, and now you are suddenly in a warm packed wagon. Most of the times I get a seat and if I am lucky there isn't an overweight person next to me squeezing me against the arm rest (for those of you that know them, in the south we still have some slam-door trains in operation).

+ 08:50-08:55 arrive in Victoria (sometimes 10 minutes later than expected, I could fill a separate blog entry with reasons this train runs late). Now the fun bit of: queuing to get out of the train, queuing to go through the train barriers, walking in true people traffic to the tube station, queuing to go down the stairs of the tube (when they let us in and not just hold us back for 10' because the platforms are full of people), queuing to go through the tube barriers, down the escalators to the packed platform, watch 2 tube-trains go by before you can be pushed closer to the doors, get on board feeling like a sausage in a ban, arrive 7' later at destination tube station, queue to go up the escalators, queue to go out through the barrier, up the stairs to lovely Oxford Street. Walk for 5' to get to the client's office (or walk 8' to go to the Avanade office).

+ 09:00-09:30 seat at my desk and be pleasant to everyone.

+ 18:00ish leave the office to start the whole process in reverse (if I miss my train, the next one is 45' later).

+ 20:00 arrive home knackered, by the time I've had dinner as you can imagine I look forward to the next morning where I get to repeat it all.

So, some aspects of my life (including this blog) are not getting the full attention they used to but now you know why. I have 4 hours per day offline and literally *no* time during Monday-Friday for anything other than my day job (and Jenny).

On the plus side, this project will end (touch wood) by February-March and then it will be on to the next client who, I can only hope, will not be in London. Anywhere south of London and I'll drive it (in a much shorter time and have a more pleasant journey), anywhere North of London and the company puts me up in a hotel on the client site.

*sigh*

#NETCF_AGL_

Sat, December 10, 2005, 03:41 PM under MobileAndEmbedded
Visual Studio 2005 includes some of the remote tools that previously we had to install eVC to get. They are still not integrated in the IDE but you can find them from the Windows Start menu same place where the VS2005 item is. The Windows CE Remote Spy didn't work in pre-release versions but obviously with RTM it does so take it for a spin. One of its features is listing all windows on the target including the handle, caption and class. The typical way you use this info is with FindWindow e.g. as shown here for programmatically closing any open msgbox on your device.

Anyway... If you use Remote Spy with Compact Framework v1 SP3 applications, you'll find that the class name of the CF forms show up as #NETCF_AGL_BASE_. If you go a step further, reference the Microsoft.WindowsCE.Forms assembly and then simply create an instance of the MessageWindow, you will observe how its class is #NETCF_AGL_MSG_. I was told a long time ago not to rely on these facts as they are internal implementation details of the NETCF windowing system. Well, I checked for v2 apps and nothing has changed with those two.

However, there is another special window that every CF v1 application has (one per app instance) and that has a class of #NETCF_AGL_PARK_. Furthermore, its caption is the file system path to your application. This *has changed* with CF v2: now its caption is empty, and the class is #NETCF_AGL_PARK_ appended with the application's file system path.

The moral of the story is, if you do take advantage of undocumented features, your application may break when you move it to the next version regardless of the compatibility efforts of the product teams at MSFT.

FileAs

Thu, December 8, 2005, 03:03 PM under MobileAndEmbedded
About 3 months ago I switched to a PocketPC Phone Edition 2003 SE device as my main phone (shocking that it took me so long, but it did). One of the things that really pisses me off is adding new contacts on the device:
1. Create a new contact
2. Populate the contact including entering the Name field: "Name Surname"
3. OK it and go back to the Contacts list
ACTUAL RESULT:
4. You get a an item in the list that reads "Surname, Name"
$%^&££$&*ing thing!

DESIRED RESULT:
4. Get an item that displays as "Name Surname".

I thought Windows Mobile 5.0 would have fixed this (e.g. by offering the FileAs option available on Outlook on the desktop), but when I received my JasJar (thanks Mike!), I found the same pain is there. So I am trying to find how I can change this on the device (forget synching with Outlook). Someone please tell me how and put me out of my misery.

Anyway, if you can't find how to do it on the UI, next step is to do it programmatically I guess, so that is what I did (it is so easy):

1. Create a new Windows Mobile 5.0 project in VS2005. Choose the Smart Device Project/Console project type.
2. Add a project reference to Microsoft.WindowsMobile.PocketOutlook
3. Replace Main with your own:
static void Main(string[] args){
OutlookSession os = new OutlookSession();
ContactCollection cc = os.Contacts.Items;

for (int j = 0; j < cc.Count; j++){
Contact c = cc[j];

string s = c.FileAs;
int i = s.IndexOf(',');
if (i > 0){
string s1 = s.Substring(0, i);
string s2 = s.Substring(i + 2, s.Length - i - 2);
c.FileAs = s2 + " " + s1;
c.Update();
}
}

cc.Dispose();
os.Dispose();
}

If you are targeting a WM2003 device, create the appropriate project for that and instead of adding a reference to the Microsoft assembly, add a reference to InTheHand equivalents.

Naturally, you can create a fancy UI to select which ones to change etc but the above is all I wanted. I run it every time I add new contacts.

Event Reviews

Sat, December 3, 2005, 11:05 AM under Events
It occurred to me that, besides being busy with commuting and my current project, I have also participated in a number of events recently without reflecting on them, so here goes.
TIP: Read them bottom up, since that is the order I wrote them in.

- DNUG meeting
Date: 30/11/05 Location: Microsoft offices in Soho (London)
I’ve described the venue further below so will not do it here again. This was the first time I managed to attend the Dot Net User Group meeting and I will be back for more. The topic was patterns and architecture by Matt Deacon of Microsoft. Most interesting were the follow up conversations down the pub including debates on the differences between consultants, permies, contractors and “body shops”.

- VS Launch event in London.
Date: 15/11/05 Location: Novotel hotel in Hammersmith (London)
Very disappointing on every conceivable front:
1. Sure you served me lunch but at the breaks all you can offer is water and smoothies? What happened to chocolates, cakes, biscuits, beer etc?
2. Where are the freebies? Just flyers doesn't cut it, give me some toys.
3. On a more serious note, (I am sorry, but) the sessions were poor not only on delivery (OK, only half of the ones I went to were very poor) but the actual choice of content was inexplicable. I was reading the session titles and couldn't get motivated to go to any of them.
4. Where was Avanade's presence? We are platinum sponsors in the US, silver sponsors in the UK, and one of the reasons I decided to attend in the end was to help at our stand - nobody told me there wasn't one!

- MVP pint & pie
Date: 14/11/05 Location: The Chapel Public House in Edgeware Road (London)
Every so often, the UK MVPs are invited to a "pie & pint" evening at a pub (a number of these vents run across the country). Our lovely FGM pays for our food and for our drinks in exchange for us making complete fools of ourselves - fair deal if you ask me :-) I had never gone to one of these before as the nearest to my home is the London one and I never worked in London before; now that I do, I get to attend evening events like this and I certainly will again.

- Training "Excellence"
Date: 8-9/11/05 Location: etc The Hatton in Farrington (London)
This was the first time I went to the etc conference in the Hatton and it is not a bad venue that serves great food. It was also the first time I went on training that was *completely* non-technical, with a mixture of Avanade employees from *all* disciplines. It is a public course that promises to change the way you view your life (and then it is up to you to act on that). It was delivered by these guys. Sorry Nick, I haven't started my master list yet but it is on my... TODO list.

- Mobile developer nuggets
Date: 27/10/05 Location: Microsoft offices in Soho (London)
The location for this event dominated my thoughts. Our own Avanade offices are on Wardour Street in Soho and I get people cracking jokes about that, but have you seen where MSFT offices are? You have to avoid offers for s3x, regardless of the direction you approach it from! Into the building and it turns out when they said "it is in the swimming pool room" they weren't joking. The room is basically a swimming pool with no water in it and with some modifications to make it usable as a presentation room. David Goon had his delivery well practised and I am definitely stealing the idea of "nuggets" for a future talk; it sounds much better than "tips and tricks". There was a break between the 1-hour stints and we enjoyed pizza and beer - definitely going back to the next MSDN event there.

- DeveloperDeveloperDeveloper II
Date: 22/10/05 Location: Microsoft UK HQ in Reading
I had a blast. I only got a chance to attend 3 sessions and the top one in my book was Ian G's Avalon session. Ian if you want my feedback, replace some of the "why" time with demos - but other than that, it was top class. My two sessions were very well received, with both rooms "selling out". My apologies to the people that were turned away, but even standing room was taken! Full credit goes to the C# team for the debugging enhancements in VS2005 and especially to the Class Designer team: those topics sell themselves and all I had to do was deliver the facts.

- QuickStart
Date: 04-07/10/05 Location: Avanade HQ in Seattle (down town)
When you join Avanade, you get your induction in the Seattle office, along with a bunch of people from other Avanade offices around the world. The induction consists of fun, basic consultancy skills training, fun, team activities, fun, education on Avanade processes/tools, and, of course, a lot of fun. My only complaint is that I cannot do it all over again. It is worth you joining Avanade simply to go on this course!

- MVP Summit
Date: 28/09-02/10 2005 Location: Microsoft HQ in Redmond (Washington)
The most frustrating event I have ever gone to. Imagine you have just attended something (film, opera, theatre, sporting event, whatever) and you came out of it *super-excited* but could not tell anyone anything; now you know how I feel. In a nutshell, with VS2005 not out of the door yet, we had a chance to participate in the specs for the next version and get insight to plans that have only just made it to paper. As you'd expect, it is the discussions with product group members during the breaks that were the most interesting. Demos of bleeding edge technology were in abundance, but I better stop typing before I spill any beans...

- MSPress Publisher's Summit
Date: 26-27/09/05 Location: Microsoft HQ in Redmond
Shouldn't really include this since I did not attend, even though I had registered. Found out the content was not geared towards my interests, plus I had already submitted my book proposal (MSPress, how long do you need to reply - a simple yes or no will do).

- Indigo Roadshow
Date: 27/09/05 Location: Washington University in Seattle
This was a single session that lasted 3 hours, thus giving us an excellent introductory overview to Indigo. The two speakers were Richard Turner and Ari Bixhorn (saw Ari first time in Barcelona teched 2002, and every time he proves that he can host a good show). Plenty of demos and audience interaction meant that I stayed awake, even though I had performed a marathon trek earlier in the day to find Bruce Lee's grave in Lakeview cemetery.

PnP on PPC2003

Sun, November 20, 2005, 03:55 AM under MobileAndEmbedded
It is always nice to see something you created being used by others. In this case I am referring to my MSDN article.

Udo Killermann sent me a project he wrote that use the P2PMessageQueue component to monitor device plug-n-play events.

You can also use the DeviceStatusMonitor in the SDF from OpenNETCF (guest,guest), which in v2 also uses the P2PMessageQueue, but Udo wanted a stand-alone example.

Download his project here, and any questions regarding the PnP project must be sent to 'udo dot killermann at web dot de' and not me!

Getting started with .NET Compact Framework development

Wed, November 16, 2005, 01:40 PM under MobileAndEmbedded
I meet a lot of experienced .NET developers lately (including colleagues) that have focused on WinForms or ASP.NET or other .NET areas, but have never dabbled with the .NET Compact Framework. It doesn't take long before out conversation ends up in me providing information on how to get started with NETCF development. Here goes for future reference

1. The very first thing to do is to install Visual Studio 2005 (it side by sides with earlier VS versions).
[ The Express editions are no good to you but Standard and above will do perfectly. There is also a stand alone SDK and you could even try Visual Studio.NET 2003 Professional or higher, but my advice is to get Visual Studio 2005. ]

2. (optional) If you are planning on targeting Windows Mobile 5.0 devices, then you also need to download the Windows Mobile 5.0 SDK (i.e. for SmartPhone and PocketPC). In this case, you also need to get ActiveSync v4 (install this *over* your existing ActiveSync v3).

3. Create a new project via the normal route, but choose the “Smart Device” node and then the appropriate self-explanatory project type (e.g. “Device Application”). Note that VS2005 also supports creating apps that target Compact Framework v1.0 (there never was a NETCF v1.1). I recommend you stick with the v2.0 projects.

4. Drag a button on the form and add an event handler to it as you normally would, and type: MessageBox.Show("It isn't that different, is it?").

5. Start debugging the application: note how you have to choose where to deploy your application (i.e. an emulator type), choose whatever you want (e.g. “Pocket PC 2003 SE Emulator” and then “Deploy”) and notice how your application runs and you can click the button to get your msgbox (this may take a few minutes if this is the first time you are deploying).

6. From the IDE, click the "Stop" to stop debugging your application (emulator remains running, but your application has exited).

7. (optional) There are also some platform considerations, read these

8. (optional) If you need to share/execute your CF code on the desktop, see this.

9. (optional) For some links on how the NETCF differs from the full framework, see here

10. (optional) Remember the netcf is not a strict subset

From here on, you can start developing that NETCF app you’ve always dreamed of :-)

You will run into issues and you will have questions. You are a smart guy/girl so, before you ask me for help, check that your question isn't already answered in the FAQ (old and new), search the netcf newsgroup via google and check that OpenNETCF hasn't addressed the limitation you face. If you still haven't got a resolution, now you can seek support. Luckily there is a vibrant netcf community and for NETCF v2 the MSDN forums rock.

Welcome to the world of mobile development. Isn’t it much more satisfying running your own creation on your pda/phone than on the desktop? The mobility space *will* take off big time in 2006. Good luck!

CF v2.0 on WinCE 4.2

Mon, November 14, 2005, 04:48 PM under MobileAndEmbedded
As you know, NETCF 2.0 supports WinCE 5.0, PocketPC 2003 and Windows Mobile 5.0 devices.

After much pressure on the fantastic netcf team, they have allowed a few of us to blog this exciting news:

Service Pack 1 of .NET Compact Framework v2.0 will offer support for custom Windows CE 4.2 devices:
• Runtime support only
• Support on all WinCE processor types

I can’t tell you anything else but if you have feedback/requests on this particular topic, log them at the product feedback center (ladybug). The NETCF team is listening!

Type vs Generics

Sun, November 13, 2005, 01:01 PM under dotNET
We are all familiar with the Type class of the framework and how useful it is in many scenarios. To obtain the Type of a type we can call GetType() on the instance, the static Type.GetType passing in the full name, or use C#'s typeOf operator (or GetType operator in VB).

We are also familiar with Generics (supported on NETCF as well).

At first there isn't much relation between the two. There are some cases, though, when you design an API (that depends on a type to be passed to it) where either of the two can satisfy your goal: A generic class or a class with a constructor accepting a Type. So in that case, which approach should you choose and why?

1. Blah<T>{...} //type declaration
2. Blah(Type t); //ctor

Just to be ultra-clear, the calling code for each occasion looks something like this:
1. new Blah<SomeType>();
2. new Blah(typeOf(SomeType));

Just FYI, and don't allow this to affect your thoughts, the indigo (or WCF if you prefer) team chose the 1st approach originally and then, after Beta 1, changed to the second. I am referring, of course, to the ServiceHost class. Why did they do that?

Since this blog doesn't have comments, reply on your own blog (or if you don't have one, feel free to email me your reply).

UPDATE:
1) .NET design guidelines guru provides comments.
2) Ayende describes his preferences
3) Apparently, there is no mystery on the Indigo change:
"The ServiceHost just needs to know the type of the object being hosted - none of the methods or properties were accepting or returning the so the generic mechanism wasn't really being using per se."

Blog link of the week 41

Sun, October 16, 2005, 02:39 PM under Links
- Even though not a asp.net guy by any stretch of imagination, I still find this quite cool

- Remoting -> Indigo

- Did you know you can add solutions to solutions?

- Ilya Tumanov provides the A to Z on netcf v2.0 cab files

- Follow the links to get Virtual Earth for your Windows Mobile :-)

Speaking at DDD II

Sun, October 9, 2005, 04:08 PM under Events
See you at Microsoft's premises in Reading, on Saturday 22nd October!

I missed the first one but will be there at the 2nd one-day UK conference: DeveloperDeveloperDeveloper II (for the US readers, this is like a code camp - a free conference from developers for developers)

If you are going, make sure you drop by my sessions and heckle :-) Apologies if you are expecting mobility topics, this time I am talking about tools:
- Class Designer in VS2005
- Debugging Enhancements in VS2005


The first one is currently scheduled after lunch; the second is the last session of the day. I am thinking of going through both talks with demos only and zero slides. What do you think?