Friday, January 28, 2011

How to find out the which application is using port 80 in windows ?

How to find out the which application is using the port 80 ?

Every application that needs to talk to other applications,
needs to have a port number. Every computer can give out port numbers
ranging from 0 – 65535, and once a port number is given,
it cannot be given to another application (while it is running at least)
so, one application is to one port number.
The reason why application have port numbers is so that,
when one application (say Firefox) wants to talk to another
application (in another computer, say Apache; a web server),
Firefox needs to know that when he sends out a message,
it will be received by the intended recipient (Apache),
and this can only be done if Firefox knows exactly where
Apache is. There are 2 components that make up a unique address of
an application — one is the IP address of the machine where the
application is running, and the other component is — you guessed it,
the port number; Collectively these two (IP address and port number)
are known as a socket, but that’s another story, let’s stop here —
What’s important to know is that, port numbers are — well, important;
they determine the uniqueness of an application within a

in windows u enter the command

C:\>netstat -aon | findstr 0.0:80

the pipe symbol extracts and get the input from netstat

TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 560

and then

C:\>tasklist | findstr 560

and the culprit is none other than skype :)

Monday, January 3, 2011

Joined in Bhea

today monday i joined..bhea knowledge technologies
staying accomodation in my cousins room. sunday i departured train from chennai central railway station lalbaugh express at 3.45 pm and reached bangalore city 10.00 pm and reached to my cousin room early morning waked up 6.30 a.m and rushed through to office by bike my cousin dropped me into office thanks to him ..i hope all things will go fine ...this new year resolution for everyone hope dreams come true ...i reached office at 8.30 i met ram sir and said wishes to him ..and later i filled all the formalities of our office ...and i later technical person sanjay interviewed me about the latest web technologies and asking what is json? how u implement it and asking the oops concepts ? asking what i mentioned everything in my resume .nice experience to me ..later i met ram sir he told he can take class after lunch . later reshma (h.r) introduced us to everyone in our office..later we went to lunch with our staff members

Thursday, December 30, 2010

Interview with Ram sir in slashprog

/today time at 5.30 interview with Ram sir bhea technologies (M.D) in our office
http://slashprog.com/
slashprog ..its such a nice experience he talking about the various technologies

and office timings and working culture finally they selected me yogesh and satya

also selected. we are decided to move bangalore they called to join and report

on monday ..

Wednesday, December 29, 2010

PHP array functions

today myblog

date 29/12/2010

today i learning array functions in php


array_change_key_case
-----------------------

<?php


$x=array('name'=>'john','age'=>25,'city'=>'mumbai');


print_r(array_change_key_case($x,CASE_UPPER));


?>

the output for the above programme is ---->


Array ( [NAME] => john [AGE] => 25 [CITY] => mumbai )




array_combine
----------------------
 
              this array function will taking this arguments as first array treating as array keys and the second array treated as values
                 so automatically the output will get an associative array


<?php


$a=array('name','age','city');

$b=array('john',25,'chennai');


$c=array_combine($a,$b);

print_r($c);

?>


the output for the above code is
Array ( [name] => john [age] => 25 [city] => chennai )



array_merge
------------


 this function will combine and merge the two arrays

<?php


$x=array('name'=>'john','city'=>'chennai');

$y=array('age'=>25,'class'=>'students');


$z=array_merge($x,$y);


print_r($z);

?>

output for the above code is

Array ( [name] => john [city] => chennai [age] => 25 [class] => students )


array_count_values
--------------------

this function returns the same values how many times appeared in that array

<?php


$x=array('city','chennai','welcome','resource','gandhi','freedom','chennai','welcome','chennai','resource','city');


print_r(array_count_values($x));


?>

output for the above program is

Array ( [city] => 2 [chennai] => 3 [welcome] => 2 [resource] => 2 [gandhi] => 1 [freedom] => 1 )


array_diff_assoc
-------------------

      this array function comparises two arrays and it eliminates the same values in both array and prints the odd values

    <?php


$x=array('chennai','city','welcome','source');

$y=array('chennai','city','welcome');

$z=array_diff_assoc($x,$y);

print_r($z);

?>

output for the above programme is

                    Array ( [3] => source )


array_diff_key
-----------------

                    in this array function it will intersect the both array keys and eliminates them and print the odd keys  first argument array key values



<?php
$array1 = array('blue'  => 1, 'red'  => 2, 'green'  => 3, 'purple' => 4);
$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan'   => 8);

print_r(array_diff_key($array2, $array1));

?>

o/p

                Array ( [yellow] => 7 [cyan] => 8 )


