Wednesday, August 8, 2012

Mobile web testing

             When we are developing any web application we can test that application on browsers. In the same way we can test the mobile web application on mobile browser. but some time it is not possible to setup mobile testing environment Immediately as it is expensive in term of time and money.
 
             To set up testing environment we need the different mobile devices which is target for the same application and we also need to setup Wi-Fi  enlivenment to access the application through mobile devices

             But for a quick test specially  for unit testing one can use simulators. some of simulator are the same simulators which are use for native application development and some simulators are special design to test web application

1)Apple device(iPhone/iPad/IPod):
             For iPhone Mac Os hasp provide iPhone and iPad simulators, for windows device one can use ibbDemo2(ibbdemo2 link1 ,ibbddemo link2) or from web one can access this simulator
           
              one of the other way use the safari browser as a simulator as Apple default browser is safari to do this install the safari browser go to preferences an check the show developer menu option, now you can see the developer menu , from developer menu select user agent and you can change user agent from safari desktop to iPhone/iPod/iPad this is one the best way as we can debug the JS, CSS  and HTML

2)Android devices
         To test the web application on android device developer has to download and install the Android SDK you can download it from this: link .

         The other alternate is the safari browser by setting the custom user agent, you can search and add add the Android user agent in safari browser as both are web-kit browser

          But some of  HTML5 and CSS3 features developer has to install Targeted OS's simulator

3)Window Mobile
         For windows Mobile developer can download and install windows mobile SDK from this: link

4)BlackBerry
        To test web application on BB device developer can download simulator from this: link

5)Opera Mobile/Mini
       Some smart phone user also install the opera browser for the mobile developer can download the opera mobile simulator from this: link and opera min simulator from this:link

Off-course simulators/emulators is provide 100% result ,but  it can use as alternate.I recommend to test application on actual mobile device before any build
       


   

Monday, August 6, 2012

MVC makes Mobile web Manageable

When we start development for mobile application our basic question is what is the platform or what architecture developer can use to develop mobile web application

  Mobile web application can develop with any platform (languages like Java, PHP , .net etc) but the architecture should be MVC

The main advantage of MVC is TDD we can easily test over code. but for mobile web application we have another advantage as bellow:

This is only require when developer want to target more than one device and want to provide native look and feel ex. for iPhone navigation should be at bottom and fix where in BB it should be at the top of page

With the MVC developer can commonly used the Model and Controller code only they need to develop different view for each targeted device using this way we can develop rich mobile application

ASP.net has also develop MVC architecture which a good choice to develop mobile application and Microsoft  has also provide mobile web development with MVC2 and MVC4

As I discussed previous here developer can design common model and controller and develop the different view for targeted device

Now next question is how to redirect end user to related view  (EX. if  end user access the web application via iPhone/iPod then he/she will be redirect to iPhone specific view which look like iPhone native app, and if end user access it via android then he/she will be redirected to Android view)

Even developer can develop one view to target desktop browser and other to target mobile device this view is known as generic mobile view

for that developer can use Mobile capable view engine which available on internet(Free). MVC is the open source architecture  from Microsoft so developer can also develop their own engine .

With MVC developer has to define related view under same folder (ex. iOS related views are stored under folder name iPhone and android related view are stored under folder name android )

Any request from and user is redirected to the view engine it will check the header information sp. user-agent information of the request and render the particular view accordingly

With MVC 4 the view storing convince in MVC 4 developer add the view in same folder but define the view like index.iPhone. extinction or index.Android. extinction as Microsoft has provide view engine in such a way

That is why MVC is the best option for mobile web development when we are targeting multiple device with different view(presentation).

pros:
1) MVC web application is easily manageable/easy maintenance .
2) MVC allow Test Driven Development
3) MVC projects are easily scale developer can easily add targeted view for without make any change in controller or model

cons:
1)Developer has to learn MVC  architecture
2) For small project TDD can increase the development time.
 

  

Friday, August 3, 2012

HTML 5 and Mobile Device :Myview

HTML5 is one of the hottest topic today for the discussion as a mobile web developer I want to share my view on HTML 5

On 14 February 2011, the W3C extended the charter of its HTML Working Group with clear milestones for HTML5. In May 2011, the working group advanced HTML5 to "Last Call", an invitation to communities inside and outside W3C to confirm the technical soundness of the specification. The W3C is developing a comprehensive test suite to achieve broad interoperability for the full specification by 2014, which is now the target date for Recommendation

HTML5 is the standard which defined by W3C and other open source working group.

For the development of those standard they have use broad view and consider all the browser from different device like mobile, Gaming console, Smart Tv and introduce many features for all type of devices that having browser and some them are not much useful for desktop/laptop browser

Tag are design so carefully that browser can render animation, video, audio without any plugin. 

As we all know only android native browser support the flash plugin, all other smart phone's native browser dose not have capability of use flash plugin to play video or animated flash file on browser

but with help of HTML 5 this will be possible to give support of animation and  video without flash player

let's take overview of some of HTML5 features

1)Canvas:
with the help of canvas tag and JavaScript developer can draw images, but not only images canvas can also use to develop animation.

2)Video
With the help of Video tag developer can add video in webpage

3)Audio
With the help of Audio tag developer can add audio element in web page

4) Geo-location:
HTML 5 has develop Geo-loaction algorithm using which developer can use end user's  Geoloaction position information.

