Diluksha's profileDiluksha's spacePhotosBlogListsMore Tools Help

Diluksha's space

Peep into my WORLD !!!

Diluksha

Occupation
I am professionally a Software Engineer, working at Virtusa. I have a special honor in BSc. IT and interested in C#, .Net, Java, AI Technologies. My hobbies are collecting and watching movies!

Visitors Locations

Feed

The owner hasn't specified a feed for this module yet.
Thanks for visiting!
Please wait...
Sorry, the comment you entered is too long. Please shorten it.
You didn't enter anything. Please try again.
Sorry, we can't add your comment right now. Please try again later.
To add a comment, you need permission from your parent. Ask for permission
Your parent has turned off comments.
Sorry, we can't delete your comment right now. Please try again later.
You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
Complete the security check below to finish leaving your comment.
The characters you type in the security check must match the characters in the picture or audio.
October 09

XML Serialization with .Net

 

What is XML Serialization?

Serialization is the process of converting an object into a form that can be readily transported. For example, you can serialize an object and transport it over the Internet using HTTP between a client and a server. On the other end, deserialization reconstructs the object from the stream.

And also serialization of XML to common language runtime objects enables one to convert XML documents into a form where they are easier to process using conventional programming languages.

Sample with C# .Net

1. Create a console application

2. Add new XML schema to the project

clip_image002

3. Add new Complex type and an Element type to the schema.

clip_image004

4. Run following command in Visual Studio Command Prompt to convert created XML schema to the C# class.

>xsd.exe /c Person.xsd

This will create a C# file named “Person.cs” inside the solution folder. Add the created C# file into the solution.

5. xsd.exe is a utility to generate schema or class files from given source. It is included with the .NET Framework. There are three main uses for xsd.exe.

· xsd.exe <schema>.xsd which will create source code for the appropriate class to de-serialize your object.

· xsd.exe <assembly>.dll|.exe is used to read the code and generate a schema (.xsd) file for you.

· xsd.exe <instance>.xml|.xdr which will try to infer an .xsd file which you can then use to create an appropriate class

6. Code sample to do a serialization

using System;
using System.Collections.Generic;
using System.Text;

using System.Xml.Serialization;
using System.IO;

namespace SerializationSample
{
    class Program
    {
        static void Main(string[] args)
        {
            //Serializing..
            Person person = new Person();
            person.id = 100;
            person.name = "Diluksha Geeganage";
            person.address = "Sri Lanka";
            person.age = 27;

            XmlSerializer xmlS = new XmlSerializer(typeof(Person));
            FileStream file = new FileStream(@"Persons.xml", FileMode.Create, FileAccess.Write);
            xmlS.Serialize(file, person);

            Console.WriteLine("Serializing Completed");
            Console.Read();

            file.Close();
        }
    }
}

7. Code sample to do a deserialization

using System;
using System.Collections.Generic;
using System.Text;

using System.Xml.Serialization;
using System.IO;

namespace SerializationSample
{
    class Program
    {
        static void Main(string[] args)
        {
            //Deserializing..
            Person objPerson;

            XmlSerializer xmlD = new XmlSerializer(typeof(Person));
            FileStream fileD = new FileStream(@"Persons.xml", FileMode.Open, FileAccess.Read);

            objPerson = (Person)xmlD.Deserialize(fileD);
            Console.WriteLine("ID {0} Name {1} Address {2} Age {3}", objPerson.id, objPerson.name, objPerson.address, objPerson.age);
            Console.Read();

            fileD.Close();
        }
    }
}

 

 

October 06

Anonymous proxy server


Anonymous proxy server is a routing communications between your computer and the Internet that can hide or mask your unique address to prevent unauthorized access to your computer over the Internet. An address is your computer's digital ID while you are online. By masking this, it helps prevent other web sites that can gain access and gather personal information about you through your unique address. Any anonymous proxy server can hide your online ID by using its own address in place of yours in every outgoing request. It helps protect your privacy while you are online.

You can use these proxy severs to gain access to unblock sites, as well as any other site.

They are three basic approaches for anonymous surfing through the Net:

  • Web

