Tuesday, 23 August 2011

Adobe Launches HTML5 Web Animations Tool “Adobe Edge”


It is very interesting to create  a webpage and there are so many software available but now Adobe іѕ launching a nеw tool called Adobe Edge whісh wіll allow creative professionals tο design animated Web content using Web standards lіkе HTML5, CSS аnd JavaScript. But nοt Flash.
Edge is a new web development tool from Adobe that makes it easy to create animations and interactive websites with HTML5, the latest revision of HTML. HTML5 tries to add the interaction and multimedia we've come to expect from the web without forcing users to download plug-ins such as Microsoft Silverlight or Adobe Flash.
While there's been a lot of hubbub over how HTML5 will change everything, older web formats such as Flash still rule the web--largely because they're much easier to work with. Although it still has the upper hand with Flash, Adobe wants to ensure that if and when HTML5 becomes the standard, developers will still create it on Adobe software. So Adobe has created Edge as a tool to help developers create complex animations using HTML5.

At the moment, Edge seems to run on an interface similar to Flash. The familiar timeline and other tools are situation in approximately the same places in Edge as they are in the current version of Flash. Behind the scenes, however, Edge is very different. Instead of Adobe's ActionScript format, the animations created in Edge are coded in JSON. So rather than actionscript the animation is coded in html and javascript and runs on all modern desktop browsers and most mobile browsers, such as Safari.

Principles of Design


A professional web designer is a person who manages to ignore his personal likes and dislikes and creates the layout that satisfies and attracts the audience of the future site. Web design principles are generally accepted, but eventually changing recommendations on how to create comfortable and user friendly website interface. While some of them may work for some project others may do no good. 

Today Website Designing has become one of the most important – rather an inseparable part of the online business or Internet trading.
The principles of design are the overarching truths of the profession. They represent the basic assumptions of the world that guide the design practice, and affect the arrangement of objects within a composition. By comparison, the elements of design are the components of design themselves, the objects to be arranged. 

Some of these basic principles are as follows:

Uniqueness
Too much of make up over the face can result into a garish look and negative impact on the onlooker. This principle is also applicable on the websites. If the website is decorated a lot and the uniqueness is beyond certain limits it is possible that half of the visitors may run away without visiting other pages. Now this could be a big loss for the business. This implies that the website should be unique but not so unique that it has a negative impact on the visitors.

 • Too many colors
Too many colors spoil the overall look of the website. Us of too many colors can spoil the appearance of the website and can even irritate the visitor. It is better not to risk the mood of the visitor and use colors in limits.

• Right Information
Only share the information that you would like to spread among your targeted market segment. The information shared with your buyers should neither be meager nor excessive.  Excessive information can confuse the visitor or prospective buyer. The website that you design should be able to provide the sought information in the least possible time.

 • Visitors are Primary
Visitors should be the prime concern of the web design. It is now a universal truth that a business is run by those who buy its services or products. If the buyers turn off then there will be none to buy the products or services offered. This implies that if you want to become a successful web designer, you need to design websites that are appealing, and at the same time efficient and effective at converting the visitors or prospective buyers into buyers.

• Font
The typography should be as simple as possible. If the font is illegible, the text content may not able to communicate effectively with the website visitor. This implies that the type and size of the font should be such that the text content is easily read by the visitor.

• Navigation
Make the navigation within the website as easy as possible and double check if all the links are working. At times it is very frustrating for the website owner when despite giving a piece of information on the website the visitor cannot find it.  The visitor can get very irritated when the links make him/her land onto a dead end or a irrelevant webpage.

• Coding
The web design should be coded in such a way that it can be downloaded as fast and possible.

• Scanning
It should be remembered that the visitors usually do not read all the content on the website but just scan through it.

• Orientation
The website that you design should not a look as if you have stuffed all the services offered by you. The website should be marketing oriented and not sales oriented.

All mentioned factors are equally important for web site. In current time website owner cannot ignore his website because it’s most powerful tool of earning on the internet.

Thursday, 11 August 2011

PHP Web Services Using NuSOAP


