Saturday 14 April 2018

Introduction of CSS

CSS stands for Cascading Style Sheets. It is a style sheet language which is used to describe the look and formatting of a document written in markup language. It provides an additional feature to HTML. It is generally used with HTML to change the style of web pages and user interfaces. 

It can also be used with any kind of XML documents including plain XML, SVG and XUL.

CSS is used along with HTML and JavaScript in most websites to create user interfaces for web applications and user interfaces for many mobile applications.

Syntax:-
<style type=”text/css”>
h1{color:red;}
</style>

Example:-
<html>
<head>
<title>CastorClasses.com</title>
<style type=”text/css>
h1{color:red;}
</style>
</head>
<body>
<h1>hello everyone</h1>
</body>
</html>

Use a Text box / Button / Radio box / Check box.


  • In text box we are use a only plain text.
  • We know everyone how to use a button.
  • Radio button is use for choose a one option.
  • Check box is use for select multiple option.
Syntax:-
<form>
<input type=”text”/>
<input type=”button” “value=show”/>
<input type=”radio” name=”gender”/>Male<input type=”radio” name=”gender”/>Female
<input type=”Check box”/>English<input type=”Check box”/>hindi
</form>


Example:-
<html>
<head>
<title>Welcome</title
</head>
<body>
<form>
<input type=”text”/>
<input type=”button” “value=show”/>
<input type=”radio” name=”gender”/>Male<input type=”radio” name=”gender”/>Female
<input type=”Check box”/>English<input type=”Check box”/>hindi
</form>
</body>
</html>

List

Type of List

  • Unorder list
  • order list
  • Definition list
Syntax:-
<form>
  • <ul type=”circle”>    //Unorder list
  • <li>item1</li>
  • <li>item2</li>
  • <li>item3</li>
  • </ul>
  1. <ol type=”i”>      //order list
  2. <li>item1</li>
  3. <li>item2</li>
  4. <li>item3</li>
  5. </ol>
<dl>                                             ///Definition list
<df>CastorClasses</df>
<dd>MatLab</dd>
<dd>Java</dd>
</dl>
</form>

Example:-
<html>
<head>
<title>Welcome everyone </title>
</head>
<body>
<form>
<ul type=”circle”>
<li>item1</li>
<li>item2</li>
<li>item3</li>
</ul>
<ol type=”i”>
<li>item1</li>
<li>item2</li>
<li>item3</li>
</ol>
<dl>
<df>CastorClasses</df>
<dd>MatLab</dd>
<dd>Java</dd>
</dl>
</form>
</body>
</html>

How to take YouTube video in HTML?


Example:-
<html>
<head>
<title>Irawen</title>
</head>
<body>
<iframe go to youtube site and click a share button then use embedded key and copy all link>
OR
<embed height=”160″ width=”220″ src=”Link copy” type=”application/X=shockwave=flasn”>
</embe>
</body>
</html>

Cell Padding / Cell Spacing


  • Cellpadding is the amount of space between the outer edges of the table cell and the content of the cell.
  •  Cellspacing is the amount of space in between the individual table cells.
Syntax:-
<table cellpadding=”10″>   //This is for cell padding.
<table cellspacing=”10″>    // This is cell spacing.


Example:-
<html>
<head>
<title>Welcome CastorClasses </title>
</head>
<body>
<table>
<tr>
<td>name</td>
<td>age </td>
<td>gender </td>
</tr>
<tr>
<td>ABC</td>
<td>26</td>
<td>Male </td>
</tr>
<tr>
<td>DEF</td>
<td>24</td>
<td>Female </td>
</tr>
<table cellpadding=”10″>
<table cellspacing=”10″>
</table>
</body>
<html>

Table Heading / Col span / row span


  • In table heading we give a heading of table.
  • In col span we give a heading of column.
  • In row span we are give a heading of rows.

Syntax:-
<th>speed </th>     //This is a table heading.
<th colspan=”2″> My bike speed </th>   //This is for col span.
<td rowspan=”3″>10% discount for all Indian </td>   //This is for row span.

Example:-
<html>
<head>
<title>CastorClasses.com </title>
</head>
<body>
<tr>
<th> Sr.no. </th>
<th> speed </th>
<th> age </th>
</tr>
<table border="1″>
<tr>
<th col span="2″>my internet plans </th>
<td rowspan="3″> 10% for discount </td>
</body>
</html>

Create Table


  • Everyone know that for create a table that is use a rows and columns.