Web proxy work through the Web (i.e. cgi proxy or php proxy). You just need to visit server and surf through Web based proxy. Your IP address is anonymous and invisible to any site that you visit because you surf through web proxy that is located on certain server. Web proxies act as anonymous proxy server. You don't need to install or configure anything.

  • Direct

Direct require the surfer to modify settings in the browser so that the browser specifically accesses the proxy server providing the anonymous services. Some of these proxies require that the surfer make the changes manually to the browser while others will modify the settings with the expressed permission of the surfer.

  • Client

Client based applications software that must be installed on user PC. They act as a local proxy server on your PC and allow you to surf the Web anonymous protecting your privacy. There are many applications that allow you to surf anonymously i.e. JAP, Tor, GhostSurf, Rutschomat, A4proxy, Multiproxy, ProxyRama etc. Some clients provide their own severs for surfing i.e. JAP, Tor, GhostSurf.

September 13

Chrome going to log your keystrokes.

Chrome is a recently added web browser for IT world. Most of the people are aware of it.

But some of the features that Chrome has are new to us. I have got to know that it has an interesting feature to suggest the keywords and URLs for you. You can enable this feature in chrome as you want.

This feature does more than just help the user about what they searching for, it’s going to store the information typed on the search bar in Google database. That means Google has an access to any keystrokes you types into the browser. Another thing is these data goes to the Google even before user hit on the Enter key.

The problem is what the Google going to do with this information. They said they going to use this information to improve their search and to make web search even better. But how can we guarantee this???

Let’s say you typed your credit card number on Chrome, as a back ground process it will store it in Google. So this will lead to open a gate to your confidential details to out side world. No one will ever like for that.

There is a way to avoid this. Make the auto-suggestions feature off and make sure not to make Chrome as your default browser.

Any way Chrome will be headache for Microsoft Internet Explore and others. So we would like to see it as a secure place for us.


August 23

Be Aware !!!


I guess this message will be helpful for all our P2P downloader’s.

The newest form of the Trojan is to accompany the media file and to play the file it asks to install the decoder. Then it conquers your PC.

http://www.teamits.com/whatsnew/articles/new-trojan-infects-mp3-and-movie-files/


 


What is a Semantic Web ??

The Semantic Web is a Web with a meaning. This is another step of World Wide Web that enables people to share information beyond the boundaries of applications and websites. Semantic Web is a way of describing things understandable by both Computer and Human.


"If HTML and the Web made all the online documents look like one huge book, RDF, schema, and inference languages will make all the data in the world look like one huge database"

Tim Berners-Lee, Weaving the Web, 1999
 

This will make our work easier by giving the right information as needed and will save the time in search. Main concern in this approach is to make it possible for the web to understand and satisfy the requests of people and machines to use the web content.

 
As of now we are accepting whatever the information given for our query in World Wide Web and looking for a suitable answer in it. However, a computer cannot accomplish the same tasks without human direction because web pages are designed to be read by people, not machines. But this will changed with Semantic Web. Web has a capability of understanding and giving the right information for users. The semantic web is a vision of information that is understandable by computers, so that they can perform more of the tedious work involved in finding, sharing and combining information on the web.

 
The Semantic Web describes the relationship between things not about links between web pages.

The difference between World Wide Web and Semantic Web is, currently the World Wide Web is based mainly on documents written in Hypertext Markup Language (HTML) for example Metadata tags,

<meta name="keywords" content="computing, computer studies, computer">
<meta name="description" content="Cheap widgets for sale">
<meta name="author" content="Billy Bob McThreeteeth">

The Semantic Web takes the concept further, it involves publishing the data in a language, Resource Description Framework (RDF), specifically for data, so that it can be categorized as human perception and be "understood" by computers. RDF is a markup language for describing information and resources on the web this will help computer to pick, search information from the web. Intelligent web applications could useful to collect information from many different sources, combine information, and present it to users in a meaningful way.

Semantic vs. non-Semantic Web

Example tags that would be used in Non-semantic web page (Web 1.0 and Web 2.0):

<item>cat</item>

A tag that would be used by Semantic web 'page'(part of Web 3.0):

<item rdf:about="http://dbpedia.org/resource/Cat">Cat</item>


To use the semantic web, we will need "Semantic Web Agents" or "Semantic Web Services". These "Agents" or "Services" will help us to find what we are looking for on the semantic web.