Tuesday, April 30, 2013

array_unique() function in PHP, How to display unique elements of an Array in PHP, How to remove duplicate elements from an array PHP


array_unique() function in PHP, How to display unique elements of an Array in PHP, How to remove duplicate elements from an array PHP

If you want to make sure all the elements in a provided array are unique, use the array_unique() function. This function removes duplicity from the Array and shrinks the array if there are in fact duplicate values. The element keys are not renumbered when this function is complete.

example

<?php
$grades = array(87,88,98,74,56,94,67,98,49) ;
echo "<b>The all elements of the Array are</b><br/>";
foreach($grades as $grade)
echo "$grade<br/>" ;
$uniqueGrades = array_unique($grades);
echo "<b>The unique elements in the Array are</b><br/>";
foreach($uniqueGrades as $ugrade)
echo "$ugrade<br/>" ;
?>

Output

The all elements of the Array are
87
88
98
74
56
94
67
98
49
The unique elements in the Array are
87
88
98
74
56
94
67
49


PHP Tutorials - Math Functions in PHP, Math functions on Array in PHP


Math Functions in PHP, Math functions on Array in PHP


The PHP provides the several math-type functions which are used to perform the math operation on arrays. The array_sum() function is used to adds the vale of all stored elements of an array and returns that answer to a variable. The count() function is used to count the number of elements of an array returns the number of elements in a variable.
Here is a simple example to demonstrate these two functions
<?php

$marks = array(87,88,98,74,56,94,67) ;
$sum_of_marks = array_sum($marks);
echo "The sum of the provided Marks is: $sum_of_grades <br/>";
$avgMarks = array_sum($marks) / count($marks) ;
echo "and the average of these Marks is: " . round($avgMarks,2) ;
?>

Output
The sum of the provided Marks is: 564
The average of these Marks is: 80.57

I have used the round() function to round the value of average grades into two decimal places.

PHP Tutorials - How to Sort Arrays in PHP, Different Sorting Methods in PHP


How to Sort Arrays in PHP, Different Sorting Methods in PHP


The Sorting is a technique to ordering an array's element by ascending or descending order.The PHP provides the number of sort functions to do this. The sort() function sorts the array based on the values in it in ascending order, The rsort() function does exactly the same thing but it sorts the array in descending order. The ksort() and krsort() sorts array by the associated key
The following examples shows the each sort function with example.


Regular Sorting

<?php
$Colors = array("Red", "Pink","Greeen",
"Blue","Yellow" ) ;
echo "<strong>Before sorting the array is</strong><br/>";
foreach ($Colors as $color) {
echo $color . "<br/>";
}
sort ($Colors) ;
echo "<strong>After Sorting the array is</strong> <br/>";
foreach ($Colors as $color) {
echo $color . "<br/>";
}

?>

output
Before sorting the array is
Red
Pink
Greeen
Blue
Yellow
After Sorting the array is 
Blue
Greeen
Pink
Red
Yellow 


Reverse Sorting

$Colors = array("Red", "Pink","Greeen",
"Blue","Yellow" ) ;
echo "<string>Before sorting the array is</strong><br/>";

foreach ($Colors as $color) {
echo $color . "<br/>";
}

rsort ($Colors) ;
echo "<strong>After Sorting the array is</strong> <br/>";
foreach ($Colors as $color) {
echo $color . "<br/>";
}

output
Before sorting the array is
Red
Pink
Greeen
Blue
Yellow
After Sorting the array is 
Yellow
Red
Pink
Greeen
Blue





Sorting with Keys in ascending order


$Colors = array("open"=>"PHP", "Microsoft"=>"ASP","Sun"=>"Java",
"IBM"=>"DB2","oracle"=>"oracle" ) ;
echo "<string>Before sorting the array is</strong><br/>";

foreach ($Colors as $color) {
echo $color . "<br/>";
}

rsort ($Colors) ;
echo "<strong>After Sorting the array is</strong> <br/>";
foreach ($Colors as $color) {
echo $color . "<br/>";
}
output
Before sorting the array is
PHP
ASP
Java
DB2
oracle
After Sorting the array is 
DB2
ASP
Java
PHP
oracle


Sorting with Keys in descending order