Syntax:-
<table>
<border=”4″>
<tr>     For use a rows
<td>Sr. no. </td>
<td> Age </td>
<td> name </td>
</tr>
</table>

Example:-
<html>
<head>
<title>CastorClasses.com</title>
<body>
<table>
<border=”4″>
<tr>
<td>Sr. no. </td>
<td> Age </td>
<td> name </td>
</tr>
<tr>
<td> 1. </td>
<td> 22 </td>
<td>ABC </td>
</tr>
</table>
</body>
</html>

Friday 13 April 2018

Use for Line Breakers.


—>This is use for Line break.

Syntax:-
There are two methods –
a) <p>this is line1 <br> this is line2 <br> this is line3 </p>

“&nbsp”——> This is a use for Space.

b)<pre>
this is line1.
this is line2.
this is line3.
</pre>

Example:-
<html>
<head>
<title>CastorClasses.com</title>
<body>
<pre>
this is line1.
this is line2.
this is line3.
</pre>
</body>
<html>

Use for Font, Bold, Italic (Sentence or paragraph)


Hello Friends,
I am Castorclasses.com. I provide a online classes for all subject.

Syntax:-
<b> This is use for BOLD </b>
<i>This is use for ITALIC </i>
<u>This is use for UNDERLINE </u>



Example:-
<html>
<head>
<title>CastorClasses.com</title>
</head>
<body>
<p>Hiii…. I am a CastorClasses</p>
<b>CastorClasses </b>
<i>am</i>
<u>Hiii…. </u>
</body>
</html>

Use for connection a link

Syntax:-
<a href=”put here link”> Click here</a>
<a href=”link.com”</a>



Example:-
<html>
<head>
<title>CastorClasses.com</title>
<body>
<h1>first page</h1>
<a href=”put here link”> Click here</a>
<a href=”link.com”>
<img src=”image.jpg” width=”50″ height=”130″/>
</a>
</body>
<html>


How to put image in website


  • If put a images in website that is show very attractive.
Syntax:-
<img src=”image/abc.jpg” height=”100″ width=”150″ alt=”Castorclass is image”/>
  In this syntax we include image of height,width and alt.

Example:-
<html>
<head>
<title> CastorClass </title>
</head>
<body>
<h1>Insert an image in html </h1>
<img src=”image/abc.jpg” height=”100″ width=”150″ alt=”Castorclass is image”/>
</body>
</html>

What is cookie?


  • A cookie is often used to identify a user.
  • A cookie is a small file that the server embeds on the user’s computer.
  • Each time the same computer request a page with a browser , it will send the cookie too.

    How to use a cookie


    Here,  Set a cookie.
    Program:-
    <?
    $time=time();
    echo $time;
    //setcookie(name , value , expire)
    setcookie(‘student’ , ‘mark’ , ‘$time’)
    ?>

    OUTPUT:-
    1407535797

    <?
    $student=$_COOKIE [ ‘student’ ];
    echo $student;
    ?>

    OUTPUT:-
    mark

How to use session in PhP


  • A session is a way to store information ( in the form of variable) to be used multiple pages.
  • A PhP session variable is used to store information about, or change setting for a user session.Session variable hold information about one single user, and are available to all pages in one application .
Program:-
<?php
session_start();
$_session[‘Name’]=’Castor classes’;
$_session[‘Age’]=’23’;
$_session[‘Weight’]=’47’;
echo “Done”;
?>

OUTPUT:-
Done

How to use global variable with function



PROGRAM:-
<?php
$name=”Castor Classes”;
echo $name;
function DisplayName()
{
global $name; # This is a global variable.
echo ‘ The name of online courses is Php’ .$name;
}
DisplayName(); #Call function
?>

OUTPUT:-
Castor Classes The name of online courses is PhpCastor Classes

How to use in-built function in PhP


Program:-

<html>
<head>
<meta charset=”UTF-8″>
<title>Castorclasses.com</title>
<style type = “text/css”>
</style>
</head>
<body>
<?
$username=”irawen.info@gmail.com”;
$entered= strtolower (“irawen.info@gmail.com”);
if($username==$entered)
{
echo “correct”;
}
else
{
echo “Please check your username”;
}
?>

How to use a basic function in PhP

Function:-A function is a block a code designed to perform a particular task.
Use:-To increase the readability of program and to perform a task repetitive manner.
Example:-
<?php
function hello_world()
{
echo”Hello world <br>”;         //This is a declare a function
echo”Hello world <br>”;
echo”Hello world <br>”;
}
hello_world();
?>

