PHP – HTML5

August 18, 2016 Leave a comment

 

PHP

Starting with PHP 5, the object model was rewritten to allow for better performance and more features. This was a major change from PHP 4. PHP 5 has a full object model.

features in PHP 5 are the inclusions of visibility, abstract and final classes and methods, additional magic methods, interfaces, cloning and typehinting.

PHP treats objects in the same way as references or handles, meaning that each variable contains an object reference rather than a copy of the entire object. See Objects and References

Features

Visibility : The visibility of a property or method can be defined by prefixing the declaration with the keywords public, protected or private.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

HTML

How do you improve the performance of a website.

  1. code unification :Each CSS file must be loaded before the page can be displayed in an internet browser.
  2. compress css and javascript files:We can compress a CSS file by removing unnecessary spaces, comments,
  3. Using sprite images instead of multiple images
  4. Always put javascripts at the bottom of the page.

What is bootstrap ?

Bootstrap is CSS framework for developing responsive, mobile first projects on the web. Current version of bootstrap is v3.3.6.  Bootstrap also comes with two preprocessors: less and saas.

 

Bootstrap uses 12 column grid system. Bootstrap’s grid system is responsive, and the columns will re-arrange depending on the screen size

 

What new features has been added in bootstrap 3?

  1. New Glyphicons icon font!
  2. Smallest file size.
  3. New grid system.
  4. its uses CSS compressors (Less/Saas)

Difference between container and container-fluid in bootstrap?

.container has a max width pixel value, whereas .container-fluid is max-width 100%.

.container-fluid continuously resizes as you change the width of your window/browser by any amount.

.container resizes in chunks at several certain widths, controlled by media queries (technically we can say it’s “fixed width”

because pixels values are specified, but if you stop there, people may get the

impression that it can’t change size – i.e. not responsive.)

 

Tell me latest jquery version ?

Latest version of jquery is  V-3.1.0 (11-8-2016)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Difference between html5 tag and normal tag ?

HTML5 tag are called as semantic tags.

A semantic element clearly describes its meaning to both the browser and the developer.

<article>

<aside>

<details>

<figcaption>

<figure>

<footer>

<header>

<main>

<mark>

<nav>

<section>

<summary>

<time>

 

Difference between live and bind function in jquery.

 

The bind() method attaches one or more event handlers for selected elements, and specifies a function to run when the event occurs.

 

The live() method was deprecated in jQuery version 1.7, and removed in version 1.9. Use the on() method instead.

 

