Friday, August 24, 2007

Custom Control, Visual Studio Designer and Properties

Recently I had to create a custom control and I was having problems with all properties getting serialized into the InitializeComponent part of the containing form. (It was causing the White Screen of Darn). Using the debugging techniques specified in http://therajahs.blogspot.com/2007/08/debbuging-white-screen-of-darn.html, I found out that the issue was caused because during serializing - the Get Accessors were being called on my control. These were to be called only during run-time and not design time. In addition the InDesignMode property was not returning the correct value (which can happen). By default all those properties that have a get and a set will automatically appear in the Property Browser. All these properties will also get serialized to the form's InitializeComponent method. One can use the following attributes on properties to control the design time appearance in the property browser of all these properties. Browsable: Determines whether the property is visible in the property browser Category: Tells the property browser in which group to include this property Description: Provides text for the property browser displays in its description bar DesignOnly: Specifies that the design-time value of this property is serialized to the form's resource file, and is typically used on design-time-only properties MergableProperty: Allows this property to be combined with properties from other objects when more than one are selected and edited ParenthesizePropertyName: Specifies whether this property should be surrounded by parentheses in the property browser ReadOnly: Specifies that this property cannot be edited in the property browser But almost none of the pages tell you how to tell Visual Designer that a certain property is not for display or designing the form and to leave those properties alone. (For a while I even thought of removing those Gets/Sets). Then DesignerSerializationVisibility came to my rescue. When ever you include your custom control in a form, the designer will automatically serialize the values for each of the properties that implement a getter and setter (In addition to showing these properties in the property browser). This will happen even to those properties that have their Browsable property set to false. I was having a really tough time working with this as some of my properties took custom types and called code that shouldnt be accessed during design time. So to stop the Visual Studio designer from serializing all property values, you can use the DesignerSerializationVisibility attribute (namespace:System.ComponentModel). If its value is DesignerSerializationVisibility.Hidden, then that property's value will not get serialized into the InitializeComponent part of the code. DesignerSerializationVisibilityAttribute specifies what part of a property should be serialized by the designer. This attribute takes one parameter, which is a DesignerSerializationVisibility enumeration member: Visible - specifies that the object should be serialized. Content - specifies that contents of the object should be serialized. Hidden- specifies that the object should not be serialized. More info: Writing Custom Designers for .NET Components(2001) http://msdn2.microsoft.com/en-us/library/ms973820.aspx Make Your Components Really RAD with Visual Studio .NET Property Browser(2002) http://msdn2.microsoft.com/en-us/library/Aa302334.aspx Custom Design-time Control Features in Visual Studio .NET (2003) http://msdn.microsoft.com/msdnmag/issues/03/12/CuttingEdge/(2003) Building Windows Forms Controls and Components with Rich Design-Time Features(2003) http://msdn.microsoft.com/msdnmag/issues/03/04/Design-TimeControls/default.aspx Building Windows Forms Controls and Components with Rich Design-Time Features, Part 2 (2003) http://msdn.microsoft.com/msdnmag/issues/03/05/Design-TimeControls/default.aspx

Thursday, August 23, 2007

Debbuging the White Screen of Darn

A useful post on debugging VS 2005 forms problems in the visual designer. http://windowsclient.net/articles//debuggingwsod.aspx

Ez-12 Parabolic Reflector Template

