01.Blogs :
IanS  
This blog is mostly about what I do at Microsoft and Technology
serializing c# class and xml / xml attributes
Thursday, October 06, 2005 1:45 PM

XML Serialization: Quick and dirty + sorry about dodge look of code :/ spoke seems to have messed it up a bit :'(

 

Was playing with XML the other day and a colleague suggested trying out XML Serialization in C#. After a quick play I found it to be extremely simple and very useful. Thought I would write a quick tutorial on it! So here I go…

 

1: Create a new project, Console Application, in Visual Studio Express C# 2005 (soz VB Guys, but the concepts are the same J ). Call the namespace whatever u want.

 

2: Add a new class to the project and call it Animal.cs

 

Source Code:

using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.Xml.Serialization;

namespace XMLSerialise
{

        [XmlRoot("Animal")]
        public class Animal
       {
                private string taxonomy;
                private string name;

                public Animal()
                {
                }

                [XmlElement("Name")]

                public string Name
                {
                                get
                                    {
                                               return name;
                                     }
                                set
                                   {
                                                name = value;
                                    }
                }

                [XmlElement("Taxonomy")]
                public string Taxonomy
                {
                        get
                            {
                                      return taxonomy;
                            }
                        set
                           {
                                     taxonomy = value;
                            }
                }
        }
}

 

Now in you main application

Do the following:

 

Source code:

 

Animal a = new Animal();

       a.Name = "Bob";

       a.Taxonomy = "Insect";

 

/// Save object to serialized file

XmlSerializer s = new XmlSerializer(typeof(Animal));

TextWriter w = new StreamWriter(@"c:\animal.xml");

s.Serialize(w, a);

w.Close();

 

 // gets file and creates the class again

Animal b;

TextReader r = new StreamReader(@"c:\list.xml");

b = (Animal)s.Deserialize(r);

r.Close();

 

 

The above code will create a nicely serialised version of you class in C:\animal.xml with the details you set in the class.

 

The second snippet of code will take that file, load it and then create an object of type animal!

 

Great stuff, and very simple to do!  For a slightly more indepth article check out: http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=236

0 Comments | Post a Comment |

posted  by  IanS  with 

Blog.entry++
Tuesday, October 04, 2005 5:00 PM

I am posting a blog entry, wow must be a miracle!!!

Been a very busy month down here in MS UK been doing lots of dev and writing up the new student newsletter which will be out around the 12th of this month. Just sigend up all the Microsoft Student Partners for the UK to the website and been a very busy day with various meetings and coke n cola :) :) :) :).

I just hope some of the MSPs are good at foozball as I could do with some compettition (foozball is not the forte of the vast majority of MS employees ;) ) heehe

Time to head home and sleep

me

0 Comments | Post a Comment |

posted  by  IanS  with 

Domain Names and Win 2k3 r2 Server (tis a mouthful)++
Tuesday, September 06, 2005 6:57 PM

Bought a couple of domain names the other day and got their a-name records to point at my box and set up the host headers to point to a temp folder. I then managed to forget how to set it up so that the host header values would re-direct to a different place on the box :-/


Cue spening ages messing about looking in mmc + dns snap in etc etc... then finally I thought to myself, "go back to the source ian, back to the source", to cut a long story short I popped back into IIS Manager.
+ My Boxen (Local Computer)
    + FTP Sites
    + Application Pools
     + Websites 
            + myWeb <- Right Click Properties

Change to "Home Directory" tab
Then Change the local path to the folder I wanted it to point to on the box...
hmm, oh well at least it works now :D

Yay for spending too long on something obvious :)

0 Comments | Post a Comment |

posted  by  IanS  with 

Brain.fill(Knowledge);
Friday, September 02, 2005 12:57 PM

Yesterday was a day of learning and such… After spending the morning playing with SqlDataAdapter and more specifically creating web-services based on DataSet objects I decided that the day would be about doing some revision for the MCAD that myself and another member of DPE are currently toying with. I am currently revising for the 70-316 exam with C# which concentrates on Windows Applications.