Some new fautures of css3?

 

  1. border-radius (border-radius: 25px;)
  2. box-shadow (box-shadow:3px 3px 3px 2px #797979;)
  3. Text Shadow ( text-shadow: #aaa 2px 2px 2px;)
  4. Multiple Backgrounds

.container {

/* fallback */

background: url(image/bg1.png) no-repeat;

 

/* modern browsers */

background: url(image/bg1.png) 0 0 no-repeat,

url(image/bg2.png) 100% 0 no-repeat;

}

 

 

 

 

 

 

 

 

 

  1. Transition

We can add animation to an element using transition. We need to specify these parameters.

  1. transition-property
  2. transition-duration
  3. transition-timing-function
  4. transition-delay

 

div {

width: 150px;

height: 150px;

background: red;

/* For Safari 3.1 to 6.0 */

-webkit-transition-property: height;

-webkit-transition-duration: 2s;

-webkit-transition-timing-function: ease-in-out;

-webkit-transition-delay: 1s;

/* Standard syntax */

transition-property: height;

transition-duration: 2s;

transition-timing-function: linear;

transition-delay: 1s;

}

 

what is closest in jquery ? What’s the difference between .closest() and .parents(‘selector’)?

.closest() method begins its search with the element itself before progressing up the DOM tree, and stops when current element matches the selector.

.parents() Begins with the parent element, get the parent of each element in the current set of matched elements

What is json?

JSON stands for JavaScript Object Notation. JSON is language independent, lightweight data interchange format. JSON data is written as key value pairs.

Eg :”name”:”Selva”

Explain position property in css?

The CSS positioning properties allow you to position an element. There are four different positioning methods: Static, Fixed, relative, absolute.

 

 

 

Difference between $(this) and this in jquery?

Keyword ‘this’ is a native DOM element. $(this) is a jQuery object that allows you to call functions such as .addClass() on it.

Will HTML5 canvas supported in IE ?

HTML5 canvas is not supported in IE version less than 9. ExplorerCanvas(excanvas) a JS library is the option to render HTML5 canvas for IE6, 7, and 8.

what is jsonp?

JSONP is nothing but JSON with padding. JSONP is mostly used in RESTFull APIs(Cross domain request). JSONP is a simple trick to overcome XMLHttpRequest same domain policy. (As you know one cannot send AJAX (XMLHttpRequest) request to a different domain.). JSONP request appends the callback function with URL. Eg: http://www.abcs.com/example.php?callback=simplecallback

Whenever the server receives the callback it will return the data. The data can be accessed using that call back function.

A simple implementation of JSONP request.

//

(function() {

var flickerAPI = “http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?&#8221;;

$.getJSON( flickerAPI, {

tags: “mount rainier”,

tagmode: “any”,

format: “json”

})

.done(function( data ) {

$.each( data.items, function( i, item ) {

$( “” ).attr( “src“, item.media.m ).appendTo( “#images” );

if ( i === 3 ) {

return false;

}

});

});

})();

// ]]>

 

 

 

How do you create a simple plugin in jquery?

Sample plugin creation code is given below:

(function($){

$.fn.showLinkLocation = function() {

return this.filter(‘a’).each(function(){

$(this).append(

‘ (‘ + $(this).attr(‘href’) + ‘)’

);

});

};

}(jQuery));

 

// Usage example:

$(‘a’).showLinkLocation();

 

List out some CSS Frameworks for creating responsive templates?

Bootstrap

-> Bootstrap is mobile first framework. It includes predefined classes for easy layout options, as well as powerful mixins for generating more semantic layouts.

 

Foundation 3

-> Foundation 3 is built with Sass, a powerful CSS preprocessor. “Pricing Tables” is an interesting componenet in foundation 3. Pricing tables are suitable for marketing site for a subscription-based product. It also offers super cool features like Right-to-left text direction support.

 

Skeleton

Skeleton is a small collection of CSS files that can help to rapidly develop sites that look beautiful at any size, be it a 17″ laptop screen or an iPhone.

 

YAML 4

YAML 4 is built on SAAS. You can check the documentation in the above link.

 

ResponsiveAeon

Responsive Aeon is a simple, fast, Intuitive css framework. It contains almost 120 lines of code and only 1kb minified.

 

 

 

 

 

What is the difference between canvas and svg?

<canvas> is an HTML element which can be used to draw graphics using JavaScript. This can be used to draw graphs, create animations etc.

The <canvas> element is not supported in older browsers, but is supported in recent versions of all major browsers.

The default size of the canvas is 300 px × 150 px (width × height). But custom sizes can be defined using the HTML height and width property.  The declaration is as follows.

<canvas id=”animate” width=”250″ height=”250″></canvas>

SVG stands for Scalable Vector Graphics (SVG) is based on XML markup language, for describing 2D vector graphics.

Can you explain the difference between cookies, sessionStorage and localStorage.?

LocalStorage stores data with no expiration date, and gets cleared only through JavaScript, or clearing the Browser Cache / Locally Stored Data – unlike cookie expiry.

Local storage and session storage are perfect for non sensitive data. The data stored in localStorage and sessionStorage can easily be read or changed from within the client/browser

so should not be relied upon for storage of sensitive or security related data within applications.

Data stored in the SessionStorage is only available for the duration of the browser session (and is deleted when the window is closed) – it does however survive page reloads.

In cookie, we can store 4096 bytes of data. Data stored in the cookie can be hacked by the user, unless the site uses SSL. We can also prevent injections like Cross-Site Scripting (XSS)/Script injection using httponly in the header.

Explain about quirks mode?

There are three modes used by the layout engines in web browsers: quirks mode, almost standards mode, and full standards mode.

Quirks mode is turned on when there is no correct DOCTYPE declaration, and turned off when there is a DOCTYPE definition.

However, invalid HTML – with respect to the chosen DOCTYPE – can also cause the browser to switch to quirks mode.

 

 

What is meant by hardware acceleration?

It means the graphical rendering is done on dedicated hardware (your GPU / graphics card) rather than your CPU. Hardware acceleration generally produces more fluid animation.In general you should always enable hardware acceleration as it will result in better performance of your application.

This will usually be a higher frame rate (the number of images displayed per second), and the higher the frame rate, the smoother the animation.

How can you load css resources conditionally?

Using CSS media querises we can load CSS contidionally. If you want to load the stylesheet for the device less than 600px, then you can declare as below.

<link rel=”stylesheet” media=”screen and (min-width: 600px)” href=”small.css”>

This style sheet will only load for screen size less than 600px.

Difference between article and section tag in HTML5. How can you nest them in your document?

The section element represents a generic section of a document or application. A section, in this context, is a thematic grouping of content, typically with a heading.

So basically the section element should contain related information bunched under a common heading.

The HTML5 <article> element represents a complete composition in a web page or web application that is independently distributable or reusable, e.g. in syndication.

This could be a forum post, a magazine or newspaper article, a blog entry, a user-submitted comment, an interactive widget or gadget, or any other independent item of content.

We can nest article inside a section tag and vice versa. This is completely legal interms of HTML5.

What happen when you dont use doctype?

When omitted, browsers tend to use a different rendering mode that is incompatible with some specifications.

Also HTML5 tags such as < article >,< footer >, < header >, < nav >, < section > may not be supported if the Doctype is not declared.

 

 

 

 

What are data- attributes good for?

The data-* attributes is used to store custom data related to the page or application.The custom data can be used in JavaScript to complete events or animations.

Which set of definitions, HTML attributes or CSS properties, take precedence?

CSS properties take precedence over HTML attributes. If both are specified, HTML attributes will be displayed in browsers without CSS support but won’t have any effect in browsers with CSS support.

How do I eliminate the blue border around linked images?

in your CSS, you can specify the border property for linked images:

a img { border: none ; }

However, note that removing the border that indicates an image is a link makes it harder for users to distinguish quickly and easily which images on a web page are clickable.

 

Explain about HTML5 local storage ?

There are two ways to store data in HTML as objects locally :

 

  1. localStorage – store data across session acess
  2. sessionStorage – storing data for current session only

Data will be stored in key/value pair format.

example:

localStorage.empid=”420″;

sessionStorage.companyname = “Thiruvarur info tech ”;

 

explain CSS media queries ?

CSS media queries are used to develop responsive templates for different layout of screen, print, mobile , tablet or any other resolutions

 

CSS media queries can be added in 3 ways as like CSS style sheet :

 

Internal stylesheet :  <style type=”text/css”>

@media only screen and (max-width: 600px){

/* rules apply to the device resolution is 480px or less  */

}

</style>

Imported stylesheet :   @import “tablet.css”   (min-width: 800px) and (max-width: 1200px);

External stylesheet:  <link rel=”stylesheet” type=”text/css” href=”deskto.css” media=”screen and (min-width: 1200px), print and (min-resolution: 300dpi)” />

 

 

explain css inheritance ?

Inheritance propagates property values from parent elements to their children. The inherited value of a property on an element is the computed value of the property on the element’s parent element. For the root element, which has no parent element, the inherited value is the initial value of the property.

<div class=”firstClass secondClass thirdClass fourthClass ” > </div >

what is javascript inheritance ?

In simple terms, inheritance is the concept of one thing gaining the properties or behaviours of something else.

Inherited children inherit their parent’s behaviour To say A inherits from B, is saying that A is a type of B.

In JavaScript You must use a special object called prototype.

function Animal() {}; // This is the Animal *Type*

Animal.prototype.eat = function () {

alert(“All animals can eat!”);

};

 

function Bird() {}; // Declaring a Bird *Type*

Bird.prototype = new Animal(); // Birds inherit from Animal

Bird.prototype.fly = function() {

alert(“Birds are special, they can fly!”);

};

The effect of this is that any Birds you create (called an instance of Bird) all have the properties of Animals

var aBird = new Bird(); // Create an instance of the Bird Type

aBird.eat(); // It should alert, so the inheritance worked

aBird.fly(); // Important part of inheritance, Bird is also different to Animal

 

var anAnimal = new Animal(); // Let’s check an instance of Animal now

anAnimal.eat(); // Alerts, no problem here

anAnimal.fly(); // Error will occur, since only Birds have fly() in its prototype

 

explain javascript associative array ?

Associative arrays are where we can associate a key string with a value string

JavaScript objects are also associative arrays.

i.e the property  emp.Name can also be read by calling emp[‘Name’]

We can access each property by entering the name of the property as a string into the array

it refers to accessing the DOM elements of HTML also [as object or associative array]

 

 

 

explain JS Namespace ?

Namespacing is a technique employed to avoid collisions with other objects or variables in the global namespace

and also helps to organize blocks of functionality into easily manageable groups that can be uniquely identified.

JavaScript doesn’t  builtin support of namespacing but using objects and closures we can achieve a similar effect.

javascript Namespacing patterns :

1)    Single global variables :

var myApplication =  (function(){

function(){

/*…*/

},

return{

/*…*/

}

})();

 

2)    Object literal notation :

var myApplication = {

getInfo:function(){ /**/ },

// we can also populate our object literal to support

// further object literal namespaces containing anything

// really:

models : {},

views : {

pages : {}

},

collections : {}

};

 

 

 

 

 

 

3)    Nested namespacing :

