Wednesday, October 22, 2008

Would you trust anyone with your passwords ?


For a while I've been using the Foxmarks Firefox extension. It's an excellent way to keep all your bookmarks in sync on every PC, even on my EeePC with Firofox under Linux. Once installed you can almost forget about it and it just does what it has to do in the background. Great. And then recently there was an automatic upgrade that asked me the following question : 'Do you want to use the Password Sync feature ?'
So I could synchronize my 100+ passwords on all my PC's too ? Great, I thought for a few seconds. Until I realized that this would imply that everytime I log on all my passwords are send to a central server. To a place I have no idea where it is. Controlled by a company I almost know nothing about. The 'About Us' shows some reliable names, including the famous Mitch Kapor, who's known to have so much money that he really couldn't care less about my ample savings on a foreign Iceland bank account. But what about the others ?
Of course Foxmarks says the passwords are safely encrypted. True. But how can I check that ? Well, I could probably check that using some network-spy software and a lot of hard work. But even if I were a hardcore hacker I would do this only a once or twice. Certainly not every time I use the service (then I would be better off by writing all my passwords on the back of my hand every day..).
And a year from now I probably don't even realize that I'm still using this feature. and the plug-in is updated automatically. So if for example a year from now update 30.134 is installed, and by accident this plug-in 'forgets' to encrypt the passwords ? Or it uses some type of encryption that is easy to decode by the Foxmarks programmers. Who may not be the same trustworthy team that founded the company in the first place as Foxmarks by then could have been purchased by a Nigerian Investment Company.

Friday, October 17, 2008

Silicone spray or Mortgages, both can kill the system

I'm not even sure Joel Spolsky thought of it when he wrote this article about the way commission based sales systems eventually always seem to backfire at the company, but the current financial crises is certainly the the biggest proof that this works on any scale...

Thursday, September 04, 2008

Speed up with Chrome

There is much buzz around the new Google Chrome browser. I suppose most of you have (like me) downloaded it, played around with it and then continued to use Firefox for everyday use. After all, the shiny clean look is impressive at first and the page preview look is fun, but the lack of (visible) UI elements and the fact you have to do without all your usefull plugins like Adblock, Foxmarks ,FireBug and Webdeveloper soon makes you return to Firefox.
And this is intentional. Chrome is not (yet) for everyday browsing. It's created as a platform for web-based apps. The importance of chrome is mainly in what you see in the image below.




These are the results of the V8 Javascript benchmark. The higher the score, the better. So yes, the Javascript V8 engine as used in Chrome performs roughly 30 times better than the engine in IE6. And this is really important these days, since Javascript is the engine that powers all these popular AJAX based web applications like Basecamp, Google docs, Flickr or Twitter. So, as predicted by Jeff Atwood in his article about Javascript, the speed of Javascript is going to be more important. And when you believe (as Google does) that the future of computing is in the browser, Chrome is the logical platform. What really surprised me though is that it lacks a 'full screen' function. After all that is what you'd really expect from a browser that is supposed to replace your desktop ?
And yet you still cannot launch any browser without having an operating system. And right now Chrome only runs on Windows...

Friday, August 22, 2008

Dreaming on: Chandler 1.0 released

