Perth .NET Community of Practice: First Meeting of 2008

The Perth .NET Community of Practice user group’s first meeting of 2008 got the year off to a great start, with a session on ASP.NET MVC presented by Michael Minutillo. It was well received, and we will endeavour to get Mike back for a further session on this hot topic. Thanks to everyone who attended and especially to everyone who helped out.

There were over 50+ people on the night, despite a clash with another event (‘Meet the Team’) being run by Change Corporation, and the fact that the announcement that we were going to have beer and pizza went out quite late!


Bill Poole from
Change Corporation gave a brief introduction to Change Corporation’s involvement with .NET development and reaffirmed their ongoing commitment to support the Perth .NET community. We are indebted for their support. Bill has also kindly offered to present an upcoming talk on Service Oriented Architecture. More details soon.

Thanks go to
Talent International for arranging and supplying the refreshments. And last but not least, a mention of all our sponsors: Change Corporation, Excom, Talent International, SoftTeq, JetBrains, Power Business Systems, Microsoft and all the publishers who are contributing to the User Group Library: O’Reilly, Apress, Pearson IT, Peachpit.

Optimise Your .NET Compact Framework 2.0 Development

Optimize Your Pocket PC Development with the .NET Compact Framework

This MSDN webcast covers quite a few topics, and most will be familiar, but it’s a good, commonsense refresher: Optimizing Your .NET Compact Framework 2.0 Applications for Performance (Level 200)

There is a large collection of Mobility Webcasts
here.

.NET Compact Framework version 2.0 Performance and Memory Working Set FAQ.

Thinking of using the Compact Framework for ‘real’-time applications? Chris Tacke’s January 2008 article, “Performance Implications of Crossing the P/Invoke Boundary” is an interesting read.

Using Log4Net with the .NET Compact Framework 2.0 SP2

Log4Net is a simple and effective logging solution for .Net applications. If you want to use it with the .NET Compact Framework, you just need to recompile the source code that is part of the standard 1.2.10 (zip) download package. Open the solution file (.sln), make sure build is set to Release, and compile with symbols NETCF and NETCF_1_0 defined in the log4net project properties [don’t forget to update the assembly references to point to the Compact Framework 2.0 SP2 DLLs, rather than the standard framework ones]

(Note: although we are compiling for CF 2.0 there is no NETCF_2_0 symbol to define)

What are the differences between the Compact and Standard versions? http://logging.apache.org/log4net/release/framework-support.html

SitePoint CSS Reference

If you haven’t already seen it, the good folks at SitePoint have put together a CSS Reference and made it publicly accessible here.

“In this free online reference, the entire CSS language is clearly and concisely explained, including browser compatibility, working examples, and easy-to-read descriptions.

The reference has been written by two of the world’s most renowned CSS experts — Tommy Olsson and Paul O’Brien — so you know it’s accurate, up to date, and best practice.”

Its other nice feature is the ability to accept user contributed notes.

C# Code Snippet: Download a File Over HTTP

This code snippet was adapted from one of Jim Wilson’s excellent “How Do I?” tutorials. It works with .NET Framework 2.0 (including the .NET Compact Framework CF 2.0 SP2), and I’ve successfully tested it on a Windows CE 4.2 device. You will probably want to add a bit more error handling:

/// 
/// Download a file from a URL to a local folder on a windows mobile device
/// Note: Don't forget that mobile folders do not start with a drive letter.
/// 
/// e.g. http://www.someaddress/downloads/
/// e.g. filetodownload.exe
/// e.g. \temp\
/// 
public static long FromHttp(string uri, string filename, string localFolder)
{
    long totalBytesRead = 0;
    const int blockSize = 4096;
    Byte[] buffer = new Byte[blockSize];
 
    if (!Directory.Exists(localFolder))
    {
        Directory.CreateDirectory(localFolder);   
    }
 
    try
    {
        HttpWebRequest httpRequest = 
  (HttpWebRequest)WebRequest.Create(Path.Combine(uri, filename));
        httpRequest.Method = "GET";
        // if the URI doesn't exist, an exception will be thrown here...
        using (HttpWebResponse httpResponse = (HttpWebResponse)httpRequest.GetResponse())
        {
            using (Stream responseStream = httpResponse.GetResponseStream())
            {
                using (FileStream localFileStream = 
   new FileStream(Path.Combine(localFolder, filename), FileMode.Create))
                {
                    int bytesRead;
                    while ((bytesRead = responseStream.Read(buffer, 0, buffer.Length)) > 0)
                    {
                        totalBytesRead += bytesRead;
                        localFileStream.Write(buffer, 0, bytesRead);
                    }
                }
            }
        }
    }
    catch (Exception ex)
    {
        // You might want to handle some specific errors : Just pass on up for now...
        throw;
    }
 
    return totalBytesRead;
}
 
Comments welcome.

A Few Useful Links for .NET Compact Framework Targeted Mobile Development

OpenNETCF have a free community edition of their extension library:
http://www.opennetcf.com/Home/tabid/36/Default.aspx
(among other things, contains a useful FileSystemWatcher which is missing from CF 2.0 SP2)

This Microsoft site has a few great tip and tricks:
http://msdn2.microsoft.com/en-us/netframework/bb495180.aspx

.NET Compact Framework Team
http://blogs.msdn.com/netcfteam/

Chris Tacke’s SDF Samples
http://blog.opennetcf.org/ctacke/CategoryView,category,SDF%20Samples.aspx

Neil Cowburn’s blog:
http://blog.opennetcf.com/ncowburn/

Jim Wilson’s Blog
http://www.pluralsight.com/blogs/jimw/

Peter Foot’s Blog:
http://www.peterfoot.net/CategoryView,category,NETCF.aspx

Mike Hall’s Blog:
http://blogs.msdn.com/mikehall/

Also, Issue 14 of the Architecture Journal has a mobile device focus:
http://www.msarchitecturejournal.com/pdf/Journal14.pdf

Make: The Best of: 75 projects from the pages of MAKE

Move over MacGyver! The Geeks are coming! Here are 75 of the best projects from the first 10 volumes of O’Reilly’s DIY MAKE magazine. In The Best of MAKE (380 pages) , editors Mark Frauenfelder and Gareth Branwyn have selected a varied assortment of projects and tips that are not only fun to work on, but also have practical applications. Even if you are not a dab hand with electronics and a soldering iron you will almost certainly find something of interest. In fact, you do not actually need to build any of these projects to enjoy this book.

The range of projects is quite varied in terms of complexity, split across the following chapters:
  1. Tools
  2. Electronics
  3. Microcontrollers
  4. Toys & Games
  5. Robots
  6. Music
  7. Flight & Projectiles
  8. Photography & Video
  9. Cars & Engines
Starting with a description of the tools that are handy to have available, Chapter 1 prepares the groundwork for what you will need to get started on these DIY projects. The following 8 chapters are a roller coaster ride through the pages of Make.
If I had to pick a top 5 projects, my favourites would have to be the Jam Jar Jet, Urban Camouflage, Pinball Resurrected , VCR Cat Feeder and the robot mouse.
I liked this book so much that I bought my brother a copy for xmas! It has even re-ignited my interest in a bit of electronics tinkering. Highly recommended. One thing to note; the Amazon cover photo shows “150 Projects” but it is actually 75.

[BTW, If you like this book, you should also check out Making Things Talk which has a distinctly embedded electronics flavor, and goes deeper into the topic of microcontrollers and programming.]

Disclosure: The Perth .NET User Group is a member of the O’Reilly User Group and Professional Association Program. O’Reilly make copies of their books available for user group libraries, and the copy reviewed here was kindly donated by O’Reilly.