var myApp =  myApp || {};

// perform a similar existence check when defining nested

// children

myApp.routers = myApp.routers || {};

myApp.model = myApp.model || {};

myApp.model.special = myApp.model.special || {};

// nested namespaces can be as complex as required

 

4)    Immediately-invoked Function Expressions :

// an (anonymous) immediately-invoked function expression

(function(){ /*…*/})();

// a named immediately-invoked function expression

(function foobar(){ /*..*/}());

// this is technically a self-executing function which is quite different

function foobar(){ foobar(); }

 

5)   Namespace injection :

// define a namespace we can use later

var ns = ns || {}, ns2 = ns2 || {};

// the module/namespace creator

var creator = function(val){

var val = val || 0;

this.next = function(){

return val++

};

 

this.reset = function(){

val = 0;

}

}

creator.call(ns);

 

// ns.next, ns.reset now exist

creator.call(ns2, 5000);

// ns2 contains the same methods

// but has an overridden value for val

// of 5000

 

 

 

 

Type of webservice ?

there are two types of web service….1. SOAP [Simple Object Access Protocol] Webservice and 2. RESTful [REpresentational State Transfer] Webservice.

SOAP is a messaging protocol , REST is a design philosophy , not a protocol.

SOAP:

you define your interface in a .wsdl file, which describes exactly which input parameters are expected and how the return values will look like

