Night launch of Discovery

We managed to make it from Ontario down to Florida to view the night time launch of the space shuttle Discovery.  At first, we didn’t think we would see it, but a few weather and technical delays pushed the launch right to the start of our vacation.  Here’s a shot of Discovery shortly after launch:

IMG_2756 

This photo was taken in Titusville, beside Space View Park (the silhouette of the park is on the right).  We were about 20 km from the launch pad which was in clear view.

Blair.

Automatically login to CodePlex/TFS in Windows 7

If you have or are part of a project on CodePlex, you know how annoying the TFS login screen is every time you start Visual Studio 2008.

This really got to me.  So much so that I sat down to figure out how to get Windows 7 to remember this.

Open the Control Panel, then click on User Accounts and Family Safety.  Then click on the Credential Manager.

Once there, click on “Add a Windows credential”.  Set the network address to tfsxx.codeplex.com (replace this with your server name), user name to SND\user_cp (note, case may matter), and enter your password you use for the website.  Then click OK.

Now launch Visual Studio.  It should ask no more for the CodePlex login credentials.

Blair.

XNA on the Micro Framework? Well, a start…

This month I have been working hard at providing XNA support for the Micro Framework.  Sometimes I wonder how I get myself into these things.

I entered another contest, Dream, Build, Play, where you or a team write a game for some cool prizes.  When I was reading through the XNA documentation and I was thinking that the paradigm of writing games fits some embedded projects a lot better than WPF that the Micro Framework is using now.  Perhaps not for all applications, but for my project is felt like it did.  Which brings me to this video of the Platform Starter Kit running in the Microsoft Emulator included with the Micro Framework:

As you can see, it is a little slow, running in the neighbourhood of about 10fps, but it is running.  Also, a limitation in the Micro Framework did not allow me to support the flip sprite effect, so the characters do the moon walk if moving left to right.  This can be fixed in the game itself by providing more graphics (but as I explain below I was getting tired editing images).  I had to stop the gems from bouncing to help the frame rate as well.  This XNA port only includes 2D graphics (and that part of the content pipeline) and input.

The porting of the game was not too bad, as I tried to stay true to the XNA API and the Grommet library handled some missing functionality in MF.  The biggest changes involve the content pipeline since XNA and the Micro Framework handle resources very differently.   I could have matched the XNA API a little closer, but I was unable to reflect enum field names, and I am starting to believe that they are stripped out before deployment. 

Another area that caused some serious tedious work is that the Micro Framework does not support alpha channels.  To get around this, I had to use Paint.NET to load each PNG, paint in magenta for the transparent parts and save out again as a GIF image.

If this was more than just a test application I would have spend more time optimising and cleaning it up.  I really do need to get back to the Dare to Dream Different Challenge.

OK, back to why I did this in the first place:  to see if XNA was viable for a user interface on the Micro Framework.  I hope this video shows that it is.  My next step is to get the screen management sample working, and use that as a basis for my clock/radio/RSS feed reader that I have been blogging about. I truly believe that if Micro Framework team wanted to support XNA, they could get much better frame rates than I can in straight managed code.

The source for this is available as part of Grommet, and this project can be found on Codeplex:

http://grommet.codeplex.com

Blair.

An Update to the Grommet Library

I have added another release to the Grommet Library (an extension to the .NET Micro Framework).

This release adds default comparers to OrderBy and ThenBy to allow the use of the orderby C# keyword.  The code sample from the previous post can now be simplified with the orderby keyword:

var feedsToUpdate = from feed in feedList
                    orderby ((RssFeed)feed).LastUpdate descending, ((RssFeed)feed).Name 
                    where ((RssFeed)feed).LastUpdate > new DateTime(2009, 03, 20)
                    select (((RssFeed)feed).Name);

Also, this release includes a more mature Http/1.1 client, including an example of calling a web service, and the accompanying service.  The Http client was missing the ability to POST which made calling web services impossible.  This is fixed now.

To better test the Linq implementation, I reorganised the unit tests to report when they passed or failed.  There is one open issue with the Linq implementation as it stands now: the SortIterator does not use a stable sort (the order of equivalent items is not maintained in the output).  Let me know if this is a big problem to anyone.

