Friends

Signed HTTP Request


What are signed HTTP requests?

Signed HTTP requests are simply a normal HTTP request, such as a GET or a POST, that happens to include a signature as part of the request.  A signature is just a string of characters generated in a meaningful way.  This signature can be used by the receiving party (ie. a REST service) to validate the request and ensure that it hasn't been tampered with.

MySql Interview Questions

Locking types
1. Internal locking - performed within the MySQL server itself to manage contention for table contents by multiple threads. This type of locking is internal because it is performed entirely by the server and involves no other programs.
2. External locking occurs when the server and other programs lock MyISAM table files to coordinate among themselves which program can access the tables at which time
MySQL uses table-level locking for MyISAMMEMORY and MERGE tables, page-level locking for BDB tables, and row-level locking for InnoDB tables.

PHP Interview Questions - II

6. What is meant by MVC (Model View Controller)?
MODEL VIEW CONTROLLER, is a software architecture, currently considered an architectural pattern used in software engineering.
This isolates business logic from presentation logic.
1. The Model represents the application data
2. The View renders a presentation of model data
3. The Controller handles and routes requests made by the client

7.What will be the answer of the following code snippet?

1echo 'Testing ' . 1 + 2 . '45';

Simply you will give the answer as : Testing 345 But the answer is : 245.That is because you can not sum a number with a string. The first part, before the plus mark is a string though there is 1 there. So engine will simply get it as 0 and the latter part as 245. so answer will be 245.

8. What is taxonomy in Drupal ?
We can define any number of vocabularies (category types) and terms (categories). We can config which content types are compatible with which vocabulary and which nodes are belong to which terms. Some important drupal modules: Views, CCK, Path auto, FCK Editor, User points, Flags, Panels, Image cache Views can be used to generate lists of content in various formats. Block is a section in a page (recent posts, news, vote to something, login box, navigation), which is movable to regions (header, footer, content top etc) in a page. Blocks can be configured to show/hide only to certain type of user roles, url patterns or some other advanced criteria.
9.How we can define custom content types? We can install CCK (Content construction kit) module and create content types. We can define the structure of each content type too. 10.What is a node in Drupal? A node is a unit of content. It has a type. Page, News or as Testimonial.


11. What is the difference between  $this  and  self ?

Inside a class definition, $this refers to the current object, while  self  refers to the current class.
It is necessary to refer to a class element using  self , and refer to an object element using  $this .




Next set of questions coming soon.... stay tune..


PHP Interview Questions

1. How to get Browser information ?
Using get_browser() we can get the capabilities of the user's browser. This is done by looking up the browser's information in the browscap.ini file. 

echo $_SERVER['HTTP_USER_AGENT'] . "
\n";
$browser = get_browser();
foreach ($browser as $name => $value) {
echo "$name $value 
\n";
}



2. what is final class?
The class which is mentioned as a "final", can not be inherited. So it's methods can not be overridden.
An abstract class can not be a final class as it needs to be extendable.


3. What is abstract class?
Abstract class is a class which can not be instantiated,contains only abstract methods - only method declarations not definitions. Child class must override the methods which are declared as abstract in parent class. These methods must be defined with same (or less restricted) visibility. Also signature should match.



Following is one of the best examples to explain the use of an abstract class and the behavior of it.
01class Fruit {
02private $color;
03
04public function eat() {
05 //chew
06}
07
08 public function setColor($c) {
09  $this->color = $c;
10 }
11}
12
13class Apple extends Fruit {
14 public function eat() {
15  //chew until core
16 }
17}
18
19class Orange extends Fruit {
20 public function eat() {
21  //peel
22  //chew
23 }
24
}
Now taste an apple
1$apple new Apple();
2$apple->eat();

What’s the taste of it? Obviously it’s apple

Now eat a fruit

1$fruit new Fruit();
2$fruit->eat();

What’s the taste of it? It doesn’t make any sense. does it? Which means the class fruit should not be Instantiable . This is where the abstract class comes into play

1abstract class Fruit {
2 private $color;
3
4 abstract public function eat()
5
6 public function setColor($c) {
7  $this->color = $c;
8 }
9}



4. OverView of Drupal CMS 

Basically, there are 5 main layers in Drupal where information flows,

  1. Data (Node, ETC)
  2. Modules
  3. Blocks and Menus
  4. User Permissions
  5. Template

Data - Base of the system is collection of Nodes. – the data pool

Modules -These are functional plugins that are either part of the Drupal core (they ship with Drupal) or they are contributed items that have been created by members of the Drupal community.

Blocks and Menus - This is the next layer where we find blocks and menus. Blocks often provide the output from a module or can be created to display whatever you want, and then can be placed in various spots in your template (theme) layout. Blocks can be configured to output in various ways, as well as only showing on certain defined pages, or only for certain defined users.

User Permissions - Here is the next layer where settings are configured to determine what different kinds of users are allow to work and see.

Template - This is mainly the site theme or the skin. This is made up predominantly of XHTML and CSS, with some PHP variables intermixed.

5. What are the two new error levels introduced in PHP5.3?

E_DEPRECATED - The E_DEPRECATED error level is used to indicate that a function or feature has been deprecated.

E_USER_DEPRECATED - The E_USER_DEPRECATED level is intended for indicating deprecated features in user code, similarly to the E_USER_ERROR and E_USER_WARNING levels.

5. Explain Late Static binding.


01class A {
02    public function who() {
03        echo __CLASS__;
04    }
05    public function test() {
06        $this->who();
07    }
08}
09
10class extends A {
11    public function who() {
12        echo __CLASS__;
13    }
14}
15$obj new B;
16$obj->test();
Out put of the above snippet is? B This is mainly because we have the object instance named as $this is for the class B, though the function is instantiated inside class A. But, If you need the expected output which is “A”, we can call them statically as follows
01class A {
02    public static function who() {
03        echo __CLASS__;
04    }
05    public static function test() {
06        self::who();
07    }
08}
09
10class extends A {
11    public static function who() {
12        echo __CLASS__;
13    }
14}
15
16B::test();
Out put -> A
Main limitation of self:: or __CLASS__ are resolved using the class in which the function belongs, as in where it was defined. By introducing late static binding this limitation has been resolved as follows,
01class A {
02    public static function who() {
03        echo __CLASS__;
04    }
05    public static function test() {
06        static::who(); // Here comes Late Static Bindings
07    }
08}
09
10class extends A {
11    public static function who() {
12        echo __CLASS__;
13    }
14}
15
16B::test();
Out put -> B


Twitter Delicious Facebook Digg Stumbleupon Favorites More