there are tools to generate the .wsdl files out of java class hirarchies. JAXB for example

there are also tools to generate java objects/classes as part of eclipse for example (don’t know the name in the moment).

SOAP is very strict. Every request is validatet against the wsdl before processing.

A good but not so easy to start with framework for SOAP WS is Apache CXF

 

REST:  (no hands on experience up to now, feel free to correct and improve😉 ):

a way to access a webserver or web application to retrieve data from or send to it.

it’s only negotiated, how it is accessed.

common is something like this http://server.domain.com/app/type/id=123 to retrieve object of type type with id=123 very intuitive, but no automatic validation of requests.

The main advantages of REST web services are:

  1. Lightweight – not a lot of extra xml markup
  2. Human Readable Results
  3. Easy to build – no toolkits required

SOAP also has some advantages:

  1. Easy to consume – sometimes
  2. Rigid – type checking, adheres to a contract
  3. Development tools

 

 

 

What is namespacing?

In many programming languages, namespacing is a technique employed to avoid collisions with other objects or variables in the global namespace. They’re also extremely useful for helping organize blocks of functionality in your application into easily manageable groups that can be uniquely identified.Namespacing Fundamentals

  1. Single global variables
  2. Object literal notation
  3. Nested namespacing
  4. Immediately-invoked Function Expressions
  5. Namespace injection

 

Single global variables

One popular pattern for namespacing in JavaScript is opting for a single global variable as your primary object of reference. A skeleton implementation of this where we return an object with functions and properties can be found below:

var myApplication =  (function(){

function(){

/*…*/

},

return{

/*…*/

}

})();

Object literal notation

Object literal notation can be thought of as an object containing a collection of key:value pairs with a colon separating each pair of keys and values. It’s syntax requires a comma to be used after each key:value pair with the exception of the last item in your object, similar to a normal array.

var myApplication = {

getInfo:function(){ /**/ },

// we can also populate our object literal to support

// further object literal namespaces containing anything

// really:

models : {},

views : {

pages : {}

},

collections : {}

};

 

 

One can also opt for adding properties directly to the namespace:

myApplication.foo = function(){

return “bar”;

}