Blair.

Update: I forgot to thank Dave for finding the limitations in the Http client!

Grommet: Linq, HTTP/1.1 and more for .NET Micro Framework

To be honest, I haven’t been working on my entry to the Dare to Dream Different Challenge lately.  I was distracted by a comment on my blog by Jens Kühner correcting my post where I stated that Linq was not possible without generics.  Well, that got me searching, and I could only find proof implementations of Linq without generics, but not a full implementation of Enumerable.cs targeted to the Micro Framework.

So I started writing one.  Although, it is not complete yet, I thought it was far enough along that I should share it, and Grommet was born.  

The idea behind the Grommet Library was to implement functionality missing from the Micro Framework in the spirit of what the Micro Framework group has already done, that is to follow the full BCL API, but only include the the most used functionality.  I really hope that some day Grommet won’t be needed.

Right now, Grommet includes Linq (and with that attributes to allow for extension methods) and an HTTP/1.1 client (HttpWebRequest/HttpWebResponse).  It also has some other extensions, which you can see at the CodePlex site:

http://grommet.codeplex.com

To give you a flavor of the current Linq support, here is a code snippet:

public class RssFeed
{
    public string Name { get; set; }
    public string Url { get; set; }
    public DateTime LastUpdate { get; set; }
}

public void FeedTest()
{
    ArrayList feedList = new ArrayList()
    {
        new RssFeed() { 
            Name = "XBox Live's Major Nelson", 
            Url="http://feeds.feedburner.com/MajorNelson",
            LastUpdate = new DateTime(2009, 03, 27) },
        new RssFeed() { 
            Name = "Quirks & Quarks", 
            Url="http://www.cbc.ca/technology/quirks-blog/index.xml",
            LastUpdate = new DateTime(2009, 03, 28) },
        new RssFeed() { 
            Name = "Dilbert Daily Strip", 
            Url="http://feeds.feedburner.com/DilbertDailyStrip",
            LastUpdate = new DateTime(2009, 03, 27) },
        new RssFeed() { 
            Name = "MSDN Just Published", 
            Url="http://msdn.microsoft.com/rss.xml",
            LastUpdate = new DateTime(2009, 03, 19) },
    };

    var sortedList = feedList.OrderBy(x => ((RssFeed)x).LastUpdate.DayOfYear, new IntComparer())
                             .ThenBy(x=>((RssFeed)x).Name, new StringComparer());

    var feedsToUpdate = from feed in sortedList
                        where ((RssFeed)feed).LastUpdate > new DateTime(2009, 03, 20)
                        select (((RssFeed)feed).Name);

    foreach (var name in feedsToUpdate)
    {
        Debug.Print(name.ToString());
    }
}

I would really like Grommet to have more functionality in it, but I need to get back to working on my Challenge entry.  If you would like to contribute to Grommet, I appreciate any help the community can provide. 

Blair.

Dream Challenge, Update Three

I have been busily working away at building infrastructure for the Dare to Dream Difference Challenge.  Since my last post, I have finished the hardware prototype, although I still need a cabinet.  The project now consists of a Device Solutions Tahoe II development board, an XBee Series 2 module, an AR1010 FM Receiver, an LM4832N audio amplifier, and two 0.5 watt speakers (pictured here).  Not pictured is the ZigBee base station.

HardwareProto1

I have made a shift in the approach I was taking for the software.  Originally, I was going to have my home server update the bedside clock through the ZigBee interface.  Sure, that was cool.  Having the bedside clock update the feeds itself over Ethernet, now that is really cool!

One problem: the Micro Framework has sockets, but no HTTP support--yet.  Jim Mateer has confirmed that HTTP is an approved feature in the next major release of the Framework, which is unfortunately too late. So, I wrote the web support classes from the System.Net namespace with enough functionality to keep me going. Namely, I implemented WebRequest, WebResponse, WebHeaderCollection, WebException, HttpWebRequest, and HttpWebResponse to support only HTTP 1.1, and not HTTP 1.0, HTTPS, cookies, caching, asynchronous operations or authentication.   I followed the behaviour I needed as best I could to allow me to replace my implementation with the official implementation from Microsoft when it is released.  With these classes I am able to download RSS feeds directly on the bedside clock.