Ez-12 Parabolic Reflector Template (http://www.freeantennas.com/projects/template2/index.html) Having trouble connecting to your wireless router.... Here is a quick and easy solution: Instead of buying one of the expensive pre-made antennas, you can build your own from some tin foil. This site has a template. All you do is print it - paste some foil on the print. Cut out using the template, fold and voila you can have a antenna that gives you quite a bit of a boost. More designs are available at http://www.freeantennas.com/

Thursday, August 16, 2007

Removing applications from the Add/Remove List

Do you have an application that is in the Add/Remove list - but you can no longer uninstall it. Well check out MS's Windows Installer CleanUp Utility (http://support.microsoft.com/kb/290301). It can be used to remove all the programs that just dont go away. An extremely handy little tool.

How to log MSI installations

Having msi installation problems and you need to log the MSI's actions.... Here is the command: msiexec /i "installer.msi" /lvx "installer.log" I have a bat file handy with the following command in it : msiexec /i %1 /lvx "%~1.log" I can then drag and drop an MSI file on the bat file to quickly log its actions to a file.

Saturday, August 11, 2007

Wednesday, August 08, 2007

Mio c310x Updated Maps compared - III

POIs BAD CHANGE To include the newer maps - which are larger than the previous data-sets, MIO reduced the number of POIs in the updated maps. (From approx 3million to 1.7 million). Here is a result of the reduction: I searched for Circuit City while centered on city capitol in Denver. The closest result that the new maps gave me was in Wyoming - almost a 100 miles away. The older maps show 2 within a 10 mile radius and 3 more within a 60 mile radius. Above: Results of searching for Circuit City in Denver on the new Maps Above: Results searching for Circuit City in Denver using the old maps
Updated maps - new cities GOOD CHANGE Here is an address that would not come up in the old version - 2160 Gold St, Alviso, CA - apparently the address for Tivo. The city of Alviso, CA wasnt even there in the old one.
THE JURY IS OUT CHANGE Here is a route that apparently is not the most optimal. 100 Oracle Parkway, Redwood City CA, to 3000 El Camino Real, Palo Alto CA. Due to the roads not being marked with the correct speed - the fastest route that is calculated is via city streets - El Camino Real. (Below - old map) In the new maps (below - new map), the route calculated is exactly the same when using the "fastest route" option. But if you instead use the "easiest route" option - you get part of the route being computed as the optimal route. (The optimal route is supposedly Highway 101 and then Oregon Expressway).
Above - route calculated using easy option

Mio c310x Updated Maps compared - II

Updated roads - GOOD CHANGE Old
New (E. Kentucky is correctly not connected, also Lincoln is not a seperate road).

Updated Exits - GOOD CHANGE
Old
New
(in the old one an exit is shown on the left of the road. This has been corrected and the exit is now on the right).

POIs - Categorized - GOOD CHANGE Below - Old Map POIs
Below - New map POIS - categorized (Shown above are POIs under food & lodging. Now the POIs are categorized. I like this way better.)
Updated POIs
Old
New

Mio c310x Updated Maps compared - I

The old (original) Mio about page -- Before The about page after the Update applied -- After Before
After

Mio c310x

I have had the Mio c310x since last november (got it during Staples ThanksGiving sale).

It is an extremely nice GPS system - especially as it was only $150.

I have travelled from Montana to Colorado, and used it in multiple cities in the US and its always worked great.

Its got great features - normally provides great routes - and has tons of addresses. I basically have had no complaints with the device. Even Mio's customer service has been great - its open 24 hours and they get back to you really quick.

In july, Mio started to offer updated maps for the system. This is the first time that I know off - where they have slipped big time.

They have been having tons of problems with this update.

The ordering system was down, shipping was delayed and once the CDs arrived - they wouldnt work!!!! Mio certainly has lost a lot of goodwill with this episode, after having built it up really well with its c310x release.

Anyways, late last night - I got all the information from a bunch of mio forums and got the new maps to work (try www.mionav.com). The maps definetly seem better - unfortunately the number of addresses seem too have been lowered.

I sure hope Mio has learnt a lesson from this fiasco.... they could have better planned this map update and people would have loved the company..... now lets see what happens in the long run.

My advice - the c310x is a great GPS system - it can be had for as less as $150 - its competitors like Garmin are atleast double that. The features are excellent - 2d maps, 3d maps, spoken directions. Also the c310 is nicely hackable and there are tons of resources on doing that.

As for the updated maps - the jury is still out - i will try and review them in the days ahead.

Tuesday, August 07, 2007

Updating the maps on MIO c310x with the 2007 Update DVD

To begin the map update process, you first need to update the firmware. (Hopefully this process is straight forward for you, if not check out http://therajahs.blogspot.com/2007/08/mio-c310x-sec-s3c2410x-test-bd-driver.html to see if it solves your issue). Also remember that one dvd serial number is to be used only with one device UUID. Donot update the firmware unless you have a unique dvd serial number to use with your device. Otherwise you will end up with a bricked c310x. (As the device UUID is only generated by the new firmware for c310x, do not try and reuse a DVD serial number across multiple c310Xs - as you might not be able to get a valid activation code for the second MIOs). Once the device's firmware has been updated you can start the Map Update application. (Update: some people have had issues with not enough space being available on their MIO310x for the update to continue. In that case see if you can move out all the mp3 and maybe even the POI database that might be on your MIO. That should free up enough space for the updated maps) 1. After you have started the map update application you will see the Map Update Activation window. The Device UUID is computed by the application. You need to provide the DVD serial number - which is available on the inside of the envelope. 2.a. (updated 12.23.2007) The recommended way to get your activation code. A reader pointed me to a new link that will allow you to get your activation number. Try using the interface at http://mapupdate.mio-tech.com/mapupdate/index.php. (if you are able to use this link then go to step 3 after generating your activation number.) 2.b. The hacky way to get your activation number (this does not get around having to buy the update CD - it just makes sure that you get the correctly generated activation code from the device id and update CD ID). i. Copy the link provided below, replacing the UUIDNumber and DVDNumber with the numbers that are unique to you. (UUIDNumber is the MIO device ID and DVD Number is the map update ID). Paste the modified link in your address bar and hit enter. http://mapupdate.mio-tech.com/mapupdate/index.php?en=en&uuid=UUIDNumber&number=DVDNumber ii. This should load a page with a long serial code in it. This is your activation code. 3. Copy the activation code and paste it into the "Activation Code" field of the "Map Update Activation Dialog". 4. Hit Continue. If you entered everything correctly - The update should start. 5. The update takes about 30 minutes to complete. (update 09/08/07: In case you get a not enough space issue - then try and clear your MIO of all songs. This usually gives it enough space to continue with the installation. If not you might have to remove the My POI database, etc. Typically the installation shouldnt have any problems if you basically have the original files that came with the MIO - as that has enough free space for the updated maps and application)

Mio c310x - SEC S3C2410X Test B/D driver not found

The problems during firmware update manifest them selves in a variety of ways. 1. Blue screen of death 2. Computer restarts 3. Update application complains that the SEC S3C2410X driver is unavailable. I have 3 computers and I had all 3 of the above problems. Once I got the updated driver - everything worked - smooth as silk! The update has 2 steps. 1. Update the firmware and 2. Update the maps. I was having problems with step 1. Everytime I would start the update firmware app, MIO device would be restarted in a special mode and at that point it would require a driver called "SEC S3C2410X Test B/D". Without this the firmware would not uptake to the device. The Mio was being started in a special mode so as to update the firmware and thus needed a special driver for this boot loader mode. This driver is available in the following file: http://www.klubin.hrleon.com/pda/ROM_do_p550_rg.zip (25mb) or you can download just the driver files from http://www.gpspassion.com/upload/SECdriver.zip Here are the steps: 1. Download the file - duh! 2. Unzip it 3. "secbulk.inf file" is the file used to install the driver. If you used ROM_do_p550_rg.zip, then within the folder "USBDownloaderFirware" you will find the secbulk.inf file. If you used SECdriver.zip - then the inf file is right in there. 5. Make sure that you have the USB drivers installed for your MIO. (The USB drivers are in the Update DVD - install\usbdriver - just right click on the WCEUSBSH.inf file and select Install) 6. Plugin your MIO. 7. Start the update firmware app. (Either through the auto start program or its the iboot.exe file in the folder install\iboot). 8. Click the update button. 9. Your Mio device should shut down and restart automatically. When it comes back up it should have something like "processing upgrade...." on its screen. Your computer will complain that you dont have the drivers for "SEC S3C2410X Test B/D". 10. If you get the screen that allows you to point to the driver file then point it at the "secbulk.inf" file that you downloaded. (its in the USBDownloaderFirware folder if you used the Rom_do.... download). If you dont get the screen - then right click on My Computer and select "Properties". Goto the device manager. You should see a device with an error mark called "SEC S3C2410X Test B/D". You should be able to right click on it and select "Update". Again point it to the SecBulk.inf file in the USBDownLoaderFirware folder. 11. Now disconnect your MIO and perform a hard reset (turn on and off the button at the bottom). 12. Re-connect. 13. Cross your fingers and toes. 14. Run the update app iboot.exe (Install\iboot folder of the upgrade DVD). It should bring you back to the following screen 15. Hit Update. (Remember - once the firmware has been updated - all your old maps will not work. Though in most cases all your old settings - like custom POIs should all work. Also if you have customized your data.zip file - back it up - as it will be overwritten). (The screen while the device is in the special boot loader mode - that allows for the firmware to be updated). 16. Hopefully - the firmware will upload to your device. Once the firmware has been updated - all your old maps are useless and you will have to update the maps to the new ones provided on the DVD. Those instructions are in another post : http://therajahs.blogspot.com/2007/08/updating-maps-on-mio-c310x-with-2007.html

JavaScript Map API comparison

JavaScript Map API comparison This article compares the 3 major mapping APIs Google, Virtual Earth and Yahoo!

VCRedist.exe - MSVCR80.dll & Msvcm80.dll

Are you having a problem where your application does not start or does not work correctly and you getting an error message that a dll could not be loaded or your application could not be started..... Use the Dependency walker to find out if there is any dll that is missing on your computer. If you see that msvr80.dll or msvcm80.dll (or a bunch of others that are listed on this page: http://support.microsoft.com/kb/923610), then you need to obviously get these files onto your machine. The wrong way to do this is - to just copy the files from a machine that has the files. The reason for this is that these were meant to be installed as side by side assemblies and should normally go into your %windir%/SxS folder. So if you were to just copy these files onto your machine - you will be cluttering it up and depending on where you drop them - you could be proping yourself up for a DLL hell scenario. So what do you do..... The best option is to go back to the person who developed the app and ask them for the latest VcRedist package. I am not sure why Microsoft hasnt released these as installers from their website and so the only way to get them is from a computer that has Visual Studio 2005 installed. Also I think the 80 version is available only if you upgrade VS2005 to Service Pack 1. So if you are the developer - then look in the following folder for "C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\vcredist_x86" for the file "vcredist_x86.exe". This installer will correctly install the VC++ runtime dlls.

Walk Score - How walkable is your neighborhood?

Walk Score - How walkable is your house? Here is a fun little mashup with Google Maps - it tells you how walkable any given address is.
For any given address it determines the distance to a bunch of different types of address - grocery stores, pharmacies, etc - and reports a Walk Score.
Its a cool way to discover local stores in your neighborhood