Tuesday, January 19, 2016

php summary


                                     PHP programming summary

PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages.
Naming Conventions

Classes

Class names may only contain alphanumeric characters. Numbers are permitted in class names but are discouraged in most cases. Underscores are only permitted in place of the path separator; the filename If a class name is comprised of more than one word, the first letter of each new word must be capitalized.

Abstract Classes

bstract classes follow the same conventions as classes, with one additional rule: abstract class names must end in the term, “Abstract”, and that term must not be preceded by an underscore
eg:-
abstract class Abstract
{
    // ...
}

Interfaces

interfaces follow the same conventions as classes, with one additional rule: interface names may optionally end in the term, “Interface”, but that term must not be preceded by an underscore

Filename

For all other files, only alphanumeric characters, underscores, and the dash character (“-”) are permitted. Spaces are strictly prohibited. File names must map to class names as described above

Functions and Methods

Function names may only contain alphanumeric characters. Underscores are not permitted. Numbers are permitted in function names but are discouraged in most cases.
Function names must always start with a lowercase letter. When a function name consists of more than one word, the first letter of each new word must be capitalized. This is commonly called “camelCase” formatting.
These are examples of acceptable names for functions:-
1.filterInput()
 
2.getElementById()
 
3.widgetFactory()

Variables

Variable names may only contain alphanumeric characters. Underscores are not permitted. Numbers are permitted in variable names but are discouraged in most cases.
For instance variables that are declared with the “private” or “protected” modifier, the first character of the variable name must be a single underscore. This is the only acceptable application of an underscore in a variable name. Member variables declared “public” should never start with an underscore. variable names must always start with a lowercase letter and follow the “camelCaps” capitalization convention.

Coding Style

<?php
 
?>

Strings

String Literals

When a string is literal (contains no variable substitutions), the apostrophe or “single quote” should always be used to demarcate the string:

String Literals Containing Apostrophes

eg:-
     $sql = "SELECT `id`, `name` from `people` "
     . "WHERE `name`='Fred' OR `name`='Susan'"

String Concatenation

Strings must be concatenated using the ”.” operator. A space must always be added before and after the ”.” operator to improve readability
eg:-
$sql = "SELECT `id`, `name` FROM `people` "
     . "WHERE `name` = 'Susan' "
     . "ORDER BY `name` ASC ";

Arrays

An indexed array may start with any non-negative number, however all base indices besides 0 are discouraged.
When declaring indexed arrays with the Array function, a trailing space must be added after each comma delimiter to improve readability:
eg:- $sampleArray = array(1, 2, 3, 'Zend', 'Studio');
Alternately, the initial array item may begin on the following line. If so, it should be padded at one indentation level greater than the line containing the array declaration, and all successive lines should have the same indentation; the closing paren should be on a line by itself at the same indentation level as the line containing the array declaration:

Associative Arrays

hen declaring associative arrays with the Array construct, breaking the statement into multiple lines is encouraged. In this case, each successive line must be padded with white space such that both the keys and the values are aligned:
$sampleArray = array('firstKey'  => 'firstValue',
                     'secondKey' => 'secondValue');

Classes

The brace should always be written on the line underneath the class name.
Every class must have a documentation block that conforms to the PHPDocumentor standard.
All code in a class must be indented with four spaces.
Only one class is permitted in each PHP file.
Placing additional code in class files is permitted but discouraged. In such files, two blank lines must separate the class from any additional PHP code in the class file.
/**
 * Documentation Block Here
 */
class SampleClass
{
    // all contents of class
    // must be indented four spaces
}
class SampleClass extends FooAbstract implements BarInterface
{
}

Class Member Variables

 
Member variables must be named according to Zend Framework’s variable naming conventions.
Any variables declared in a class must be listed at the top of the class, above the declaration of any methods.

