Sunday, March 27, 2011

Delete Query In PHP

I recommend you to perform insert, select and update query first then move on delete query......



Update Query in PHP



OUTPUT:


How to make button in Flash

In flash we are going to develop an application which is having button to play like shown below.........



Example : Click on Play Button below:::



 

 
So to make like this you have to follow some steps which are described below:

Step 1: Start the Flash Macromedia Software




  • Before making button add one stage. (From Insert Menu > Select Scene)
  • Make some application on stage 2 like masking or shape tween ( In scene 2 )
  • Now come back to scene 1

Step 2:  Make Square Shape in the stage. ( You can make rectangle or any type of symbol ) 



Step 3:  Click the right button on the drawing and select "Convert to Symbol" option.


Step 4:  And Select the Button Option and give the name of the button:


Step  5:  Now double click on the stage (white portion) then you will redirect to button Timeline which is shown below


Step 6:  Write some text on the button and then double click on stage (white portion)

(Button Stage)

(Application Stage)

Step 7:  Now select first frame and right click on it, then select Action option



Step 8: Now you should double click on "Stop" from left hand side bar....


Step 9: Now right click on the button and select Action option 



Step 10:  Now select option as shown in the figure below:


Step 11: Now select Goto Option from the left hand side bar.....




Step 11(a) : Now select the Scene no  that you want to go after clicking the button but therefore you have to make another scene before making the button.....

Now your button is ready you can test it by pressing "Ctrl  + Enter"

Monday, March 21, 2011

IMP Questions for PHP / HTML

  • Write PHP code to find out current date in DD/MM/YYYY format. 
     Ans:




  • Give the difference between $_GET and $_POST
   And:  HP provides two special functions called $_GET & $_POST, this functions are used to get the values which are passed from a user-filled form, like user registration or login form etc.
 