$Colors = array("open"=>"PHP", "Microsoft"=>"ASP","Sun"=>"Java",
"IBM"=>"DB2","oracle"=>"oracle" ) ;
echo "<string>Before sorting the array is</strong><br/>";

foreach ($Colors as $color) {
echo $color . "<br/>";
}

krsort ($Colors) ;
echo "<strong>After Sorting the array is</strong> <br/>";
foreach ($Colors as $color) {
echo $color . "<br/>";
}
output
Before sorting the array is
PHP
ASP
Java
DB2
oracle
After Sorting the array is 
oracle
PHP
Java
ASP
DB2




Thursday, April 25, 2013

Online Chatting Project free Download in Java, Free Download Facebook like Chat Application in Java


Online Chatting Project free Download in Java, Free Download Facebook like Chat Application in Java






This Project is Used to do Chatting among peoples who are belongs to different places and able to talk with sending text to each other.
Facebook like Chat application is an online system created for the number of members to connect with each other over the WWW. This project resolves almost all the restrictions of the traditional program. Anyone can use this project.




To get This project Contact me

Talib Hassan
Email- thussain520@gmail.com
Contact No- 8802932594

Airline Reservation System Project Free Download in Java, Free Download Airline Reservation System in Java


Airline Reservation System Project Free Download in Java, Free Download Airline Reservation System in Java





This Project Developed in Java Swing and it is able to book the air ticket by computer system to reducing the manual mistakes.
With the help of this project any vender book the tickets for flights and check status of confirmation etc.

To get This project Contact me

Talib Hassan
Email- thussain520@gmail.com
Contact No- 8802932594

Monday, April 22, 2013

Android Jumper Game Project Download Free with Source Code, Free Download Project Jumper Game in Android


Android Jumper Game Project Download Free with Source Code, Free Download Project Jumper Game in Android





Android Jumper game is developed for Android Devices. It is a game which is similar to the doolde game. This project has all the files including source code, images, apk file etc.
This game is developed in Java Technology and you can download it free from here


Download Project

Encryption Algorithm Project with Source Code Free Download in ASP.Net, Encryption Algorithm Project Report Free Download


Encryption Algorithm Project with Source Code Free Download in ASP.Net, Encryption Algorithm Project Report Free Download





There are many types of Algorithms to Change Original data to the cipher text and transmit it to the network and when the data reached to its destination then these Algorithms are used to change the cipher text to the original text.
Encryption algorithm project  is used one of these algorithms to covert the data from original form to cipher text and vice verse. It is an ASP.Net project





To get This project Contact me

Talib Hassan
Email- thussain520@gmail.com
Contact No- 8802932594


CPU Scheduling Simulation Project Free Download in C#.Net, Free Download CPU Scheduling Simulation Project


CPU Scheduling Simulation Project Free Download in C#.Net:-


This Project is developed for graphical representation of the CPU Scheduling Algorithms like FCSF, Priority Scheduling, Round Robin etc. In this project the all algorithms workings are defined in reality with multiple tasks assignments.





To get This project Contact me

Talib Hassan
Email- thussain520@gmail.com
Contact No- 8802932594
Saturday, April 20, 2013

Free Download Online Quiz Project in ASP.Net, Online Quiz Project in Asp.Net Free Download


Free Download Online Quiz Project in ASP.Net




This is a web based Online Quiz developed in ASP.NET 3.5 and C# with SQL Server.
It is a online Quiz system which contain questions and their answer options, a user which will play a quiz read the question and select a right answer option which are appear below the question and these options are in the form of radio buttons.



To get This project Contact me

Talib Hassan
Email- thussain520@gmail.com
Contact No- 8802932594

Free Download Online GAS Booking System Project in ASP.Net, Online GAS Booking Project Free Download


Free Download Online GAS Booking System Project in ASP.Net




This project is useful to book the gas cylinders online, a user go to online and book their gas cylinder through the id which is assigned to them and a password given to the users that can be changeable according to the user's choice.

This project reduce the traditional booking system in which the user go to the agency and book their cylinder or call to the distributor for booking the gas, it is a time consuming task so this project is very useful. 

To get This project Contact me

Talib Hassan
Email- thussain520@gmail.com
Contact No- 8802932594

Free Download Hotel Room Booking System Project Report, Online Hotel Room Booking Project Free Download


