Calendar

<<  January 2012  >>
MoTuWeThFrSaSu
2627282930311
2345678
9101112131415
16171819202122
23242526272829
303112345

View posts in large calendar

RecentComments

Comment RSS

Welcome

Latest news from Geekays.net

Migrated to BlogEngine.Net. Read details on my blog.

Uploaded new photo on picasa My Picassa

Looking for your feedback on the new site. Send me you feedback.

Welcome to Geekays.Net!

This is the place where geeks unite and you know what happens when they unite - technological revolution. With experiences of more than thirteen years in the information technology arena, providing services, working in different diverge LOB (Line of Business) including Material management, Exports, Fianance and accounts, Utility business, e-HR etc. Kangkan has evolved into an evangelist of architecture having a wit to deliver practical solution that is effective.

The idea behind the site:

I am Kangkan, Kangkan Goswami, The Architecture Evangelist. I run several websites on different domains, and they are all connected in various ways. This website is my personal site, and it has a lot of links to my company website. This site is basically meant for demonstrating my newest research works and publishing information I collect. Knowledge can not be developed, but is actually collected and delivered! Kangkan dedicates this website to the Geeks around the world.

The site has been here for some good length of time, but has been revamped recently when I have migrated it originally from a mere classic ASP site to a dasBlog blogger and then finally migrated to blogEngine.Net. Please explore the site and you might have something good! I shall also like to seek apology in case you don't find it enough worthy. It might be so because I am at this point of time getting little time to put after the site.

Please note: This site is only for demonstrating my works and in no means a commercial platform to sell goods and/or services. Of course I do offer services, but that is through my company Unisys Global Services, I have not aimed at making any kind of commercial propaganda through this site. In case you want to contact me, please write mail to Kangkan Goswami

 

The latest from my posts

 

XML Data Storage and XmlSerializer : The easy data store

Earlier I worked in an application where the data storage was XML and we spent quite some time designing the XSD and finalising what tags will be there for storing the different data. This is quite trivial when we need to use it as a datastore and the application need to be able to get some specific data out of it or we need some query implementations on top of this data storage.

Sometime back, in a team that I was associated with, needed a small datastore for some hierarchical data. The requirement was to get the data loaded into the application right at the startup of the application and save back the changes done at the end of the application or whenever the user wish to save back.

With all natural instincts, the team started thinking of the structure of the XML and ways and means of loading the data from XML and saving the data back node by node. After some hit and trial with some POCs they reported the issue that it is becoming hard to design this structure and writing a good data access or serialisation class.

I think almost any programmer, who has not worked on XML extensively,  tend to start in this manner only. Then with some throw of light on the XmlSerializer and a slightly different angle of thought, the easy and simple solution came up. We used a .NET Collection and other data structures to create our data structure that was easy for the program. For the first time, we set some default value to the structure and simply saved it to an XML file using the XmlSerializer. The method was something like:

[code:c#] public void SerializeXML(object Obj, System.Type ObjType)
        {
            XmlSerializer ser;
            ser = new XmlSerializer(ObjType, TargetNamespace);
            MemoryStream memStream;
            memStream = new MemoryStream();
            XmlTextWriter xmlWriter;
            xmlWriter = new XmlTextWriter(memStream, Encoding.UTF8);
            xmlWriter.Namespaces = true;
            ser.Serialize(xmlWriter, Obj, GetNamespaces());
            xmlWriter.Close();
            memStream.Close();
        } [/code]

Voila! We have the XML file without putting any effort on the design of the XML. Thanks to XmlSerializer. Our next point was to prove that we can reuse this XML. So we needed to deserialise the XML file and get back the original data structure. So the deserialisation code:

[code:c#] public object DeserializeFromXML(string xmlString, System.Type ObjType)
        {           
            XmlSerializer ser;
            ser = new XmlSerializer(ObjType, TargetNamespace);
            StringReader stringReader;
            stringReader = new StringReader(xmlString);
            XmlTextReader xmlReader;
            xmlReader = new XmlTextReader(stringReader);
            object obj;
            obj = ser.Deserialize(xmlReader);
            xmlReader.Close();
            stringReader.Close();
            return obj;
        } [/code]

Awesome! It worked without any glitch and the module was ready in flat 16 hours as the team had to put their effort on the business rules and UI only.