OUTPUT:-
Hello world
Hello world
Hello world

How to use function with return value

Program:-
<?php
function add($num1,$num2)
{
$result add  $num1 + $num2;
return result;
}
$add1=add(550+1000);
echo add (550,1000).'<br>’;
$add2=add(560+1000);
echo add (560,1000).'<br>’;
echo $add1*$add2;
?>

OUTPUT:-
1550
1560
2418000

Switch Statement use in PhP


  • PHP switch statement is used to execute one statement from multiple conditions. It works like PHP if-else-if statement.
Syntax:-
switch(expression){
case value1:
 //code to be executed
 break;
case value2:
 //code to be executed
 break;
……
default:
 code to be executed if all cases are not matched;
}

Example:-
 
<?php
$num=20;
switch($num){
case 10:
echo(“number is equals to 10”);
break;
case 20:
echo(“number is equal to 20”);
break;
case 30:
echo(“number is equal to 30”);
break;
default:
echo(“number is not equal to 10, 20 or 30”);
}
?>

Output:
number is equal to 20

Loop use in PhP

For Loop

  • PHP for loop can be used to traverse set of code for the specified number of times.
  • It should be used if number of iteration is known otherwise use while loop 
  • Syntax:-
            for(initialization; condition; increment/decrement){
            //code to be executed
               }

Example:-
<?php
for($n=1;$n<=10;$n++){
echo “$n<br/>”;
}
?>


OUTPUT:-
1
2
3
4
5
6
7
8
9
10

While Loop use in PhP

  • while loop can be used to traverse set of code like for loop.
  • it should be used if number of iteration is not known.
syntax:-
while(condition){
//code to be executed
}
another  syntax:-
while(condition):
//code to be executed
endwhile;

Example:-
<?php

$n=1;
while($n<=10){
echo “$n”;

$n++;

}

?>


OUTPUT:-

1

2

3

4

5

6

7

8

9

10

How to array use in a PhP?

  • Array is a collection Similar data,Basically array is use for group of value.
Example:-
<?php
$names=array(‘mark’,’john’,’bob’);
echo $names[1];
?>

OUTPUT:-
john

  • The another methods is-
Example:-
<?php
$names=array(‘Mark’,’John’,’Bob’);
$names[3]=’July’;                                  //This is use for add another value.
$names[4]=’Castor Classes’;                 //This is use for add another value.
print_r($names);                                   //Print all value on output screen.
?>

OUTPUT:-
Array ( [0] => Mark [1] => John [2] => Bob [3] => July [4] => Castor Classes )

Multidimensional Array in PhP

  • PHP multidimensional array is also known as array of arrays. It allows you to store tabular data in an array. PHP multidimensional array can be represented in the form of matrix which is represented by row * column.
Syntax:-
$emp = array
  (
  array(1,“sonoo”,400000),
  array(2,“john”,500000),
  array(3,“rahul”,300000)
  );
Example:-
<?php
/*
students
Name Age Weight
Mark 15 46
John 13 65
Tom 14 56
*/
$students=array(array(‘Name’=>’Mark’,’Age’=>15,’Weight’=>46),
array(‘Name’=>’John’,’Age’=>13,’Weight’=>65),
array(‘Name’=>’Tom’,’Age’=>14,’Weight’=>56));
echo $students[0][‘Name’].’ ‘;
echo $students[1][‘Age’].’ ‘;
echo $students[2][‘Weight’].'<br>’;
echo $students[0][‘Name’].’ ‘;
echo $students[1][‘Age’].’ ‘;
echo $students[2][‘Weight’].'<br>’;
echo $students[0][‘Name’].’ ‘;
echo $students[1][‘Age’].’ ‘;
echo $students[2][‘Weight’].'<br>’;
?>

OUTPUT:-
Mark 15 46
Mark 14 65
Mark 13 56

How can use Comparison operator and Logical Operator?


  • The Comparison operator is used for compare between two number.
  • There are study a  some operators:-

    Example:-
    <?php
    $number1=’10’;
    $number2=10;
    if($number1==$number2)
    {
    echo “Equal”;
    }
    else
    {
    echo “Not Equal”;
    }
    ?>
    OUTPUT:-
    Equal

    Logical Operators
  • The logical operator is used for logic apply between to equation.
  • Here, we are see a some operators:-