Free Download Hotel Room Booking System Project Report




It is a simple application which provides all facilities like room booking, room class type, hall booking, hotel booking, etc…
This is an online system which is available online and any user type the address in address bar of browser and make an account and then manage their account for booking rooms and everything available on the website.

To get This project Contact me

Talib Hassan
Email- thussain520@gmail.com
Contact No- 8802932594



        

Free Download Online Examination System Project in Asp.net, Online Examination System Project Free Download


Free Download Online Examination System Project in Asp.net





An online system for conducting tests called Online Examination system is developed for Schools & Colleges to facilitate in conducting online tests. This System helps the User to log into the application whenever he desires and evaluates the results immediately.
          The application is very flexible and user friendly. There is no need to monitor while a person is taking the exam. All the instructions are displayed to the user before he takes the test application. This application is developed in Asp.net. It is an online application and available online each user can conducted the exam easily.


To get This project Contact me

Talib Hassan
Email- thussain520@gmail.com
Contact No- 8802932594

Free Download Airline Ticket Booking System Project in ASP.Net, Online Airline Ticket Booking Project Free Download


Free Download Airline Ticket Booking System Project in ASP.Net




Airline Ticket Booking System Project was developed in Visual Studio 2003 with C#.net.
With this application a user can book airline tickets by creating an account and if needed they can able to cancel the tickets.
This project can show the all available flights ant their fare price. It is very helpful application for the students to create the application like this.


To get This project Contact me

Talib Hassan
Email- thussain520@gmail.com
Contact No- 8802932594

Free Download Online Recruitment Portal Project Report, Online Recruitment Project Free Download


Free Download Online Recruitment Portal Project Report, Online Recruitment Project Free Download





Online Recruitment portal project is helpful for both employee and employers. Any job seeker can make their profile on the portal and provide their skill set and job providers see the applications of the job seekers and if the application which is provided by the job seekers is able to fulfil the job providers requirement then they make call to the job seekers.


To get This project Contact me

Talib Hassan
Email- thussain520@gmail.com
Contact No- 8802932594

Free Download Internet Banking System Project in Java, Internet Banking Project Free Download


Free Download Internet Banking System Project in Java, Internet Banking Project Free Download




The Online Internet Banking System is used to provide the accessible facility of account online by any Bank to their account holders. With the help of this system we account holders can manage their account info online through the username and password provided by Bank and the account holders can transfer money to any other account, purchase products online etc. 


Download This project

Thanks for visiting




Free Download Mobile Phone Based Attendance Management System project, Attendance Management System with Mobile Free Download


Free Download Mobile Phone Based Attendance Management System project, Attendance Management System with Mobile Free Download



Mobile Phone based Attendance System project is used to make attendance of students of an institute or college electronically, It is very useful application to monitor the day by day attendance of each and every student and these attendance will store into an online database which is accessible through the username and password.
Each Teacher has its own username and password and they can manage their account and can see attendance of its own assigned class's students only.


To get This project Contact me

Talib Hassan
Email- thussain520@gmail.com
Contact No- 8802932594 

Free Download Payroll System Project in ASP.Net


Payroll System Project in ASP.Net Free Download




Project Details:-

The Payroll System is used to maintain the records of all employees in an organization. This is a kind of module which is very helpful for HR department to evaluate the salary of each employee.

The Project Contains

Source Code
Images
Database



To get This project Contact me

Talib Hassan
Email- thussain520@gmail.com
Contact No- 8802932594 
Friday, April 19, 2013

Use of Break And Continue keywords in Java, Break and Continue Keywords in Java


Use of Break And Continue keywords in Java, Break and Continue Keywords in Java


Two keywords, break and continue, can be used in loop statements to provide additional controls. Using break and continue can simplify programming in some cases like sometimes if you don't want to execute the statement after a specific statement.

You can use the keyword break in a switch statement. You can also use break in a loop with the help of a conditional (if) statement to immediately terminate the loop.

The following program demonstrate the effect
of using break in a loop.


public class Test {
public static void main(String st[]) {
int sum = 0;
int num = 0;
while (num < 20) {
num++;
sum += num;
if (sum >= 100)
break;
}

System.out.println("The number is " + num);
System.out.println("The sum is " + sum);
}
}