I also ported an NTP client written by Valer Bocan.  He wrote this in the 1.0 days, which was perfect for Micro Framework. 

So now the bedside clock updates its time from a time server on the internet, it can fetch RSS feeds, and it can tune to FM radio stations and adjust the volume, treble and bass.

Here is a list of things of things I learned since the last update:

  • Don’t try yield to implement IEnumerable.GetEnumerator() because it won’t work.  You will instead have the MetaDataProcessor fail with an informative E_FAIL.
  • Reference MFDpwsExtensions.dll to get access to the System.Ext namespace.  That’s where I found Uri implemented.
  • Speaking of this, System.Ext.Net and System.Ext.Net.Sockets are documented, but the classes in these namespaces have gone AWOL.
  • TcpClient and UdpClient are not available, so you will have to do things the old fashion way with Sockets.  Fortunately, NetworkStream is available!
  • In order to use extension methods, you will need to provide an implementation of System.Runtime.CompilerServices.ExtensionAttribute.  More good news is that the other C# 3.0 compiler features I tried (lambda expressions, object initializers, and automatic properties) work great. Linq is out because of lack of generics support.  Update: Appears Linq is possible.  Thanks, Jens!

For the next update, I will be working with the Micro Framework’s WPF implementation to start building the user interface.

Dream Challenge, Part Two

After a week of coding, I now have the first signs of a bedside clock!

FirstClock

The first milestone of my project was to get the XBee network stack up and running where I would have a desktop computer and an embedded device talk to one another.  To reduce the risk of getting both devices talking I wanted to have the exact same code run on the desktop and the embedded device.

I went about this by creating a class library project targeted at the .NET Micro Framework and another class library targeted at the full .NET Framework.  The files lived in the Micro Framework library, and the full Framework library linked to the same source files (the simplest approach I found was to unload the project and manually add the Compile elements with a relative path in the Include attribute).  I worked with two Studio’s open, one for the desktop, the other for the embedded device.  I wrote the stack in the Micro Framework solution since it is a sub-set of the full Framework and tested and debugged in the Desktop solution.  In the end, I only needed to code a few methods from the Utility class from the .NET Micro Framework in my Desktop project to have the same code in both environments.

There was one “funny” was that was really driving me crazy.  If I debugged the code on the embedded device, it worked great.  If I tried running the embedded device stand-alone, it would never talk over the XBee network.  With much digging I found a post on the Micro Framework news group by Martin Welford offering the advice to move the serial port open call before the connecting any event handlers.  If the serial port was opened after the event handlers were connected, the serial port would not fire the events.  Sure enough, I moved the Open() call and it worked.

Blair.

First Weekend, XBee fun

My kit arrived on Friday for the Dare to Dream Different ChallengeVery very cool.  The only minor disappointment was that the supplied XBee modules were Series 1.  Fortunately, I had a few 2.5 modules laying around from a past project that I upgraded to ZB. 

Fortunately for me, Michael Schwarz created a library that contains code to talk to 2.5 and later modules for the desktop and micro frameworks.  After a few hours of leaning how his library worked (and not worked with Series 1) and upgrading XBee modules, I started work on one piece of my project.  Here’s a screenshot of the application (so far) running showing my little XBee network:

FirstNetworkList

So far, I have only used the desktop part of his library.  I hope to try out the Micro Framework version soon.  But first, I need to send RSS data between two modules.

Also, thanks to Dan for answering yet another one of my newbie WPF questions, this time about data binding.

Looks like I was dreaming about dreaming

Now I am officially in round 2.  I didn’t realize I had to fill out some forms to make sure that I met the contest rules.  Fortunately, that is all behind me now, and my development board is on it’s way.

Which doesn’t give us contestants a lot of time.  Round 2 ends March 31, 2009, which is a little over 2 months away.

I plan to blog about my progress.  Right now, I am in the “getting reacquainted with Micro Framework” that I last looked at a couple of versions ago.  I had bought the book “Embedded Programming with the Microsoft .NET Micro Framework” by Donald Thompson and Rob Miles, but some of the examples don’t work anymore with the 3.0 release, especially the WPF ones.

