Interesting Tech Projects
Software Engineering
Not All Wii Nunchuks Are Created Equal
Aug 29th
What is the difference between the two Nunchuks below?
Quite a lot actually. The one on the left was bought on ebay for £3.50 and came with no packaging or information. The one on the right was bought from Amazon for £11.20 and came with Nintendo packaging and a warranty. Read on for details of all the differences I discovered. More >
Reading a Wii Nunchuck Using I2C
Aug 20th
There are plenty of descriptions on how to read the joystick, accelerometer and button values from a Wii Nunchuck using I2C but I haven’t seen any waveforms. So here are mine. Click on the images to see them in full size.
The I2C bus was running at about 100kHz. The time between the handshake and the first data read sequence is about 1.8ms and the time between each subsequent data read sequence is also about 1.8ms, although I feel that these times can probably be reduced.
Unlike many code examples I have seen there are no delays between each write operation in the handshake or between the write and read operations of the data read sequence.
First up is the handshake to send “unencrypted” data:
Next is the data read sequence containing a six byte chuck of data with the values we need:
Hopefully these will be useful to people developing application with a Wii Nunchuck.
Fast Reading of XML Files
Jul 14th
I recently had the need to parse 780MB XML files, and quickly. My preferred language for PC development is C# because I can work quickly and efficiently with it, however I was a bit wary of the speed of XML file processing. Thankfully Mike Taulty has worked out a solution using LINQ and XmlReader, providing the user friendliness of LINQ with the speed of XmlReader.
An initial test showed that a 39MB XML file is processed in 4.9 seconds using Mono on a quad core server running Ubuntu. This is about 8MB/second which means that my 780MB file should be processed in around 98 seconds. Nice!
Internationalization in Silverlight
May 10th
For some reason Microsoft have made it difficult to work out how to support multiple languages in Silverlight. The solution isn’t hard, once you manage to work it out. It is complicated by the fact that accessing string tables in C# is completely different to accessing them in XAML. Plus there is a nasty bug in Visual Studio which apparently still isn’t fixed.
However, never fear. After trying several approaches, all of which failed in some way, the solution can be found on timheuer.com. Tim presents a clear and straightforward method without needing to do anything weird (except for the Visual Studio bug workaround).
Why Adobe Has Lost the Plot
Mar 4th
Flash and PDFs are staples of the internet and have been for many years now. I used to develop some flash applications but not anymore as Adobe really has lost their way.
Adobe Reader
Sadly it appears no longer possible to directly download this application and install it. Now you have to get the “Adobe Download Manager” first which then forces you to get a McAfee security program at the same time as Adobe Reader. There are no options to cancel the download or installation of this program and it doesn’t matter that I already have security software on my PC. When will Adobe realize that people want to be able to choose what to download and install? No thanks.
Adobe Flash Player
Back when I bothered to write applications for flash (note – not adverts but client-side file processors and mapping tools) I installed the debug version of Flash Player so I could use FlashBug for debugging. Ever since then Flash Player continually crashes on me when visiting most websites with flash (such as CNN). This is despite uninstalling the debug version and installing the regular version. Sometimes I can dismiss the crash errors and it keeps working and other times it freezes Firefox for several minutes before crashing that too.
On setting up my new Windows 7 installation Flash Player forced me to close Firefox before it would continue – rather than closing and restarting via the add-ons window like all other plugins. After installation FireFox now will only start in “Safe Mode” with many features disabled. Wonderful.
Thanks Adobe for a really great user experience! Or should I say software engineering failure.
50,000 Point GPS Track in Silverlight
Mar 1st
About six months ago I posted a video showing a GPS track with 7,000 points in a slippy map control called DeepEarth. If you watch the video you can see that the track lags behind the map a little and I think I was at the limit of what was usable.
Yesterday I wrote about my new C# based slippy map control for Silverlight and Moonlight that can display 50,000 map markers and I wanted to see what it’s performance was like for a GPS track. I created a random track with 50,000 points in it to simulate a track from a GPS unit. Here is the result. More >
50,000 Map Markers in Silverlight
Feb 28th
There are a range of pan and zoom map controls (sometimes called slippy maps) available for C#/.NET and Silverlight/Moonlight. All the ones I’ve seen have something in common – they are bloated. The authors attempt to address the needs of as many users as possible and the result is large downloads and far too many features. The forums and mailing lists are full of people asking how to achieve basic functionality because they are lost in the vast realm of classes.
Of course, it is possible to remove what you don’t need but that requires understanding the code and after all that effort you are left with code that might not have the right license for your needs. The solution? Time to cringe – reinventing the wheel.
Fortunately it’s not much of a wheel, assuming your requirements are simple as mine are. C# and good development tools (Visual Studio and MonoDevelop) makes it easy to quickly develop a lightweight and flexible slippy map that can be used in Windows, Mac OS X and Linux (using Moonlight). More >
Optimizing DeepEarth For GIS Mapping
Sep 5th
DeepEarth is an interesting Silverlight project. It allows interactive tile-based maps to run in a browser with overlays of custom data, however it suffers from some performance problems.
Large GPS Track Logs
I had the need to display GPS tracks in DeepEarth. GPS tracks can contain thousands of points. DeepEarth has three update modes called ElementUpdate, PanOnlyUpdate and TransformUpdate for showing features such as tracks:
- ElementUpdate recalculates the point positions on every map movement. This produces an accurate track display but gets slower as the number of points increases.
- PanOnlyUpdate recalculates point positions during panning and hides features while zooming. Not too useful for me and didn’t seem to show anything anyway.
- TransformUpdate draws the tracks to the map once then scales and pans the vector graphic in synchronization with the map. This makes it very fast. Sadly the scaling code is flawed. Lines disappear as you zoom in and sections of the tracks become distorted, almost looking like calligraphy.
I wasted many evenings trying to get the scaling in TransformUpdate mode working before giving up. I then turned my attention back to the ElementUpdate mode to see where the bottleneck is. More >
Google’s Walking Directions – Fail
Jun 8th
I think Google’s software engineers needs to work on their walking directions a bit more. I was playing around and decided to see the walking route from Watford, UK to Plymouth, UK. Here is the result:
Note the warning: “Use caution – This route may be missing sidewalks or pedestrian paths”. Oh yes…