array_fill_key
---------------

                this function will fills the key values to the array keys

                      <?php

                $keys=array('name','school','welcome');
               
                $y=array_fill_keys($keys,'oniorns');

                print_r($y);

                       ?>
output:-
--------------

                       Array ( [name] => onions [school] => onions [welcome] => onions )



array_fill
--------------

               this function fills insert values into the arrays

array_flip
-------------

              this function returns the values as keys and keys as values  funny interesting thing to change  the keys and values

          <?php



$x=array('name'=>'kiran','age'=>25,'city'=>'chennai');


$y=array_flip($x);

print_r($y);

?>

output:--
------------

           Array ( [kiran] => name [25] => age [chennai] => city )



array_intersect_assoc
----------------------

              this function intersects both the arrays and it will print the common elements in both the arrays

              <?php


         $x=array('x'=>45,'y'=>25,'z'=>65);

         $y=array('x'=>42,'z'=>65);

         $z=array_intersect_assoc($x,$y,);

         print_r($z);

         ?>

output of the code

              Array ( [z] => 65 )

array_intersect_key
------------------------

<?php
$array1 = array('blue'  => 1, 'red'  => 2, 'green'  => 3, 'purple' => 4);
$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan'   => 8);

print_r(array_intersect_key($array1, $array2));
?>


output for the code is
---------------------------

         Array ( [blue] => 1 [green] => 3 )


array_intersect
            this function returns the intersection of both the arrays


array_key_exists
----------------
                this code will check whether the key exists or not in the programme

     <?php

$x=array('name'=>'kiran','city'=>'chennai');

if(array_key_exists('city',$x))
{
     echo "find in the array";
   
 }
 else
   echo "not found in the array";
  
   ?>

    output :=  find in the array

array_keys
------------
             it will print the array keys

array_map
-------------

                <?php


function scope($x)

{
   
    return($x*$x*$x);
   
}


$a=array(4,5,8,9);

$b=array_map("scope",$a);

print_r($b);

?>

the above code represents the array_map it getting the value from the array and pass it to another array for calucalting the function

output is
    Array ( [0] => 64 [1] => 125 [2] => 512 [3] => 729 )

Tuesday, December 28, 2010

PHP

Tuesday                                                    PHP          
28/12/2010                              
 
Intro to php

Php is a server side scripting language most of the websites nowadays developing using php because it is free and open source it is major tough competition to asp.net and java it has lot of inbuilt features for creating dynamic web applications it will be very helpful now maximum share of the websites in the world using php scripting and  apache webserver because of its simplicity of code and extraordinary features of having it .acronym for php is “hypertext-preprocessor”

It is compatibility with all database servers mysql,sqlite,postgresql ,oracle and more

Syntax of php

              There are 4 ways of syntax declaring php are

   <?php  ?>

   <%    %>

  <script language=”php”>

   <?            ?>
Installation of php on windows

For developing web applications we need one server side scripting language and one  database server and the operating system whatever it may be and the webserver is apache or IIS whatever it may be

                   If you go through the xampp pack we get a bundled pack of  compenents:

           Apache+Mysql+PHP

So the developers need not worry about the installation of xampp pack in windows

Just download the xampp pack in apachefriends.org and select for windows and just save it in which drive you want

   C:/ and then change directory to xampp


After installing the xampp stack in windows u get a control panel of xampp stack just open and click the mysql and apache u enable and click start button to enable mysql and apache server
And then later

Open the firefox type this  http://localhost

You get the xampp stack web appearance in your firefox desktop

Open the notepad and type the small snippet of code save it your own filename and .php with extension

<?php
      
    Phpinfo();

?>

Save the php files in C:/xampp/htdocs/(“filename.php”)

And later check in the firefox of output of our programme just type the url location  http://localhost/(“yourfilename.php”)

Above programme shows the output of php version and php information in the server
Php in Ubuntu

Download the lamp stack from apachefriends.org and extract the tar file in

tar –xvzf  (latest version of lamp stack.gz file) –C /opt

u get a folder called lampp and as usual normal u go and type the code in normal note pad and save it in  filesystem/var/www with .php extension

if u not have permission to write any files to that folder

sudo chmod 777 –R /var/www




it will give write permission to that particular folder in /var file system

run the code in browser http://localhost/(filename.php)

Getting started with php

php has 4 data types of variables they are

1)    scalar

2)    compound type
              
3)special data type

Scalar data types are
                                   Integer,float,string,double
Compound date types
                                    Array,Object
Special data types
                                    Resource,Null

First exercise in php

<?php

   echo $_SERVER[‘HTTP_USER_AGENT’];

?>
      Normally php variables started with $symbol the above code output wil displays the browser information of which browser we using currently