myApplication.utils = {

toString:function(){

/*..*/

},

export: function(){

/*..*/

}

}

 

  1. Nested namespacing
  2. Immediately-invoked Function Expressions (IIFE)s
  3. Namespace injection

 

  1. Explain about css specificity

 

  1. what is the use of box shadow and tell me the syntax.

 

  1. how to acheive rounded corners in css3.

 

  1. How will you improve the performance of a website.

 

  1. What is the use of sprite images.

 

  1. What are the different font formats and how will you include in your css stylesheet.

 

  1. What is responsive web page layout.

 

  1. What is fluid layout and advantages of it ?

 

  1. What do you know about css animations. Will you do css3 animation if we give google access?

 

  1. what are the css frameworks you know. have you ever used any css frameworks like LESS SAAS?

 

 

 

 

 

 

 

 

 

  1. Difference between HTML4 and HTML5?

 

  1. What is the use of canvas ? have you ever used it.

 

  1. What is the main difference between canvas and svg?

 

  1. What are semantic tags in html5. What is the main advantage of it.

 

 

 

  1. How will you add a jquery to your page.

 

  1. What is the diiference between javascript and jquery?

 

  1. Tell me the difference between document.ready and onload function in jquery?

 

  1. how can u apply css in jquery?

 

  1. Can you dynamicaaly add a div using jquery ?

 

  1. What are filters in jquery?

 

  1. What is an anonymous function in jquery and how will you define it?

 

  1. Have you ever heared about MVC in javascript?

 

  1. Javascript or Jquery which is faster ?

 

  1. How can you animate using Jquery?

 

  1. Tell me the use of is() , eq() methods in jquery?

 

  1. Why we use index() method in jquery.

 

  1. Tell me jquery.noConflict() method.

 

  1. Have you ever contributed any plugin?

 

  1. Tell me what are the Jquery UI you know. And how can you customize them.?

Back to Yuvan Shankar Raja

August 18, 2016 Leave a comment

Solli Tholaiyen Ma Lyrics From Yakkai

Movie : Yakkai
Song : Solli Tholaiyen Ma Lyrics
Music : Yuvan Shankar Raja
Singer : Dhanush
Lyrics : Vignesh Sivv

Kaana Poona Kadhala
Naana Kenji Kekkuren
Poona Poguthu Kadhala
Solli Tholiyen Ma
Veena Neram Poguthu
En Maanam Kappal Erudhu
Thaana Vandhu Kaadhala
Solli Tholaiyen Ma

Nee Ok Solli Tholanja
Thara Kuthu Poduven
Illa Venam Solla Thuninja
Solo Song ah Paduven

Unakku Wait Panni
En Body Weak Aaguthu
Basement Shake Aguthu
Heart-u Break Aguthu
Loveahh Sollaathathaale
Nenju Lock Aaguthu
Current Illatha
Oor Pola Dark Aguthu

Vaaram Onnula
Kanavula Vandha
Vaaram Rendula
Manasulla Vandha
Moonam Varame
Rathathilayum Neethan
Ada En Maa En Maa

Nalla Pakkura
Koocha Padamanee
Nalla Illikira
Loveh Solla Mattum
Yenma Moraikkura
Sariye Illamaa
Ada Poo Ma Poo Maa

No No Summa Sonnenamma
Unakkaga Poranthavan
Nan Mattum Thanma
Un Kooda Vazhave
Thinam Thorum Saguren
Kaapathu Kadhala
Solli Tholaiyenma

Poona Poguthu Kadhala
Solli Tholiyen Ma

Unakku Wait Panni
Wait Panni
Wait Panni
Unakku Wait Panni
En Body Weak Aaguthu
Basement Shake Aguthu
Heart-u Break Aguthu
Loveahh Sollaathathaale
Nenju Lock Aaguthu
Current Illatha
Oor Pola Dark Aguthu

 

PHP Access Modifiers

PHP access modifiers are used to set access rights with PHP classes and their members that is the functions and variables defined within the class scope. In PHP, there are some keywords representing these access modifiers. These keywords will be added with PHP classes and its members.

PHP keywords as Access Control Modifiers

Now, let us have a look into the following list to know about the possible PHP keywords used as access modifiers.

  1. public – class or its members defined with this access modifier will be publicly accessible from anywhere, even from outside the scope of the class.
  2. private – class members with this keyword will be accessed within the class itself. It protects members from outside class access with the reference of the class instance.
  3. protected – same as private, except by allowing sub classes to access protected super class members.
  4. abstract – This keyword can be used only for PHP classes and its functions. For containing abstract functions, a PHP class should be an abstract class.
  5. final – It prevents sub classes to override super class members defined with final keyword.

Access modifiers Usage with PHP Classes, Class Members

Based on the possibility of applying the above list of PHP access modifiers, we can classify them. The following tabular column specify which keyword could be applied where in classes,functions or methods.

Access modifier classes functions variable
public Not Applicable Applicable Applicable
private Not Applicable Applicable Applicable
protected Not Applicable Applicable Applicable
abstract Applicable Applicable Not Applicable
final Applicable Applicable Not Applicable

public Access Modifier

Before introducing access modifiers in PHP, all classes and its members are treated aspublic by default. Still, for PHP classes without specifying any access modifiers, then it will be treated as public.

If we specify public,private or protected for a PHP class, then it will cause parse error. For example, if we define a class as,

public class  {
...
...
}

