Monday, 10 September 2012

Software Freedom Day


   
  Software Freedom Day (SFD) is an annual worldwide celebration of Free Software. SFD is a public education effort with the aim of increasing awareness of Free Software and its virtues, and encouraging its use.

     Software Freedom Day was established in 2004 and was first observed on 28 August of that year. About 12 teams participated in the first Software Freedom Day. Since that time it has grown in popularity and while organisers anticipated more than 1,000 teams in 2010 the event has stalled at around 400+ locations over the past two years, representing a 30% decrease over 2009.

     Since 2006 Software Freedom Day has been held on the third Saturday of September, it has occasionally coincided with International Talk Like a Pirate Day.

Software Freedom International

"Software Freedom International" (SFI) is a non-profit organisation that acts as the official organiser of Software Freedom Day, and is the legal body that handles donations, sponsorship contracts, and accounting. SFI has successfully obtain a tax-exempt status in the USA where it is registered, in order to make donations tax-deductible. The name Software Freedom International was chosen to distinguish the organisational body from the event of Software Freedom Day itself.
 

Sunday, 22 May 2011

Cryptography algorithm in C#.Net

  Substitution cypher:


using System;
using System.Text;
using System.IO;
using System.Net.Sockets;
class encriptclient
{
  public static void Main(string[] args)
 {
  string s1;
  string s2="";
  char[] c=new char[10];
  int a,b;
  string server=args[0];
  int port=Int32.Parse(args[1]);
  TcpClient client=null;
  NetworkStream netStream=null;

  try
 {
  client=new TcpClient(server,port);
  Console.WriteLine("Connected to server");
  netStream=client.GetStream();
  }
  catch(Exception e)
 {
  Console.WriteLine(e.Message);
  }

 for( ; ;)
 {
  Console.WriteLine("Enter the string");
  s1=Console.ReadLine();
  c=s1.ToCharArray();
  for(int i=0;i<s1.Length;i++)
  {
  a=(int)c[i];
  b=(a+2);
  if(b>122)
  b=b-26;
  c[i]=(char)(b);
  }
  for(int i=0;i<s1.Length;i++)
  s2=s2+c[i];
  Console.WriteLine("The encripted string is:{0}",s2);
  byte[] buffer=Encoding.ASCII.GetBytes(s2);
  netStream.Write(buffer,0,buffer.Length);
  byte[] buf=new byte[32];
  netStream.Read(buf,0,buf.Length);
  Console.WriteLine("The decripted string is:          {0}",Encoding.ASCII.GetString(buf,0,buf.Length));
 }
 netStream.Close();
 client.Close();
 }
}


Server side Decryption:

 using System;

 using System.Text;

 using System.Net;

 using System.Net.Sockets;

 class decriptserver

 {

   private const int size=32;

   public static void Main(string[] args)
  {
   char[] c=new char[10];
   int a,b;
   int port=Int32.Parse(args[0]);
   TcpListener listener=null;
   try
   {
    listener=new TcpListener(IPAddress.Any,port);
     listener.Start();
   }
   catch(Exception e)
  {
   Console.WriteLine(e.Message);
   }
  for(;;)
  {
  TcpClient client=null;
  NetworkStream netstream=null;
  client=listener.AcceptTcpClient();
  netstream=client.GetStream();
  Console.WriteLine("handling client");
byte[] buffer=new byte[size];
  netstream.Read(buffer,0,buffer.Length);
  Console.WriteLine("The string is{0}:",Encoding.ASCII.GetString(buffer,0,buffer.Length));
  string s1=Encoding.ASCII.GetString(buffer,0,buffer.Length);
  Console.WriteLine("the string is:{0}",s1);
  c=s1.ToCharArray();
 for(int i=0;c[i]!='\0';i++)
 {
 a=(int)c[i];
 b=(a-2);
 if(b<97)
 b=b+26;
 c[i]=(char)b;
 }
 string s2="";
 for(int i=0;i<s1.Length;i++)
 s2=s2+c[i];
 Console.WriteLine("The original text is:{0}",s2);
 byte[] buf=Encoding.ASCII.GetBytes(s2);
  netstream.Write(buf,0,buf.Length);
  netstream.Close();
  client.Close();
  }
 }



Monday, 9 May 2011

Introduction to C#


Define C# ?

    C# (pronounced as 'C sharp') is programming Language developed by Microsoft Corporation. It is a fully object oriented language like java and is the first component -oriented language. It is mainly used for NET Framework. It is a purely object oriented language suitable for developing Web-based applications.

What is new in C#?

  C# is mainly used for developing system for the .NET platform.
NET Framework provides some services such as   

  •    .NET infrastructure tools   
  •   .NET user experience
  •    .NET building block
  •    .NET device software

Orgins of .NET Technology:

    The .Net has developed through three important phases of development

  •         OLE  technology
  •         COM technology
  •         NET technology
  
OLE Technology
    
     OLE(Object Linking and Embedding) technology was developed by Microsoft .
It provides interprocess communications.

  •               To embed documents from one application into another application             
  •               To  enable one application to manipulate objects located in another application.
e.g)   C#.NET windows program store the data into MSAccess or SQL.

