Monday, February 10, 2014

What is Subnet Masking



IP address:
subnet part - high order bits
host part - low order bits
Device identity in network is IP address like our home address and Identity card Number But in real world IPv4 or IPv6 are not enough to address whole device in network here Subnet Masking help to connect whole device with the network and provide unique ip address in networking
what’s a subnet ?
device interfaces with same subnet part of IP address can physically reach each other without intervening router 
recipe

to determine the subnets, detach each interface from its host or router, creating islands of isolated networks each isolated network is called a subnet


Tuesday, February 4, 2014

Make Voice Calculator in c#

To Make it simple our calculation here is the voice calculator  c# code try your self and enjoy


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Speech.Synthesis;
using System.Speech.Recognition;

namespace Add_speak
{
    public partial class Form1 : Form
    {
        SpeechSynthesizer sSyn = new SpeechSynthesizer();
        PromptBuilder pb = new PromptBuilder();
        public Form1()
        {
            InitializeComponent();
        }

        SpeechRecognitionEngine sReg = new SpeechRecognitionEngine();

        private void button1_Click(object sender, EventArgs e)
        {

        }
     

        private void Form1_Load(object sender, EventArgs e)
        {
         
         
            Choices cList = new Choices();
            cList.Add(new string[] { "next","add","1", "2", "3", "4", "5", "6", "7", "8", "9" });
            Grammar gr = new Grammar(new GrammarBuilder(cList));

            try
            {
                sReg.RequestRecognizerUpdate();
                sReg.LoadGrammar(gr);
                sReg.SpeechRecognized +=new EventHandler<SpeechRecognizedEventArgs>(sReg_SpeechRecognized);
                sReg.SetInputToDefaultAudioDevice();
                sReg.RecognizeAsync(RecognizeMode.Multiple);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }

     
        }
        bool ba = false;
        void sReg_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
        {
     
         
            if (e.Result.Text.ToString() == "next")
            {
                this.ActiveControl = textBox2;
                ba = true;
               // textBox2.Text = e.Result.Text.ToString();
            }
         
            else if (e.Result.Text.ToString() == "add")
            {

                int a = Convert.ToInt32(textBox1.Text);
                int b = Convert.ToInt32(textBox2.Text);

                label3.Text = (a + b).ToString();
            }
            else if (ba)
            {
                textBox2.Text += e.Result.Text.ToString();
            }
         

            else
            {
                textBox1.Text += e.Result.Text.ToString();
            }
         
        }

    }
}

Sunday, February 2, 2014

A Simple Server Client Application in Java

A Simple Server Client Application in java using TCP Connection




import java.io.*;
import java.net.*;

public class TCPClient
    {
        public static void main(String[] arg) throws Exception
        {
            String sentence;
            String modifiedSentence;
            BufferedReader inFromUser=new BufferedReader(new InputStreamReader(System.in));
            Socket clientSocket=new Socket("localhost",6789);
            DataOutputStream outToServer=new DataOutputStream(clientSocket.getOutputStream());
            BufferedReader inFromServer=new BufferedReader(new InputStreamReader(clientSocket.getInputStream()) );
            sentence=inFromUser.readLine();
            outToServer.writeBytes(sentence + '\n');
            modifiedSentence=inFromServer.readLine();
            System.out.println("From Server: "+modifiedSentence);
            clientSocket.close();
        }
    }



import java.io.*;
import java.net.*;

class TCPServer
    {
        public static void main(String[] arg) throws Exception
        {
            String clientSentence;
            String capitalizedSentence;
            ServerSocket welcomeSocket=new ServerSocket(6789);
           
            while(true)
            {
                Socket connectionSocket=welcomeSocket.accept();
                BufferedReader inFromClient=new BufferedReader(new InputStreamReader(connectionSocket.getInputStream()) );
                DataOutputStream outToClient=new DataOutputStream(connectionSocket.getOutputStream());
                clientSentence=inFromClient.readLine();
                capitalizedSentence=clientSentence.toUpperCase() +" success "+ '\n';
                outToClient.writeBytes(capitalizedSentence);
            }
        }
    }

Saturday, February 1, 2014

How To Pass value within Android Two Java Pages

When Develop a android application if we want to pass the values and receive the values from another activity



this is the code sent the value to another activivity here i'm sent the value to viewmap 
  

public void onClick(View view)
    {
           // Launching All products Activity
         Intent in = new Intent(getApplicationContext(), ViewMap.class);
        // sending pid to next activity
      in.putExtra("address",strAdd);
        // starting new activity and expecting some response back
       startActivityForResult(in, 100);   
      }



when we receive something from another activity and another main thiunk is both names are want to be same
in.putExtra("address",strAdd) and in.putExtra("address",strAdd);

   Intent i = getIntent();
        // getting product address  from intent
        Bundle extras = getIntent().getExtras();
        if (extras != null) {

            adress=extras.getString("address");
            }

Monday, January 27, 2014

What we Learnd from Industrial Visit

Industrial visit mean spend our few hours in industries during the academic period it will teach so many things to future and can understand industries how to survive in  this competitive world.


Sri Lankan IT industries achieve  remarkable victories in IT field and compete with international industries. IT is the 3rd national income source of Sri Lanka.

in this scenario, I got a chance to visit 5 of IT industries in Sri Lanka IFS, 99X Technology, hSenid Mobile, WSo2, and Virtusa. in my 3rd year academic period. so from this visit, I got a small frame about industries and it's expectation from fresh undergraduates.so I would like share with my followers.

Sri Lankan industries are maintaining Quality in there products so industries expect Quality peoples to work . quality peoples mean they expect some requirements like best results in academic, good communication skills , contribution in university projects , participation in extra curriculum activities like GSoC  and other soft skills.

 From the presentation by industries they mentioned about their requirements, it differs industry to industry some companies expect only the batch top students and they ready to teach technical staff and some companies expect that students want to have some sort of experience in technical staff but not reject the results. another most important aspect is communication skills it's a very important to work in industries . because most customers of industries are from foreign countries , there are so many meetings within industry and industries maintain multicultural within the industry  so employee wants to collaborate with the different background individuals so without communication skill can't survive in the industry. 

 another point is university projects in our university life we never bother about projects but when we face interview it's playing the main role and it's going to show our whole knowledge what we get from our university carrier. so when we select the project we need to satisfy the industrial aspects also and want to do in our own passion .

participation in extra curriculum activities like GSoC is giving the plus point in interview board . there are so many thinks to work on this category like working on open source projects , doing some other individual projects and competitions. maintaining the blogger and LinkedIn also bigger point in the interview board.

Wednesday, December 11, 2013

Display Data as ListView in Android

here we have a string jSon values in in productList arrayList labeled as TAG_PID,TAG_NAME and we are going to display our data as list view
but actually it's View of many activities that activities only have two values here one is TAG_PID,TAG_NAME here so here i'm calling list_item layout for store data one by one
AroundMe.this a name of this class

public void run() {
                    /**
                     * Updating parsed JSON data into ListView
                     * */
                    ListAdapter adapter = new SimpleAdapter(
                            AroundMe.this, productsList,
                            R.layout.list_item, new String[] {
                            TAG_PID,TAG_NAME},
                            new int[] {R.id.pid, R.id.name });
                    // updating listview
                    setListAdapter(adapter);

                }