PHP Web Services have been popping up all over the internet since past few years. There could not be any better language than PHP for building your own Web Service in simplistic manner.
PHP is a great scripting language with many advantages. It provides the power to connect to variety databases (that are available with hosting providers) and easy development curve for faster development along with high response time on account of the underlying libraries compiled for performance.
A database is a crucial part of any PHP Web Service, however it is not mandatory to have one for Web Service. It is just that without it a Web Service is not that useful. It helps you store information about user query and visit information.
What are Web Services?
In a typical scenario, a visitor visits a website and uses the functionality provided by application hosted. HTTP request is send to the server from web browser and server responses are translated back by browser to display the desired result of the visitor.
But things have changed a lot with the evolution of web technologies. You don’t need to visit a website to use its service and functionality if it is providing a Web Service.
With Web Service you can exchange data between a server and a client using a standard XML format to ‘package’ requests and data so that both systems can ‘understand’ each other properly. Either a server or a client could be a Web Server, or any other electronic device you could think of for that matter.
There are different methods for providing Web Services but the most common methods are SOAP, XML-RPC and REST.
What is NuSOAP?
NuSOAP is a group of PHP classes that allow developers to create and consume SOAP web services without needing any special PHP extensions.
It stands for Simple Object Access Protocol, and it is essentially a standard for exchanging XML based data via HTTP.
Having understood Web Services and NuSOAP let’s start building our own Web Service using PHP.
Requirements: PHP 5 and above, Apache Webserver, NuSOAP library and MySQL (required in case there are database interactions)
You can download NuSOAP (version 0.7.3) from http://sourceforge.net/projects/nusoap/files/nusoap/
To understand the concept of the Web Service are going to create a ‘calculator’ Web Service and consume it too.
Create a new project ‘webservice’ on the webroot and unzip the NuSOAP file and place it in this folder.
Firstly, create a new file calc_server.php in the NuSOAP directory (for demonstration purpose I have created it in NuSOAP directory).
The PHP file will look like this:
// load SOAP library
require_once("lib/nusoap.php");
// set namespace
localhost in my case
$ns = "http://localhost/";
// create SOAP server object
$server = new nusoap_server();
// setup WSDL file, a WSDL file can contain multiple services
$server->configureWSDL('Calculator', $ns);
$server->wsdl->schemaTargetNamespace = $ns;
// register a web service method
$server->register('ws_add',
array('int1' => 'xsd:integer','int2' => 'xsd:integer'),// input parameters
array('total' => 'xsd:integer'),// output parameter
$ns, // namespace
"$ns#ws_add", // soapaction
'rpc', // style
'encoded', // use
'adds two integer values and returns the result' // documentation
);
function ws_add($int1, $int2){
return new soapval('return','xsd:integer', add($int1, $int2));
}
// implementation of add function
function add($int1, $int2) {
return $int1 + $int2;
}
//substract method
$server->register('ws_substract',
array('int1' => 'xsd:integer', 'int2' => 'xsd:integer'),// input parameters
array('total' => 'xsd:integer'),// output parameter
$ns, // namespace
"$ns#ws_substract", // soapaction
'rpc', // style
'encoded', // use
'substracts two integer values and returns the result' // documentation
);
function ws_substract($int1, $int2) {
return new soapval('return','xsd:integer',substract($int1, $int2));
}
// implementation of add function
function substract($int1, $int2) {
if($int1 > $int2)
return $int1 - $int2;
else
return $int2 - $int1;
}
//multiplication
$server->register('ws_multiply',
array('int1' => 'xsd:integer', 'int2' => 'xsd:integer'),
array('total' => 'xsd:integer'),
$ns,
"$ns#ws_multiply", // soapaction
'rpc',
'encoded',
'multiplies two integers and returns the result'
);
function ws_multiply($int1, $int2) {
return new soapval('return', 'xsd:integer', multiply($int1, $int2));
}
// implementation of multiply function
function multiply($int1, $int2) {
return $int1 * $int2;
}
// service the methods
$server->service($HTTP_RAW_POST_DATA);
Save the file. It will look like this when you browse it.









NuSOAP library has a very good feature of Web Service Inspection. If you open the calc_server.php file in a browser, you will see something like this:











With this we have now created our own ‘calculator’ Web Service. Now, let us understand how to consume this new created NuSOAP Web Service in PHP.
Create a new PHP file, say ‘calc_client.php’ and put the following code in it.
//client code
<?php
require_once('lib/nusoap.php');
//create a parameter array to pass to the webservicefunction call
$param = array('int1'=>'15.00', 'int2'=>'10');
//define the webservice
$wsdl = "http://localhost/webservice/nusoap/calc_server.php?wsdl";
//create client object
$client = new nusoap_client($wsdl, 'wsdl');
$response = $client->call('ws_add', $param);
//print the response
print_r($response);
?>
The result is the addition of 2 numbers and it will be displayed as below:







 It is that simple to create and consume Web Service using NuSOAP library. Moreover, NuSOAP library can also use XML-RPC and REST methods for Web Services.
I have shown you creation and consumption of PHP Web Service using NuSOAP library. If you want to play more with it then perhaps you might even consider adding an interface to the client for INSERTing and UPDATEing new items.

WordPress Custom Post Type Creation


Before understanding the advanced part of it let me explain you in brief about WordPress. It is an FOSS CMS i.e. content management system powered by PHP and MySQL. Among many features it provides the important features are plug-in architecture and a template system which makes this CMS a robust one. It is used by over 10% of global websites.
Now moving to one of the most exciting features coming in WordPress 3.0 is custom post types, which will vastly expand WordPress’ CMS capabilities. This feature will come handy especially when using WordPress as a CMS.
WordPress Custom Post types are basically different kinds of building blocks that when put together form our website. To understand it in a better way let us create our custom post type called “place”.
Any WordPress system will have functions.php in themes folder. This is the one of our interest. To achieve the purpose you will have to add the following code at the end of the functions.php file.
function post_type_place() {
 register_post_type('place', array('labels' => array('name'=>__('Places'),'add_new_item' => __( 'Add New Place' ),'edit_item' =>__( 'Edit Place' )),
                             'public' => true,
                             'show_ui' => true,
                             'supports' => array('title','author','editor',
                                        'post-thumbnails',
                                        'excerpts',
                                        'trackbacks',
                                        'custom-fields',
                                        'comments',
                                        'revisions'),
                                        'rewrite' => false,
                                        '_builtin' => false,
             '_edit_link' => 'post.php?post=%d',
             'capability_type' => 'post',
             'hierarchical' => false,'query_var' => true
                                )
                      );

  // add to our plugin init function
  //for single template
  global $wp_rewrite;
  $place_structure = '/place/%category%/%place%';
  $wp_rewrite->add_rewrite_tag("%place%", '([^/]+)', "place=");
  $wp_rewrite->add_permastruct('place', $place_structure, false);

  //for displaying tags
  register_taxonomy_for_object_type('post_tag', 'place');

  //for displaying categories
  register_taxonomy_for_object_type('category', 'place');

}
// Add filter to plugin init function

If you want you can use a single page template for displaying custom post.

//function to redirect to place page(templating system)
// Add filter to plugin init function
add_filter('post_type_link', 'place_permalink', 10, 3);
// Adapted from get_permalink function in wp-includes/link-template.php
function place_permalink($permalink, $post_id, $leavename) {
 $post = get_post($post_id);
 $rewritecode = array(
  $leavename? '' : '%postname%',
  '%post_id%',
  '%category%',
  '%author%',
  $leavename? '' : '%pagename%',
 );

 if ( '' != $permalink && !in_array($post->post_status, array('draft', 'pending', 'auto-draft')) ) {
  $unixtime = strtotime($post->post_date);

  $category = '';
  if ( strpos($permalink, '%category%') !== false ) {
   $cats = get_the_category($post->ID);
   if ( $cats ) {
    usort($cats, '_usort_terms_by_ID'); // order by ID
    $category = $cats[0]->slug;
    if($category == "featured") {

     $category = $cats[1]->slug;}

    if ( $parent = $cats[0]->parent )
     $category = get_category_parents($parent, false, '/', true) . $category;

   }
   // show default category in permalinks, without
   // having to assign it explicitly
   if ( empty($category) ) {

    $default_category = get_category( get_option( 'default_category' ) );
    $category = is_wp_error( $default_category ) ? '' : $default_category->slug;
   }
  }

  $author = '';
  if ( strpos($permalink, '%author%') !== false ) {
   $authordata = get_userdata($post->post_author);
   $author = $authordata->user_nicename;
  }
  $rewritereplace =
  array(
   $post->post_name,
   $post->ID,
   $category,
   $author,
   $post->post_name,
  );
  $permalink = str_replace($rewritecode, $rewritereplace, $permalink);
 } else { // if they're not using the fancy permalink option
 }
 return $permalink;
}
add_action('init', 'post_type_place');
Update the permalinks.
The newly created post type (place) will look like this in the WordPress administrator dashboard under the links panel:








Now after creating a custom post you will want to use it. Now see the image below to understand how to add new place in WordPress.










Once you add couple of places the list view under WordPress dashboard will look something like below.







To be able to display the single-type-template using WordPress you will have to use a PHP file by the name single.php. To display newly created custom post you will have to use single-{posttype}.php. So in our case the filename would be single-place.php.

Similarly to archive the custom post use archive-{posttype}.php in WordPress. Normally, the archive-type-template use archive.php file. So in our case the archive template file name would be archive-place.php.