Then, the following parse error will be displayed to the browser.

Parse error: syntax error, unexpected 'public' (T_PUBLIC) in ...

Similarly, class functions without any access modifiers, will be treated as public functions. But, it is good programming practice to specify those functions as public for better understanding.

Unlike PHP classes and functions, we need to specify access modifiers for PHP class variables explicitly. For example, the following code is invalid, which will cause PHP parse error.

class Books {
$categories = array("puzzles","pull back","remote","soft");
...
}

And, the valid code for defining classes with public variables are follows.

class Books {
public $categories = array("puzzles","pull back","remote","soft");
...
}

private Access Modifier

We can state this keyword only for class variables and function, but not for class itself, as like as public modifier. PHP class members defined as private cannot be accessed directly by using its instance. For example,

class Books {
private $categories = array("puzzles","pull back","remote","soft");

public function getbooksCategories() {
return $this->categories;
}
}
$objbooks = new Books();
print "<pre>";
print_r($objbooks->categories); // invalid
print_r($objbooks->getbooksCategories());
print "</pre>";

In the above program, Books class contains an private variable and a public function. Accessing this private variable by using Books class instance with the line,

print_r($objbooks->categories); // invalid

will cause PHP fatal error as,

Fatal error:  Cannot access private property Books::$categories in ...

But we can access class private variables via any public function of that class. In the above program we are getting the elements of $categories array variables via getbooksCategories() function defined as public.

Note that, all members of a class can be access within the class scope by using $this variable.

protected Access Modifier

This keyword is used in a PHP program which is using PHP inheritance. And, it is used to prevent access for PHP classes and its members from anywhere, except from inside the class itself or from inside its subclasses.
With this keyword, PHP classes and its members functions cannot be access directly from outside the classes and their subclasses, with the references of their instance.

Consider the following PHP program.

<?php
class Books {
protected $categories = array("puzzles","pull back","remote","soft");
protected $books = array(array("name"=>"Mechanical books","category"=>"pull back"),
array("name"=>"Jigsaw","category"=>"puzzles"),
array("name"=>"HiTech","category"=>"mech"),
array("name"=>"Teddy","category"=>"soft"),
array("name"=>"Baby","category"=>"soft"),
array("name"=>"Chinese","category"=>"puzzles"),
array("name"=>"Electronic","category"=>"remote"));
protected function getBooks() {
for($i=0;$i<count($this->nooks);$i++) {
$books_list[] = $this->books[$i]["name"];
}
return $books_list;
}
protected function getBooksByCategory($category) {
for($i=0;$i<count($this->books);$i++) {
if($this->books[$i]["category"]==$category) 
$books_list[] = $this->books[$i]["name"];
}
return $books_list;
}
}

class SoftBooks extends Books {
protected $category = "soft";
function getBooks() {
return $this->getBooksByCategory($this->category);
}
}

$objBooks = new Books();
$objSoftBooks = new Softbooks();
print "<pre>";
/**Invalid
print_r($objBooks->categories);
print_r($objSoftBooks->categories);
print_r($objBooks->getBooks());*/
print_r($objSoftBooks->getBooks());
print "</pre>";
?>
Categories: selvabalaji

Google Introduces Search Engine Apps : Springboard

springerboard

Springboard is designed and marketed towards business and enterprise users of Google’s productivity apps — particularly those that have to regularly sort and search through large numbers of documents and files.

Within the same announcement Google also announce a significant upgrade to Google Sites, which is a tool designed by the company for creating web pages. The update will allow users to easily pull in information from other Google apps, and features all fully responsive designs for all of its layouts.

Both Springboard and the upgrade to Sites are currently being tested amongst a select group of users in Google’s early adopter program. If you’re interested in getting an early look at Springboard you can sign up here. An official public release date was not mentioned in the announcement.

Overview of HADOOP

When we look into the structure of this framework , we find that it is divided into HDFS and MapReduce.
The two hands of Hadoop framework
i.e. HDFS and MapReduce are Hadoop Distributed File System- the storage hand and the processing hand respectively. This skeleton divides the total data into smaller blocks and circulate them in assemblage through the junctions called nodes in the network. The JAR is sent to the nodes where the data needs to be worked on. Here the nodes responsible for those data residing near them work faster in transferring them.

big-data
Hadoop  carries  four programs  of  study.

They  are :
-> Hadoop Common
-> HDFS
-> Hadoop YARN
-> Hadoop MapReduce

1. Hadoop common acts as the information centre that contains the collections of Hadoop libraries.
2. HDFS is the storage part of high band of frequencies.
3.The YARN organizes the properties that line up the user’s function in an assemblage.
4.MapReduce is the processor that processes all sets of data.