The var construct is not permitted. Member variables always declare their visibility by using one of the private, protected, or public modifiers. Giving access to member variables directly by declaring them as public is permitted but discouraged in favor of accessor methods (set & get).

functions and Methods

Function and Method Declaration


Functions must be named according to Zend Framework’s function naming conventions.
Methods inside classes must always declare their visibility by using one of the private, protected, or public modifiers.
As with classes, the brace should always be written on the line underneath the function name. Space between the function name and the opening parenthesis for the arguments is not permitted.
Functions in the global scope are strongly discouraged.
eg:-
/**
 * Documentation Block Here
 */
class Foo
{
    /**
     * Documentation Block Here
     */
    public function bar()
    {
        // all contents of function
        // must be indented four spaces
    }
}

Control Statements

Control statements based on the if and elseif constructs must have a single space before the opening parenthesis of the conditional and a single space after the closing parenthesis.
Within the conditional statements between the parentheses, operators must be separated by spaces for readability. Inner parentheses are encouraged to improve logical grouping for larger conditional expressions.
The opening brace is written on the same line as the conditional statement. The closing brace is always written on its own line. Any content within the braces must be indented using four spaces.
if ($a != 2) {
    $a = 2;
}

Switch

Control statements written with the “switch” statement must have a single space before the opening parenthesis of the conditional statement and after the closing parenthesis.
All content within the “switch” statement must be indented using four spaces. Content under each “case” statement must be indented
switch ($numPeople)
 {
    case 1:
        break;
 
    case 2:
        break;
 
    default:
        break;
}



