Free C# Teaching Materials

Rob Miles, aprofessor at the University of Hull, (and co-author to Embedded Programming With The Microsoft .NET Micro Framework) has released his C# teaching materials for free. It is available from here..

The book contains 185 pagesand covers everything from how to start with C# (like the basic languageconstructs) to how to create user interfaces, components and even how toencapsulate the logic of your application into business objects.

 

Currently rated 3.0 by 4 people

  • Currently 3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: AllanJP
Posted on: 12/27/2008 at 3:29 PM
Tags: , ,
Categories: C#
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

.NET Micro Framework

The .NETMicro Framework brings the effectiveness of managed code into the world of embeddedsystems, by the means of using (among other things) objects to store thedifficult and tedious tasks of sending output/input to specific pins, and a wholelot more. I hope to give an insight into what the .NET Micro Framework is, andin later blogs provide you with exiting code examples of how I go about usingthe .NET Micro Framework to develop some cool applications on an embedded system. 

What is the .NET Micro Framework?

The .NETMicro Framework is a “bootable runtime”, which means that it provides a subset(a subset selected by Microsoft to provide most services that is needed to run embeddedapplications on small devices) of a full blown operating system (from now oncalled OS). This subset consists of resource management, execution control andI/O.  Having this subset, it allows the.NET Micro Framework to run directly on the hardware without the need of atraditional OS (although, it can also run on top of an OS) , this is achievedby adding things like interrupt handling, threading, process management, heapmanagement and other traditional OS functions, into the .NET Micro Framework.By creating a bootable runtime the services needed by the application areprovided through the runtime and framework, and directly to the application,and thereby being independent of a traditional OS (this abstraction level iscalled PAL, Platform Adaption Layer). This means that the .NET Micro Framework isrunning on an optimized small footprint (20-30K, core) hardware abstractionlayer (HAL) in place of a traditional OS.  

The core ofthe .NET Micro Framework is the CLR (Common Language Runtime), which is anoptimized managed code runtime.  The factthat the CLR supports managed code, allows for rapid development and for safeexecution of application code by the means of modern tools (Visual Studio .NET)and programming language(C#).

What tools can be used for developing with the.NET Micro Framework?

You canutilize the strengths of Visual Studio .NET 2005 (standard, professional, orteam suite) or 2008, to develop your applications. You do not even need anyhardware to run or test the code on (although the hardware is at some pointneeded to deploy your solutions to). When installing the .NET Micro Framework,the installer provides the needed resources to the Visual Studio environment,and it also provides you with an emulator to run your code against.

Download the .NET Micro Framework

What is the .NET Micro Framework targeting?

It istargeted against a new generation of less expensive and more power efficient 32-bitprocessors, where “Fastexecution” lets a process run in smaller duty cycles and thus spend more time in power-efficientsleep modes. (for complete specs. Please visit MSDN).

 

What’s next?

I will provide a small tutorial on how to get the Visual Studio environment up andrunning, but will not go in to much detail on that subject.

And then it’son to some code. I will setup an example of how to write a first program, and Iwill try to explain my thoughts to the best I can. I do know that things may sometimesseem unclear, and if there is some information, or something I haven’texplained well enough, please bring it to my attention and I will do my best togive a better explanation or provide you with more detailed information. 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: AllanJP
Posted on: 12/21/2008 at 4:23 PM
Tags: ,
Categories: Embedded
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Id3TAG and C#

The other day one of my friends told me that he was tired of all the programs on the marked claiming that they were perfect for keeping track of his music collection. When I asked what he was looking for, he told me that he needed a program that could read in his collection of mp3’s and keep track of these music files. Thay should be loaded into the program, and listed by their Tag id (title, artist, album and so on). You should also be able to edit the tags, mark all mp3’s and select ”remove all comments”. He also wanted the program to able to get titles, album names and so on for the files in his collection which doesn’t have a tag. Now this last part is properly the hardest thing (not impossible) to accomplish, I decided to write a blog on how to make such a program.

In this first part, I started out with trying to retrieve the information, and putting the output on the console (This will be in version ID3v1, but later on it will also be in version ID3v2). I mean, test the functionality before deciding on GUI layout and all. This meant that I have to somehow search through my ”music” directory and list all files, and subdirectories files. And what better way to do that than with a recursive method. Now here is what I did.

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.IO;

namespace Id3

{

    class test

    {

        public byte[] TAGID = new byte[3];     

        public byte[] Title = new byte[30];     

        public byte[] Artist = new byte[30];    

        public byte[] Album = new byte[30];     

        public byte[] Year = new byte[4];       

        public byte[] Comment = new byte[30];   

        public byte[] Genre = new byte[1];      

        //Search through directories and sub directories to find mp3's

        //and I do this by a recursive method..

        public void SearchDirectories(string StartPath)

        {

            string[] dirs = Directory.GetDirectories(StartPath);

            if (dirs.Length > 0)

            {

                foreach (string subDirectories in dirs)

                {

                    SearchDirectories(subDirectories);

                }                           

            }

          

            //Will reach here after the current directory has been checked for other directories..

            string[] fileNames = Directory.GetFiles(StartPath);

            foreach (string fileName in fileNames)

            {   // When utilizing "using" we get the benefit of not having to close the FileStream ourselves, this is done for us. (there is more, but I will elaborate on this later).

                using (System.IO.FileStream fs = System.IO.File.OpenRead(fileName))

                {   // The tag information is the last 128 bit of an mp3...

                    if (fs.Length >= 128)

                    {

                        test tag = new test();

                        fs.Seek(-128, System.IO.SeekOrigin.End);

                        fs.Read(tag.TAGID, 0, tag.TAGID.Length);

                        fs.Read(tag.Title, 0, tag.Title.Length);

                        fs.Read(tag.Artist, 0, tag.Artist.Length);

                        fs.Read(tag.Album, 0, tag.Album.Length);

                        fs.Read(tag.Year, 0, tag.Year.Length);

                        fs.Read(tag.Comment, 0, tag.Comment.Length);

                        fs.Read(tag.Genre, 0, tag.Genre.Length);

                        string theTAGID = Encoding.Default.GetString(tag.TAGID);

                        if (theTAGID.Equals("TAG"))

                        {

                            string Title = Encoding.Default.GetString(tag.Title);

                            string Artist = Encoding.Default.GetString(tag.Artist);

                            string Album = Encoding.Default.GetString(tag.Album);

                            string Year = Encoding.Default.GetString(tag.Year);

                            string Comment = Encoding.Default.GetString(tag.Comment);

                            string Genre = Encoding.Default.GetString(tag.Genre);

                            Console.WriteLine("Title: {0}", Title);

                            Console.WriteLine("Artist: {0}", Artist);

                            Console.WriteLine("Album: {0}", Album);

                            Console.WriteLine("Year: {0}", Year);

                            Console.WriteLine(Comment);

                            Console.WriteLine("Genre: {0}", Genre);

                            Console.WriteLine();

                        }

                    }

                }

            } Console.ReadLine();

        }

    }

}

This is actually pretty strait forward, there is nothing difficult about this piece of code. I did not have to use a recursive method in order to achieve this functionality, I did this because I recently finished a course in algorithms, and I’m simply testing my abilities.

I will continue in the next part, I have not decided what functionality to implement next (I think it will be focused to getting tag information out of the ID3v2 tags, which are quite different!), but I will return. If you find that I don’t explain my code enough, please email me, and I will make it better. I’m trying to find out who my audience is, and at what level of experience you are, so that I can make it just right. So don’t hesitate to comment.

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: AllanJP
Posted on: 11/4/2008 at 1:55 AM
Tags: ,
Categories: C#
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (5) | Post RSSRSS comment feed

OpenMoko

Now its out of the bag!!!

Now why would I mention an opensource phone when I'm blogging about Microsoft and ASP.NET? It's simple, the uses Linux as a operating system, but there is also Mone! Mono is a port of Microsofts C# language, where the only big differens is that you are not able to use Windows.Forms framework, but instead you use GTK# when you create your GUI.

This phone now means that you can use your skills in C# to create the applications on the phone. You can do a complete rewrite of all the software on the phone, or just make a couple of applications that you might think could be in handy on your phone.. Now thats news for geeks and wannabees..  For Instance, I have a daugther who is currently four years old, but as she becomes older, she'll be needing a phone, and she'll go to parties... The phone has a built in GPS chip, and 3D Graphic chip... I'm thinking - I write a program using the GPS to moniter where she is when she says that she's sleeping at a freinds house!!! hehe... Okay thats maybe not what I would do, but it has endless possibilities. So get the phone and start making your own phone....

 

 

For more infomation take a look at www.openmoko.org  and www.mono-project.com

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: AllanJP
Posted on: 9/4/2008 at 4:23 AM
Tags: ,
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (3) | Post RSSRSS comment feed