You might not have noticed, but on August 8th, 2008 at 1:47 pm, Chandler, the ' "Note-to-Self Organizer", designed for personal and small-group task management and calendaring' finally came to release 1.0 ! Now Chandler is an Open Source project, and 80% of these projects probably never reaches this stage at all, but Chandler is a special case. It is created by the Open Source Application Foundation which was founded and and is sponsored by Mitch Kapor. The Chandler project is a unique example of where a project that has no deadline and an unlimited funding can lead to: unlimited development.
And no matter what finally comes out of it, the first three years of the project already gave us the magnificent novel by Scot Rosenberg : Dreaming in Code. A great book that may well outlive the software itself. It describes the development process from the initial idea upto version 0.7. Three years have passed then and Rosenberg realises he just has to draw the line himself and publish the book before the project is finished. And he was right. The book was written by the end of 2005 and so it has taken roughly two and a half years before they they finally came to version 1.0 . I'm glad he didn't wait for that, since by now I already read the book twice. I really recommend it to any developer, manager or just anybody using software (Yep, that's you by default, or you would not be reading this..).
Apart from it being really fun to read, it's description of ever shifting deadlines, continuously changing specifications and numerous code re-writes is so recognizable to me as a developer. Just check out Joel Spolsky's review to see what I mean.
And what about the software itself ? Well, I haven't tried it yet but the concept is great, though not as revolutionary as it might has seemed in 2002. As already mentioned in the book, 37Signals already provides most of the functionality as a web application. With all the benefits: no server maintenance, available everywhere through every browser and automatic upgrades.
But the Outlook / Exchange combination is still used in many corporate environments. And since Chandler is aimed at replacing that, they might still have a chance.

Thursday, August 21, 2008

Easy C


After reading this 'Daily WTF' I first laughed, but then I suddenly noticed the this particular line:
/* arithmetic operators */
#define MOD %

.. when I realised this actually solves one of my little annoyances that I had for as long as I program in C or C# : I never remember the 'modulo' operator !
Since it's not something you need everyday I always end up looking at some kind of standard C manual to find out what it was. And nine out of ten times I first hit a compilation error because I use the (non existent) mod(x) function. I think this has to do with the fact that the '%' sign is not in any way related to a 'real' mathematical operator like +, -, / or * . Probably the C language developers just felt that the modulo operation should be a keyword, and the % was the last unused character on the keyboard.
And what about the '==' versus '=' mistake, often marked as the most frequently made mistake in C programming ? Using just ' #define EQUALS == ' would really eliminate this type of error. So maybe there is something to say for this 'Better C'. If it helps you in writing programs faster because you it makes things look more natural to you, then why not do it like this ?

Wednesday, July 02, 2008

Serial communication on the EeePC

Whenever I get a new computer, or just anything that is programmable, my first thought is " Will it do RS232 communication ?" That's mainly because I'm working all the time with instruments and micro controller based systems whose main or only form of contact to the outside world is still plain 9600 baud 8N1 RS232 comms...
And for the EeePC the answer is yes.
I connected a fairly standard USB-Serial converter. This device is based on the Prolific 2303 chipset which is very common in most converters these days. The EeePC recognizes and starts it immediately, although this is not immediately obvious. The KDE desktop does not show any sign of activity, and there is no way you can even check it's appearance through the desktop. To be sure it installed, open a console and type 'dmesg'.
[Inline Rant]
(Don't ask me why almost everything on Linux requires typing 5 to 10 letter acronyms for tasks you never even knew existed.. [growisofs, nifd, mozplugger, fstab-sync ??? And these are just a few of the most popular commands.])
[Inline Rant End]
Well, if your USB converter gets recognized it will show up in the last couple of lines of text shown to you. And if so, it's available as /tty/ttyUSB0 (U-S-B-Zero). Now it's time to do something useful. First you will need a communication program, which is not available in the standard EeePC distribution (or 'distro') so you will first have to instal additional repositories: this entry on the eeepc wiki shows how.
Now just start the Applications->System->Synaptic, search for minicom, Cutecom or GTKCom and install it.
I started using minicom, but apart from this being a bit like going back to the eighties (It's a Procomm /Telix for DOS clone..), I could not get it to send what I typed. It did set the Modem Init string, and received all characters I was sending to it, so I assume my USB-Serial adapter works.
So I moved to Cutecom, and this works fine. Cutecom is pretty simple and straightforward, but that's merely a plus if you use it on the rather limited screen of the EeePC.


EeePC is here !


It's obviously the most desirable gadget of the moment. The ASUS EeePC with it's 7" screen, small but complete keyboard and it's beautiful 'Pearl-Shine' white finish. And it's also a real computer. 900Mhz Intel Celeron, 512 MB RAM, 2 Gigabyte flash hard disk, WLAN, Ethernet, VGA output and 3 USB connections make this little box a full fledged PC with capabilities one could only dream of a few years ago. It comes with a Linux OS, and it boots in something like TWENTY seconds. It has many pre-installed apps, like the complete OpenOffice suite, FireFox and Thunderbird, so 90 to 100% of your daily work is covered. And that's what it's for. I think if you buy it as a'multi purpose' desktop PC replacement and expect to work exactly like your WindowsXP machine you're missing the point (and you get rants like "I hate my EeePC"). Nobody complains about his multi media phone not being able to run OpenOffice. That's not what it was designed for.
On the other hand, if you are a geek like me and are tempted by the possibilities of this platform then there is plenty of room for experimenting. But I'll keep the original setup intact because that's really ideal if you want to get some work done in confined spaces like an airplane chair on a low cost flight..

Monday, May 26, 2008

Too hard, or a challenge ?

Quote:

'it's a fun programming exercise that you're doing because it's just hard enough to be interesting but not so hard that you can't figure it out.'

Never thought of it that way, but this is indeed the kind of project I like to do most. And if most programmers are like me they will always tend to bend a projects towards this edge. If it's too simple we'll add functionality that creates new challenges. And if it seems just to hard we try to figure a way around it (buying a third party library or let someone else do it..) so we can spend more time at the things we like, like the slow fading in and out of our super-fancy splash-screen...

Friday, April 25, 2008

Arcade Games

So I'm not the only one. I already tried to explain in one of my previous posts how I felt about Arcade gaming, but if you read Jeff Atwoods blog about the subject you know exactly. I could not have said it better.I think the only difference between me and Jeff is that he needed a car to get to the arcade, and I could go by bike...

Tuesday, November 20, 2007

The Mysterious Breakpoint

(Or how even Microsoft programmers sometimes forget to clean-up..)

While working on a piece of software that relied on a ActiveX control, I regularly found my debugger stopping at an address somewhere in memory that was not part of the program. First I tried to find out where the bug was, then I found that just continuing the program worked fine, and that there were apparently no side-effects. But it kept stopping there, no matter how much of the debugger features I disabled. So I decided to get into it a bit deeper and found out it always stopped at an address named 'DbgBreakPoint' in module NTDLL.DLL. It looked like it stopped on a breakpoint, but not one that I had set. And the 'Disable all breakpoints' option in the Borland C++ Builder debugger did not make any difference. It really looked like Microsoft forgot to remove a breakpoint from one of the most important DLL's in Windows. A bit of Googling made clear that this was indeed the case, and also that it was not easy to get around it. Patching NTDLL.DLL appears impossible since it is one of the most 'protected' core-pieces of Windows. If you try to modify it, Windows will just 'restore' it on start-up. And if you are clever and modify the backup copy it uses for this restoration, Windows just won't start at all...
So the only way around seems to 'patch' the DLL in memory after it is loaded by your program by overwriting the memory location containing the breakpoint with a 'NOP' instruction. Here is the function to do it:

void PatchINT3()
{
unsigned char NOP=0x90;
void* pNTDLL;
DWORD BytesWritten ;
FARPROC Address;
if (Win32Platform != VER_PLATFORM_WIN32_NT){ return; }
pNTDLL = GetModuleHandle("NTDLL.DLL");
if (pNTDLL == 0) {return;}
Address = GetProcAddress(pNTDLL, (LPCSTR)"DbgBreakPoint");
if (Address == NULL){ return;}
unsigned char Byte= *(char *)Address;
if (Byte != 0xCC) {return;}
try

{
if (WriteProcessMemory(GetCurrentProcess(), Address, &NOP, 1, &BytesWritten))
{
if(BytesWritten == 1)
{
FlushInstructionCache(GetCurrentProcess(), Address, 1);
}
}
}catch(EAccessViolation &E){}
//Do not panic if you see an EAccessViolation here, it is perfectly harmless!

}

I suppose anyone who got to here has enough knowledge of Windows programming to see how it works :-)
And so, by calling PatchINT3() at the start of the program the breakpoint is erased and won't show up again.
(Thanks to Peter Morris at HowToDoThings , who wrote the Delphi version that I translated here)

Monday, October 22, 2007

Serial Communication Trouble

Ever since the 'real' serial comport (the hardwired connector on the rear of your PC) has been replaced with all types of 'virtual' alternatives like IR ports or Serial to USB devices, it has been a cause for all kind of trouble. And I've seen many of them, but the one I found this morning was new to me. Suddenly one of the programs I've written myself showed 18 comports to choose from. Now the program uses a dedicated function to enumerate the available ports, so obviously I thought it had something to do with a bug in my software. Also because the 'Hardware manager' of the PC only showed the two comports that are actually available. On the other hand I found that some other software that uses serial ports showed the same behaviour.
So I looked at the registry ( HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM) to find out which port were actually registered. And this showed all 18 as \Device\VComxx, where xx is the port number. So obviously something was creating virtual serial com ports. But what? I did not add any hardware to my PC that could cause this, nor did I install any serial com port related software or drivers.
So finally I located in the System Properties -> Device manager under 'System Devices' two suspicious entries: 'NCF Virtual serial bus enumerator' and 'VXCOM port'. The first turned out to be the 'Nokia Communication Framework', something I installed long ago in an attempt to communicate with my Nokia phone. After searching on the web for the second one, I found only a few entries, but it seems this one is related to the Windows Mobile 6 SDK, which I indeed installed last week. And when I disabled this driver, the problem was gone.
Apparently VXCOM is a virtual com driver used for the SmartPhone emulator. Why it reserves 18 ports at startup, even though I never used this emulator is a mystery to me...

Sunday, September 09, 2007

Mouse toTrackball to Centipede


Born in '65, it's inevitable that I grew up playing arcade games in the local arcade, re-discovered the joy of the simple games of those days and found my way to the MAME project.
I downloaded the the MAME executable and a bunch of (illegal...?) games, and I carried it with me several years, copying it to every new PC, and occasionally playing some of my favourite games. What always created a slight itch was the fact that playing on a computer keyboard does not really come near the 'real arcade experience'. So, like many others.. I would love to build a real arcade cabinet, with real joystick, trackball, spinner and fire buttons. Of course I lack the time to build it, a place to store it and even time to play it, but the idea remains. Looking around I found several on-line shops that sell all necessary parts from controls to marquees to make it look exactly like the original, but adding it all together it gets quite expensive. Certainly controls like a trackball and a spinner are costly items. And actually a spinner does not seem like a difficult thing to make yourself, but I decided to start with the trackball, since I already owned this. It is a Wico-trackball that was manufactured in 1983(!) for the then popular TI-99 home computer. Actually this seems bad timing, since TI exited the home computer market by the end of '83... Well, I bought the trackball a few years later for a few bucks, and first interfaced it to my Commodore 64, but hardly ever used it. Since a trackball and a standard computer mouse (the ball type) are very similar I thought it would not be too difficult to combine the two and have a 'mouse compatible' trackball. Fortunately 'standard' mouses can be found in large piles lying around unused in almost every office, so I soon found a suitable Logitech USB type that no one cared about anymore. First I thought it should be possible to use the original optical switches of the Wico, and just wire these to the mouse electronics. But since neither the mouse nor the trackball switches have any type numbers stamped on them so I could not easily compare the connections and make a new routing plan, I decided it would be easier just to remove the switches from the mouse, and mount them inside the trackball, completely discarding the original trackball electronics. So I just removed the Infrared LEDs and the opto switches from the mouse board, mounted them on a piece of prototyping board, and re-wired them to the original contacts. The image here shows the result. Bottom right you see the original mouse electronics. Bottom left you see the piece of prototype board holding the LED and the opto-switch. Right top you see a little piece of the second board just before it's put in place. Top left you also see the contacts of the 'fire' button. The wires from this I just cut to the right length and soldered them to the rear of the switch that used to be the left mouse button.
And it works great!. Finally I can play one of my favourites (Centipede) the way it was intended. So now I'm ready to take the next step: build a 'Rotary controller' or 'Spinner' for my all time favourite game : Tempest .Right now I'm chasing another unused mouse...

Wednesday, August 15, 2007

The Big Step: Microsoft Visual Studio

So it finally had to happen. I purchased and started to use Visual Studio 2005. After using Borland C++ Builder for more than 10 years for all my Windows (and even DOS) programming, the Pocket PC platform turned out be the decision maker. From the start the only way to write programs for the Pocket PC platform has been through Microsoft. And they also made it very easy by giving away the free Embedded Visual Basic, followed by Embedded VisualC. But today, now everybody has a Pocket PC, none of these tools is being supported, and they also refuse to work with the new Windows Mobile 5 devices. Now this could be a great starting point for some Microsoft bashing, but actually I read some explanation on a MS-Developer blog that makes sense. Since the embedded versions where completely separate projects within Microsoft, the development and support started to suffer from the fact that the developers also worked on the commercial Visual Studio product. And it's just a fact of life that supporting a commercial product has a higher priority...
But I've written all my software using EVC 3 and 4. And so I struggled some time by using old PocketPC's for debugging, actually waiting for Borland to come up with the 'Delphi for PocketPC'. But I don't think this will happen for a while, and I even wonder if they ever will produce something for the PocketPC platform. So I finally had to get Visual Studio 2005 to continue supporting my embedded Visual C apps. Fortunately I could go for an Visual Studio 2005 Upgrade, because I already owned C++ Builder, making it a bearable € 250,-.
And now I must agree, the Visual Studio environment a a giant leap forward compared to the old EVC programs. The editor is much more up to date, it compiles faster, has a better debugger, and (surprise, surprise) also supports direct emulation on your desktop PC, even when your program uses ActiveX controls or external DLL's !.

Tuesday, May 01, 2007

Creating Q-Web

To visualise data that is related to geographical locations (e.g. the local weather) nothing beats a good map with some clear symbols that reveal data from a database. The following series describes my route towards a database driven ASP.NET application that shows data as collected by the 'Discharge measurement' stations. The company I work for (Qmetrix) supplies these stations to local water management authorities. They measure the flow of water in a river or stream, combine it with the water-level and the local depth-profile and calculate the total cubic meters of water per second that passes by.
First I needed a nice map. I used MapBuilder, the excellent tool to manipulate Google maps. Now what I need for the webpage is a image for the area of interest, for which I know the exact coordinates of the left-top and right-bottom corner. Here is how:
In MapBuilder first click 'New Map' and enter a (short) name and a description. Then return to 'Edit Map'. Disable the 'Automatic Zoom' feature. Make sure the area of interest is completely visible. (Find it quick by just typing the name and country of a city that that in the area in the "Location Search & Quick Navigation" box )
Click in the left top corner, this will show a blinking marker. Select a small marker type, type 'Left Top' in the 'Caption' box and click 'Add'.
Repeat these steps for the 'Right-Bottom' marker. Now click 'Save Center, Zoom, Maptype'. Select 'Map Controls' in the menu, and disable all visible features. Don't forget to click the 'Save' button at the bottom of this screen.
Now choose 'Preview' in the menu. It might be required to shift the map a little to get both markers in the right place.

If required you can go back to the 'Map Controls' screen, and increase the map width and height. Now if you don't want to include the Google and Mapbuilder trademarks you must make sure they fall outside the area as enclosed by the two markers. If the map is right, capture the whole screen, using a screen-capture utility or just [Shift][PrtScreen]. Load the captured image in an image editor, and cut out the exact area Top left to Bottom right. Save this as a new (.jpg or .png) image.
Now go back to MapBuilder, and make a note of the exact coordinates of Top-Left and Right-Bottom. (I usually just click on the markers, and Copy-Paste the 'Latitude' and 'Longitude' fields to a Notepad text file.)
While this text file is open you might also write down the exact sizes (in pixels) of the map image we just created. Usually this can be found using the image editor, but you can also locate the file in Explorer, right click it and select 'Properties'. Hidden under an 'Advanced->' button you find the exact size of the image in pixels.

Wednesday, September 06, 2006

Joel's club of amazing employees..

You might have notice my link to the site of 'Joel on software'. I read his articles on a regular basis, and usually I either fully agree with him, or consider his point of view as refreshing. But in one of his more recent articles he explains how his company recruites new employees and this time I feel FogCreek Software is probably located on a different planet. First I think it's almost incredible that a company spends so much time and money on recruiting. Second I wonder why his company needs such a continuous supply of the most brilliant programmers, since as far as I can see hey're only selling three major software packages. None of which I ever heard before I started reading his articles, so they certainly do not come near the Microsoft, Oracle or even Computer Associates in quantities.
Nevertheless Joel Spolsky, who runs and manages this enervating business seems to have so much spare time that he can write almost numerous articles for his blog, give interviews, follow his fellow bloggers and comment on them if necessary and even read all 100 articles that appear on MSDN every day... And I don't know about you, but creating a post like this takes me at least two evenings, and when it comes to a a more practical posting (which requires some kind of research) it often takes me a week to complete it.
So by now I'm beginning to think that Joel is not a real person (anymore). Yes, someone with this name probably started up FogCreek, and started this , now famous, weblog. But I think somewhere in time the 'brand name' was probably bought by some huge company ( could be 'M'...) and now the texts are created by a team of professional writers. And since Joels opinion about MicroSoft always was mildly positive, all they have to do is to keep it that way.

Thursday, July 27, 2006

Debugging CF applications on the PDA

In a previous post I mentioned that it's not a real problem that you cannot debug apps directly on your PDA because the application can be debugged on your desktop. Unfortunately this is not completely right, since it already has occured a few times that the desktop version behaved different after copying it to the PDA. So now I'm investigating the possibilities for debugging using the (free) Mdbg.exe tool . I found a good start at David Kline's CF Weblog. (to be continued..)

Tuesday, July 25, 2006

Intermezzo : Developers, developers, developers


The (in)famous 'Developers..' video by Steve Balmer.Probably everybody has seen this one. It's been on television, and you can find it on almost every website that tries to make fun of Microsoft. And even though I tend to think that it's a bit over the top, I sometimes just have to see this 19 seconds because it makes me feel good. Apart from the 'comic' level, it also has expresses a level of appreciation for 'us' developers that I seldom find in my everyday job. Don't get me wrong: I like, even love, what I do and I would probably make fun of anybody who would try to express some kind of appreciation. But sometimes I feel a little envy towards professionals that are more in the spotlights like journalists, politicians or actors. Let's face it, even the people that prepare the food for the people who cary the furniture in an everyday television series get their name mentioned on the title scroll...

Friday, July 21, 2006

Custom Components for the CF

After following all my own guidelines and creating a functional CF program for .NET2.0 ( the 'CFSimpleTerm' program, a serial communication terminal which you can find in the 'Downloads' section of C-Scope) I decided to start working on my first custom component. I found notes on the web everywhere that his was so simple in C#...
But ofcourse I wanted to create a custom component for the CF. Because one of the first things that strike you when developing CF applications (after finding out how 'simple' it is) is that the final application looks real 'basic', or even 'dull' I'd say. You cannot change fonts or colors of standard controls, and everything is flat (which is the standard for PocketPC's, I know, but I like it a little more fancy than that..). So I started out creating an enhanced button, with 3-D look, user definable color, and selectable font. Something like this:
So I used the 'Custom Component' wizard to create a 'xButton' class, derived from the standard Button. Something like this:

using System;
using System.Drawing;
using System.Windows.Forms;

namespace xControls
{
/// <summary>
/// Description of UserControl1.
/// </summary>
public partial class xButton : Button
{
private Color m_color1 = Color.LightGreen; //first color
private Color m_color2 = Color.DarkBlue; // second color
.... more code....

And this is what it looked like after two struggling two evenings with the .NET Drawing and Event override functions. Color, font and text alignment can be selected, and there is a basic 3D look.
Finally I copied a sample program using this xButton control to my PocketPC, only to find out that the button is still the same flat, grey one as in my previous applications :-(
So what went wrong ? Microsoft has the answer on this page. The following line explains it all:
"...most of the standard controls, such as Button, ListBox or Label, don't allow you to override the OnPaint event and add custom drawing to them..." So much for my custom button that overrides the OnPaint event. Fortunately the solution is also given here. Custom controls for the CF should always start from the toplevel 'Control' class, which does allow the overriding of the OnPaint. And, how convenient, the forementioned article contains a lot more hints and tips on creating a custom image button, so I suppose I had to start all over. I don't think just changing 'Button' to 'Control' in the class declaration will be sufficient. But ofcourse I did try it, just to see what happens. And to my (big) surprise, the program compiled without any warning, the button looked exactly the same when running the program on my PC, and... it also worked on the PDA ! So much for my first step towards what I hope will be a series of 'fancy' controls for the CF.
(Hey hey, but how did you actually do it ? Just look at the source here to find out...)

Wednesday, July 12, 2006

More CF compiling options

It's nice to see how suddenly more people start thinking along the same lines. Stefan Cruysberghs has created an article on the Borland developers network showing how to create CF applications using Delphi. I just read it, and it feels like a deja-vu, since it roughly follows the same procedure as in my previous posts. On the site of JED-Software you can even find a complete package to make Delphi more 'CF-Enabled'. Chee Wee Chua has posted a Compact Framework Project Preprocessor (MakeCFCompatible) to the Borland CodeCentral that's remarkable like my own CFPreProcessor. Ofcourse all of these solutions assume that you are the fortunate owner of Delphi 6 or the Borland Developer Suite 2006, and do not (yet) support .NET 2.0.

Friday, June 02, 2006

SDK's and Emulator for the Compact framework

I Mentioned earlier that there is no emulator available for the CF. But now there is. Microsoft has released the Mobile 5 Emulator as a standalone package. Here it is:
Standalone Device Emulator 1.0 with Windows Mobile OS Images.

After installing it you can run it like any other program from Programs in your Start Menu. The first time you start it, select PocketPC, Coldboot. Note that it will take almost a minute to boot for the first time, so be patient.
Unfortunately this version does not have the Compact Framework 2.0 installed, so we'll have to do that manually:
- First get the CompactFramework Installation file (NETCFSetupv2.msi)
- Make sure you have ActiveSync 4.0 or higher installed.
- Open the 'Device Emulator Manager' (it's in the same section of the Programs menu where you just started the PocketPC emulator). If the PocketPC emulator is running you will see it in the Device Manager screen as a button with a green arrow, followed by de Device ID.
- Select it, and open the Actions menu. Select 'Cradle'. This is the same as connecting an actual PocketPC to your PC by putting it in the cradle or docking station. Usually ActiveSync will now pop-up and connect, but if it does not, just open ActiveSync,and select 'File->Get Connected'.
The Emulator now behaves exactly like a real device connected through ActiveSync.
- Now start the Compact Framework Installation (just double click on the 'NETCFSetupv2.msi' file and the installation will start automatically. It will first extract the installation to your harddisk, then start up ActiveSync, and upload the installation to the emulator. The emulator will start the installation procedure.
Now pay attention : when the installation is finished on the emulator DO NOT LET IT RESTART. If you do, it will perform a coldboot, and your installation is gone. Select 'File->Save State and Exit' instead. The whole ROM image, including hte CF 2.0 installation will now be saved. Next time you start the emulator, start the 'PocketPC - Savestate' and you'll have a Compact Framework 2.0 enabled Pocket PC at your desktop.

What's also nice to have when developing is theWindows Mobile 5.0 SDK for Pocket PC.
This contains all kind of usefull samples, images, projects and also the Windows.WindowsMobile namespaces. Now when you try to install it you will notice it first checks for the presence of Visual Studio, and if that's not available, it refuses to install :-(
So we just have to unpack the .msi file using the
'LessMSIerable' utility from http://blogs.pingpoet.com/ :-) I'm not 100% sure this is legal, but since it's so easy it would be foolish to forbid it.