Example:-
<?php
$number1=20;
$number2=10;
if(($number1>$number2)and($number1==$number2))
{
echo “Equal”;
}
else
{
echo “Not Equal”;
}
?>
OUTPUT:-
Not Equal

String is Empty Example



  1. /*
            Java String isEmpty Example.
            This Java String isEmpty example shows how to check whether the given
            string is empty or not using isEmpty method of Java String class.
     */
    public class JavaStringIsEmptyExample {
            public static void main(String args[]){

                    String str1 = “”;
                    String str2 = null;
                    String str3 = “Hello World”;

                    /*
                     * To check whether the String is empty or not, use
                     * boolean isEmpty() method of Java String class.
                     *
                     * This method returns true if and only if string.length() is 0.
                     */

                    System.out.println(“Is String 1 empty? :” + str1.isEmpty());

                    //this will throw NullPointerException since str2 is null
                    //System.out.println(“Is String 2 empty? :” + str2.isEmpty());
                   
                    System.out.println(“Is String 3 empty? :” + str3.isEmpty());

                    /*
                     * Please note that isEmpty method was added in JDK 1.6 and it is not available
                     * in previous versions.
                     *
                     * However, you can use  
                     * (string.length() == 0) instead of (string.isEmpty())
                     * in previous JDK versions.
                     */
            }
    }

    /*
    Output of Java String isEmpty would be
    Is String 1 empty? :true
    Is String 3 empty? :false
    */

String to Date Example




  •         Java String to Date Example.
            This Java String to Date example shows how to convert Java String to Date object.
     */
    import java.text.ParseException;
    import java.text.SimpleDateFormat;
    import java.util.Date;

    public class JavaStringToDate {
            public static void main(String args[]){

                    //Java String having date
                    String strDate = “21/08/2011”;

                    /*
                     * To convert Java String to Date, use
                     * parse(String) method of SimpleDateFormat class.
                     *
                     * parse method returns the Java Date object.
                     */

                    try{

                            /*
                             * Create new object of SimpleDateFormat class using
                             * SimpleDateFormat(String pattern) constructor.
                             */

                            SimpleDateFormat sdf = new SimpleDateFormat(“dd/MM/yyyy”);

                            //convert Java String to Date using parse method of SimpleDateFormat
                            Date date = sdf.parse(strDate);

                            //Please note that parse method throws ParseException if the String date could not be parsed.

                            System.out.println(“Date is: “ + date);

                    }catch(ParseException e){
                            System.out.println(“Java String could not be converted to Date: “ + e);
                    }
            }
    }

    /*
    Output of Java String to Date example would be
    Fri Jan 21 00:00:00 IST 2011
    */

String to Lower Case example



  1. /*
            Java String to Lower Case example.
            This Java String to Lower Case example shows how to change the string to lower case
            using toLowerCase method of String class.
    */
    public class StringToLowerCaseExample {

            public static void main(String[] args) {

                    String str = “STRING TOLOWERCASE EXAMPLE”;

                    /*
                     * To change the case of string to lower case use,
                     * public String toLowerCase() method of String class.
                     *
                     */

                     String strLower = str.toLowerCase();

                     System.out.println(“Original String: “ + str);
                     System.out.println(“String changed to lower case: “ + strLower);
            }
    }

    /*
    Output would be
    Original String: STRING TOLOWERCASE EXAMPLE
    String changed to lower case: string tolowercase example
    */

Popular Posts

Categories

AI (27) Android (24) AngularJS (1) Assembly Language (2) aws (17) Azure (7) BI (10) book (4) Books (113) C (77) C# (12) C++ (82) Course (60) Coursera (176) coursewra (1) Cybersecurity (22) data management (11) Data Science (85) Data Strucures (6) Deep Learning (9) Django (6) Downloads (3) edx (2) Engineering (14) Excel (13) Factorial (1) Finance (5) flutter (1) FPL (17) Google (18) Hadoop (3) HTML&CSS (46) IBM (25) IoT (1) IS (25) Java (92) Leet Code (4) Machine Learning (43) Meta (18) MICHIGAN (4) microsoft (3) Pandas (3) PHP (20) Projects (29) Python (726) Python Coding Challenge (170) Questions (2) R (70) React (6) Scripting (1) security (3) Selenium Webdriver (2) Software (17) SQL (40) UX Research (1) web application (8)

Followers

Person climbing a staircase. Learn Data Science from Scratch: online program with 21 courses