Hadoop is such a frame that can store and circulate huge data files without minimum error. Hence it is highly scalable.

1.This software costs very less for storing and performing computations on data in comparison with the traditional databases.
2.Accessing with different kinds of business solution data is done by Hadoop with ultimate comfort. It has been proving to be its best in decision making.
3.It helps in social media, emailing, log processing, data warehousing, error detection etc.
4. Since it maps the data wherever it is placed so Hadoop takes very less time in order to unfold any data. It hardly takes an hour to work on large petabytes of data. Hene, it is super fast.

Hence, the companies using Hadoop are able to gain far better insights. Whenever a data block goes from one node to another in the assemblage of the network, each  block gets copied to each node and even if the data is lost, we will always be having a backup copy of it. Hence, fault occurrence is really very low.

 

Retrieving Google Analytics Data to Build a KPI Dashboard

October 26, 2015 Leave a comment

Introduction

As we all know, many web projects are created in order to solve particular business needs. Any business requires data on how well it is going, how big the traffic of clients is, how many clients register, etc..

Google Analytics is an industry standard service to collect such data. The site webmaster puts a JavaScript tracker script in the pages to allow Google Analytics to collect the data for every time a page is loaded.

Google Analytics Charts

All that is done on front-end site, no PHP code is involved. In this article I cover retrieving access statistics data from Google Analytics using PHP.

Retrieving Google Analytics Data to Build a KPI Dashboard

Project owners and investors might need a dashboard or KPI progress page. Let’s see how to grab statistics from your Google Analytics account to s PHP backend in order to build a dashboard.

There are many statistics that represent the heartbeat of your project: number of visitors, bounce rate, percent of registrations, profit from every user, etc. These are called KPIs: the key performance indicators, each of which is a business metric used to evaluate factors that are crucial to the success of an organization.

KPIs differ from one company to another.  Some of these indicators can be seen in original Google Analytics reports: how many people came and how engaged they are in average. What your customer might want is to combine that data with revenue and profit data from your database and build a solid dashboard.

At this point you will realize that you need to retrieve Google Analytics data from your PHP scripts.
Hold on, Google Analytics is a complex data source, —entries can be queried by date and name.

You will find an couple of classes below that help to automate interaction with this service and return a simple number as result of your query. The code is based on Zend Framework 1, since it helps a lot to automate interaction with Google services (a technology called GData).

First, let’s create an abstract class to help us create classes to work with different Google Services (just replace XXX with your app or library name)

<?php

class XXX_Google_Wrapper_Abstract {

    public $gdClient; 
    
    protected $_listFeedsUrl;
    protected $_dataUrl;
    
    /**
     * Constructor for the class. Takes in user credentials and
     * generates the the authenticated client object.
     *
     * @param  string $email    The user's email address.
     * @param  string $password The user's password.
     * @return void
     */
    public function __construct( $email, $password, $service) {
        $client = Zend_Gdata_ClientLogin :: getHttpClient( $email, $password, $service);
        $this->gdClient = new Zend_Gdata( $client );
    }

    protected function __fetch($url) {
        $query = new Zend_Gdata_Query($url);
        $feed = $this->gdClient->getFeed($query);
        return $feed;
    }
    
    public function listFeeds() {
        return $this->__fetch($this->_listFeedsUrl);
    }
    
    public function fetchItems(array $params) {
        $url = $this->_dataUrl . '?' . http_build_query($params);
        return $this->__fetch($url);
    }
}

Now, we can use this parent class to create a class to work with Google Analytics:

<?php

class XXX_Google_Wrapper_Analytics extends XXX_Google_Wrapper_Abstract {
    protected $_listFeedsUrl = 'https://www.google.com' . '/analytics/feeds' . '/accounts/default';
    protected $_dataUrl = 'https://www.google.com' . '/analytics/feeds/data';
        
    public function __construct( $email, $password) {
        parent::__construct( $email, $password, 'analytics');
    }   
}

Both classes must be placed anywhere where your scripts can automatically load them. Zend Framework provides a simple naming convention to make it work automatically.

Google Analytics data is very flexible — e.g., you can grab total visits count, or visits of a page that contains a particular keyword in its URL. So we need one more abstract class, that we will use our Google Analytics wrapper to access any kind of required data:

<?php
abstract class Stats_Google_Analytics_Abstract {
    protected static
        $_wrapper,
        $_reportID;
    protected $_page;
        