The first few chapters are pretty easy going and re-hash a lot of generally knowledge from university. Threading, exception handling and similar generic topics. After a bit of playing with that I decided to to have a bash at windows control libraries and see what would happened =) Seemed to work alright, and is something that I could see being quite useful in situations where you wanted to developers to re-use specific sorts of custom controls

Cool stuff I have been playing with:

   www.start.com   <-  highly customizable website which is really cool as a homepage

  http://viavirtualearth.com/vve/Gallery/Default.ashx  <- cool virtual earth 'hacks' :P

Join me tomorrow or monday for:

10 Things I now know about Computer Science that I wish I knew before starting!
Shortly followed by 10 things I don’t know about computer Science that I wish I did ^_^

0 Comments | Post a Comment |

posted  by  IanS  with 

Half Life 2 + Microsoft???!!!!
Wednesday, August 31, 2005 2:14 PM

This is so cool I had to post it as soon as possible, checkout the new coding4fun section which deals with Half-Life 2 modding! Pretty awsome

Link:

http://msdn.microsoft.com/coding4fun/half-life/default.aspx

MS Press Release:

http://www.microsoft.com/presspass/press/2005/aug05/08-31ValveCPlusPlusPR.mspx

0 Comments | Post a Comment |

posted  by  IanS  with 

weekend=null
Tuesday, August 30, 2005 12:26 PM

Yay for long weekends!

Interested in sitting back, watching a short movie while experts (some of who I work with) teach you about technology? Well, checkout http://www.microsoft.com/uk/msdn/events/archive.aspx 

 

0 Comments | Post a Comment |

posted  by  IanS  with 

new Uri("http://www.codekeep.net/");
Tuesday, August 23, 2005 9:14 AM
Check out this website it is a online repository for storing and sharing code:
http://www.codekeep.net/

cool way of storing all your code snippets that you would like handy wherever you are! Very very useful!!!

| |

posted  by  IanS  (Comments Off) 

While(Ian.location == Microsoft.uk.reading) { code++; coke++;
Monday, August 22, 2005 3:17 PM

howdy,

Been another busy week in Microsoft UK had an intensive week working with Mark Tulip the marketing chap who is going to be running the MSP program this coming year. If you haven’t signed up to be an MSP yet I think you can still get on the program. Just point your browser to http://www.microsoft.com/uk/academia/students/programmes/student-partner-programme/

So what have I been up-to you ask? Well busy coding with Visual Studio 2005 Beta 2. I have been having a look at creating a nice little tutorial for people taking their first stages in using DLL’s, creating a windows installer for their application, coding a tray app and a bit of the classic RSS/XML feed stuff that we hear about so much.

Also been having a play with Vista Beta1 at home which is interesting. Luckily I have a graphics card that is supported by Vistas aero skin, so my computer looks rather pretty and transparent/blurry. Other cool things in vista include the file browsing functionality and the way admin rights work. My only minor niggle is that the desktop background resets to the default every time I restart! Though I have a feeling they will fix this well before release =)
Other things that I have been playing with are SQL2000 Server, accessing stored procedures via C# and far too much coke ^_^. If anyone is up for a quick tutorial on SQL stored procedures and how to access them via C# drop me an e-mail and I may oblige.

P.S. Go to Thorpe park!

| |

posted  by  IanS  (Comments Off) 

while(day != weekend) day++
Friday, August 12, 2005 2:20 PM

Well Well it’s Friday afternoon and I have been back in the UK for 5 days and feel less jet lagged than I did (though I do hate colds). So what was techready1 like?!

After the all the fun I had getting there I was really looking forward to the first keynote on Monday morning. I sat down and started taking in the sights of this immense room that was to accommodate 6000 people. After a number of well presented speakers that chatted about techready1, and their plans for the week everyone wanted one thing. To a standing applause and light display Bill Gates walked onto centre stage. He chatted about what he thinks the future of technology will be and how important every person is at Microsoft. Very good speech and he made a number of interesting points.

After that it was straight to the DPE keynote where Sanjay talked about DPE, its strengths and handed out some prizes (at least 2 people were nominated from DPE UK I am sure we will win some next year).
As for the rest of the week it was a whirl-wind ride of information and lectures. Some great information about every topic IT related you could think of! They talked about vista a lot and a few other products on the pipeline such as SQL2005 and VS 2005.

It was really a great experience and I got to know Microsoft and the DPE team better than I did the week before.
It’s the weekend, I can’t wait spending my days chilling out, maxing, relaxing all cool…
Have a good weekend all
Ian

| |

posted  by  IanS  (Comments Off) 

me.sleep = true
Tuesday, August 09, 2005 4:34 PM

I am back! Sorry I didn’t blog at all last week but access to internet was quite limited and rushing back and forth between sessions meant that I had little time to think to pull all my thoughts together. Tune in tomorrow for a run down of the week and get the scoop on all the problems I had with airplanes (Lots!)

Random Interesting(!?) Facts:
Total Time from Heathrow to Seattle:   28Hours
Total Time from Seattle to Heathrow:   16Hours
Total Time Spent traveling:                 44Hours
Total Time Spent in lectures:               50hours
Total Rides I went on in theme park:    1
Total Planes I got on:                         5
Total Planes that took off:                   4
Times Luggage was lost:                     1
Total Time Sleeping:                           Not Enough

 

| |

posted  by  IanS  (Comments Off) 

while(!anchors.inBoat) { anchors.length-- } Console.write("Anchors Aweigh!\n");
Friday, July 29, 2005 1:25 PM

Hello again,

Friday afternoon, office is quiet and I am going to America on Sunday w000000t :D
I have checked my passport for the hundredth time, (make that hundred and one times) and hope that everything goes smoothly on the flight. 

Andy Sterland and Christopher Adams have now left the building, and are going back to academic life for at least one more year. They are really great guys and I hope they have tons of success

Just to stoke the flames of competition, I have two people working on solutions to Challenge #1. I saw their entry and its pretty cool, though I haven’t tested it yet… Anybody else wanting to enter hurry up and post your entries as a reply to the blog. (Both entries so far area in c#)

I have feeling the student flash I alluded to is going out today, so check it out and have a read of some stuff.

XAML!? Well, I have been playing, and let’s say it’s pretty damn cool. Very nicely done, easy to pickup and use (even for us non-graphics people) I think when we do the MSP events this year we are going to have to let people get their hands on this stuff and show people what can be done, some cool future technologies from MS.

On that note, did you see that Vista and IE7 betas are now available if you are on the MSDN network? This beta is definitely slated at us developers; I see it as a chance to familiarize ourselves with the platform. Hopefully have lots more cool things to talk about after tech-ready, expect photos of bill gates and less regular blog updates for the next week.

Anyway, going to drink another coke and carry on checking my passport.

And before I forget, check these out :) very amusing developer sketch videos
http://www.escapeyesterworld.com/downloads/videos/high/evil_wears_cape_300.wmv
http://www.escapeyesterworld.com/downloads/videos/high/infotech_from_ages_past_300.wmv
http://www.escapeyesterworld.com/downloads/videos/high/repetitive_tasks_of_doom_300.wmv
http://www.escapeyesterworld.com/downloads/videos/high/change_orders_of_death_300.wmv
http://www.escapeyesterworld.com/downloads/videos/high/terror_on_two_wings_300.wmv

Links:

IE Team Blog
http://blogs.msdn.com/ie/default.aspx

Vista:
http://www.microsoft.com/windowsvista/default.mspx

IE7:
http://www.microsoft.com/windows/IE/ie7/default.mspx

| |

posted  by  IanS  (Comments Off) 

XAML!
Wednesday, July 27, 2005 6:05 PM

Hello hello,

Wednesday afternoon and it’s raining in England!!! What a surprise =)..
Well, it means I get to spend the day learning about some interesting things.
Today there was a bunch of lectures held for people from MSDN by the Developer Evangelists in TVP. I went to three of the four and thoroughly enjoyed the learning experience. So what did they speak about?

The first lecture was about ASP .NET 2 which has a lot of useful features and really just improves on the high standards set by ASP .NET 1/1.1. They fixed the problem with validation in multiple logical forms on one page! (which is great!) There’s tons of other cool stuff and lots of really useful features in VS 2005 IDE

