adBrite

Your Ad Here

music

BidVertiser

Thursday, November 11, 2010

Rose 1.6 Beta vs Poison Ivy

Rose 1.6 Beta vs Poison Ivy

Tuesday, November 9, 2010

Serialize - BinaryFormatter


private Stream SerializeObject(object myStringToSend)
        {
            // Initialize a storage medium to hold the serialized object
            Stream stream = new MemoryStream();

            // Serialize an object into the storage medium referenced by 'stream' object.
            BinaryFormatter formatter = new BinaryFormatter();

            // Serialize multiple objects into the stream

            formatter.Serialize(stream, myStringToSend);

            // Return a stream with multiple objects
            return stream;
        }
       

Monday, November 8, 2010

What are the advantages and disadvantags of serialization?

The advantages of serialization are:
  • It is easy to use and can be customized.
  • The serialized stream can be encrypted, authenticated and compressed, supporting the needs of secure Java computing.
  • Serialized classes can support coherent versioning and are flexible enough to allow gradual evolution of your application's object schema.
  • Serialization can also be used as a mechanism for exchanging objects between Java and C++ libraries, using third party vendor libraries (like RogueWave's Tools.h++ ) within C++.
  • There are simply too many critical technologies that rely upon serialization, including RMI, JavaBeans and EJB.
However, serialization has some disadvantages too:
  • It should ideally not be used with large-sized objects, as it offers significant overhead. Large objects also significantly increase the memory requirements of your application since the object input/output streams cache live references to all objects written to or read from the stream until the stream is closed or reset. Consequently, the garbage collection of these objects can be inordinately delayed.
  • The Serializable interface does not offer fine-grained control over object access - although you can somewhat circumvent this issue by implementing the complex Externalizable interface, instead.
  • Since serialization does not offer any transaction control mechanisms per se, it is not suitable for use within applications needing concurrent access without making use of additional APIs. 
  •  

Serialization

Serialization is the process of converting an object into a stream of bytes in order to persist it to memory, a database, or a file. Its main purpose is to save the state of an object in order to be able to recreate it when needed. The reverse process is called deserialization.


How Serialization Works

This illustration shows the overall process of serialization.
Serialization
 Graphic
The object is serialized to a stream, which carries not just the data, but information about the object's type, such as its version, culture, and assembly name. From that stream, it can be stored in a database, a file, or memory.

Uses for Serialization

Serialization allows the developer to save the state of an object and recreate it as needed, providing storage of objects as well as data exchange. Through serialization, a developer can perform actions like sending the object to a remote application by means of a Web Service, passing an object from one domain to another, passing an object through a firewall as an XML string, or maintaining security or user-specific information across applications.

Making an Object Serializable

To serialize an object, you need the object to be serialized, a stream to contain the serialized object, and a Formatter. System.Runtime.Serialization contains the classes necessary for serializing and deserializing objects.
Apply the SerializableAttribute attribute to a type to indicate that instances of this type can be serialized. A SerializationException exception is thrown if you attempt to serialize but the type does not have the SerializableAttribute attribute.
If you do not want a field within your class to be serializable, apply the NonSerializedAttribute attribute. If a field of a serializable type contains a pointer, a handle, or some other data structure that is specific to a particular environment, and the field cannot be meaningfully reconstituted in a different environment, then you may want to make it nonserializable.
If a serialized class contains references to objects of other classes that are marked SerializableAttribute, those objects will also be serialized.
Binary and XML Serialization

Either binary or XML serialization can be used. In binary serialization, all members, even those that are read-only, are serialized, and performance is enhanced. XML serialization provides more readable code, as well as greater flexibility of object sharing and usage for interoperability purposes.

Binary Serialization

Binary serialization uses binary encoding to produce compact serialization for uses such as storage or socket-based network streams.

XML Serialization

XML serialization serializes the public fields and properties of an object, or the parameters and return values of methods, into an XML stream that conforms to a specific XML Schema definition language (XSD) document. XML serialization results in strongly typed classes with public properties and fields that are converted to XML. System.Xml.Serialization contains the classes necessary for serializing and deserializing XML.
You can apply attributes to classes and class members in order to control the way the XmlSerializer serializes or deserializes an instance of the class.

SOAP Serialization

XML serialization can also be used to serialize objects into XML streams that conform to the SOAP specification. SOAP is a protocol based on XML, designed specifically to transport procedure calls using XML. As with regular XML serialization, attributes can be used to control the literal-style SOAP messages generated by an XML Web service.

Tuesday, November 2, 2010

[C#] TcpListenser

[C#] 
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Text;
 
class MyTcpListener
{
  public static void Main()
  {    
    try
    {
      // Set the TcpListener on port 13000.
      Int32 port = 13000;
      IPAddress localAddr = IPAddress.Parse("127.0.0.1");
      
      // TcpListener server = new TcpListener(port);
      TcpListener server = new TcpListener(localAddr, port);
 
      // Start listening for client requests.
      server.Start();
         
      // Buffer for reading data
      Byte[] bytes = new Byte[256];
      String data = null;
 
      // Enter the listening loop.
      while(true) 
      {
        Console.Write("Waiting for a connection... ");
        
        // Perform a blocking call to accept requests.
        // You could also user server.AcceptSocket() here.
        TcpClient client = server.AcceptTcpClient();            
        Console.WriteLine("Connected!");
 
        data = null;
 
        // Get a stream object for reading and writing
        NetworkStream stream = client.GetStream();
 
        int i;
 
        // Loop to receive all the data sent by the client.
        while((i = stream.Read(bytes, 0, bytes.Length))!=0) 
        {   
          // Translate data bytes to a ASCII string.
          data = System.Text.Encoding.ASCII.GetString(bytes, 0, i);
          Console.WriteLine(String.Format("Received: {0}", data));
       
          // Process the data sent by the client.
          data = data.ToUpper();
 
          byte[] msg = System.Text.Encoding.ASCII.GetBytes(data);
 
          // Send back a response.
          stream.Write(msg, 0, msg.Length);
          Console.WriteLine(String.Format("Sent: {0}", data));            
        }
         
        // Shutdown and end connection
        client.Close();
      }
    }
    catch(SocketException e)
    {
      Console.WriteLine("SocketException: {0}", e);
    }
      
    Console.WriteLine("\nHit enter to continue...");
    Console.Read();
  }   
}

Sunday, October 31, 2010

.........,,,,,,,,.....,...............,~:..,:::+++?????????,,,::,,:,,,,,,,,,,,,,
..,,,.,,,,,,,,,,......................,~...,~,::==+++++?III?,:~~,::,,,:::::,,,::
...,,,,,,,,,,,:,....,................,:,,,:,:~,,:=+=+++?III7,~::,,:,,,,,,,,,,,,,
.............,,,...,................,:~~.~=~=+~:,.,===??II77?~,,,.....,..,,,,,,,
............:,,...,..................:+=:~=+~:=~,,...,~??II77::,,.,...,...,..,,.
............:,..............,,......,~??+:++,~::~~:,..,:=+I77.,,,.,,,,,.........
...........,.,..............:,:::....~???=~.:,~,,:~:,,:,::.+7::,,.,,,,,...,...,.
..........,................:~~:::...,==?I?=........,,::=,,,.:,,,,,,,,,,..,,.,,,.
.............,.............:,,~:=,..,++++?+,,:,,,..,,+=7.,,~I..,,.,,,,,,.,,.,.,.
....,.,...................,:=:,+=~..~=+=++??=,=~:::~+?~I,..:=:,.,,,,,,,.,,,.,,,.
......,,..................~~~====~:..:+?+~+++=,~===+????:,..,:::..,,,,,..,,.,,,.
.......,...................:++++=+==.,,+++~=++=,===+????I:,,,.,.,...,,,,,,,,,,,,
...,.........................~====++?,.:==+=~=+=:~=+?I++=7?I~,:,,,,,,,,,,,,,,,,,
..............................,,.~=+??~..,+==~~=~:=~:..~,+?I=:,,,,,,.,,,,,,,,,,,
..............................,,,:=????+...:~~:~==~,:=,.~+I?:::,,,,,,,,,.,,,,,,,
..............................,,::=++???+~.,..::==++:?~I++++,,,,,,,,,,,,,,,.,,,,
.......,,....................,,:~:~=+++++++:,,..,,:,,,,~===~:::,.,,.,,,,,,,,,,.,
......,,.....................,::~~::~=+++++==:,..,.....,+=+:,:,,.,,,,,,,,,,.,,,,
.....,,......................,~:~~~~:~~=======~:,....~:,:+,~:,,,.........,......
.....,,.......................:~:~~~~:::~~~====~::,,...,=,.,,::,.,,......,......
.......,......................,~~:~~~:::::::~==~=~::?===....,,,,,..,,,...,......
....,,,....,...................:~~~~=~::,,,,:::~~:::+?+..:.,~,....,,,,.......,..
........,......................,~~~~==~:,,,,,,,,,,,:=?.....,,,,,,..,,...,.......
.,.....,,......................,,~~===~:,,,,,,............,,,~:,...,..,,........
,....,,.....................,...,,~==~::,,,,.......,........,~,:..,,,,,..,,,,,..
....,.........,............,,,...,,~~~::,,,,,,......,.......::~,..,,,,,.,...,,..
...,....,,....,...........:::,:....,~~::,:::,,,.............,::,......,...,.....
.........,...,,..........,~~==,~...,,:::::~::,,...............:,,~,,,,,,,,......
..............,..........:=+?++~,:...,,:~~=~::,.,.............,,.,...,..,,...,..
..............,..........=??I??++~:,...,~~~~::,,,,.............,,,,.,,,,,,..,,,,
..............,.......,~:+?II???+==:,,....,~::,,::..............,,.,,,,,,.,,,,,.
..............,,...::,~=,=?II???++=~::::,,,....,::...............:~:,.,,,,,.,,,,
.............,,~=~::,~==:=+II????+=~~=+++=:,:~~:.....,............:~,:=~,,,,,,,,
..........,.=~=~=++~:~=~,=?IIIIII+==+????????++==:,..................~~~=+,.,,..
.....,..====??????+??::~:+?IIIIII?+??IIIIIII?I???~~:~,,...,........,::,:~==.,,..
,,,,,~++???????:??~~~~~~+?IIIIIIII?IIIIII?IIIIII?~:::,,,..,,......,.,::,:~~+,,..
,.=++????????+?+=~~~~~=~=??IIIIIIIIIIIIII???IIIII=:~::,,,,~~~,......,,,:,:=+,,.,
?????+++????++=+=:~~=~=~~????IIIIIIIIIII?I?IIIIII+~~~:,,,,==~~........,:,:~+,,,,
???+=+==+???++~++~~~~~~==???IIIIIIIIIIIIIIIIIIIII+~~~::,,,=:=~:.......,:,:~=,...
++++~~==+++++?==~~~~~=~~=??IIIIIIIIIIIIIIIIIIIIII+=~~~::,,==~+=:......,:,::++,,,
++===:==++++++~+::~~==~~+?IIIIIIIIIIIIIIIIIIIIIII+=~~:::,,==~:=~,......,,:~~I:,:
++=~=~~=+?+=++~=::~~=~~~+???IIIII????IIIIIIIIIIII+=~::::::~==~:=~,......:~~~?::,
++==~=:~=+==+=~=:~~~~~~~+?????????????IIIIIIIIIII+~:~::~~:~=~::~~:.......,,~+~::
++===~~~====+=~~:~~~~~~~=????I???????IIIIIIIIIIII+~:::::::=~~::~~:,.......,,:?::
++==~~~:~~~~=~~~:~~~~~~~+???I???????IIIIIIIIIIIII+~:::,,::=~~:::~:,........~~~,:
++====~~~~~~=~::::~::~:~+??III???????IIIIIIIIIIII+~::::,::~~~:,:~:,,.......,~:,,
++=====~:~~:~~:~~~~:~~~~+??I?+++??????IIIIII+?III+~::::,,,:::,.~~~:::.......,~~,
=++====~~:~::::~~~~~~~~~+??I??+++~????IIII?+?IIII+~:::,,,,::,..:~~::::.......~:,
~+++++=~~::::::,:::::~:~??I?+++==~????III+++++?II=::::,,,,,,...:~~::::,......,I~
:=++++=~~:~:,,,,::::::::??III+==~++????I=+=+?+II?=:,::,,,,,,...:~:::~:,........:
:~++++==~~::,,,,:::::~:~?I?+?+=?==~++??I~=?+IIII+~:::,,,,,,,...,~:::::,,,......,
::++++==~~::,,.,:,,,~~:~?II??=====+++++++==+???++~:,,,,,,,,,...,~::::,,:........
:~=+++===~~::.,,,:,~:::~?II??+==+=+=++??++=+?III=~:,,,,,,,,,...,::,::,:,,:......
:~:+++===~:~:,..,,:::::~??I??=+=+~:=++++~+=++III=~,,,,,,..,,...:~:,::,:,:::.....
:~~=++=~=~~::,,.,,~::~::+?????+~~~:=??++~~=??+??=~,,,.....,,...:~,::::::::~,....
,:~~++==~=~~::,..,,,~==~=????+++~::~??~~~=+++???~~:.......,,..,~:,:,:::,:::~,...
,:~~++==~~=~:::,.,,,:~~~:++++++~~~=+??+==~~+++++~:,..........,,~,,:,:,,:::~~~...
,:~~:=+=~~=~::,,,....::::======~~~=++++=~~~:====::,..........,:,,,::::,~:::~~~,.
,,:~~:==:~=~~,::,......,::~~~~:~~~=+++++=~~,:~~~::...........,:,,,::::,::::~~~~:
,,:~~:~==~~=~::::,......:::~::::~=====++=~::::::::...........:,,,,:::,,~:~:~+=~=
,,,:~:~~==~~~~:,:,,.....,,::::::~======++=~::,,,,,..........,:,,,,:::,::~~~~~~~=
,,,::~~:~==~:~:,,,,.....,,,,,::~=======++++=:,,,,,..........,,,,,::::,:~~~~=====
,,:,:~:~:===~:~:,,,,.....,.,,:~~======++++++==~:,,.........,:,,,,,::,,~~~~~~~==+
,,,,:::~~~===:,:,,,,.....,.,:~~==+====++++++++=~:,.........,,,,,,,::,:~=~~:=~===
,,,,,:::~~~===:,:,,,,,...,,::~==+++==+++++++++==,,........,:,,,,,:::,:==~~~===++
,,,,,,::~~:~==~:,,,,,,....,:~~==+++++++++++++===,,........,,,,,,,::,,~==~=~====+

Multi MSN Messenger

Log on to as many Msn Messenger Accounts as you want. Use this Multimsn Messenger to enjoy MSN polygamy. This small multi msn Add-on is very helpful Software which enables you multiple sign ups. We also have Multi MSN patch for Latest Windows Live MSN Messenger Beta versions. Enjoy multi msn 9 beta. Download Multi MSN 9.0 and enjoy Multiple Live for Windows Live Messengers
Here we have different version of Multi MSN messenger you can download your required version and patch your msn. This patch not only gives help to login multiple accounts at a time but also serves ad msn ads remover and removes all the unwanted advertisement banners from windows live msn messenger. 

Download >>> Download <<<


clicksor

Go Daddy Girl Ella Koon- $7.49 .COM Domains
CompUSA