    public function __construct() {
        
        if (!empty(self::$_wrapper)) return true;
        
        $config = Zend_Registry::get( 'config' ) -> toArray();
        $analyticsConfig = &$config[ 'google' ][ 'analytics' ];
        
        $email    = $analyticsConfig['email'];
        $password = $analyticsConfig['password'];
        self::$_reportID = $analyticsConfig['report']['id'];
        
        try {
            self::$_wrapper = new Sunny_Google_Wrapper_Analytics( $email, $password);
        }
        catch(Zend_Gdata_App_AuthException $e) {
            error_log( 'Zend_Gdata_App_AuthException: ' . $e->getMessage() );
            throw $e;
        }
    }
    
    public function fetchValue( $startDate, $endDate = null, array $additionalParams = null) {
        $list = $this->fetchAll( $startDate, $endDate, $additionalParams );
        $sum = array_sum($list);
        return $sum;
    }
    
    public function fetchAll($startDate, $endDate=null, array $additionalParams = null) {
        if (empty( $endDate )) {
            $endDate = $startDate;
        }
        $params = $additionalParams;
        $params['start-date']   = date('Y-m-d', strtotime( $startDate ));
        $params['end-date']     = date('Y-m-d', strtotime( $endDate ));
        $params['ids']          = self::$_reportID;
        
        try {
            $result = self::$_wrapper->fetchItems( $params );
        }
        catch(Exception $e) {
            error_log('Exception: ' . $e->getMessage());
            throw $e;
        }
        $dimensions = array();
        foreach ($result as $entry) {
            $extensions = $entry -> getExtensionElements();
            $attrs = array();
            foreach ($extensions as $extension) {
                $attributes = $extension -> getExtensionAttributes();
                $attrs[ $extension->rootElement ] = $attributes;
                $value  = $attributes[ 'value' ][ 'value' ];
                ${$extension -> rootElement} = $value;
            }
            
            if (empty($dimension)) {
                $dimension = null;
            }
            $dimensions[ $dimension ]  = $metric;
        }
        return $dimensions;
    }
    /**
     * Returns amount of unique visitors in the given time period
     * @param string $fromDate
     * @param string $toDate
     * @return int
     */
    public function count( $fromDate, $toDate = null) {
        $params = array(
            'metrics'       => 'ga:visits',
        );
        
        if (!empty($this->_page)) {
            $params['filters'] = 'ga:pagePath=~/'.$this->_page.'/*';
        }
        
        return $this->fetchValue( $fromDate, $toDate, $params );
    }
}
To make it work, your Zend Framework configuration file must include these settings:
google.analytics.email      = your@email.com
google.analytics.password   = YourPassword
google.analytics.report.id  = ga:12345
OK, all is ready. Let’s create a class to grab statistics about all page views from your account:
<?php

//yes, it's an empty class since everything is defined in the abstract class
class Stats_Google_Analytics_Visit_Total extends Stats_Google_Analytics_Abstract {
}

$startDate = '2014-01-01';
$endDate = '2015-10-15';
$tracker = new Stats_Google_Analytics_Visit_Total;
echo $tracker->count( $startDate, $endDate );
This how to count pages that contain ‘/admin/’ in their URL:
<?php

class Stats_Google_Analytics_Visit_Admin extends Stats_Google_Analytics_Abstract {

    protected $_page = 'admin';
}


$tracker = new Stats_Google_Analytics_Visit_Admin;
echo $tracker->count($startDate, $endDate);
As you can see, it’s that easy!
Categories: selvabalaji

INTERESTING PAGES IN FACEBOOK

March 15, 2014 Leave a comment

We use Facebook to share our toughs(whats on your mind??) , there are many important pages by Facebook to be noted.

# News room home page: link

FB

# KeyFacts: link

The Key factor mentions recent statistics, about the company, no.of employees, Board members and Head quarters for Facebook. It displays all the statistics about the Facebook report and statistical data til last quarter of the year.

# Products of Facebook: link

Th product of Facebook is been listed in product page these ‘n’ number of product is been used by Facebook. The tab is been included with products, timelines, group research, photo , videos and messenger.

#Photos and Broll: link

The Important photos events of particulars is been made album and released in this link.

# Developer Page in Facebook: link

If you are keen interested in developing an apps for Facebook this page is right for you. And get more announcements in this page by the Facebook CEO on the right corner (connected to Facebook blog).

# Carrier @ Facebook: Link

Search job in Facebook based on  countries and job search. This page is really interesting to learn about the responsibilities and requirements on described job position.

# Help @ Facebook: Link 

%d bloggers like this: