Wednesday, 24 September 2014

PHP skill test for PHP developers

Que.1 Who is called the father of PHP.

a) Larry Wall 
b)  Rasmus Lerdorf
c)  James Gosling
d)  Guido Van Rossum 


Que.2  What is the difference between print() and echo()?
a)  print() can be used as part of an expression, while echo() cannot.
b) echo() can be used as part of an expression, while print() cannot.
C)  echo() can be used in the CLI version of PHP, while print() cannot.
D)  both A and B

Que. 3  What is input sanitization?
a) Secure user input 
b)  Converting input into a format that PHP supports 
c)  Removing or cleaning potentially malicious user input. 
d)  All of the above
 




Que.4 The output of following script will be..


$somerar=15;

function ad it () {

GLOBAL $somevar;

$somerar++ ;

echo "somerar is $somerar";

}

addit ();

a) somerar is 15
b) somerar is 16
c)  somerar is 1
d)  somerar is $ somerar
Que.5  what will be the ouput of below code ? Assume that today is 2009-5-19:2:45:32 pm
<?php

$today = date("F j, Y, g:i a");
?> 
a) may 19,09,2:45:32 PM
b) May 19, 2009, 2:45 pm
c) May 19,2009,14:45:32 pm
d) May 19,2009,14:45:32 PM

Que. 6 What is the name of function used to convert an array into a string?

a)  explode()
b)  glue()
c)  implode()
D)  None of the above

Que. 7 If property of class is declare using var then PHP5 will treat the property as?
a)  Protected 
b)  Private 
c)  Public
d)  Final

Que. 8  What will be  the output of following script?
  
<?php
$test="3.5seconds";
settype($test,"double");
settype($test,"integer");
settype($test,"string");
print($test);
?> 


a)  3.5
b)  3.5seconds
c) 3
d)  3seconds 

Que.9 What is the name of function used to convert an array into a string?
a)  explode() 
b)  glue()
c)  implode() 
d)  None of the above 

Que. 10  The output of following script will be..

<?php
$x=array(4,2,5,1,4,5,3,4);
$y=array_count_values($x);
echo count($y);
?> 

a) 8
b) 7
c) 5
d) 28

PHP developers : Check your skills

Que.1 Which one of the following PHP functions can be used to build a function that accepts any number of arguments?

a) func_get_argv()
b) func_get_argc()
c) get_argv()
d) get_argc()

Que.2  How many error levels are available in PHP?

a) 14
b) 15
c) 16
d) 17

Que.3 Which of the following statements invoke the exception class?

a) throws new Exception();
b) throw new Exception();
c) new Exception();
d) new throws Exception();

Que.4  Which of the following is/are an external data?

i) Cookies
ii) Input data from a form
iii) Server Variables
iv) Web services data
a) Only ii)
b) ii) and iii)
c) None of the mentioned
d) All of the mentioned

Que.5 The attack which involves the insertion of malicious code into a page frequented by other users is known as..

a) basic sql injection
b) advanced sql injection
c) cross-site scripting
d) scripting

Que.6 hich one of the following statements can be used to establish port 80 connection with www.nachi.com?

a) fsockopen(“www.nachi.com”, 80);
b) sockopen(80,”www.nachi.com”);
c) fsockopen(80,”www.nachi.com”);
d) sockopen(“www.nachi.com”, 80);

Que.7 What is the default value of max_execution_time directive? This directive specifies how many seconds a script can execute before being terminated.

a) 10
b) 20
c) 30
d) 40

Que.8 Which one of the following PHP functions can be used to find files?

a) glob()
b) file()
c) fold()
d) get_file()

Que.9 Say you want to report error concerned about fatal run-time, fatal compile-time error and core error which statement would you use?

a) error_reporting = E_ALL
b) error_reporting = E_ERROR | E_PARSE | E_CORE_ERROR
c) error_reporting = E_ERROR | E_COMPILE_WARNING | E_CORE_ERROR
d) error_reporting = E_ERROR | E_COMPILE_ERROR | E_CORE_ERROR

Que.10 How many predefined exceptions does SPL (Standard PHP Library) provide access to?

a) 13
b) 14
c) 15
d) 16

PHP test : object oriented PHP-1

THEORY


Que. 1 Which method scope prevents a method from being overridden by a subclass?

a) Abstract
b) Protected
c) Final
d) Static
Que.2  PHP recognizes constructors by the name..

a) classname()
b) _construct()
c) function _construct()
d) function __construct()
Que 3  The practice of creating objects based on predefined classes is often referred to as..

a) class creation
b) object creation
c) object instantiation
d) class instantiation
Que.4  The practice of separating the user from the true inner workings of an application through well-known interfaces is known as..

a) Polymorphism
b) Inheritance
c) Encapsulation
d) Abstraction
Que.5  Which version of PHP introduced the instance of keyword?

a) PHP 4
b) PHP 5
c) PHP 5.3
d) PHP 6
PROGRAMS :
Que.1  In the PHP code given below, what is/are the properties?
  1.     <?php
  2.     class Example 
  3.     {
  4.         public $name;
  5.         function Sample()
  6.         {
  7.             echo "This is an example";
  8.         }
  9.     } 
  10.     ?>
a) echo “This is an example”;
b) public $name;
c) class Example
d) function sample()

Que.2  What will be the output of the following PHP code?
  1. <?php
  2. class MyClass
  3. {
  4. }
  5.  
  6. $a = new MyClass;
  7. var_dump(!($a instanceof stdClass));
  8. ?>
a) bool(true)
b) bool(false)
c) Error
d) None of the above


Que. 3  What will be the output of the following PHP code?
  1. <?php
  2. class ParentClass
  3. {
  4. }
  5.  
  6. class MyClass extends ParentClass
  7. {
  8. }
  9.  
  10. $a = new MyClass;
  11.  
  12. var_dump($a instanceof MyClass);
  13. var_dump($a instanceof ParentClass);
  14. ?>
a) bool(false)
bool(false)


b) bool(true)
bool(true)


c) bool(false)
bool(true)


d) bool(true)
bool(false)


Que 4  What will be the output of the following code?
  1.     <?php 
  2.     $foo = 'Bob';              
  3.     $bar = &$foo;              
  4.     $bar = "My name is $bar";  
  5.     echo $bar;
  6.     echo $foo;
  7.     ?>
a) Error
b) My name is BobBob
c) My name is BobMy name is Bob
d) My name is Bob Bob


Que. 5  What will be the output of the following PHP code?
  1. <?php
  2. interface MyInterface
  3. {
  4. }
  5.  
  6. class MyClass implements MyInterface
  7. {
  8. }
  9.  
  10. $a = new MyClass;
  11.  
  12. var_dump($a instanceof MyClass);
  13. var_dump($a instanceof MyInterface);
  14. ?>
a) bool(false)
bool(false)


b) bool(true)
bool(true)


c) bool(false)
bool(true)


d) bool(true)
bool(false)

Test for PHP developer

QUESTIONS  :




Que. 1 Identify the variable scope that is not supported by PHP

 
a. Local variables

b. Function parameters

c. Hidden variables

d. Global variables
 

Que.2 Which of the following functions require the allow-url-fopen must be enabled?

A include()

b. require()

c. both of above

d. None of above

Que 3 On failure of which statement the script execution stops displaying error/warning message?

 

a. rinclude ()

b. require ()

c. both of above

d. None of above

Que 4 Trace the function that does continue the script execution even if the file inclusion fails

a. include ()

b. require ()

c. both of above

d. None of above

Que 5 Which of the following delimiting method is known as string Interpolation

a. delimited by single quote

b. delimited by double quote

c. delimited by <<< identifier

d. All of above

Que. 6 Casting operator introduced in PHP 6 is

a. (array)

b. (int64)

c. (real) or (double) or (float)

d. (object)

Que. .7 When defining identifier in PHP you should remember that

a. Identifier are case sensitive. So $result is different than $ result

b. Identifiers can be any length

c. Both of above

d. None of above

Que . 8 What is the correct way to include the file "time.inc" ? 

a) <!--include file="time.inc"-->

b) <% include file="time.inc" %>

c) <?phpinclude_file("time.inc"); ?>

d) <?php require("time.inc"); ?

Que 9 PHP allows you to send emails directly from a script 

a) True
b) False

Que. 10 .In PHP, the die() and exit() functions do the exact same thing.

a) False

b) True

Que 11 With SQL, how do you select a column named "FirstName" from a table named "Persons"?

 

a) EXTRACT FirstName FROM Persons

b) SELECT Persons.FirstName

c) SELECT FirstName FROM Persons

d) None of these

Que. 12 The HTML ______ tag is used to insert a JavaScript into an HTML page.

a)<scripting>

b)<script>

c)<javascript>

d)None of these

Que. 13 Which SQL keyword is used to sort the result-set?

a) ORDER

b) SORT

c) ORDER BY

d) SORT BY

Que 14 Which event will be occur when user enter or leave the page?

a) OnFocus, OnBlur

b) OnFocus, OnChange

c) OnLoad, OnUnload

d) None of these

Que. 15 Which method is secured for securing data in PHP?

a) $_POST

b) $_GET

c) Both a & b

d) None of these

PHP Practice For WEB DEVELOPMENT

Que. 1. Which of the following is/are true for an abstract class?

 i) A class is declared abstract by prefacing the definition with the word abstract.

ii) A class is declare abstract by using the keyword implements.

iii) It is a class that really isn’t supposed to ever be instantiated but instead serves as a base class.


iv) Attempting to instantiate an abstract class results in an error.


a) Only ii)
b) All of the mentioned
c) ii) and iv)
d) ii), iii) and iv)



Que. 2. If one intends to create a model that will be assumed by a number of closely related objects, which class must be used?


a) Normal class
b) Static class
c) Abstract class
d) Interface



Que. 3. If your object must inherit behavior from a number of sources you must use a/an


a) Interface
b) Object
c) abstract class
d) static class



Que. 4. Which method is used to tweak an object’s cloning behavior?


a) clone()
b) __clone()
c) _clone

d) object_clone()



Que. 5. Which feature allows us to call more than one method or function of the class in single instruction?


a) Typecasting
b) Method Including
c) Method adding
d) Method chaining


Que. 6. Which magic method is used to implement overloading in PHP?


a) __call
b) __invoke
c) __wakeup
d) __unset


Que. 7. Which one of the following statements is true ?

  1. class CopyMe {}
  2. $first = new CopyMe();
  3. $second = $first;
a) In PHP 4: $second and $first are 2 distinct objects
b) In PHP 5: $second and $first are 2 distinct objects
c) In PHP 4: $second and $first refer to one object
d) None of the above





Que. 8. What will be the output of the following PHP code?

  1. class Checkout {
  2.     final function totalize() {
  3.         // calculate bill
  4.     }
  5. }
  6.  
  7. class IllegalCheckout extends Checkout {
  8.     final function totalize() {
  9.         // change bill calculation
  10.     }
  11. }
a) PHP Fatal error: Class Illegal Checkout may not inherit from final class
b) Value of the bill calculated
c) PHP Fatal error: Cannot find object
d) PHP Fatal error: Cannot override final method





Que. 9. __clone() is run on the ___ object.


a) original
b) pseudo
c) external
d) copied




Que. 10. Which keyword is used to put a stop on inheritance?


a) stop
b) end
c) break
d) final

Essential elements for a Website Design


 Great Structure :

 Have you ever been on a website that frustrated you because the layout/design wasn’t intuitive? When designing a website, it is paramount that you make the content easily accessible as well as logically organized so that it’s intuitive for your audience to find the information they are seeking. A poorly structured website, no matter how great the content, will make potential customers click away and on to the competition.

Strong Visual Appeal :

You only have three seconds to capture your audiences’ attention so it is crucial that you have a visually appealing design that your audience can relate to. When planning your site design, remember to think about color theory. The right combinations of color — along with a well-conceived design plan and
elements — will not only demonstrate your brand value, but will also help visitors stay on your site longer.


User-Friendly Navigation :


  Nothing will drive customers away faster than confusing or complicated navigation! Your customers should be able to know where they are on your site at all times, and should easily be able to find pages they've already visited.

A Well-Planned Color Scheme :

There can be a lot of meaning behind colors. Different colors and color combinations can evoke different emotions. When choosing a color scheme for your website, think about how your colors are going to be used and where you want to draw attention. Don’t forget to picture your color choices as a part of the different elements of your website, including the background, navigation, links, and call-to-action buttons.

Interesting and Readable Typography :

What is typography? Simply, it’s the art and technique of arranging type. Typography includes the font family, style, and size of a font. For your body copy, choose a font and size that are easy to read, even in large amounts of text. You can be a little bit more playful with headings and calls to actions. Just remember, the fonts you choose need to be easy for your visitors to read; chances are, if your text is too difficult to read, your visitors are just going to skip over it.

Framework7

Framework7

Framework7 - is a free and open source HTML mobile framework to develop hybrid mobile apps or web apps with iOS native look and feel. It is also an indispensable prototyping apps tool to show working app prototype as soon as possible in case you need to.
The main approach of the Framework7 is to give you an opportunity to create iOS apps with HTML, CSS and JavaScript easily and clear. Framework7 is full of freedom. It doesn't limit your imagination or offer ways of any solutions somehow. Framework7 gives you freedom!
Framework7 is not compatible with all platforms. It is focused only on iOS to bring the best experience and simplicity.
Framework7 is definitely for you if you decide to build iOS hybrid app (PhoneGap) or web app that looks like and feels as great native iOS apps.

Features

Ultra Easy To Use. Not Harder Than Website!

To create iOS apps using Framework7 is so easy as website creation. Try to start and you will be surprised how easy is it. All you need to make it work is a simple HTML layout and attached framework's CSS and JS files! Framework7 doesn't force you to write some custom tags that will be converted by JavaScript to something else. It doesn't force you to write and describe all your content in JavaScript (or JSON). Just plain HTML and you always get exactly the same that you expect to get when you write this HTML.

iOS Specific

As said above Framework7 is iOS specific framework. From the very beginning it was carefully thought-out to give you easy ways to realize all incredible features from all necessary UI elements visualization to complicated animation and touch interactions that characterize the platform. That is why Framework7 is the only solution to realize precisely pixel-perfect iOS native app's interface.

UI Components

Framework7 comes with a bunch of ready to use UI elements and widgets like modals, popup, action sheet, popover, list views, media lists, tabs, side panels, layout grid, preloader (activity indicator), form elements, etc. The awesome point is that you don't need JavaScript at all for the most of mentioned widgets.

Library Agnostic

Framework7 doesn't use and does not depend on any third party libraries. That is why it is ultra lightweight, performance and flexible.

Clear JS API

No need to learn something new With Framework7. It has ultra clear and easy JavaScript API methods to control every part of your app. For example, if you need to call alert modal you just do app.alert('Hello World!')

High-performance Animation

It is all about performance and Framework7 uses only high performance hardware accelerated css animations and transitions to achieve the best result.

Pages Animation

One of the main target of Framework7 is to have native look and feeling of iOS7 application. And Framework7 is the only framework that solves it and offers 1:1 page animation with smooth parallax effect, changing opacity and shadow when loading new page.

Swipe Back

One of Framework7' killing feature is supporting of iOS well known swipe back gesture from left border of screen when you want to get to the previous page. It simply works, and works perfectly as you expect it to do. Just swipe from left (or drag with mouse) area of the page to see smooth transition to the previous page. It is not just A-B transition. It really follows your finger with parallax animation while touch!

Dynamic Navbar

As was mentioned already Framework7 makes everything to give you a feel of native iOS app. And one of the significant feature that improves this feeling is the dynamic navigation bar (navbar). You can see how its elements sliding and fading during pages transition and when you swipe back.

Native Scrolling

It can sound even curious but one of the most important Framework7 feature is that it uses only native scrolling. Moreover - it multiplies its advantages! So you can still have this awesome scrolling with momentum and resistance bounce without any scrolling issues!

Pull To Refresh

Framework7 is probably the first and only framework that has this great feature realized on pure native scrolling! That is why pull to refresh behavior is perfect as possible and works totally equal in many native iOS apps!

Swipe To Delete

Do you remember how you swipe left on the message in the Mail app if you want to delete it? Yep, Framework7 has totally the same functionality for any list elements, with the same smooth animation and touch interaction!

Messages

Framework7 comes with great realized "messages" widget that you can easily customize and integrate into your app for messaging between users or devices using some realtime sync data service like Realtime Framework or Firebase.

Multiple Views (Split View)

Framework7 supports unlimited number of different isolated views. And the fun thing is that you can easily control each single view without any line of JavaScript just using "data-view" attribute on links.

XHR + Caching + History + Preloading

This is an unbeatable combination to make your app routing as perfect as possible. Framework7 is ready to route your app pages using XHR (Ajax) with its own internal methods and internal HTML configurable caching that allow to load pages faster and save a lot of time and traffic for your users! It loads page via Ajax only ones per specified caching period (10 minutes by default), other times it just gets it from memory. It allows to make further requests immediately!
Navigating deeper and deeper you may face a problem about how to get back in the same order? Framework7 solves this problem by collecting own navigation history. It is especially good if your users may come to the same page from different routes. And with Framework7 it is enough just to add "back" class to your link and it will recognize what page to load and will do other job for you.
Framework7 automatically preloads previous page (when available) so your users can always do the nice swipe back gesture to get that page immediately.

Easy To Customize

With Framework7 everything is simple, all styles are divided by parts into small .less files, so you can really easy bring your own custom styles to your app.

Custom Dom Library

As said above Framework7 doesn't use any third party library, even for DOM operation, even jQuery. It has its own custom DOM library that utilizes most edge and high-performance methods for DOM manipulation. You can also use it and you don’t need to learn something new for that, it has the same syntax as well known jQuery library with support of the most popular and widely used methods and jQuery-like chaining.
Facebook

cake PHP a framework of PHP ...

cake PHP is an open-source application framework written  in PHP . cake PHP was  started in April 2005 by Michal Tatarynowicz...

it is a fundamental structure for programmers to create web applications...

it was intended to developing and maintaining application easier...

cake PHP offers many useful design patterns like model-view-controller (MVC) patterns,which is used in other popular framework like ruby..

It also provides reusable libraries for dealing with common tasks...

Why we use cake PHP....

Compatible - compatible with both PHP-4 and PHP-5.

Flexible - Support for MySQL, PostgreSQL SQLite, PEAR-DB and wrappers for  ADODB, a database abstraction library.

Time saving - presence of Scaffolding.

SEO friendly - Search Engine Friendly URLS 

Clean MVC conventions - comes with a set of conventions to guide you in development of your application.

                     cake PHP can Works from any web site directory, with little to no Apache configuration involved.

How useful are web application frameworks? & How do I know which framework would suit me?

For non-technical background people; framework is a bunch of libraries, tools that do common task in web development and it aims to ease the common activities which have to perform in web development. Using appropriate framework is essential for a developer because it saves an important time and efforts for building an app. Most of the applications have a common set of functionality such as handling session data validation etc. and web framework prevent a developer from re-writing every time a same code to create a web app.The purpose of framework is to allow designers and developers to focus on building an unique feature for their web based projects rather than re-inventing by coding. Framework is specially created to help you boost the performance and efficiency of your web app development task. They are equipped with fascinating features such as templates and session management and database access libraries. Depending on your convenience and task you can select from vast range of framework offered in the market. Each framework can provide you with extended choice of web app features which provides a very less error-prone app. In simple way framework helps in the prototyping, design and implementation stages of the app development lifecycle and also simplifies ongoing maintenance and enhancement of a web app.

Let’s see when you feel need of a web framework:
->When your web app is based on CRUD cases.
->When you need a proper separation of the UI and understanding logic but don’t have time to implement a system.
->When you find yourself having self-made libraries you use in each of your covering user authentication, session and other usual operations associated with creating a web app
->When you are focused to create a CMS in a very short time and you already know the framework

But, how web frameworks are useful?
Actually web frameworks are very useful and in many ways they help web developers to build a web app by providing different functions and features. Following are the aspect which shows how frameworks are beneficial:
>>Saves time:
Biggest advantage of framework is that it reduces time and energy in developing any app because developer doesn’t need to worry about data sanitization, session handling, error handling and authentication logic. Most of these functions are well taken care by the framework. It avoids head scratching and developer can start writing code for an application straight away without wasting more time with those repetitive coding. It doubles up development process and increases productivity.
>>Well organized app:
Developer should not have to worry about managing web directories and files. Things get more organized because frameworks already have a good skeleton structure to use. No need to shuffle of files from one place to other. Framework also offers to separate business logic from the interface files.
>>Flexibility and highly customizable:
If you are a MySQL user and you have been given a postgresSQL database to use for your app, I’m sure you’d have scratch your head to write the web app from scratch, but the advantage of framework help you to not waste time on studying things that don’t really matters. A few tweaks can help you to ship your application from one platform to another. Add-ons, themes, plugins, widgets are all names for things which develop within framework communities and enable further rapid customization on your application.
>>Secure code:
Framework makes developer sure that application using good security measurements because framework itself takes care of it. This is another huge advantage of using framework for web development. You as a developer should not have to worry about hacker who can break your app. Framework makes you feel much secure and better.
>>Say no to re-inventing:
Web framework offers many typical components right out of the box such as, user management functionality- which might otherwise take months to build.
>>Scalable, fast and secure:
Framework are designed to be reused, this leads to quality control on a global scale and so an extremely robust foundation from which to develop your web product from. Such as WordPress; is currently used by over 60 million websites worldwide.
>>Well supported:
Communities of users and developers spring up around web frameworks where ideas can be shared and knowledge can be captured.
>>Reduce development time and cost:
For every particular programming language there are web framework created, each has its pro’s and con’s due diligence should be taken when selecting a framework for your web app taking expert advice if necessary.
>>CRUD:
Frameworks are created to make web development faster and easier. It provides tools to cover the common CRUD cases such as create, read, update, delete. You can find libraries for accessing a database, managing session and cookies, creating templates to display HTML pages and more.
>>Re-use of code:
Framework also promotes the reuse of code. With a good framework you only need to design for instance, a contact form once. Later you can drop your generic contact from code into all your projects and save yourself some time and efforts.
>>Templates system:
Most frameworks either provide a templates system or make it easy to add on own template system so that common chunks of HTML that rarely change. For example: header and footer of your page need only to be written once. Inbuilt templates satisfy many developers with design available to create web product quickly.
>>Easy deployment and maintenance:
Framework based application can be deployed as a web app with windows like functionality. You can support multilingual environment too. With native windows application, user can personalize framework application by rearranging them in many different ways to best fit the way they work. Maintenance is easier because application follow a consistent coding approach, making it easier to understand and maintain the code.
>>Rapid development Boost Productivity:
Almost all the available frameworks are designed to boost productivity of developer by offering an easy-to-use and easy-to-understand generic application framework. Frameworks also support the rapid prototyping, designing, implementation and deployment of commercially focused application.
Code assistants generate much of the code required and together with an expanding library of components, developers can more rapidly assemble powerful application. Components are also shipped for user management, authority management, server management and common code management.
>>Suitable for teamwork:
Many frameworks also help you create environment for teamwork. You can let your designers work on the views, database expert work in the models, and let the smart programmer build reusable libraries and plugins etc also you can let someone build unit tests because they come with tools for that too. For example: PHP frameworks.

How to select right framework?
There are many programming languages and so as frameworks available to build a web app but the truth is all frameworks are really just a set of helpful libraries they are building to be leveraged by a particular programming language. When selecting framework for your programming language you will see there are many frameworks available therefore putting strong criteria are necessary as described below:
>>Requirement list:
Before you start searching for a suitable framework you will need to make a list of requirements about web application and make sure whether a framework is suitable for that purpose
>>License:
Licenses are important simply because they can have a significant impact on your application. Before you start developing using framework, check out what kind of license the frameworks falls under. While most licenses are pretty liberal to work with and allow you to create commercial application and some of them are not so generous. Find out if license allows you to distribute your application commercially or not.
>>Popularity:
Choose the framework which is well known, recognized and complete which includes good ideas, the numbers and quality of plugins etc
>>Sustainability:
While choosing a framework make sure that it will be able to keep up with you for the duration. This simplifies both the maintenance and upgrading of your application
>>Techniques:
TO avoid becoming trapped in complexity it is always beneficial to choose an interoperable solution; one that respects best practice in terms of development.
>>Security:
While choosing a framework to minimize risk make sure it is capable of ensuring security functions such as XSS management.
>>Documentation:
Well explained, detailed documentation draws in the power users and preacher who then brings on more people and it is the key to its success. With a bad written, confusing document people are going to walk off confused mind and annoyed.
>>Community support:
Choose the framework which has a friendly community which helps developers new to platform. Communities behind framework can make or break framework. More mannered the communities are more users attracted towards the framework.
>>Core libraries:
While choosing a framework you as a developer make sure that library you have chosen must be in such as that it frees you from writing repetitive code but still provides a way for you to mess with it if you need more features and controls.
>>Software pattern:
Almost every framework uses the MVC pattern, which helps you to keep data: the model, the logic, the controller and the user interface, the view, separate from each other. This lets you write a better code which ultimately gives you in better app.
>>Unit testing:
Frameworks are definitely surplus if lets you write units tests.
Frameworks such as cakePHP, zend includes code igniter and allows you to create custom tests to check the critical parts of your application.
>>Bug fixes:
Choose the framework which is not inactive. You don’t want a hacker to tell you that security vulnerability exists in the framework through a page he hacked on your site. You’d rather hear that from the framework developers hopefully with a link to a patch to the issue.
Choose a framework which update often, is open about the bugs it finds and more importantly fixes the bugs as soon as possible.
>>Ease of installation:
While choosing a right framework for web development ease of installation also plays a very important role.
A framework can be a problem if one has to run through a number of steps just to get it installed and working. This will also bring a problem once the application is ready, tested and needs to be deployed.
Choose a framework which lets you develop and running as rapidly as possible. A framework with ease of installation and deployment adds satisfaction to developer’s life.
>>Easy extension and availability:
Choose a framework which you can be re- purpose it into a component suitable to reuse in your other application or even better release it to the general public so they can make use of it in their application.
Choose a framework which allows you extended the framework easily with minimal fuss.
While choosing a framework, also remember the availability of plugins. Choose the extension by its quality not by numbers
>>DB abstraction & ORM:
While choosing a framework, select the one which will allow your web application to become database agnostic. So, you’ll never have to care about the database parts in case you need to switch out database if your framework takes care about it. And the other thing you should be concern about is ORM. ORM allows you to express data as an object and see how it relates to other objects. Such as, Ruby, cakePHP, Django has ORM capabilities.
>>Hasting requirements:
All the web developers want to build an application on cutting edge platform but it is also depend on client’s budget and demands. So, it may be out of clients given budget to get a dedicated host to place application on you’ll have to make with shared hosting with normal modules and settings.
>>Learning curve:
When selecting a framework remember to choose one that has the smallest possible learning curve. Some frameworks are flexible when it comes to naming conventions, directory structure and what not’s while others are very strict throwing up errors at tiniest mistakes.

Choosing a framework must not be taken lightly; it is a long-term commitment. Make sure that you make the right selection!

Common Android Questions and answers

Common Android Questions and answers


Que.1 What is the manifest file and how is it used?

Answer:
Every Android app must have this manifest file in its root directory named . The file includes critical information about the app, including the Java package name for the application,

Bonus follow up question: What is the first element in the AndroidManifest file, right after the encoding declaration?
Answer: 
  Note: The ‘permissions’ element is the next best answer if the developer assumed you meant the first element within the structure.

Que.2 Explain .apk extension.
Answer: 
The .apk extension files are common in Android development. It refers to a file type having compressed information of application code, resource files and AndroidManifest.xml file. APK stands for Application Package and the final project lies within this file.
  
Que.3 Name 4 ways Android allows you to store data?

Answer:
Any of the following 5 possible options are acceptable:
1.SharedPreferences
2.Internal Storage
3.External Storage
4.SQLite Database
5.Network connection

Que.4 What language is used to develop Android?
Answer: 
Android is developed mainly using Java however there are lots of SDK’s to translate the Java to code to any language.
Que.5 What items or folders are important in every Android project?

Answer: 
 The developer should name at least 4 of these 6 items below, as these are essential within each Android project:
1. AndroidManifest.xml
2. build.xml
3. bin/
4. src/
5. res/
6. assets/

Que. 6 What is the Open Handset Alliance?
Answer: 
 The OHA is a group of 84 technology and mobile companies including Google, HTC, Sony, Samsung, Dell, Intel, Nvidia and many morewho strive to accelerate innovation in mobile technology and offers the end users a better and richer mobile experience. Android is the main software of the alliance.
Que.7 What are the primary components used in Android architecture?
Answer
The architecture of Android is designed considering four essential components: Linux Kernel, Set of libraries, Android Framework and Android Applications.
Que.8 What is ANR?

Answer:
ANR stands for “Application Not Responding”. It’s a dialog box that appears when an application doesn’t respond for more than 10 seconds (sometimes it can be less than 10 seconds). The ANR dialog box offers the user the option of either closing the app or waiting for it to finish running.

Que.9 What are containers?

Answer:
Containers holds objects and widgets together, depending on which items are needed and in what arrangement they need to be in. Containers may hold labels, fields, buttons, or even child containers, as examples.

Que.10  What do you know about AIDL?
 
Answer:  
AIDL stands for Android Interface Definition Language. It offers to define the client’s interface requirements and moreover a service in order to communicate at same level with the help of inter process communications.
Que.11 What did you like better, Ice Cream Sandwich or KitKat?

Answer:
These are code names for Android releases, and are well known throughout the Android community. Your developer should be familiar with them. Ice Cream Sandwich was Android version 4.0 (API level 14) released on October 18, 2011. KitKat refers to Android version 4.4 (API level 19), released on October 31, 2013.
               This question is really to weed out the beginners who may not be as familiar with the different Android releases and that changes within each. You really want your developer to be in tuned to the Android updates so they know what’s possible, how to best implement what you are asking, and where things are headed in general.

Que.12 What is referred to Explicit and Implicit Intent?
Answer:  
The role of explicit intent is to specify an activity to respond to intent. Implicit intent on the other hand is declaration of intent. Explicit intent is used for internal messages of an application while implicit intent is used to activate components of another application.
Que.13 What is the role of Orientation?
 
Answer
Orientation is used to determine the presentation of LinearLayout. It may be presented in rows or columns.
Que.14 List the data types supported in AIDL?
Answer:  
AIDL supports string, list, map, charSequence and all type of native java type data types.
Que.15 What are App Widgets?

Answer:
Also referred to simply as Widgets, App Widgets in the Android world are miniature views that are embedded within Android apps and typically display periodic updates. Music players, weather updates, sports scores, and stock price changes are all examples of data that can be displayed in an App Widget.

Saturday, 20 September 2014

Hot Trends in Mobile App Development

Hot Trends in Mobile App Development for 2014


Mobile app development has exploded over the past few years, and it’s no surprise that 2014 looks to be an even bigger year for it. Better technology, better tools, more developers, and better ideas, are contributing to the rapid growth in the industry. Here are some trends to keep an eye on in the year to come.
More OSes to Develop For
iOS and Android still dominate the landscape, with Windows Mobile and BlackBerry trailing behind. But 2014 will see the growth of new mobile OSes, such as Mozilla’s mobile Firefox OS, a mobile Ubuntu OS, and Sailfish, a proprietary OS created by former Nokia engineers. Many of these new OSes are aimed at creating smartphones inexpensive enough to reach all economic levels, and phase out feature phones entirely. More people in 2014 will be able to purchase their first smart device than ever before, especially in emerging markets. This means, among other things, that the fragmentation problem mobile developers currently have is only going to get worse.
More Processing Power to Play With
Apple stepped up its game by releasing its 5S iPhone with a chip that has a 64-bit processor, leaving other phone and chip makers scrambling to catch up. Both Qualcomm and Samsung have promised to deliver chips with comparable processing power during 2014. And when they do, mobile app developers will have quite a bit more power to play with when designing apps for new mobile devices.


More Multiscreen Use
Experts are predicting that in 2014, people will own even more mobile devices, not fewer — up from 5.7 devices per home in 2013 to 6 or more devices per home in 2014. And users will be looking for exceptional experiences on each device. We’ve just recently started seeing new kinds of mobile devices, or wearables, such as smart glasses and smart watches. Although it might still be awhile before wearable devices start going mainstream, mobile developers will need to be aware of performance issues on each new type of device and screen.
People are using two or more connected devices at the same time to interact with each other via specialized apps. For instance, the Xbox One has its SmartGlass app, which allows users to use their smartphones as a remote hub to control their Xbox Ones. Expect more such apps to come down the pipe this year.
More Kinds of Connected Objects
Google just recently bought smart appliance maker Nest, after Nest released a smoke detector controlled entirely by a smartphone app. Samsung also recently released a washing machine controlled by Wi-Fi. In addition to smart TVs and video game consoles, 2014 should see a boom in more connected objects in the household such as appliances, as technology improves and companies start to play with the possibilities of the ‘Internet of Things.’
So what’s in it for you, the mobile developer?
Currently, according to a survey from Vserv.mobi, 47 percent of the mobile developer base is comprised of indie developers. But indie developers and smaller companies may have trouble keeping up with the ever-increasing fragmentation problem, and being able to optimize their mobile apps for enough devices. The trade-off is that for each new device and OS that an app needs to be optimized for, there’s also a potential for new revenue to be gained. We may see an increase in partnerships, mergers, and hiring for indie developer shops, to help cope with the demand.
The enterprise is continuing to invest heavily in mobile, and Apple is expected to fill the gap that BlackBerry has left. Enterprise apps also tend to generate way more revenue than consumer apps, so this might be a good opportunity to stake a claim to all that cash on the table, especially for Apple enterprise app developers.
Using third-party services (like Parse and Appcelerator) to assist in mobile app development efforts will free up precious developer time, allowing them to focus their efforts on serving their customer base with amazing user-experiences. And of course excellent app performance will continue to be the key factor in enabling app developers to stay ahead of the competition, so mobile app performance monitoring tools will play a key role in keeping customers loyal.
What trends are you seeing pop up in your corner of the mobile development industry? Share your thoughts with us in the comments!