6)Application cache:
Using application cache developer can develop web application that can work in offline mode (without internet connection) once it downloaded on user machine user can access the application in offline

7)Storage :
HTML5 also allow developer to store values on client end, I am not talking about cookie. HTML 5 has provide
Session Storage: data remain on client machine for a session only
Local storage: data remain on client machine forever same as cookie key value pair
Web SQL db: developer can store large amount of data in table format just like database ,but those data are stored on client end

8) Worker:
Like ajax some of JavaScript code execute in other thread and it will note affect the performance of the main page loading thread,this can be use with heavy JavaScript function which take more time to execute. but developer can not access document, Window ,etc object in worker it is message base communication between main thread and worker thread

9) Web Socket ,Server Push:
It is bi-directional/ uni-directional communication of browser and server, can be use to develop application like facebook which can give updates on browser in regular interval

10)new input type:
There are many input types are introduce for mobile device they are not much useful for desktop machine like number,date, date time, URL, email add., search etc.

12)Validation 
Client side validation without any JavaScript i.e. require and reg.expression validation

13)Microdata:
add SEO related information in tag

14)new Tags
like input type many new tag are introduce with HTML5 ex. output, section tags etc

This list dose not stop here it s going on and on .....

With this HTML 5 has make web powerful  , but currently no browser is supporting all the features of HTML 5 as it is under draft face but I am sure by the end of 2014 browser developer try to support most of the features of HTML 5.

HTML 5 will make developer life easy. 

Without HTML 5 all those is possible but developer has to suffer lot to archive all those functionality across the browser. 

Reference :


The rise of server side JavaScript

When first time I think about this it seems almost impossible, because as per my understanding JavaScript is client side scripting and it is execute by the browser. But the power of JavaScript has made it possible to have the server side JavaScript. This is very old concept it was first time introduce by Netscape Enterprise Server in late 1994 but Node.js has given more popularity to this concept. Moreover for Microsoft Azure has also adopted Node.js as development averment for cloud application.

Node.js is the server side JavaScript. Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices. We can configure node JS to listen event on request on particular port and provide response to the request without any sever !

Node.js is currently using V8 JavaScript engine which was develop by Google. The same engine is used in Google chrome to parse the JavaScript.

Node.Js is the only one example we can find more server side JavaScript example on:
List of Server Side JS

Reference:
http://en.wikipedia.org
http://nodejs.org/

Tuesday, March 27, 2012

Mobile web beginner



Mobile web development is as simple as web development for desktop but programmer should consider the basic thing i.e. device size and design pages accordingly more ever developer has to follow some guide lines

1) Add meta tag for view port

A typical mobile-optimized site contains something like the following:



The width property controls the size of the viewport. It can be set to a specific number of pixels like width=600 or to the special value device-width value which is the width of the screen in CSS pixels at a scale of 100%. (There are corresponding height and device-height values, which may be useful for pages with elements that change size or position based on the viewport height.)

The initial-scale property controls the zoom level when the page is first loaded. The maximum-scale, minimum-scale, and user-scalable properties control how users are allowed to zoom the page in or out.

This will fix the page render problems on mobile devices
ex:-

first image is with meta tag viewport and second is without meta tag

Tuesday, July 6, 2010

php mysql paging

<?php

$start=0;

$pagesize=10;

if (isset($_GET["pageid"]))

{

$pageid=$_GET["pageid"]-1;

$start=$pageid*$pagesize;

}

mysql_connect("localhost","root","");

mysql_select_db("test");

$query="select count(*) from login";

$result=mysql_query($query);

$row=mysql_fetch_array($result);

echo $rows=$row[0];

$query="select * from login limit $start ,$pagesize";

$result=mysql_query($query);

echo "<table border='1'>";

mysql_num_rows($result);

while($row=mysql_fetch_row($result))

{

echo"<tr><td>".$row[0]."</td><td>".$row[1]."</td></tr>";

}

echo "</table>";

$noofpage=ceil($rows/$pagesize);

for($i=1; $i<=$noofpage; $i++)

{

echo "<a href=\"paging.php?pageid=$i\">$i</a>";

}

?>

Tuesday, May 25, 2010

Change Web Root Path for XAMPP on Windows

Change Web Root Path for XAMPP on Windows
I had an existing XAMPP install on a shared location that I wanted to access using a laptop with its own local XAMPP install. I didn’t want to do any heavy lifting with the laptop, just wanted to access the web files on the shared server through the laptop’s localhost.
I also didn’t want to relocate the entire XAMPP folder on my laptop, so I instead modified the httpd.conf file on my local XAMPP install to point to the web root of the remote XAMPP install.
Here’s what I did:
1. Locate httpd.conf file on my local XAMPP install: C:\xampp\xampp\apache\conf\httpd.conf
2. Edit the “DocumentRoot” line to the location of the remote \htdocs folder. I changed mine from:
“C:/xampp/xampp/htdocs” to “C:/Users/Ann/Documents/My Dropbox/Dev/Xampp/xampp/htdocs”
3. Edit the “Directory” tag to the same remote location you set for DocumentRoot. My Directory tag looked like Directory “C:/Users/Ann/Documents/My Dropbox/Dev/Xampp/xampp/htdocs”
4. Save the file and restart your local Apache server.
5. Navigate to “http://localhost/” in your browser and you should see the remote web site files.