Arrays in php

              Php have 3 types of arrays they are
                  1)Numeric array

                 2)Associative array

                 3)Multidimensional array


1)Numeric array

           It is ordinary array just we declaring the array values as usual in other languages example
 
         <?php

         $myarr = array(‘chennai’,’mumbai’,’calcutta’,’delhi’);

        echo  $myarr[0]
         
        echo  $myarr[1];

        echo  $myarr[2];

         ?>

The above code represents we declaring the variable $myarr and assigning the values of city names chennai,mumbai,calcutta and delhi

And printing the values of  the variable $myarr[] and the position of the array

The output for the above programe is Chennai,Mumbai,calcutta

2)Associative array

                    In this array we assign the key values to them

Example
  
           <?php

         $myarr=array(‘sachin’=>45,’sehwag’=>75,’talent’=>’ap’);

                     echo  $myarr[‘sachin’] ;
                      
                     echo  $myarr[‘sehwag’];

                     echo  $myarr[‘talent’];

                ?>        

We assign the key values to the above variable in $myarr we will get the output  45,75 and ap

3)Multidimensional Array

  We declare array within array is called multidimensional array php has nice feature of this

 Example
 
 <?php

  $myarr=array(“john”=>array(‘family’=>’chennai’,’age’=>32,’code’=>45),

  ‘smith’=>array(‘name’=>’school’,’age’=>42,’code’=>23));

                       echo  $myarr[‘john’][‘family’];

                       echo  $myarr[‘john’][‘age’];
                          echo  $myarr[‘john’][‘code’]; 

                         echo  $myarr[‘smith’][‘code’]; 

                          echo  $myarr[‘smith’][‘name’]; 

?>
The above programme output is Chennai,32 ,45,23,school

Saturday, December 25, 2010

Rails session

25/12/2010  --saturday

today we celebrate christmas in our office and we cut the cake and celebrate lots of fun in our office

today our guru chandrashekar sir told the introduction to rails

rails features

today our sir told class responsibilites colloborators

crc (vs) data flow diagram

sir told the difference between them

to generate a model in rails
--------------------------------

                rails generate model user

name:string        email:string  password:string

to check the db
---------------
                     less config | database.yml

rake db:migrate

to check db exists (or) not
---------------------------

                 rails dbconsole


rails 3 has an inbuilt nice feature of "sqlite" light weighted database

sqlite> .tables           this command will show the list of all tables

sqlite>.schema users      to see the users structure

sqlite>.quit --------> to quit the sqlite

to start a server
------------------
                       rails server

another terminal
---------------------------
                               cd rails  again cd tu

like Irb rails console
-----------------------

                            u= user.new
                            u.name="john"
                            u.password="john123"
                            u.email="john@doe.com"
                            u
                            u.save!

the above lines stating that creating a new user and assigning a password and email id
and save the rails application

another terminal
-----------------------
                         to show rails console
                    
               SELECT *from users
            
                sqlite>
                        u=user.new:name=>'smith':password=>'smith123':email=>'smith@yahoo.com'
                        u.save

                SELECT *from users


 u=user.find-by-name("john")
 users=users.find:all        //it will find all records

      
users[0].name
users[1].name

users=user.find:all,:conditions=>{:name=>'john'}

users=user.find:first,:conditions=>{:name=>'john'}

-----------------------------------------------------------------

vi app/models/user.rb

class User<activeRecord ::Base

            .validates:name,:presence=>true
 
            .validates:name,:uniqueness=>true
                                       
             .validates:name,:length=>{:maximum=>32}

end


and sir also told ....best  guides to ruby on rails

 www.api.rubyonrails.org

Tuesday, December 21, 2010

jQuery

              jQuery



today i getting started with jQuery ..it is an javascript library ..it is simple light weight and more elegant ...we can do more customization becuase its is fully open source we can animate and navigate the objects and play
around with them

Steps to install jQuery

   download the latest version of the jquery from jquery website
                http://jquery.com/

   just click the download button u will get a javascript huge code just
 right  the mouse and save the page as jquery.js for our convenience we can save it anywhere the file in desktop or file system where it may be


Getting started with jQuery

          just open the notepad or vi editor or gedit  declare html tags
head,body,and all

in the script tag you specify the source "jquery.js"

jQuery is easy to learn just knowing of Html and javascript and css basics is enough

<script type ="text/javscript" src="jquery.js">
</script>



My First programme in jQuery

<html>

<head>

<script type="text/javascript" src="jquery.js"></script>

<script type="text/javascript">

$(document).ready(function(){

  $("p").click(function(){

  $(this).hide();

  });

});

</script>

</head>

<body>
<p>If you click this sentence this will disappear </p>
</body>

</html>