PHP PROGRAMMING PHP programming summary PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. Naming Conventions Classes Class names may only contain alphanumeric characters. Numbers are permitted in class names but are discouraged in most cases. Underscores are only permitted in place of the path separator; the filename If a class name is comprised of more than one word, the first letter of each new word must be capitalized. Abstract Classes bstract classes follow the same conventions as classes, with one additional rule: abstract class names must end in the term, “Abstract”, and that term must not be preceded by an underscore eg:- abstract class Abstract { // ... } Interfaces interfaces follow the same conventions as classes, with one additional rule: interface names may optionally end in the term, “Interface”, but that term must not be preceded by an underscore Filename For all other files, only alphanumeric characters, underscores, and the dash character (“-”) are permitted. Spaces are strictly prohibited. File names must map to class names as described above Functions and Methods Function names may only contain alphanumeric characters. Underscores are not permitted. Numbers are permitted in function names but are discouraged in most cases. Function names must always start with a lowercase letter. When a function name consists of more than one word, the first letter of each new word must be capitalized. This is commonly called “camelCase” formatting. These are examples of acceptable names for functions:- 1.filterInput() 2.getElementById() 3.widgetFactory() Variables Variable names may only contain alphanumeric characters. Underscores are not permitted. Numbers are permitted in variable names but are discouraged in most cases. For instance variables that are declared with the “private” or “protected” modifier, the first character of the variable name must be a single underscore. This is the only acceptable application of an underscore in a variable name. Member variables declared “public” should never start with an underscore. variable names must always start with a lowercase letter and follow the “camelCaps” capitalization convention. Coding Style Strings String Literals When a string is literal (contains no variable substitutions), the apostrophe or “single quote” should always be used to demarcate the string: String Literals Containing Apostrophes eg:- $sql = "SELECT `id`, `name` from `people` " . "WHERE `name`='Fred' OR `name`='Susan'" String Concatenation Strings must be concatenated using the ”.” operator. A space must always be added before and after the ”.” operator to improve readability eg:- $sql = "SELECT `id`, `name` FROM `people` " . "WHERE `name` = 'Susan' " . "ORDER BY `name` ASC "; Arrays An indexed array may start with any non-negative number, however all base indices besides 0 are discouraged. When declaring indexed arrays with the Array function, a trailing space must be added after each comma delimiter to improve readability: eg:- $sampleArray = array(1, 2, 3, 'Zend', 'Studio'); Alternately, the initial array item may begin on the following line. If so, it should be padded at one indentation level greater than the line containing the array declaration, and all successive lines should have the same indentation; the closing paren should be on a line by itself at the same indentation level as the line containing the array declaration: Associative Arrays hen declaring associative arrays with the Array construct, breaking the statement into multiple lines is encouraged. In this case, each successive line must be padded with white space such that both the keys and the values are aligned: $sampleArray = array('firstKey' => 'firstValue', 'secondKey' => 'secondValue'); Classes The brace should always be written on the line underneath the class name. Every class must have a documentation block that conforms to the PHPDocumentor standard. All code in a class must be indented with four spaces. Only one class is permitted in each PHP file. Placing additional code in class files is permitted but discouraged. In such files, two blank lines must separate the class from any additional PHP code in the class file. /** * Documentation Block Here */ class SampleClass { // all contents of class // must be indented four spaces } class SampleClass extends FooAbstract implements BarInterface { } Class Member Variables Member variables must be named according to Zend Framework’s variable naming conventions. Any variables declared in a class must be listed at the top of the class, above the declaration of any methods. The var construct is not permitted. Member variables always declare their visibility by using one of the private, protected, or public modifiers. Giving access to member variables directly by declaring them as public is permitted but discouraged in favor of accessor methods (set & get). functions and Methods Function and Method Declaration Functions must be named according to Zend Framework’s function naming conventions. Methods inside classes must always declare their visibility by using one of the private, protected, or public modifiers. As with classes, the brace should always be written on the line underneath the function name. Space between the function name and the opening parenthesis for the arguments is not permitted. Functions in the global scope are strongly discouraged. eg:- /** * Documentation Block Here */ class Foo { /** * Documentation Block Here */ public function bar() { // all contents of function // must be indented four spaces } } Control Statements Control statements based on the if and elseif constructs must have a single space before the opening parenthesis of the conditional and a single space after the closing parenthesis. Within the conditional statements between the parentheses, operators must be separated by spaces for readability. Inner parentheses are encouraged to improve logical grouping for larger conditional expressions. The opening brace is written on the same line as the conditional statement. The closing brace is always written on its own line. Any content within the braces must be indented using four spaces. if ($a != 2) { $a = 2; } Switch Control statements written with the “switch” statement must have a single space before the opening parenthesis of the conditional statement and after the closing parenthesis. All content within the “switch” statement must be indented using four spaces. Content under each “case” statement must be indented switch ($numPeople) { case 1: break; case 2: break; default: break; }

Friday, January 15, 2016

Unity 3D manual.
Introduction
1.opening unity 3D
2.a).import character to the scene
b).import geographical assets from asset store
3.code the script to move the character
4.load the game to play
 
1.opening unity 3D
a).Open unity3d software->open new project->name the project and save it .
2.import characters to the scene
a)open window->choose asset store->select character of your choice from the list.
b)click on 3D models and click characters
c)click download ->import ->import all
d)open unity 3D platform then import  character to the scene.
3.code the script to move the character on the scene
right click on assets-> create ->javascripts->name movement.js->open editor then code.save then run.
 



How to connect mysql database with unity3D procedure


how to download and install mysql

> Go to the internet and access for free mysql  through the following link https://dev.mysql.com/downloads/windows/installer/
>  After it has downloaded .Access the file and install in a certain directory
>  After that one can open it and use:-

                                     connect it now with unity3D


>  Open your 3D unity  software
>  create  PHP file in note++ and save it into asset folder in unity3D
 
>code your php file and save it
> Go back to the asset part and create a c# script and name it testmysql.cs and call the php file as follows:->
>  Save it and go back to unity3D platform
> After that you will have your files imported into assets folder
>  Select the main camera and attach the c# scripts that calls the php file
>  play your game and test how it works
> with this concept one can login and enter the his details before  playing anygame and it can be used also to be used to fetch important data.