COM Technology
 
   COM(Component Object Model) is componentware .It is inter-module communication.


  •         Reduces the overall complexity of software.  
  •         Enables distributed development across multiple organizations or departments.
.NET Technology

 .NET is network technology provides Intermediate Language to web applications .It is intersite communication.

What is difference between Methods and Functions?

   Functions is defined  as outside of the class .  e.g.) main() in C++,whereas methods are declared inside of the class .e.g) Main()  in C#.

What is difference between  Constructors and Methods?
 
   Constructor is special member function .Constructor name same as class name, where as methods are not same as class name. whenever an object is created the constructor is automatically invoked.

e.g) class  sample 
     {
        Sample()   //constructor
        {
        //constructor without parameter
         }
       Sam()   //method
      {
        //method without parameter
       }
 }










   

Sunday, 24 April 2011

Network Program in C#.Net

Client - Server Communication

  The term client and server refer to these roles.The client program initiates communication,while the server program waits passively for and  then responds to client that contact it.
 How does a client find out a server's IP Address and port number?.Let us see 

 IP Address:
        An Internet Protocol address (IP address) is a numerical label assigned to each device (e.g., computer, printer) participating in a computer network that uses the Internet Protocol for communication.

Port Number:
    A port number is a way to identify a specific process to which an Internet or other network message is to be forwarded when it arrives at a server.

Protocol:
   A protocol is an agreement about the packets exchanged by communicating programs .Standard set of rules to be followed to transfer the packets such as TCP/IP, UDP,SMTP,FTP etc..

Socket:
   A socket is an abstraction through which an application may send and receive data in much the same way as an open file allows an application to read and write data to stable storage.

Client Program:

// Two Way Communication Using TCP/IP

 using System;
 using System.Text;
 using System.IO; 
 using System.Net.Sockets;
 class twoclient
 {
 public static void Main(string[] args)
 {
 string server=args[0];
 int port=Int32.Parse(args[1]);
 string s1;
 TcpClient client=null;
 NetworkStream netstream=null;
 try
 {
 client=new TcpClient(server,port);
 Console.WriteLine("Connected to server:");
 netstream=client.GetStream();
}
catch(Exception e)
{
Console.WriteLine(e.Message);
}
for(;;)
{
 Console.WriteLine("Enter the string:");  // Send the message
 s1=Console.ReadLine();
 byte[] buffer=Encoding.ASCII.GetBytes(s1);
netstream.Write(buffer,0,buffer.Length);
if(s1=="bye")
goto x;
byte[] buf=new byte[32];     //Receive the message
netstream.Read(buf,0,buf.Length);
Console.WriteLine("received {0}",Encoding.ASCII.GetString(buf,0,buf.Length));
string s2=Encoding.ASCII.GetString(buf,0,buf.Length);
}
x:
netstream.Close();
client.Close();
}
}

Server Program:

 using System;
 using System.Text;
 using System.Net;
 using System.Net.Sockets;
 class twoserver
 {
 private const int size=32;
 public static void Main(string[] args)
 {
 string s1,s2;
  int port= (args.Length ==1)?Int32.Parse(args[0]):7;
  TcpListener listener=null;
  try
  {
  listener=new TcpListener(IPAddress.Any,port);
  listener.Start();
  }
  catch(Exception e)
  {
  Console.WriteLine(e.Message);
  }
  for(;;)
  {
  TcpClient client=null;
  NetworkStream netstream=null;
  client=listener.AcceptTcpClient();
  netstream=client.GetStream();
  Console.WriteLine("handling client");
  for(;;)
  {
  byte[] buffer=new byte[size];
  netstream.Read(buffer,0,buffer.Length);
  Console.WriteLine("echoed string {0}:",Encoding.ASCII.GetString(buffer,0,buffer.Length));
  s2= Encoding.ASCII.GetString(buffer,0,buffer.Length);
  Console.WriteLine(s2);
  Console.WriteLine("Enter the string:");
  s1=Console.ReadLine();
  byte[] buf=Encoding.ASCII.GetBytes(s1);
  netstream.Write(buf,0,buf.Length);
  if(s2== "bye")
  break;
}
  netstream.Close();
  client.Close();
 }
 }
 }