I dare to dream different!

Wow!  I was accepted into Round 2 of the Dare to Dream Different Challenge by winning Round 1.

Round 1 consisted of making a proposal of what your dream device would be and telling a little about yourself.  My dream device is a bedside digital assistant.  It is much more than an alarm clock (although it will have that feature).  Through the use of RSS feeds, it will act as a morning newspaper, weather report, and digital picture frame.  It will have some other features that I always wanted at my bedside, but I’ll save that to blog about another day.

The nice part about the challenge is that the sponsor (thanks Microsoft!) is providing a development kit to allow us to create our prototype.  I can’t wait to get going on this!

Blair.

Playing with Windows Sensors in Windows 7

At PDC 2008, there was a booth for Windows Sensors & Location Platform (more here).  I was lucky enough to snag one of the free development kits.

I’m running the Windows 7 build from the PDC, and it is very stable.  I haven’t any problems with it so far.  The main reason for me to use Windows 7 for for this API.

Setting up the dev kit was really easy.  I posted my setup experience on the forums here.  If you are having trouble installing, maybe this thread can help.

I just stumbled across this today:  if you want to get your hands on one of these boards free you have one day left (closes Nov 19th, 2008) to get your entry into AeroXP.org (http://www.aeroxp.org/7-sensors).

Blair.

Toronto Code Camp

I just got back from the Toronto Code Camp.  I attended Bruce Johnson’s “Binding Objects in ASP.NET 2.0” and “Introduction to the .NET Enterprise Library 2.0” (Bruce covered for Bill Dunlop who couldn’t make it).  After lunch, I caught Shaun Hayward’s “Professional Look-and-Feel using Infragistics”, Sheldon Fernandez presenting “Code Access Security in Practice” and “OpenNetCF Smart Device Framework 2.0” by Mark Arteagea.  All the presentations were excellent, and for many presenters it was their first time.

 

I even won a book at the end of the day (with a lot of other people). 

 

Kudos to Chris Dufour and Jean-Luc David for leading this excellent event!

Flying in a Beech Expeditor

I'm a member of the Canadian Warplane Heritage Museum.  One of the cool benefits of being a member is the membership flight in a vintage aircraft.  This weekend I went on a 1/2 hour flight on a Beech E18S Expeditor.  I really enjoyed the intimate nature of this small transport plane.  I listened as pilots worked their way through the checklist and watched them hand-pump the fuel into the engines for startup.

I am trying to volunteer in the museum archives, but lately it seems my wife is volunteering there more that I am.

If you live within driving distance, you should check the museum out.  It owns and operates one of the last two flying Avro Lancasters (the other is in England, owned by the RAF). From what I understand, it is the only one where you can go up on a flight.

Fixing your Abacus

After months of my cheap Abacus SPOT watch constantly resetting, I found this on the internet:

http://forum.spotstop.com/showthread.php?t=726

I'll reproduce the post here (thanks a million, Kas) in case the page disappears:

“If your watch re-sets when you shake it try this:
1. Open your watch by removing the 4 screws on the back. Then get
a flat object to take off the back cover.
2. Check to see if there is a space between the battery and the battery holder.
3. If there is fold up a piece of tape and put it in the space.
4. Put the cover back on and test it out.
Note: When opening your watch watch the cover as there is a wire attached to it. (Thanks to Icedrey for this)
Be carefully while doing this. I take NO RESPONSIBLY if you damage your watch. It will as void you 90 day warrranty.”

I performed this fix, and I've been running for 4 months without a reset.

 

Where is Canada, anyway? Is my SPOT watch there?

Rob pointed me to this great deal at TigerDirect.ca for a Abacus SPOT watch for $30.  I wouldn't spend $150 for one of these things, but at $30, I couldn't resist.  I've been able to play with it for just over a day, and I must say, it is really cool.  I would love to be able to push my own content and code to it, but no SDK as of yet.

When I was waiting for it to charge, I thought I would read the Reference Guide.  I came across this:

Regardless of where you travel in North America or Canada, ...”

«November»
SunMonTueWedThuFriSat
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345