Second feature was about web services and was quite interesting as it has been something I have been having a play with the last few days. After a quick introduction to SOAP and XML standards the lecture talked about a few cool things like wiizzzzzzzzzzzzzze (wse 3.0)

I had to do some stuff so missed the session on smart clients, then went to the last lecture which was about Avalon and XAML. WOW  that stuff is cool, MS really have a winner on their hands. XAML is a way of using XML like syntax to create applications UI. And many other cool things, I am gonna have a play with it now, check back tomorrow for my verdict on XAML :D

Links to check out:
Web Services: http://msdn.microsoft.com/webservices/
ASP.NET 2: http://beta.asp.net/Default.aspx?tabindex=0&tabid=1

| |

posted  by  IanS  (Comments Off) 

passport.amount = ((00001010 / 00000101) - 00000001)
Monday, July 25, 2005 9:34 AM

Hey everyone,

Sorry I missed posting last week Friday. Had a busy day sorting trains, planes and passports out! As a learning experience and a great opportunity to learn more about the way Microsoft’s cogs will be spinning for the next year or so I have been invited to go to Seattle and attend techready1!

What is techready1? Well, it’s an internal MS conference (only for employees) that has a large amount of interesting and exciting sessions including explanations of new, upcoming technologies as well as a look at the old ones. There is a lot of great stuff going on, and I may even get the chance to see some cool MS directors.

For the last week, I have been chatting with Andy Sterland about VS Express 2005 and a number of other interesting stuff. I have also just written 2 articles for the student flash that will be going out later this week. If you haven’t signed up go to https://www.microsoft.com/uk/academia/studentzine/ and grab yourself a copy.
Why would you want to get the newsletter? Good question, it has lots of useful information about upcoming MS events as well as some information about beta programs and MS resources you may not have hear about.

Don’t tell anyone, but here is a sneak preview of the newsletter ;)

Would you like to know a bit more about ASP .NET with VS .NET?  The Developer Center is currently offering a free online course in this exact subject! The test will take you about 17 hours to go through, though it’s all self paced, so you can take as little or as long as you would like.
Check it out at
http://msdn.microsoft.com/asp.net/learn/asptraining/ all you need is a Passport account and to sign up quick as the free training is only available for a limited time!

Pass on the link to as many people as you want, free stuff is always good! Will be posting a couple more times before my 13 hour flight!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

| |

posted  by  IanS  (Comments Off) 

if(blog.count == 0) Blog.post++
Tuesday, July 19, 2005 3:21 PM

Welcome to my first blog. Not just my first blog on ‘The Spoke’ but my first blog ever! An interesting time to start blogging you say and I would tend to agree. So, who am I and why am I here?!  Well I am someone who really enjoys technology and has a deep interest in things which one would generally consider geeky, or in my opinion cool!  I have just started working for Microsoft UK at Thames Valley Park working in the Developer Platform and Evangelism group where I will be working in the academic section. I will be doing a similar Job to Andy Sterland http://www.thespoke.net/MyBlog/AndyS. I also work with Caroline Phillips and a whole bunch of other cool guys (check out Stephen Lambs cool tech blog http://blogs.technet.com/steve_lamb/)

So what’s my current hobby/project? Well, the last week or so I have been reading a great deal about the Microsoft Compact .NET framework. If you don’t know what this is you are missing out! Ever wondered how they make those programs for your (windows) smart phones? .NET Compact framework is a subset of the libraries of the .NET framework that has been re-coded and optimized for mobile devices. What this means is that from the comfort of home you can use Visual Studio and your favorite .NET programming language to make a killer app for mobile devices! Even if you don’t have a phone to play with there are a number of emulators available that allow you to create and test your application on your home PC!

Hope I have inspired you to have a look into .NET compact framework (check out the links below). Check back on Friday evening (22/07/2005) for a little bit more about what I am doing with the .NET compact framework and some insights into my first couple of weeks at MS (too much coke!)

Some interesting links:
Slide 5: Great mobile oriented event that happened at MS UK TVP on Monday!
http://www.slide5.com/

Making a game for mobile device using .NET:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/html/gamesprogwithcheese.asp

What is the .NET compact framework?
http://msdn.microsoft.com/smart