Output:-

The number is 14
The sum is 105


The above program adds integers from 1 to 20 in this order to sum until sum is greater than or equal to 100. Without the if statement, the program calculates the sum of the numbers from 1 to 20. But with the if statement when the sum becomes less then or equal to 100 the loop has terminate and the output is as follows--

The number is 20
The sum is 210


You can also use the continue keyword in a loop. When it is encountered, it ends the current iteration. Program control goes to the end of the loop body. In other words, continue breaks out of an iteration while the break keyword breaks out of a loop.The following program demonstrate the effect of using continue in a loop.


public class Test {
public static void main(String st[]) {
int sum = 0;
int num = 0;
while (num < 20) {
num++;
if (num == 10 || num == 11)
continue;
sum += num;
}
System.out.println("The sum is " + sum);
}
}

Output:-

The sum is 189


The above program adds integers from 1 to 20 except 10 and 11 to sum. With the if statement in the program, the continue statement is executed when number becomes 10 or 11 and the 10 and 11 numbers are not added to the sum and the output is as follows

The sum is 210

In this case, all of the numbers are added to sum, even when number is 10 or 11. Therefore, the result is 210, which is 21 more than it was with the if statement.



Core Java Tutorials - Iterative Statements (Loops) in Java, For Each Loop in Java, For Loop, While Loop, Do-while Loop in Java


Iterative Statements (Loops) in Java, For Each Loop in Java, For Loop, While Loop, Do-while Loop in Java


Suppose that you want to print a string like "Java is an Object Oriented Programming" a 100 times. It would be lengthy process to write the following statement a 100 times:

System.out.println("Java is an Object Oriented Programming!");
System.out.println("Java is an Object Oriented Programming!");
...
...
...
System.out.println("Java is an Object Oriented Programming!");

So, how do you solve this problem?

Java gives a powerful feature called a loop that controls how many times an operation or a sequence of operations is performed in succession. Using a loop statement, you simply tell the computer to print a string a 100 times without printing the hard coded code to print the statement a 100 times, as follows: 

int c = 0;
while (c < 100) {

System.out.println("Java is an Object Oriented Programming!");

c++;
}


The variable c is initially 0. The loop checks whether (c < 100) is true. If so, it executes the loop body to print the message "Java is an Object Oriented Programming!" and increments c by 1. It repeatedly executes the loop body until (c < 100) becomes false. When (c < 100) is false (i.e., when c reaches 100), the loop terminates and the next statement. after the loop statement is executed.


Loops are constructs that control repeated executions of a block of statements. The concept of looping is fundamental to programming. Java provides three types of loop statements: while loops, do-while loopsfor loops and for-each loop.


The while Loop

The syntax for the while loop is as follows:

while (condition) 
{
// Loop body
Statement 1;
Statement 2;
........
........
Statement n;
}




Example

class whileDemo
{
public static void main(String st[])
{
char ch;
ch='a';
while(ch<='z'){
System.out.println(ch);
ch++;
}
}
}



The do-while Loop
The do-while loop is an another way of the while loop. But, The do-while loop executes the loop body first, then checks the loop condition to determine whether to continue or terminate the loop. The do-while loop must be execute at least one time whether the condition will true or false.The syntax is given below:

do {
// Loop body;
Statement(1);
Statement(2);
...........
...........
Statement(n);
} while (loop-condition);



Example:-
public class Test
{
public static void main(String st[])
{
int a=5;
int b=1;
do{
int c=1;
do{
if((c==b)||(c==a+1-b))
System.out.print("#");
else
System.out.print("#");
b++;
}while(c<=a);
System.out.println();
b++;
}while(b<=a);
}
}




The for Loop:-

A for loop can be used to simplify the proceeding loop:

for (i = initial Value; i < end Value; increments or decrements) {
// Loop body
Statement(1);
Statement(1);
........
........
Statement(n);
}

In general, the syntax of a for loop is as shown below:

for (initial-action; loop-condition;
action-after-each-iteration) {
// Loop body;

Statement(1);
Statement(1);
........
........

Statement(n);
}
Example:-

public class ForLoopsDemo
{
public static void main(String st[])
{
int loopVal;
int endVal=11;
for(loopVal=0;loopVal<endVal;loopVal++)
{
System.out.println("Loop Value "+loopVal);
}
}
}