//One Way Communication Using UDP

Client program:

using System;
using System.Text;
using System.Net;
using System.Net.Sockets;
class udpclient
{
public static void Main(string[] args)
{
string s1;
string server=args[0];
int port=Int32.Parse(args[1]);
for(;;){
Console.WriteLine("Message");
s1=Console.ReadLine();
byte[] buffer=Encoding.ASCII.GetBytes(s1);
UdpClient client=new UdpClient();
client.Send(buffer,buffer.Length,server,port);
IPEndPoint remote = new IPEndPoint(IPAddress.Any,0);
byte[] buf=client.Receive(ref remote);
Console.WriteLine("reply:{0}",Encoding.ASCII.GetString(buf,0,buf.Length));
client.Close();
}
}
}

Server Program:

using System;
using System.Net;
using System.Text;
using System.Net.Sockets;
class udpserver
{
public static void Main(string[] args)
{
string s1;
int port=Int32.Parse(args[0]);
UdpClient client=null;
try
{
client=new UdpClient(port);
}
catch(Exception e)
{
Console.WriteLine(e.Message);
}
IPEndPoint remote=new IPEndPoint(IPAddress.Any,0);
for(;;)
{
byte[] buffer=client.Receive(ref remote);
Console.WriteLine("reply:{0}",Encoding.ASCII.GetString(buffer,0,buffer.Length));
Console.WriteLine("message:");
s1=Console.ReadLine();
byte[] buf=Encoding.ASCII.GetBytes(s1);
client.Send(buf,buf.Length,remote);
}
}
}

  These  are the way to transform the packets client to server and server to client using protocol such as TCP/IP or UDP.



Saturday, 2 April 2011

Data Communication and Network

Network
      A computer network is an interconnection of various computer systems located at the same/different places.The interconnection is done through a communication link also known as the physical layer of the network and this link is such that it is totally transparent to the users of the network.


Network Architecture
     In  Communications, data is transferred either in parallel or serial.    
               *   Parallel Communication is faster but requires more wires
               *   Serial  Communication. is much slower but requires fewer wires.
                      

 Network Topology
     LAN - Networks used to interconnect computers in a  single room,rooms within building or buildings are normally called  Local Area Networks.



    Ethernet:
                 Ethernet is a very popular and widely accepted method for linking local stations to one another(LAN),for sharing data,program and equipment resources.



    WAN - Wide Area Network is used to describe a computer network spanning a global area.In WAN wide range is covered using LHN (Long Haul Networks) connect computer on separate sites,separate countries.There are three common approaches to networking such as

     Circuit Switching      -    Dial up Links are used. 



     Message Switching  -    Switching the complete circuit does not have to be established when the message is transmitted.


     Packet Switching      -    Packet Switching is similar to message switching except the packets are of fixed size . 


     MAN  - Metropolitan and wide area network have wider  geographical reaches than Local Area Networks.





Data Base Management

  

    
Data:
        Fact,raw or isolated facts from which the required information is processed.


Data Warehouse:
      Collection of data organised to support management.

Information:


        Processed,Organised  and Summarized data defined collection of related data which communicate meaningful and useful message.


Database System:


           Data Base system is collection of inter related data and set of program that allow uses to access an modify these data.




Data Mining:
          Data Mining is used to "extracting the knowledge" from the database.



Distributed Database:
        Distributed database system consists of multiple and independent databases that operate on two or more computers that are connected and share data over a network.



Database Manager:
       Data Base  Manager is a program module which provides the interface between the low-level data stored in the database .


Database Administrator:
      The person who has central control over the system is called as database Administrator.


Keys: 
       Keys allows us to indentify a set of attribute and thus distinguishes entities from each other.
     
Structured Query Language:
      SQL is non-procedural language.It is used to communicate with relational database management systems.


SQL Commands:


     DDL-Data Definition Language is used to creating the table,add the new fields,modify the data type or increasing the value size ,create new table from existing table and delete the table.
        create table ,
        alter table......add,
        alter table ...modify,
        create table  ...as select,
        drop table,
        Truncate,
        Rename.

    DML -Data Manipulation Language is used to insert new rows,update the existing rows and remove unwanted rows.
       Insert,
       Delete
       Update.


   DQL- Data Query Language is used to retrieve data from the database.
       Select- select the database


  DCL-Data Control Language   gives and removes rights to database objects.
       Grant
       Revoke


 These are basic commands set used in database management.