$_GET is less secure and effective than $_ POST, $_GET has few limitations like it can send about 100 words of data at a time, whereas $_POST does not have such kind of limitations, we can send any amount of data using this variable. $_POST is more secure than $_GET in the means of that whenever we send data from one web page to another using $_GET variable we can see the values in address bar, on the contrary $_POST does not allow any thing to be displayed in address bar of the browser.


    • What is cookie? Explain with example.
     



    • Explain in detail advantages of PHP
     PHP is one of the most popular server side scripting languages running today. It is used for creating dynamic webpages that interact with the user offering customized information. PHP offers many advantages; it is fast, stable, secure, easy to use and open source (free).


    • Explain PHP variables and also explain why PHP is a loosely typed language?
    Variables are used for storing values, like text strings, numbers or arrays. When a variable is declared, it can be used over and over again in your script. All variables in PHP start with a $ sign symbol. The correct way of declaring a variable in PHP: $var_name = value; 

    In PHP, a variable does not need to be declared before adding a value to it.
    In the example above, you see that you do not have to tell PHP which data type the variable is.
    PHP automatically converts the variable to the correct data type, depending on its value.
    In a strongly typed programming language, you have to declare (define) the type and name of the variable before using it.



    • Give syntax of date() function.

    Syntax

    date(format,timestamp





    • Give syntax of mktime() function

    Syntax

    mktime(hour,minute,second,month,day,year,is_dst)  



    • Write the Inbuilt function that reverses the string.
      strrev(string)



    • Write the Inbuilt Function that converts the string to Uppercase.
    strtoupper(string)  



    • When we can use $REQUEST variable?

    The PHP built-in $_REQUEST function contains the contents of both $_GET, $_POST, and $_COOKIE.
    The $_REQUEST function can be used to collect form data sent with both the GET and POST methods.


    • All variables in PHP starts with a ________ sign symbol. Ans. $
    • _________ is used to print text in php page. - Echo 


      • PHP is server side scripting language because.........(complete the statement)
      You can create dynamic web pages with the PHP scripting language. A dynamic Web page interacts with the user, so that each user visiting the page sees customized information


      • What is an array ? List the types of array.
      An array is a special variable, which can store multiple values in one single variable.
      • Numeric array - An array with a numeric index
      • Associative array - An array where each ID key is associated with a value
      • Multidimensional array - An array containing one or more arrays




      • Explain for loop with example.

      The for loop is used when you know in advance how many times the script should run.

      Syntax

      for (init; condition; increment)
        {
        code to be executed;
        } 




       
      • Give an example of a function that returns a value.
      • Major difference between include() and require() functions.
      • List 3 different function used to open, close, and checking end-of particular file.
      • Difference between PHP and HTML
      • What is an anchor tag?
      • How can we add image in HTML document?

        Sunday, March 20, 2011

        Revision Operating System - 1

        1. What is an Operating System ?

        "Operating system is the part of computer system that manages all of the hardware, and all of the software of computer system. It controls every files, every device, every section of main memory, and every nanosecond of processing time."

        • Operating system services
            •  Program Execution
            • I/O Operation
            • File - system Manipulation
            • Communications
            • Error Detection
            • Resource Allocation
            • Accounting
            • Protection

        • Process Concept 
            • A process is an entity that consist of number of elements. Two essential elements of a process are program code (which may be shared with other processes that are executing the same program) and set of data (associated with that code)

        Saturday, March 19, 2011

        Microsoft is more ethical than Google, Facebook, Apple

        Search giant Google may profess its 'Don't be Evil' motto, however, when it comes to ethical action Microsoft steals a march over its arch rival, according to a recent ranking.

        Microsoft has earned a place on Ethisphere's 2011 list of the world's 110 most ethical companies. Other IT companies on the list include, Teradata, Hitachi Data Systems, Symantec Corporation, Freescale, Texas Instruments, Adobe, eBay, T-Mobile and Salesforce.

        The unranked listing recognizes these IT companies for their "real and sustained ethical leadership" across various industries. These companies are believed to "truly go beyond making statements about doing business ethically and translate those words into action."

        Surprisingly, Google, who has been on the list in 2008, 2009 and 2010 is among the 36 companies that dropped off from the list this year. Two other big miss on the list are Apple and Facebook.

        Though, Ethispehere has not disclosed individual reasons for the companies that dropping off from the list, it said, these "drop offs" generally occurred because of litigation and ethics violations, as well as increased competition from within their industry.

        Ethisphere has ranked companies based on factors like history of regulatory infractions, sustainable business practices and peer nominations.

        Monday, March 14, 2011

        Learn Database Connection in PHP in 15mins (15-Steps)

        I tried to make this article more simple and interactive for you......


        To learn the database connection in PHP, you have to follow some easy steps which are described below.
        But make sure that you have installed the "WAMP SERVER" in your PC.


        Step 1: Start the WAMP server



        (Fig shows the WAMP latest version 2.1 )

        Step 2: Click on WAMP server icon from notification bar and select "phpMyAdmin".......



        Step 3: It will show like this......




        Step 4: Click On "Databases"




        Step 5:  Write your database name in textbox under "Create new database" below:
        Step 6: Then message "Database db1 has been created" will be displayed.....


        Step 7: Give the name of the table and number fields like shown in the figure..................



        Step 8: Give name, datatype and primary key to fields...................



        Step 9:  Then Click On Save Button.......and it will show a page  like below........




        Step 10: Now Click On Insert  Tab for inserting data into table................



        Step 11:  Write the values in the value fields and other part remains blank..........



        Step 12: Click on Go below of the second data field.........



        Step 13: Now your data are inserted into the table



        Step 14 (a): Now openNotepad file..................



        Step 14 (b): Write the same code which is given below:




        Step 14 (c): Save notepad file in WAMP folder: "C:\wamp\www\"


        Step 15: Final Step:
        Now execute your file in WAMP - Local Host.............


        Sunday, March 13, 2011

        Unix Programs (Operating System Assignment)


        UNIX Practicals
         



        1. WAS: to display 1 to 10 numbers (while loop)

        a=1
        while [ $a -le 10 ]
        do
        echo "$a"
        a=`expr $a + 1`
        done

        2. WAS: to display 1 to 10 numbers (for loop)

        for (( a=1;a<=10;a++ ))
        do
        echo "$a"
        done
          
        3. WAS: to display 1 to 10 numbers (until loop)

        a=1
        until [ $a -gt 10 ]
        do
        echo $a
        a=`expr $a + 1`
        done




        4. WAS: to display 10 to 1 numbers (while loop)

        a=10
        while [ $a -ge 1 ]
        do
        echo $a
        a=`expr $a - 1`
        done  

        5. WAS: to display 10 to 1 numbers (for loop)

        for (( a=10;a>=1;a-- ))
        do
        echo "$a"
        done

        6. WAS: to display 10 to 1 numbers (until loop)

        a=10
        until [ $a -lt 1 ]
        do
        echo $a
        a=`expr $a - 1`
        done   

        7. WAS: to display 1 to N numbers (while loop)

        echo "Upto what numbers you want"
        read n
        a=1
        while [ $a -le $n ]
        do
        echo $a
        a=`expr $a + 1`
        done        




        8. WAS: to display 1 to N numbers (for loop)

        echo "Upto what numbers you want"
        read n
        for (( a=1;a<=n;a++ ))
        do
        echo “$a”
        done

        9. WAS: to display 1 to N numbers (until loop)

        echo "Upto what numbers you want"
        read n
        a=1
        until [ $a -ge $n ]
        do
        echo $a
        a=`expr $a + 1`
        done        

        10. WAS: to display N to 1 numbers (while loop)

        echo "enter the no"
        read no
        while [ $no -ge 1 ]
        do
        echo $no
        no=`expr $no - 1`
        done 

        11. WAS: to display N to 1 numbers (for loop)

        echo "from what numbers you want"
        read n
        for (( a=n;a>=1;a-- ))
        do
        echo “$a”
        done




        12. WAS: to display N to 1 numbers (Until loop)

        echo "enter the no"
        read no
        until [ $no -le 1 ]
        do
        echo $no
        no=`expr $no - 1`
        done 

        13. WAS: to find the sum of 1 to 10 numbers (while loop)

        $ cat >f4
        a=1
        sum=0
        while [ $a -le 10 ]
        do
        sum=`expr $sum + $a`
        a=`expr $a + 1`
        done
        echo "total is $sum"

        14. WAS: to find the sum of 1 to 10 numbers (for loop)

        a=1
        sum=0
        for (( a=1;a<=10;a++ ))
        do
        sum=`expr $sum + $a`
        done
        echo "total is $sum"

        15. WAS: to find the sum of 1 to 10 numbers (until loop)

        a=1
        sum=0
        until [ $a -ge 10 ]
        do
        sum=`expr $sum + $a`
        a=`expr $a + 1`
        done
        echo "total is $sum"
        16. WAS: to find the factorial of a given no (while loop)

        fact=1
        echo "enter the no"
        read no
        while [ $no -gt 0 ]
        do
        fact=`expr $fact \* $no`
        no=`expr $no - 1`
        done
        echo "factorial is $fact" 

        17. WAS: to find the factorial of a given no (for loop)

        fact=1
        echo "enter the no"
        read no
        for (( no=no;no>0;no-- ))
        do
        fact=`expr $fact \* $no`
        done
        echo "factorial is $fact" 

        18. WAS: to find the factorial of a given no (until loop)

        fact=1
        echo "enter the no"
        read no
        until [ $no -lt 0 ]
        do
        fact=`expr $fact \* $no`
        no=`expr $no - 1`
        done
        echo "factorial is $fact" 

        19. WAS: to display Fibonacci series (while loop)

        a=0
        b=1
        echo " how much steps you want "
        read no
        echo $a
        echo $b
        x=`expr $no - 2`
        while [ $x -gt 0 ]
        do
        c=`expr $a + $b`
        echo $c
        a=$b
        b=$c
        x=`expr $x - 1`
        done     

        20. WAS: to display Fibonacci series (for loop)

        a=0
        b=1
        echo " how much steps you want "
        read no
        echo $a
        echo $b
        x=`expr $no - 2`
        for (( ;x>0;x-- ))
        do
        c=`expr $a + $b`
        echo $c
        a=$b
        b=$c
        done



        21. WAS: to display Fibonacci series (Until loop)

        a=0
        b=1
        echo " how much steps you want "
        read no
        echo $a
        echo $b
        x=`expr $no - 2`
        until [ $x -lt 0 ]
        do
        c=`expr $a + $b`
        echo $c
        a=$b
        b=$c
        x=`expr $x - 1`
        done         

        22. WAS: to get the reverse number of given digit (while loop)

        echo "enter the number"
        read no
        while [ $no -gt 0 ]
        do
        x=`expr $no % 10`
        echo $x
        no=`expr $no / 10`
        done

        23. WAS: to get the reverse number of given digit (for loop)

        echo "enter the number"
        read no
        for (( no=no;no>0;no=no/10 ))
        do
        x=`expr $no % 10`
        echo $x
        done

        24. WAS: to get the reverse number of given digit (Until loop)

        echo "enter the number"
        read no
        until [ $no -lt 0 ]
        do
        x=`expr $no % 10`
        echo $x
        no=`expr $no / 10`
        done

        25. WAS: to display the multiplication table of a particular number (while loop)

        i=1
        echo "enter the number for multiplication table"
        read no
        while [ $i -le 10 ]
        do
        x=`expr $i \* $no`
        echo "$i x $no = $x"
        i=`expr $i + 1`
        done

        26. WAS: to display the multiplication table of a particular number (for loop)

        echo "enter the number for multiplication table"
        read no
        for (( i=1;i<=10;i++ ))
        do
        x=`expr $i \* $no`
        echo "$i x $no = $x"
        done

        27. WAS: to display the multiplication table of a particular number (until loop)

        i=1
        echo "enter the number for multiplication table"
        read no
        until [ $i -ge 10 ]
        do
        x=`expr $i \* $no`
        echo "$i x $no = $x"
        i=`expr $i + 1`
        done

        28. WAS: to display the multiplication table from upto N number (While loop)

        i=1
        j=1
        echo "enter upto wht number you want the tables"
        read num
        while [ $j -le $num ]
        do
        while [ $i -le 10 ]
        do
        x=`expr $i \* $j`
        echo " $i x $j = $x"
        i=`expr $i + 1`
        done
        j=`expr $j + 1`
        done         

        29. WAS: to display the multiplication table from upto N number (While loop)

        echo "enter upto wht number u wnt"
        read no
        for (( j=1;j<=no;j++ ))
        do
        for (( i=1;i<=10;i++ ))
        do
        t=`expr $i \* $j`
        echo "$i x $j = $t"
        done
        done  

        30. WAS: to display the multiplication table from upto N number (Until loop)

        i=1
        j=1
        echo "enter upto wht number ypu want the tables"
        read num
        until [ $j -ge $num ]
        do
        until [$i -ge 10 ]
        do
        x=`expr $i \* $j`
        echo " $i x $j = $x"
        i=`expr $i + 1`
        done
        j=`expr $j + 1`
        done         

        31. WAS: to do sum of any digit (while loop)

        echo "enter any no"
        read no
        sum=0
        while [ $no -gt 0 ]
        do
        x=`expr $no % 10`
        sum=`expr $sum + $x`
        no=`expr $no / 10`
        done
        echo "sum = $sum"

        32. WAS: to do sum of any digit (for loop)

        echo "enter any no"
        read no
        sum=0
        for (( no=no;no>0;no/=10 ))
        do
        x=`expr $no % 10`
        sum=`expr $sum + $x`
        done
        echo "sum = $sum"

        33. WAS: to do sum of any digit (Until loop)

        echo "enter any no"
        read no
        sum=0
        until [ $no -lt 0 ]
        do
        x=`expr $no % 10`
        sum=`expr $sum + $x`
        no=`expr $no / 10`
        done
        echo "sum = $sum"
        34. Write a shell script to find even or not.
        echo "enter the no"
        read no
        x=`expr $no % 2`
        if [  $x -eq 0 ]
        then
        echo "even"
        else
        echo "odd"
        fi

        35. WAS. To find the given year is leap year or not

        echo "enter the year"
        read year
        x=`expr $year % 4`
        if [ $x -eq 0 ]
        then
        echo "leap year"
        else
        echo "not leap year"
        fi

        36. WAS: to find the greatest of all from 3 numbers.

        echo "enter three numbers"
        read n1
        read n2
        read n3
        if [ $n1 -gt $n2 ] && [ $n1 -gt $n3 ]
        then
        echo "$n1 is greater"
        elif [ $n2 -gt $n3 ] && [ $n2 -gt $n1 ]
        then
        echo "$n2 is greater"
        else
        echo "$n3 is greater"
        fi
        36. WAS: to find the greatest of all from 3 numbers.

        i=1
        max=$1
        for i in $*
        do
        if [ $i -gt $max ]
        then
        max=$i
        fi
        done
        echo "max = $max"

        37. WAS: to find percentage and class of a student.

        echo "enter 5 sub marks"
        read s1
        read s2
        read s3
        read s4
        read s5
        tot=`expr $s1 + $s2 + $s3 + $s4 + $s5`
        per=`expr $tot \* 100 / 5`
        if [ $per -gt 70 ]
        then
        echo "distinction"
        elif [ $per -gt 60 ]
        then
        echo "first class"
        elif [ $per -gt 50 ]
        then
        echo "second class"
        else
        echo "third class"
        fi



        38. WAS: to find it is prime or not

        x=0
        i=2
        echo "enter the no"
        read no
        while [ $i -lt $no ]
        do
        y=`expr $no % $i`
        if [ $y -eq 0 ]
        then
        x=1
        fi
        i=`expr $i + 1`
        done
        if [ $x -eq 0 ]
        then
        echo "prime"
        else
        echo "not prime"
        fi       

        39. WAS: to find string is equal or not

        if test "$1" == "$2"
        then
        echo "equal"
        else
        echo "not equal"
        fi   

        40. WAS: to find check that file exist or not

        if test -a f1
        then
        echo "exist"
        else
        echo "dosent exist"
        fi    
        41. WAS: to find that file is readable or not

        if test -r f1
        then
        echo "readable"
        else
        echo "not readable"
        fi  

        42. WAS: to find that file is writable or not

        if test -w f1
        then
        echo "writeable"
        else
        echo "not writeable"
        fi  

        43. WAS: to find that string is null or not

        if test -z $1
        then
        echo "NULL"
        else
        echo "NOT NULL"
        fi  

        44. WAS: to find that file is executable or not

        if test -x f1
        then
        echo "executable"
        else
        echo "not"
        fi   



        45. WAS: to find the minimum and maximum from given 5 numbers

        i=1
        min=$1
        max=$1
        for i in $*
        do
        if [ $i -lt $min ]
        then
        min=$i
        fi
        if [ $i -gt $max ]
        then
        max=$i
        fi
        done
        echo "min = $min and max = $max"

        46. WAS: to count how many even and odd numbers are there.

        i=1
        a=0
        b=0
        for i in $*
        do
        j=`expr $i % 2`
        if [ $j -eq 0 ]
        then
        a=`expr $a + 1`
        fi
        if [ $j -eq 1 ]
        then
        b=`expr $b + 1`
        fi
        done
        echo "even = $a and odd = $b"