For-Each Loop:-

The for-each loop is used to iterate a collection for example if we want to print the all elements of an array then we need to find the length of the array and iterate it from 0 to less then length but if we use the for-each loop we don't need to find the length of the array.

Example:-

int numbers[]=new numbers[]{12,23,43,25,65,67};
for(int num:numbers)
{
System.out.println(num);
}

it will print
12
23
43
25
65
67





Core Java Tutorials - Type Casting in Java, How to cast a type to another type in Java, Difference between implicit and explicit type casting in java


Type Casting in Java, How to cast a type to another type in Java, Difference between implicit and explicit type casting in java


In Java Casting is an operation that converts a value of one data type into a value of another data type. There are two type of Type Casting in Java (1)Implicit Type Casting, (2)Explicit Type Casting.
Casting a variable of a type with a small range to a variable of a type with a larger range is known as widening a type. Casting a variable of a type with a large range to a variable of a type with a smaller range is known as narrowing a type. Widening a type can be performed automatically without explicit casting. Narrowing a type must be performed explicitly. 
The syntax is the target type in parentheses, followed by the variable’s name or the value to be cast. For example, the following statement


System.out.println((int)1.9);

Display Output 1 because, if a double value is cast into an int value, then the  fractional part is truncated.

The following statement

System.out.println((double)2 / 4);


Displays Output 0.5, because 2 is cast to 2.0 first, then 2.0 is divided by 4. 

See This Example again

System.out.println(2 / 4);

Displays Output 0, because 2 and 4 are both integers and the resulting value should be an integer.

Note:- Casting is necessary if you are assigning a value to a variable of a smaller type range, such as assigning a double value to an int variable. A compile error will occur if casting is not used in situations of this kind. Be careful when using casting. Loss of information might lead to inaccurate results.


Casting does not change the variable being cast. For example, d is not changed after casting in the following code:

double d = 7.5;
int i = (int)d; // i becomes 7, but d is not changed, still 7.5


To assign a variable of the int type to a variable of the short or byte type, explicit casting must be used. For example, the following statements have a compile error:

int i = 1;
byte b = i; // Error because explicit casting is required







Thursday, April 18, 2013

Core Java Tutorials - Creating Constants in Java, How to Create Constants in Java


Creating Constants in Java, How to Create Constants in Java


A simple variable's value can be change during the program execution but a constant value can't be change after it's creation time.

A constant must be declared and initialized in the same statement. In other programming languages like C and C++, we use a keyword const to declare a constant same as the word final is a Java keyword for declaring a constant. For example, you can declare PI as Constant like this-

final double PI=3.14159;

Benefits for declaring constants


There are three benefits of using constants:

(1) you don’t have to repeatedly type the same value.

(2) if you have to change the constant value (e.g., from 3.14 to 3.14159 for PI), you need to change it only in a single location in the source code.

(3) A descriptive name for a constant makes the program easy to read.


Core Java Tutorials - Identifiers in Java, Variables declaration in Java, How to Declare Variables in Java


Identifiers in Java, Variables declaration in Java, How to Declare Variables in Java

The Identifiers(Variables) are used to store the data in any programming language and the use of Identifiers are same in java like other languages. Identifiers are the combination of letters, digits, underscores(_) and dollar signs($).

Rules for constructing Identifiers in Java 


  • An identifier is a sequence of characters that consists of letters, digits, underscores (_), and dollar signs ($).
  • An identifier must start with a letter, an underscore (_), or a dollar sign ($). It cannot start with a digit.
  • An identifier cannot be a reserved word. (See Appendix A, “Java Keywords,” for a list of reserved words.)
  • An identifier cannot be true, false, or null.
  • An identifier cannot be a keyword.
  • An identifier can be of any length.
  • An Identifier should have its data type.

Examples of valid variables declaration 

double radious=1.0;
double area=radious*radious*3.14159;
String data="Hello Identifier";
int value=30;
int roll_no=1001;
String permanent_add;

Examples of invalid variables declaration 


double 1radious=1.0;
double @area=radious*radious*3.14159;
String da.ta="Hello Identifier";
int val&ue=30;
int roll#no=1001;
String permanent*add;