Wednesday, June 8, 2011

Serialization in .Net

Many times we are faced with the situation where we need to save records in different tables and these are inter-linked and having a relationship. Now the problem is how to send these records from application to database and then save them maintaining their relationships intact. Further all this should be fail proof so that if any error is encountered in the whole operation then all is rolled back. In this post I am going to discuss about how to handle this situation by an example. The key points that I am going to touch is Serialization and XML.

For example we have a application where we are registering a student. For this we are saving the basic information of the student, the subjects that he has chosen. Thus the outline of the student registration data would be as follows:

Student
   --BasicInfo
         --RollNo
         --Name
         --Age
         --Address
         --Class
         --Gender


   --Subject
         --SubjectId
         --SubjectName

Now the number of records in Subject for a student can be more then one i.e. for a single BasicInfo record of a student there can be multiple Subject records i.e. a one to many relationship. The entity for Student will be as follows:


public class Student
{
    public int RollNo { get; set; }
    public string Name { get; set; }
    public int Age { get; set; }
    public string Address { get; set; }
    public int Class { get; set; }
    public bool Gender { get; set; }

    public List<Subjects> ListSubject { get; set; }

}

public class Subjects
{
    public Subjects(int subjectId, string subjectName)
    {
        SubjectId = subjectId;
        SubjectName = subjectName;
    }

    public int SubjectId { get; set; }
    public string SubjectName { get; set; }   
}


Here to maintain the relationships of one to many I have used List collection for subjects. This collection would contain all the subjects that the student chooses. We fill the entity as follows:





Student obj = new Student();
obj.Name = "Jai";
obj.RollNo = 100;
obj.Age = 27;
obj.Class = 10;
obj.Gender = true;
obj.Address = "New Delhi, India";

obj.ListSubject = new List<Subjects>();
       
obj.ListSubject.Add(new Subjects(1, "English"));
obj.ListSubject.Add(new Subjects(2, "Maths"));
obj.ListSubject.Add(new Subjects(3, "Physics"));
obj.ListSubject.Add(new Subjects(4, "Computers"));

Now to convert this into XML we would serialize the Student object. The code for it is as follows:


StringBuilder builder = new StringBuilder();
System.Xml.Serialization.XmlSerializer x =
new System.Xml.Serialization.XmlSerializer(obj.GetType());

using (StringWriter writer = new StringWriter(builder))
{
x.Serialize(writer, obj);
}

string myXml = builder.ToString();

The XML generated for it is as follows:


Thus we have generated the XML of the Student entity class using serialization and we have also maintained the one to many relationship between the StudentInfo and Subjects. In the next post I will discuss how to use this consume this XML in sql server and save the data in the tables.

Monday, April 18, 2011

HCL - Ozone HRMS - Cloud Computing in Action

In my earlier posts I had discussed about the various Cloud computing applications put forward by various vendors like Google and Amazon. In this post I am going to discuss a new initiative that has been launched by HCL in the Cloud Computing domain. It is the HCL Ozone HRMS (Human Resource Management System). It is a SaaS and is a complete package suiting needs of HR management for any organization of any size.

The HCL O’zone HRMS offering is a comprehensive 360 degree HR management suite that includes several modules to help manage important organizational needs such as payroll management, appraisals, HR information and other essentials – a total of 18 comprehensive modules integrated into one system.

It has more than 18 different modules that fit into the HR operations for any organization:


HCL O’zone brings to you comprehensive human resource management solutions, implemented for your whole organization and available anytime, anywhere on the cloud. With the growth of services, human resource management has become a primary concern for almost every organization, be it an SME or a large enterprise. Easy access to information, clear policies and guidelines and efficient systems are just some of the things every employee expects these days.

To know more visit the official site of HCL Ozone.

Intel - Sandy Bridge -Changing the future

In coming months of 2011, Intel is going to launch a new series of processors that are going to spice up the computing world.

Intel has in the past month unveiled “the next evolution of the PC” featuring Sandy Bridge, its highly anticipated microprocessor. The processor takes advantage of the latest graphic technology and 32 nanometer silicon technology. In fact, Sandy Bridge is the first 32 nanometer based graphics engine in the industry.

Sandy Bridge is also the first microprocessor that integrates HD processor graphics, a shared L3 cache that is both part of the graphics card and the low power, high performance core side. It features 1.16 billion transistors on one chip. Which is impressive, considering the human brain has anywhere between 20-25 billion “transistors,” or synapses (artificial brains here we come!). Sandy Bridge’s advanced architecture gives users the ability to transcode (moving video from one format to another seamlessly) in record breaking time. For example, the processor can convert an HD formatted video into an iPad or iPhone format in under 16 seconds. The new processor also allows users to edit and watch 3D Blu-ray videos, and then send them wirelessly from a laptop to a large-screen digital TV.

Sandy Bridge is Intel’s best integration with Microsoft to date. As per estimates it will represent over 1/3 of Intel’s corporation’s revenue and a total of $125 billion dollars of revenue for the PC Industry. Watch the following video for more :


Sandy Bridge is a 32nm CPU with an on-die GPU. While Clarkdale/Arrandale have a 45nm GPU on package, Sandy Bridge moves the GPU transistors on die. Not only is the GPU on die but it shares the L3 cache of the CPU.

There are two different GPU configurations, referred to internally as 1 core or 2 cores. A single GPU core in this case refers to 6 EUs, Intel’s graphics processor equivalent (NVIDIA would call them CUDA cores). Sandy Bridge will be offered in configurations with 6 or 12 EUs.

While the numbers may not sound like much, the Sandy Bridge GPU is significantly redesigned compared to what’s out currently. Intel already announced a ~2x performance improvement compared to Clarkdale/Arrandale, and I can say that after testing Sandy Bridge Intel has been able to achieve at least that.

Both the CPU and GPU on SB will be able to turbo independently of one another. If you’re playing a game that uses more GPU than CPU, the CPU may run at stock speed (or lower) and the GPU can use the additional thermal headroom to clock up. The same applies in reverse if you’re running something computationally intensive.

On the CPU side little is known about the execution pipeline. Sandy Bridge enables support for AVX instructions, just like Bulldozer. The CPU will also have dedicated hardware video transcoding hardware to fend off advances by GPUs in the transcoding space.

LinkWithin

Related Posts with Thumbnails