Getting started with PhoneGap in Eclipse for Android

Getting started with PhoneGap in Eclipse for Android

Eclipse is an open source integrated development environment (IDE) that supports many technologies, but this article is focused on its support of Java, the native language for Android applications. Android is Google’s open source mobile operating system. Android is the operating system for many smartphone and tablet devices, including the Samsung Galaxy line of phones and tablets, the Amazon Kindle Fire tablet, and the Barnes and Noble Nook tablet, as well as many other devices from numerous manufacturers. PhoneGap is an open source application platform that enables you to create natively-installed mobile applications using HTML and JavaScript.

Setting up Eclipse

The first step in setting up your development environment for PhoneGap applications on Android is to download and install the Eclipse IDE.
Android development with PhoneGap can be done in Windows, OS X, or Linux. There are many different installation packages for Eclipse. While PhoneGap may work with other package configurations, the Eclipse Classic package is recommended and already includes tools that you need to get started and be productive with PhoneGap application development.
  1. Visit the Eclipse downloads page to download the Eclipse Classic package for your operating system. The Eclipse download will be an archive containing the development environment.
  2. Extract the archive to your local hard disk and remember its location.
  3. Once extracted, you can launch Eclipse by double-clicking the Eclipse application, without any additional setup steps.

Setting up Android Tools

After you have downloaded and set up Eclipse, you will need to configure your environment to use Google’s Android development tools. There are two steps to this process. First, you download and install the Android SDK. Second, you install the ADT plugin for Eclipse.

Download and configure the Android SDK

The first step in configuring Android tools on your system is to download the Android SDK.
  1. Visit the Android SDK site to download the appropriate build for your operating system.
  2. Extract the downloaded archive to your local hard drive and remember its location.

Configure the ADT Plugin for Eclipse

Next, you need to set up the ADT (Android Development Tools) plugin for Eclipse. The ADT plugin must be installed through the Eclipse Install New Software wizard.
  1. Start Eclipse.
  2. Follow the download instructions for the ADT plugin, available at the Android developer SDK page for Eclipse. These steps will guide you through the installation of the ADT plugin.
  3. Restart Eclipse.
Once you’ve installed the ADT plugin and restarted Eclipse, you need to configure it to use reference the Android SDK that you have already downloaded to your local file system.
  1. Follow the instructions on the Android developer SDK page for configuring Eclipse to set the appropriate Android SDK location in the ADT plugin.

Downloading and installing PhoneGap

The next step is to download and set up PhoneGap.
  1. Visit the PhoneGap download page and click the orange Download link to begin the download process.
  2. Extract the archive to your local file system for use later.
You are now ready to create your first PhoneGap project for Android within Eclipse.
Note: The steps that follow are for PhoneGap 1.5, but the process should be applicable or similar for all versions of PhoneGap.

Creating the project in Eclipse

Follow these steps to create a new Android project in Eclipse:
  1. Choose New > Android Project (see Figure 1).
Figure 1. Creating a new Android project.
Figure 1. Creating a new Android project.
After you create a new, standard Android project you will update that project to use PhoneGap.
  1. In the New Android Project dialog box, type a project name and select Create New Project In Workspace (see Figure 2).
  2. Click Next.
Figure 2. The New Android Project dialog box.
Figure 2. The New Android Project dialog box.
  1. Select the Android 2.2 build target, and click Next (see Figure 3).
Note: Choosing the Android 2.2 build target will configure the compiler to target the Android 2.2 SDK, and will ensure that your PhoneGap application will work on devices running Android 2.2 and newer versions of the operating system.
Figure 3. Selecting a build target
Figure 3. Selecting a build target
  1. On the Application Info screen, type a package name for your main Android application (see Figure 4). This should be a namespace that logically represents your package structure; for example, com.yourcompany.yourproject.
  2. Click Finish.
Figure 4. Specifying a package name.
Figure 4. Specifying a package name.

Configure the project to use PhoneGap

At this point, Eclipse has created an empty Android project. However, it has not yet been configured to use PhoneGap. You’ll do that next.
  1. Create an assets/www directory and a libs directory inside of the new Android project. All of the HTML and JavaScript for your PhoneGap application interface will reside within the assets/wwwfolder (see Figure 5).
Figure 5. New project directories.
Figure 5. New project directories.
  1. To copy the required files for PhoneGap into the project, first locate the directory where you downloaded PhoneGap, and navigate to the lib/android subdirectory (see Figure 6).
Figure 6. The PhoneGap lib/android directory.
Figure 6. The PhoneGap lib/android directory.
  1. Copy cordova-1.5.0.js to the assets/www directory within your Android project.
  2. Copy cordova-1.5.0.jar to the libs directory within your Android project.
  3. Copy the xml directory into the res directory within your Android project (see Figure 7).
Figure 7. Copied resources.
Figure 7. Copied resources.
  1. Next, create a file named index.html in the assets/www folder. This file will be used as the main entry point for your PhoneGap application’s interface.
  2. In index.html, add the following HTML code to act as a starting point for your user interface development:
<!DOCTYPE HTML> <html> <head> <title>PhoneGap</title> <script type="text/javascript" charset="utf-8" src="cordova-1.5.0.js"></script> </head> <body> <h1>Hello PhoneGap</h1> </body> </html>
  1. You will need to add the cordova-1.5.0.jar library to the build path for the Android project. Right-click cordova-1.5.0.jar and select Build Path > Add To Build Path (see Figure 8).
Figure 8. Adding cordova-1.5.0.jar to the build path.
Figure 8. Adding cordova-1.5.0.jar to the build path.

Update the Activity class

Now you are ready to update the Android project to start using PhoneGap.
  1. Open your main application Activity file. This file will have the same name as your project, followed by the word “Activity”. It will be located under the src folder in the project package that you specified earlier in this process.
For my project, which I named HelloGap, the main Android Activity file is named HelloGapActivity.java, and is located in the package com.tricedesigns.hello, which I specified in the New Android Project dialog box.
  1. In the main Activity class, add an import statement for org.apache.cordova.DroidGap:
import org.apache.cordova.DroidGap;
  1. Change the base class from Activity to DroidGap ; this is in the class definition following the word extends :
public class HelloGapActivity extends DroidGap {
  1. Replace the call to setContentView() with a reference to load the PhoneGap interface from the local assets/www/index.html file, which you created earlier (see Figure 9).
super.loadUrl("file:///android_asset/www/index.html");
Note: In PhoneGap projects, you can reference files located in the assets directory with a URL reference file:///android_asset, followed by the path name to the file. The file:///android_assetURI maps to the assets directory.
Figure 9. Updates to the main Activity class.
Figure 9. Updates to the main Activity class.

Configure the project metadata

You have now configured the files within your Android project to use PhoneGap. The last step is to configure the project metadata to enable PhoneGap to run.
  1. Begin by opening the AndroidManifest.xml file in your project root. Use the Eclipse text editor by right-clicking the AndroidManifest.xml file and selecting Open With > Text Editor (see Figure 10).
Figure 10. Opening AndroidManifest.xml.
Figure 10. Opening AndroidManifest.xml.
  1. In AndroidManifest.xml, add the following supports-screen XML node as a child of the rootmanifest node:
<supports-screens android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" android:resizeable="true" android:anyDensity="true" />
The supports-screen XML node identifies the screen sizes that are supported by your application. You can change screen and form factor support by altering the contents of this entry. To read more about<supports-screens>, visit the Android developer topic on the supports-screen element.
Next, you need to configure permissions for the PhoneGap application.
  1. Copy the following <uses-permission> XML nodes and paste them as children of the root<manifest> node in the AndroidManifest.xml file:
<uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.RECEIVE_SMS" /> <uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> <uses-permission android:name="android.permission.READ_CONTACTS" /> <uses-permission android:name="android.permission.WRITE_CONTACTS" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <uses-permission android:name="android.permission.BROADCAST_STICKY" />
The <uses-permission> XML values identify the features that you want to be enabled for your application. The lines above enable all permissions required for all features of PhoneGap to function. After you have built your application, you may want to remove any permissions that you are not actually using; this will remove security warnings during application installation. To read more about Android permissions and the <uses-permission> element, visit the Android developer topic on the uses-permission element..
After you have configured application permissions, you need to modify the existing <activity> node.
  1. Locate the <activity> node, which is a child of the <application> XML node. Add the following attribute to the <activity> node:
configChanges="orientation|keyboardHidden"
  1. Next, you need to create a second <activity> node for the com.phonegap.DroidGap class. Add the following <activity> node as a sibling of the existing <activity> XML node:
<activity android:name="com.phonegap.DroidGap" android:label="@string/app_name" android:configChanges="orientation|keyboardHidden"> <intent-filter></intent-filter> </activity>
At this point, your project is configured to run as a PhoneGap project for Android. If you run into any issues, verify your configuration against the example provided at the PhoneGap getting started site for Android.

Running the application

To launch your PhoneGap application in the Android emulator, right-click the project root, and select Run As > Android Application (see Figure 11).
Figure 11. Launching the Android application.
Figure 11. Launching the Android application.
If you don’t have any Android virtual devices set up, you will be prompted to configure one. To learn more about configuring Android emulator virtual devices, visit the Android developer guide for devices.
Eclipse will automatically start an Android emulator instance (if one is not already running), deploy your application to the emulator, and launch the application (see Figure 12).
Figure 12. The application in the Android emulator.
Figure 12. The application in the Android emulator.
After you get your application running in the Android emulator, you’ll want to test it out on a physical device. I strongly recommend that you always test your applications on a physical device before deploying the application into production environments. Physical devices always have different computing abilities and form factors than emulators, and device testing can uncover issues that may not have been detected in the emulator environment.
Follow these steps to launch your application on a physical Android device:
  1. Make sure the device is connected to your computer via USB.
  2. Choose Run > Run Configurations (see Figure 13).
Figure 13. Updating run configurations.
Figure 13. Updating run configurations.
  1. Select your application under Android Application on the left side of the Run Configurations dialog box.
  2. Click the Target tab, and then select Manual as the Deployment Target Selection Mode.
  3. When you are ready to launch your application, click Run (see Figure 14).
Figure 14. Preparing to run the application on a device.
Figure 14. Preparing to run the application on a device.
In the Android Device Chooser dialog box, you can select either an emulator or a connected Android device. All connected Android devices will be displayed in this list.
Figure 15. Choosing an Android device.
Figure 15. Choosing an Android device.
  1. Select the device that you want to use (see Figure 15), and click OK.
Your PhoneGap application will be installed and launched on the device.