A Struts2 Application with Netbeans

quarterceladonMobile - Wireless

Dec 10, 2013 (4 years and 7 months ago)


for iOS
US $ 15 | Rs. 100 | Vol. 12 No.07 July 2012
A Struts2 Application with Netbeans
Create Pac-Man Game using Scratch
Google sitebricks, GUICE and JPA App with Netbeans
Using Microsoft Excel as a Data Mining Tool
Robust Cloud Services Management: Integrating Java & Windows Azure
Business-Centric Testing
Letters to the editor
Post your Problem
Create Pac-Man Game using Scratch
– Part III
Struts1, Spring and JPA app with
Netbeans 7 part 2
Using Microsoft Excel as a Data
Mining Tool
A Struts2 Application with Netbeans
A key requirement for new regula-
tory-driven systems and processes
Google sitebricks, GUICE and JPA
App with Netbeans
Building a custom HTML5
video player with CSS3
and jQuery
his time cover is all about emer
ies for iOS. For a lon
for iOS devices requi
ed knowled
e of Ob
ective-C. This meant tha

e part of pro
rammer com
wasn’t able to build a
s for iPhone an

Pad. Recentl
a number of new t
ies have come up which aim to chan
this status quo, b
lopers of other pro
e to build
pps for iOS without learnin
a n
ew lan
e and a new framework.
Emerging Technologies for iOS
Devel operI Q | Jul y 2012
Dear Sir,
I am a reader of DeveloperIQ magazine. My name is Prasannakumar shivaraddi. Please send of yearly
subscription cost of DeveloperIQ magazine and how to subscribe. I am living in rural place. Can I get by posts
to my place? Please send the other details.
Thank you.
Yours faithfully
Prasannakumar shivaraddi
(Via email: pkshivaraddi@gmail.com)
Dear Prasannakumar,
You can subscribe DeveloperIQ magazine by sending the DD or Cheque to the following address. The DD or
or Cheque should be in favor of “IQ Techmedia Pvt Ltd.” payable at Mumbai.
For Five years it is Rs. 6,000/-
For Three years it is Rs. 3,600/-
For Two years it is Rs. 2,400/-
For one year it is Rs. 1200/-
You need to send the DD or Cheque to the following Address.
IQTechMedia Pvt. Ltd
#317, 3rd Floor, Jhalawar
E.S. Patanwala Compound, L.B.S. Marg,
Ghatkopar (W), Mumbai - 400 086
Phone: 022-67727666
Fax: 022-67727699
You can also subscribe from online using credit card from the following URL.
IF you need any other information please send an email to snehal@developeriq.in or you can also call on 022-
67727666. We can end the magazine in a Post.
We accept articles on technology, industry perspectives and trends. Contributions may be technology primers, white
papers, research reports or even experiences of professionals in the information technology marketplace.
Contributions can be between 800-3000 words, must be accompanied by relevant pictures, graphs or tables, or sugg-
estions for the same.
We prefer contributions in Word or PDF formats. Visuals must preferably be high resolution (TIFF or JPG).
Contributions must be original works and copyrights of authors, or they must obtain permission from the original
copyright owner to contribute the same to DeveloperIQ.
Wherever necessary, DeveloperIQ can make the request for permission to use an article published elsewhere if the
author can alert us to it.
Articles must be accompanied by the author’s e-mail address, designation and name of his/her organization, a brief
biography and a high-resolution photograph. Send it to kishore@developeriq.in. Wherever possible, please alert
Developer IQ on the same e-mail address about contributions you are planning to make.
Dear Editor,
I am Java Professional working as
project leader in Accenture, Banga-
lore. I am also a subscriber of De-
velopeIQ magazine. I have read the
article on “embedding messages in
digital images using java”. It is very
nice article and very well written.
Also provide the latest version of
Java in your coming Cd’s.
Thanks & regards
Surya Prabahakar
Dear Surya,
Thanks you comments. We will sure-
ly give the latest Java in the coming
Letters should not be longer than
350 words. Please mention your ad-
dress and job designation. Letters
may be edited for clarity.
Write to:
The Editor, Developer IQ
Write to the Editor
Dear Sir,
I am a reader of Developer IQ for the past one year. I found the magazine as a very useful one for a
software developer. Let me make a few comments about the magazine.
Some of the screen shots used in the magazine are never clear. But the other graphics are good. As the
screen shots are not clear, we were not able to make out most of the figures.
(Especially in struts1, spring and JP app with netbeans and hadoop Mapreduce output to multiple Cas-
sandra column family etc..)
Most articles that appear in the magazine are very high standard. I believe the content of the magazine
will keep on improving in the future.
Amit Hari
Hi Amit,
This for your comments.
Devel operI Q | Jul y 2012
I recently attended a meeting called by a top
government organization, which was planning
its IT budget for the year. My presence along
with couple of CIOs was to provide an indepen-
dent view of how they should plan IT.
We were forced to go through presentations
from different vendors who were suggesting dif-
ferent solutions to different IT challenges, the
organization was going through.
The first presentation was from a popular
virtualization vendor, who not without even un-
derstanding the IT infrastructure straight away
started talking of virtues of virtualization. He
presented virtualization as a silver bullet to all
the problems the organization was facing.
The second vendor straight away pointed
that the applications used by the vendor were
running slow, and recommended a change of
database as the right option. Understandably, he
represented the large database vendor. The third
talked of Unified Communications, fourth cloud
computing and so on…
Vendors generally speak of technologies
such as cloud computing, virtualization, newer
technologies as an end to the IT challenges an
organization faces.
But the truth of the matter is, they all start
new challenges in an IT organization. Challeng-
es in learning curves, challenges in new security
threats and above all a need the organization will
feel to change, and every one to adapt to it.
Importantly you need to find out whether
you require the technology in the first place or
not, or most importantly whether the technology
will solve the problem you have.
Remember, Cloud Computing, Virtualization
or switching over to the latest operating system,
SDK or platform is not going to help solve your
Identify and understand the problem first, and
articulate it! The solution will present itself.

Send me your thoughts on
G Raja Kishore Reddy
Vendor Confusion
Devel operI Q | Jul y 2012
How do you expose a LINQ query as an
ASMX web service? Usually, from the busi-
ness tier, I can return a typed DataSet or
DataTable which can be serialized for trans-
port over ASMX.
How can I do the same for a LINQ query?
Is there a way to populate a typed DataSet or
DataTable via a LINQ query?:
public static MyDataTable CallMySproc()
string conn = ...;
MyDatabaseDataContext db = new MyDatabaseDataContext(conn);
MyDataTable dt = new MyDataTable();
// execute a sproc via LINQ
var query = from dr in db.MySproc().AsEnumerable
select dr;
// copy LINQ query resultset into a DataTable -this does not work !
dt = query.CopyToDataTable();
return dt;
How can I get the resultset of a LINQ query into a DataSet or
DataTable? Alternatively, is the LINQ query serializeable so that
I can expose it as an ASMX web service?
Geoff Dalgas
As mentioned in the question, IEnumerable has a CopyToDataTable
IEnumerable<DataRow> query =
from order in orders.AsEnumerable()
where order.Field<DateTime>(“OrderDate”) > new DateTime(2001,
8, 1)
select order;
// Create a table from the query.
DataTable boundTable = query.CopyToDataTable<DataRow>();
What is the best way to close a form’s webpage after the sub-
mit button is clicked? I want the form to post then close and for
the life of me I can’t find a good way to do this. I guess if it comes
down to it I can do an Ajax call then call window.close() when the
Ajax call completes.
Aneesh R
You can achieve it using jQuery...
$(“form”).submit(function() {
$.post($(this).attr(‘action’), $(this).serializeArray());
I have a JavaScript method that I need to run on one of my
pages, in particular, the onresize event.
However, I don’t see how I can set that event from my content
page. I wish I could just put it on my master page, but I don’t
have the need for the method to be called on all pages that use that
master page.
Any help would be appreciated.
Rohit Jaiswal
Place the following in your content page:
<script type=”text/javascript”>
// here is a cross-browser compatible way of connecting
// handlers to events, in case you don’t have one
function attachEventHandler(element, eventToHandle, eventHandler)
if(element.attachEvent) {
element.attachEvent(eventToHandle, eventHandler);
} else if(element.addEventListener) {
element.addEventListener(eventToHandle.replace(“on”, “”),
eventHandler, false);
} else {
element[eventToHandle] = eventHandler;
attachEventHandler(window, “onresize”, function() {
// the code you want to run when the browser is resized
This code should give you the basic idea of what you need to do.
Hopefully you are using a library that already has code to help you
write up event handlers and such.


Devel operI Q | Jul y 2012
I’m writing a site on PHP. And I have a simple registration form.
<label...></label> <input .../>
I want to add a confirmation field:
<input type=’hidden’ name=’hiddeninput’ value=”jn3kjnv3kjvn35”>
But how does this code look on the server side? Do I need to
save every hidden value to the database whenever registration
form is loaded? Please give me just general idea of what it looks
I’m trying to make sure the form is not being filled in by bots.
That’s why I need a random hidden value that is unique for every form
I know what the HTML code looks like. What I don’t know
is: Suppose every time I generate the registration page - I gener-
ate the unique value for “hidden” field. The thing I don’t know
is - when user submits the form - how do I compare submitted
value to the one that was generated (as once it’s generated - it’s not
stored anywhere in the site). That’s the question.
Serhyi V
Basically, you should use a function that generates a random string
(hash for example) and sessions to “remember” this string. After sub-
mitting the form , you’ll check the INPUT’s value and cross it with
the SESSION’s value.
For instance:
$hash = md5(time());
$_SESSION[‘form_xx’] = $hash; //in case you have more than one
<form method=’post’ action=’do.php’>
<input type=’hidden’ name=’secret_key’ value=’<?=$hash?>’>
if($_POST[‘secret_key’] == $_SESSION[‘form_xx’]) //Just make
sure your making the posted value SAFE
//He’s ok.
die(“arggg...those hackers”);
How to check if string tag contained text is being updated in
I am showing data of a <string name=”whatsnew”> </string>
in a textview and i have to show this textview only when the text
inside this being changed.
for eg:
If previous state is:
<string name=”whatsnew”>Hi Collegues </string>
If current state is this data is being updated as:
<string name=”whatsnew”>Hello Collegues</string>
I have implemented a logic that i will retrieve the previous and
current stringlength of
<string name=”whatsnew”> </string>
containing text. But this logic has a loop hole if the updated text is
of same length of previous string length.
Please help me with a better and efficient logic.
Vishwanath K
use hashCode() of your string to compare, for example:
int hash = “this is my string”.hashCode();
or simply compare with another string:
boolean isSame = “first string”.equalsIgnoreCase(“second string”);
How do I create a regular expression for this in android? Sup-
pose I have a string like this:
string = “Manoj Kumar Kashyap”;
Now I want to create a regular expression to match where Ka
appears after space and also want to get index of matching char-
acters. I am using java language.
You can use regular expressions just like in Java SE:
Pattern pattern = Pattern.compile(“.* (Ka).*”);
Matcher matcher = pattern.matcher(“Manoj Kumar Kashyap”);
int idx = matcher.start(1);

Devel operI Q | Jul y 2012
1) The code name for Mac OS X 10.1.
2) _________ is a programming language created by Professor Niklaus Wirth (who also created Pascal, Modula and
Modula-2) and his colleagues at ETH Zurich in 1986.
3) _________ company is founded in 1984 by Sandra Lerner and Leonard Bosack, both from Stanford University.
4) __________ company is started by Steve Jobs 1985, when he left Apple. The company produced UNIX workstations.
5) Online video sharing and viewing community - was invented in 2005 by Steve Chen, Chad Hurley and Jawed Karim.
6) _________ is an Internet-telephony service that allows low-cost phone calls over the Internet. The company was co-
founded by Swedish-born Niklas Zennström.
What you need to do?
Answer these six questions and send the answers to us, so that it reaches us, on or before 25th of July 2012.
The correct answers will be provided in the August 2012 edition of the magazine. You need to tear this page
and send he answers written in clear, bold letters, You can also take part in this Quiz online by logging on to
Wiley India Pvt.Ltd. will award any six all correct entries with a book on
Programming Microsoft Office Business Applications & Windows Phone
7 Developer Guide will be couriered free to your address.
In case there are more than six entries, the winners will be chosen through a
lucky draw Photostat copies of this page are accepted, and make sure that you
fill the form correctly. The editor of the magazine is the final authority on all
disputes and decisions. No further queries will be enterntained.
Send this from to our Mumbai Office
IQ TechMedia Pvt. Ltd. # 317, “Jhalawar” 3rd Floor, E.S. Patanwala Com-
pound, L.B.S Marg, Ghatkopar West, Mumbai - 400 086.
My Details:
Name: .................................................................................... Date of Birth: ......................................................
Address: ..............................................................................................................................................................
Teliphone Number ....................................................... Mobile Number ...........................................................
E-mail id: .............................................................................................................................................................
These are the answers for the June -2012 Book Quiz,
Winners will be announced on www.developeriq.in
1) Micro Focus
2) A BASIC Interrupter for the Intel 8080 up
3) AT&T Information System, USA
4) Ted Nelson
5) C Brain (January 1986)
6) Niklaus Wirth
Devel operI Q | Jul y 2012
Whether you’re a novice or experienced DBA, this book has
all you need to learn MySQL
MySQL Administrator’s Bible is designed to provide a solid framework for
a beginning MySQL DBA or an experienced DBA transitioning from another
database platform. The book starts with the fundamentals of MySQL database
management, including MySQL’s unique approach to SQL queries, data and in-
dex types, stored procedures and functions, triggers and views, and transactions.
The authors continue with comprehensive coverage of major MySQL Server
components and processes for which DBAs are responsible—these include:
• MySQL Server tuning
• Query optimization and index tuning
• Managing storage engines
• Caching
• Authentication and managing users
• Partitioning; Replication; Logging
• Database and performance monitoring
• Security; Backup and Recovery
• Managing availability and scaling
• Fully covers MySQL 5.1
Title: MySQL Administrator’s Bible
Authors :Sheeri K, Cabral, Keith Murphy
Publisher: Wiley India Pvt. Ltd.
Pages: 888
Photoshop is the preferred
image-editing software, with
more than four million us-
ers worldwide. Professional
photographers, Web design-
ers, graphic designers, and
serious photo hobbyists who
already know earlier ver-
sions of Photoshop will ex-
pand their skills by master-
ing these techniques. Fully
revised for the newest Pho-
toshop release, this guide
uses step-by-step instructions and full-color screen shots to make
comprehension quick and easy for the visual learner.
• Photoshop is the image-editing software preferred by profes-
sional photographers and designers around the world; new
functionality and enhanced tools in the latest version enable
new shortcuts and techniques
• This full-color guide shows intermediate-level users how to
coax more from Photoshop with professional tips and tricks
• Packed with cool and valuable advice to help you take advan-
tage of Photoshop’s newest bells and whistles and take your
skills to new heights
Photoshop Top 100 Simplified Tips & Tricks provides a visual
reference that teaches adventurous users how to make the most
of Photoshop.
Title: Potoshop CS5: Top 100 Simplified Tips and Tricks
Authors: Lynette Kent
Publisher: Wiley India Pvt. Ltd.
Pages: 288
Intermediate-level users learn to coax much more from Photoshop
Devel operI Q | Jul y 2012
or a long time programming for iOS devices
required knowledge of Objective-C. This
meant that a large part of programmer commu-
nity wasn’t able to build apps for iPhone and
iPad. Recently a number of new technologies
have come up which aim to change this status quo, by al-
lowing developers of other programming language to build
apps for iOS without learning a new language and a new
You can build your apps in Javascript, Html, Java, C# or
ActionScript. Here are the technologies.
1. Phonegap/Cordova (Built native apps with HTML and
2. Flex and Flash Builder (Build iOS apps with AS3)
3. RubyMotion (Build iOS apps with Ruby)
4. Sencha Touch (Built native apps with Javascript)
5. Appcelerator Titanium (Javascript)
6. MonoTouch (C#)
7. Java using GWT and Vaadin Touchkit(Java)
8. Trigger.io (Javascript)
9. Corona (Lua)
♦ Phonegap/Cordova
Phonegap is a toolkit which can compile HTML pages to
native apps. It was recently made part of Apache foundation
and is now known as Apache Cordova. It integrates well
with Sencha touch, Jquery Mobile or Vaadin TouchKit. If
you already have a mobile enabled site, Phonegap might be
the best way to get your app running with minimal effort.
Pricing: Free. Website: http://phonegap.com/
for iOS
Devel operI Q | Jul y 2012
• Why PhoneGap?
Mobile development is a mess. Building applica-
tions for each device--iPhone, Android, Windows Mobile
and more--requires different frameworks and languages.
The big players in mobile may decide to work together
and unify third-party app development processes. Until
then, PhoneGap will use standards-based web technolo-
gies to bridge web applications and mobile devices. Plus,
because PhoneGap apps are standards compliant, they’re
future-proofed to work with browsers as they evolve.
PhoneGap is an open source implementation of open
standards. That means developers and companies can
use PhoneGap for mobile applications that are free, com-
mercial, open source, or any combination of these.
Since winning the Web 2.0 Expo LaunchPad com-
petition in April 2009, PhoneGap has been widely
recognized as a game-changer for mobile app devel-
opment. The code has been downloaded more than
600,000 times and thousands of apps built using Phone-
Gap are available in mobile app stores and directories.
♦ Adobe Flex and Adobe Flash
Adobe added the ability to publish apps built with Flex
builder in version 4.5.1. There are a lot of games built with
Adobe technologies which can be ported to iOS now with
minimal effort.
• Adobe Flex
Adobe Flex is a RIA User Interface Framework that en-
ables us to develop Rich Internet Application quickly, re-
sulting in high productivity and customer satisfaction.
Adobe Flex is a highly productive, free open source
framework which is used for building expressive web ap-
plications. Adobe Flex deploy consistently on:
• All major browser leveraging the Flash Player
• And on desktop with Adobe AIR
• Adobe Flash Builder
Flash Builder 4.5 makes development simpler and more
streamlined with a wizard-like experience that is now used
to deploy to several different mobile platforms with the same
codebase. These platforms include Android, iOS, and Black-
Berry tablets. You’ll also get a rundown of Flash Builder’s
many productivity features for refactoring, data-centric
development, breakpoints, variables, and expressions.
Pricing: Free Trial, Premium version starts at $499.
♦ RubyMotion
RubyMotion is a very new technology
which allows building iOS apps using pure
Ruby. Its very recently released. (In May
• Why RubyMotion?
• Simple, as in Ruby
Ruby is a very high-level programming language de-
signed to make humans productive and happy. It has a con-
cise and flexible syntax that can be used to express powerful
algorithms in very little code.
While Ruby was designed on the same semantics as Ob-
jective-C, it is syntaxically different. Ruby has no header
files, no complicated syntax to define classes, properties or
builtin types, and doesn’t suffer from single namespace is-
sues. We can go on. And Ruby offers many more features,
while remaining simpler.
Devel operI Q | Jul y 2012
RubyMotion brings the Ruby language on iOS, allowing
you to make use of the iOS frameworks from a very conve-
nient and productive language.
You already know Ruby? You can write iOS apps, today.
♦ Fast, as in Objective-C
Ruby has a reputation of being a slow language, due to
problems in its historical implementation. Make no mistake,
RubyMotion is not slow. Quite the contrary.
RubyMotion compiles Ruby and activates a load of per-
formance optimizations, such as inline method caching,
immediate fixed and floating numeric types, zero-cost ex-
ceptions, promotion of variables into CPU registers, cached
constant lookups, tail-call optimization, dead code elimina-
tion, and many more.
RubyMotion makes Ruby as fast as Objective-C, if
not faster in certain cases. RubyMotion apps start as fast
as Objective-C ones and use the same amount of memory.
Your app will be so fast your fingers will be delighted.
• App Store compliant
RubyMotion is 100% compliant with Apple’s App Store
policies. Your code is compiled ahead-of-time, never inter-
preted, and you access the entire set of iOS public APIs.
At the end, a RubyMotion app looks pretty much the
same as an Objective-C app.
Pricing: 199$ license.
Website: http://www.rubymotion.com/
♦ Sencha Touch
Sencha Touch allows
you to build web apps
which look very nearly
native. They can be com-
piled to native apps using
Phonegap or Trigger.io.
Sencha Touch 2, a high-performance HTML5 mobile
application framework, is the cornerstone of the Sencha
HTML5 platform. Built for enabling world-class user ex-
periences, Sencha Touch 2 is the only framework that en-
ables developers to build fast and impressive apps that
work on iOS, Android, BlackBerry, Kindle Fire, and more.
• Sencha Touch 2 Features
• Built on HTML5 Technology
Sencha Touch 2, a high-performance HTML5 mobile
application framework, is the cornerstone of the Sencha
HTML5 platform. Built for enabling world-class user ex-
periences, Sencha Touch 2 is the only framework that en-
ables developers to build fast and impressive apps that
work on iOS, Android, BlackBerry, Kindle Fire, and more.
• Smoother Scrolling and Animations
Sencha Touch 2 provides a user experience unparalleled
in HTML5. Fluid animations and smooth scrolling make
Sencha Touch 2 apps come alive, rivaling native technol-
ogy. Lists, carousels, and other components scroll smoothly
and naturally, with a high frame rate across a wide range of
devices. The framework automatically uses the best scroll-
ing mechanism for each device, resulting in a great experi-
ence everywhere.
• Adaptive Layouts
Sencha Touch’s novel layout engine leverages HTML5
in powerful ways to let developers build complex applica-
tions that respond, load, and layout in a snap. Switching
from landscape to portrait happens nearly instantaneously,
and applications load in fractions of a second as Sencha
Touch 2’s advanced layout engine ensures pixel perfection.
• Native Packaging
Web applications work everywhere. But there are still a
few features uniquely available to native apps — like cam-
era access and app store distribution — that are essential
to app developers. Sencha SDK Tools give you the best of
Devel operI Q | Jul y 2012
both worlds, providing a way to seamlessly “wrap” your
web app in a native shell. Whether you’re on Mac or Win-
dows, you’re one command away from deploying to the
Apple App Store or Android Market.
Pricing: Free with paid support and training.
Website: http://www.sencha.com/products/touch/
♦ Appcelerator Titanium
Titanium lets you write apps
which use native UI components us-
ing JavaScript. These are pure plat-
form UI native widgets. They do not
require compiling again with Phone-
gap or Trigger.io.
Appcelerator Titanium Mobile is
one of several phone web based ap-
plication framework solutions allow-
ing web developers to apply existing
skills to create native applications for
iPhone and Android. Yet, while using
the familiar JavaScript syntax, developers will also have to
learn the Titanium API, which is quite different from famil-
iar web frameworks such as jQuery.
Appcelerator Titanium is sometimes compared to Adobe
Air for developing desktop applications for Windows, Mac
and also Linux.
All application source code gets deployed to the mobile
device where it is interpreted (the company’s marketing re-
fers to this as being a “cross-compiler”). This means that
during development any errors in the source code do not
occur until run-time. At run time, the loading performance
is lower, as the last step (i.e. interpreting the source code on
the device) needs to be done every time the application runs.
Some developers have reported that although working
with Titanium gives fast results, making Titanium well suit-
ed for prototyping, there are issues around differences in
behaviour of the API cross-platform, stability and memory
management, that made them re-write their apps in na-
tive code in the end. However, as of February 28th, 2012,
there have been over 30,000 applications shipped to the
app stores built with Titanium, including NBCUniversal’s
flagship mobile app. Many Appcelerator developers cite
the speed of development, native UI, and JavaScript skill
set needed as reasons why they choose to use Appcelerator.
In June 2011, Appcelerator released Titanium Studio
and Titanium Mobile 1.7. Titanium Studio is a full open
standards IDE that is derived from Aptana Studio which
Appcelerator acquired in January 2011. In April 2010 Ap-
pcelerator expanded the Titanium product line with the Ti-
tanium Tablet SDK. The Titanium Tablet SDK draws heav-
ily from the existing support for iPhone but also includes
native support for iPad-only user interface controls such
as split views and popovers. Initially the mobile SDK only
supported development for iPad, but support now includes
Android-based tablets as well.
Appcelerator, Inc. also offers cloud-based services for
packaging, testing and distributing software applications de-
veloped on the Titanium platform. The company expanded
its product line in January 2011 by acquiring Aptana, Inc, a
developer of open source tools for building web applications.
The core features of Appcelerator Titanium include:
• Support for standards-based web technologies: HTML,
CSS and Javascript on all platforms along with PHP, Py-
thon and Ruby for desktop platforms
Devel operI Q | Jul y 2012
• Integrated support for popular JavaScript and AJAX
Frameworks including jQuery, YUI, MooTools, Scrip-
taculous and others.
• A platform-independent API to access native UI com-
ponents including navigation bars, menus, dialog boxes
and alerts, and native device functionality including the
file system, sound, network and local database
• API access to native mobile functionality like geoloca-
tion, accelerometer and maps
• Extensibility through open interfaces and licensing, al-
lowing developers to introduce support for additional
scripting languages, media codecs and device-specific
Pricing: Free with paid upgrades.
Website: http://www.appcelerator.com/
♦ MonoTouch
MonoTouch lets you
build iOS apps with C#.
Create C# and .NET ap-
plications for iPhone, iPod
Touch and iPad while tak-
ing advantage of iPhone
APIs, and reusing exist-
ing .NET code, libraries,
and skills. MonoTouch is
a software development
kit that contains a suite of compilers, libraries and tools
for integrating with Apple’s iPhone SDK. MonoTouch
includes Microsoft .NET base class libraries along with
managed libraries for taking advantage of native iPhone
APIs. Also included is a cross-compiler that can be used
for turning .NET executable files and libraries directly
into native applications for distribution on the Apple Apps
Store or for deployment to enterprise iPhone users. In ad-
dition, Xcode integration enables application developers
to test on the device or in Apple’s iPhone Simulator and
ship applications to the Apple Apps Store for distribution.
MonoTouch is a software development kit for Mac OS
X that lets you use .NET programming languages to cre-
ate native applications for Apple iPhone, Apple iPod Touch
and Apple iPad devices. MonoTouch allows developers to
use the .NET framework and more efficient programming
languages, such as C#, to create applications that run on
the iPhone and can take advantage of native iPhone APIs.
Developers can test MonoTouch applications on the iP-
hone simulator, as well as physical hardware, and can dis-
tribute MonoTouch applications on Apple’s App Store.
MonoTouch Features:
• Mono for the iPhone, iPad and iPod Touch
• C# and .NET on the iPhone
• .NET Bindings to Native APIs
• Distribute on the Apple App Store
• Enterprise deployable
• MonoDevelop Integration
• XCode Integration
Pricing Free to $2499.
Website: http://xamarin.com/monotouch
♦ Vaadin Touchkit and GWT
Like Sencha allows you to build native looking apps with
Javascript, using Vaadin Touchkit and GWT allows you to
build native looking apps using Java. You would need to
compile these to final version using Phonegap or Trigger.
• Efficient application mobilization
Take full advantage of the Vaadin Framework serv-
er-centric model and Java EE API’s for accessing your
backend services, securely and effi-
ciently. Since you’ll be coding only
in Java, your mobile applications will
be simple to create and you can speed
up the development by reusing your
existing Java code and libraries as-is.
Devel operI Q | Jul y 2012
Vaadin TouchKit gives Java developers a compelling
alternative to create beautiful mobile client UIs without us-
ing any scripting languages. Stick to pure Java and mobilize
your enterprise applications with minimal learning curve.
• Smooth user experience
Vaadin TouchKit visual effects make your mobile
apps look professional. Animated screen transitions and
support for touch gestures, such as swipe, give your
application a native look and feel. Accessing enterprise
resources with UI components specifically designed for
mobile touch devices improves your customer satisfaction.
TouchKit’s default theme is designed to resemble iOS,
but as with any Vaadin application you can customize
your own theme to give your personal, company or device
specific touch.
♦ Customizable offline mode
Vaadin TouchKit applications can be started without a
connection to the network by utilizing the HTML5 cache
manifest feature. TouchKit comes with a default offline
mode implementation, that displays a notification dialog
when the connection is down.
Overriding default offline mode functionality can be eas-
ily customized by writing plain GWT code that takes care
of storing application specific data in the browser’s local
storage. Once the connection is back up, the data is synchro-
nized with the backend. You are in control of when and how
the data is synchronized to the server.
• Easy development and updates
Deploy your applications without time consuming ap-
proval processes. Maintaining your mobile app is just as
easy. Just update your application on the server and all users
will have access to the latest and greatest version of your
mobile application.
TouchKit Benefits
• Write mobile applications in pure Java.
• Animated screen navigation makes your application look
like native app.
• Produce working apps in hours and deploy them instantly.
• Reuse your main application code to create a mobile
• Enable support for offline mode.
• Support for swipe gesture.
Website: https://vaadin.com/add-ons/touchkit
♦ Trigger.io

Trigger.io is a competitor to Phonegap. They can com-
pile webkit apps to native apps.
Trigger.io Forge is a development framework which en-
ables you to create native apps for multiple platforms from
a single HTML5 codebase.
It consists of a common JavaScript API that exposes na-
tive functionality such as the Camera, SMS, Contacts, along
with a set of tools and cloud build service to build your app
for each platform that you want to support.
The simplest way for web developers to build native
iOS, Android and Windows Phone apps using HTML5.
• Access native features from JavaScript
• Distribute in multiple app stores, fast
• Simple dev process, no need to setup Eclipse / XCode
• Cloud build service, you can even build for iOS on
• Real native UI components, no need to fake it
Pricing: Free - 299/Month.
Website: http://trigger.io/
Devel operI Q | Jul y 2012
♦ Corona
Corona is a specialized toolkit for building games. Using
this you can write games for IOS in Lua.
Corona’s ease of use, graphical and interactive capabili-
ties and third-party ecosystem make our platform the ideal
solution for authors and publishers. Download Corona today
and bring your creations to the digital world in record time.
• Create beautiful experiences
Seamlessly add images, animation, sound and interactiv-
ity to bring your book to life.
Take advantage of Corona’s easy to implement gaming
features including physics, to make your eBook truly stand
out and go the extra step and implement in-app purchases to
add downloadable content and modules.
• Focus on story, not code
Corona minimizes the need for coding, so
you can focus on what’s truly important – craft-
ing the best possible story and immersive experience.
Corona provides APIs and frameworks such as Story-
board, that greatly simplify the basics of eBook creation.
Take advantage of a range of third-party tools such as Kwik,
a Photoshop plugin that entirely eliminates the need to code.

• Maximize your reach
Build for iOS, Android, Kindle Fire and NOOK with a
single codebase.
Expand to a larger audience, without the need to bring in
multiple development teams to deal with fragmentation.
• Leverage a thriving ecosystem
Corona’s active community is always here to lend a help-
ing hand, and gives you access to time-saving tools. Build
amazing experiences within Photoshop with Kwik, or easily
export your Flash assets with SpriteLoq.
We also offer one-on-one training to help you get started
and can connect you with talented developers to collaborate
on projects
Pricing: Free to $399/year.
Website: http://www.anscamobile.com/corona/
So which of these technologies should you choose?
If you are a web developer: Build apps using Sencha
Touch + Phonegap
If you are a Java Developer: Vaadin Touchkit+Phonegap
If you are a C# developer: Monotouch
Adobe/AS3 developer: FlashBuilder
So what are you waiting for? No matter what language
you work with you can get your apps on Apple store using
these technologies.
Devel operI Q | Jul y 2012
Robust Cloud
Integrating Java
& Windows Azure
♦ Introduction
henever a new
technology is
introduced to
the computing
world, it raises a lot of questions
for an enterprise or organization
regarding integration. How do
you integrate an application built
on new technology into the exist-
ing system infrastructure? What
are appropriate tools to select for
integration? How do you select
the right candidate subsystem to
migrate, refactor, or re-engineer?
Although Windows Azure pro-
vides a revolutionary new plat-
form, it is almost impossible for
any organization to migrate the
entire existing on-premises sys-
tem and infrastructure into the
cloud platform. Therefore, inte-
gration strategies are extremely
important. Even subsystems,
which are built with Windows
Azure technology, still need to
be integrated together. Microsoft
has already provided cloud-com-
puting-based services, such as
.NET Services, SQL Azure, and
Live Services. These services
provide organizations with rich
functionality and a broad range
of building blocks for integra-
Improvement in productivity is due not only
to technology, but also to how it’s integrated
into the organization .Improved productiv-
ity has thus become a concern of all organi-
zations, both public and private. There has
always been a constant need for organiza-
tions to improve operational efficiency to keep
pace with the market dynamics. To maintain a
lead over the competition, organizations have
been looking out for advanced technological
options that will help in focusing on core busi-
ness rather than IT. Cloud Services has given
the new direction to business management.
Integration of Java technology with Windows
Azure can make it possible. We have covered
the cloud services in previous articles. In this
article the emphasis is given on the advance
cloud service management through Java and
Azure technologies.
Devel operI Q | Jul y 2012
Cloud computing technology is one of the technolo-
gies gaining momentum and industry attention, influencing
business decisions and acting as a game changer. Microsoft
has come up with “Windows Azure” a cloud computing
platform which is acting as a principle element in achiev-
ing non-linear growth for most of the organisations that are
facing challenges like scalability, elasticity, high availability
and other technology needs.

Migration to cloud platform needs special knowledge,
as compared to new development using the latest frame-
works. To perform migration you need expertise in mapping
legacy technologies / frameworks used in existing applica-
tions, which can be mapped to the cloud based architecture.
Migration involves following major phases which can be
carried out in parallel or sequentially depending upon the
nature of applications -
1. Application Technology Migration – This caters to all
code/architectural changes in the application. Special at-
tention should be given to areas like State Management,
Security, Authentication, Session management, use of local
file systems storage, application monitoring, components
which need to be installed using installers, ActiveX con-
trols needing registration, event logging, database access
methodology, mission critical data, ingress/outgoing data
transfer, transaction processing, on-premise data/ applica-
tion access, OLAP/OLTP, and Reporting applications. Prior
hands on experience in migrating & integrating Java & ASP
to ASP.NET, VB to VB.NET would be an added advantage
for technology partners to move unmanaged applications to
a managed environment.
2. Database Objects and Data Migration - To enjoy the true
benefits of cloud computing your data needs to be deployed
in the cloud. This includes understanding existing database,
schema, RDBMS features used in developing business
logic/ reporting purposes. All this may or may not be fully
compliant in cloud based databases like SQL Azure. Partner
should be able to handle such schema conversions, carry out
database feature comparisons and finally perform data mi-
gration. There are several tools readily available which will
help expedite data Transfer from an on-premises database to
a cloud database.
2.1. Data Synchronization - Migration/development may
need data to be synchronized between different data sourc-
es. Data sources may be on cloud or on-premises. Better
understanding of synchronization techniques are required
so that proper database schema changes can be done or
tools/ frameworks can be selected. ‘SQL Azure Data Sync’
enables creating and scheduling regular synchronizations
between SQL Azure and either SQL Server or other SQL
Azure databases. Having an understanding of ‘Microsoft
Sync framework’ will be a value addition.
“SQL Azure Data Sync Scenarios:
• Cloud to cloud synchronization
• Enterprise (on-premises) to cloud
• Cloud to on-premises
• Bi-directional or sync-to-hub or sync - from-hub
2.2. Data Reporting - Data has no meaning unless it is uti-
lized. Reporting is an integral part of any application irre-
spective ofwhere it is deployed (on cloud or on-premises).
SQL Azure Reporting is a flexible and cost effective cloud
based reporting capability that allows organisations to de-
velop and rapidly deploy reports that deliver insights to
business users. A partner with relevant experience in other
reporting engines like Crystal report, SQL Server Reporting
Services will help expedite learning Azure based reporting
“Combined with the SQL Azure Data Sync, SQL Azure
Reporting enables new hybrid IT scenarios - for example,
customers can schedule automatic synchronization of on-
premises databases with SQL Azure, and then deploy cloud-
based BI reports based on the synchronized cloud-based
data sources.”
2.3. Content / Data Delivery Network(CDN) – To reap the
real benefits like performance, user experience and reliabil-
ity in accessing data, your data should be closer to the end
users. Windows Azure CDN allows you placing data closer
to the user (multiple locations across the globe) resulting
Devel operI Q | Jul y 2012
in better user experience, reduced internet trips, and enable
handling high load conditions. Applications needing smooth
audio/video streaming can be implemented using CDN. The
partner should have some experience in this area too.
3. Integration with On-Premise systems - Applications
rarely accomplish functionality without interfacing with
other enterprise applications. Thus it is imperative to have
a robust integration solution that makes deployment to the
cloud a seamless job.
If the applications are developed in Java programming
languages, then these applications can be deployed on Win-
dows Azure. Microsoft provides tools to write, debug, con-
figure and deploy Java applications on Windows Azure.
♦ Java & Windows Azure Integration
for Cloud Services
Windows Azure compute
• App-centric development and execution model
• Applications can be
o fault-tolerant
o highly available
o highly scalable
• Application requirements modelled through DSL
o roles
o instances
o interfaces
• Provides elasticity in compute
• Monitoring and management built-in
• Different VM sizes available
Windows Azure Apps provides pre-built, middleware
services that raise the level of abstraction and reduce the
complexity of cloud deployment. These services are open
and interoperable across languages (.NET, Java, PHP) and
give developers a powerful pre-built ‘class-library’ for de-
velopment. Experience in using Service Bus, Access Con-
trol and caching services is desirable.
For applications with special needs that cannot be run
on standard Web role or Worker Role, will need VM Role
expertise to deploy application on Azure.
The only risk that organizations may seek in opting
Windows Azure platform is the technology challenges.
Since Windows Azure is an evolving platform there might
be cases where you will need to take help of Microsoft for
specific advanced technical implementations. In such cases,
turnaround time for such requests should be least possible,
and this can be achieved by using the below services, avail-
able as part of Microsoft Partner program or by formal con-
tract with Microsoft. This risk can be mitigated by availing
below options
• Microsoft Technical Support
• Services Microsoft Advisory Services, consulting
• Trainings by Microsoft
( Fig : Windows Azure technical view)

(Fig : Integrating Java & Azure for Cloud)
Devel operI Q | Jul y 2012

(Fig : Integrating Java & Azure for Cloud)
Integrating Java and Azure
Ex.Sample code
TableStorageClient objTableStorage = TableStorageClient.
create( URI.create( TABLE_NAMESPACE ), false, strAc-
countName, strAccountKey );
List<String> listStrTables = objTableStorage.listTables();
We need to install JRE
Start Java class as new process
Process p = new Process()
StartInfo= new ProcessStartInfo(…..
• Conclusion
Windows Azure provides you with a platform for run-
ning your applications in the cloud. You can build your cloud
application by using .NET Framework tools and languages
such as C#. However, the platform is open and interopera-
ble, so you can utilize other technologies such as Java, both
for implementing your cloud services and for creating client
applications that access your cloud services.
This article covers only the basic concepts .For core
technical aspects & consultancy you can consult the follow-
ing references or e-mail at : skphind@yahoo.co.uk
♦ References & Web Links
• Microsoft Azure: Enterprise Application Development
By Richard J. Dudley, Nathan Duchene,Packt Pub.
• Cloud Computing with the Windows Azure Platform By
Roger Jennings, John Wiley & Sons,Pub.
• Moving Applications to the Cloud By Eugenio Pace,
Dominic Betts,O’Reilly Media Pub.
• http://www.microsoft.com
• http://www.WindowsAzureBootCamp.com
• http://blogs.msdn.com/b/windowsazure/
• www.windowsazure4j.org
Sunil Kr.Pandey
Head- IT & Systems
Jaipuria Institute of Management
Jaipur, Rajasthan

About the Author
Devel operI Q | Jul y 2012
From this article you will learn the following things.
• How HTML has grown and changed since it was
• Where HTML5 fits in with the other versions of
• What the Open Web Standard is and how it relates to
• How a web application differs from typical web pages
• How to build a very simple HTML5 web page
• Why you want to use HTML5 for your mobile applica-
Mobile Web
Learn to build a simple HTML5 document and find out why HTML5 is the
language you should know if you want to design and develop mobile applications.
Devel operI Q | Jul y 2012
HTML5 is the latest version of HTML, and although
adoption on desktop browsers such as Internet Explorer is
slow, mobile devices are jumping on the bandwagon in re-
cord numbers. Nearly every smartphone and tablet device
sold today supports HTML5, and those numbers are growing.
In this article you will learn how HTML5 came into
being and how it has changed the landscape for web de-
signers and developers as well as the customers viewing
your pages. You’ll learn to build a simple HTML5 docu-
ment and why HTML5 is the language you should know
if you want to design and develop mobile applications.
♦ Understanding How We Got to
In March 1989, Sir Tim Berners-Lee wrote a proposal
that suggested using hypertext to link related documents
together over a network. After collaborating with others at
CERN, hypertext eventually became HTML or Hypertext
Markup Language.
HTML was based on a language already in use for
marking up doc-
ument s—SGML
(Standard Gen-
eralized Markup
Language). In
September 1991,
a discussion began
across the internet
about how the web
and HTML should
Up until around 1993, the only browser available was a
text-only browser called Lynx. Then Mosaic came out with
features such as images, nested lists, and forms. Most de-
signers these days take these things for granted, but back in
the early 1990s many people browsed the web in a black-
and-white (or green-and-black), text-only environment.
Getting a browser to support images was very exciting.
It wasn’t until 1994 that the HTML working group was
set up by the IETF (Internet Engineering Task Force). In
July it released a working draft of HTML 2. Later that year,
the W3C, or World Wide Web Consortium, was formed at
MIT to act as a standards body for HTML. HTML 3 was
released as a draft in 1995, and HTML 3.2 was endorsed
as a standard in 1997. HTML 4 was published as a recom-
mendation in 1999.
After 1999 things began to change. The W3C no lon-
ger felt that HTML should remain as it was. Instead, they
wanted to make it more machine-readable, more consistent,
and much stricter. So, rather than working on a new version
of HTML, they began turning HTML into a strict markup
language called XHTML.
XHTML was created as a version of HTML 4.01 that
was rewritten in XML (eXtensible Markup Language). It
was developed in 1998 as a way to create markup languag-
es that are machine readable. XHTML documents must be
well formed and valid. In fact, the W3C wanted all browsers
that read XHTML to stop rendering the page if the page’s
HTML was not valid or well-formed.
XML is still used by many companies. For example,
many content management systems (CMSs) use XML on
the back end to manage large websites; many books are
written in DocBook, which is an XML language for pub-
lishing; and ePub books use XML to create ebooks.
By the Way: Well-Formed Versus Valid
24 Copies
1200/- 900/-
1 Copy
12 Copies
Actual Price
No. of Copies
You Pay only
OR Send in your cheque / DD at the below address
www. facebook.com/developeriq
www. twitter.com/developeriq1
Follow us:
* CD not included in e-copy

A i
N f C i







Devel operI Q | Jul y 2012
A document that is well-formed has the declaration state-
ment at the top—including the specification, all attributes
are surrounded by quotation marks, all elements are closed,
and there is only one container element. A document that is
valid is one that is checked against the specification and has
no errors.
♦ HTML5 is Born
XHTML, because it is based on XML, has the same
strict requirements as XML, which makes XHTML very
difficult to write. Although most web designers recognize
the importance of creating HTML that is valid, at the end of
the day the most important thing is that the HTML works in
readers’ browsers. Every beginning web designer who has
ever validated a page knows that just because a page isn’t
valid doesn’t mean browsers won’t be able to display it. In
fact, web browsers have no problem displaying technically
invalid HTML.
Because of these difficulties, a group of web designers
and developers as well as browser makers and others got
together in 2004 and formed the Web Hypertext Applica-
tion Technology Working Group (WHATWG). They started
building the HTML5 specification to
address the needs of designers, devel-
opers, and browser makers. Finally, in
2008, the W3C decided to scrap XHT-
ML development in favor of reintegrat-
ing with the HTML5 community, and
added the HTML5 specification into
the W3C framework.
♦ Learning What’s Different with
HTML 4 is the last recommendation developed by the
W3C alone. Most web pages right now are built in HTML 4
because it is widely supported by web browsers and editors.
XHTML was created by rewriting the HTML 4.01 speci-
fication as XML, which means that all tags must be closed,
the XHTML tags must be written in all lowercase, all at-
tributes must have quotation marks around them, and tags
must be nested without overlapping.
• Nesting Tags Correctly
When you nest two HTML tags, you should think of them
as a stack of bowls—one inside the other. Always close the
nested tag first, and then close the outer tag.
• Incorrect:
This text is <em>italic, and this is <strong>bold and
• Correct:
This text is <em>italic, and this is <strong>bold and
HTML5 goes back to a less restrictive version of HTML.
End tags are no longer required for all elements, you can
write in upper- or lowercase, and attributes don’t need to
have quotations around them all the time.
HTML5 also adds a lot of new elements, including a
streamlined doctype (or DTD—the first line of your HTML
document. It tells the browser that this document is an HT-
ML5 one), sectioning elements, many new form features,
and support for drag and drop and other features useful for
creating web applications.
Did you Know?: A New HTML5 Doctype
HTML5 has a new streamlined doctype that is very easy
to remember—<!doctype html>. Nothing else is required. It
doesn’t even have to be written in all caps.
♦ Defining Web Applications
Applications are software
programs that are used on a local
computer to do various tasks. The
most commonly used applications
are web browsers (such as Internet
Devel operI Q | Jul y 2012
Explorer or Firefox), document editors (such as Word), and
email clients (such as Outlook or Thunderbird). These pro-
grams are very similar to one another because they all run
on the same operating system. They have features such as
• A similar look and feel, such as the menus at the top
• Functionality such as drag-and-drop, saving to the hard
drive, and interactivity
Web applications are web pages that are attempting to
look and act like desktop applications. They are written to
run inside a web browser, rather than directly on the com-
puter. This means that they are limited by the functions that
the web browser can and cannot do:
• Web applications rely on the web browser for function-
ality that would otherwise have to be coded (such as the
back button, rendering the page, and so on).
• Web applications are limited the same way a browser is
limited. They can’t save data to the hard drive, they have
only limited scripting functions, and they can’t interact
directly with the computer operating system.
Web applications, unlike desktop applications, are not
limited to one operating system. A web application runs in
a browser, and so anywhere a browser will run, the web ap-
plication will run.
♦ Using the Open Web Standard
HTML5 was written primarily as a way to develop
better, more efficient web applications, and it is part of
the suite of APIs and specifications developed under the
Open Web Standard. The Open Web Standard or Open Web
Platform is a collection of royalty-free technologies that
enable the web.
HTML5 to create a suite of tools you can use to build
web pages, web applications, mobile applications, and
more. These all are part of the Open Web Standard.
Some of the specifications in this standard include:
• CSS3
• Web Fonts
• HTML Canvas
• Web storage
• Geolocation
By using standards-based specifications for your web
applications, you will know that your pages and applica-
tions will work for a wider audience, and that your pages
and applications will last longer.
Try It Yourself: Building Your First HTML5 Document
HTML5 is, at its heart, HTML, which is what you use
to build web pages. So before you can get started on the ap-
plication, you need to know how to build a web page.
You start by writing some HTML, which is very easy to
write. All you need is a text editor.
Did you Know?: Finding Your Computer’s Text Editor
If you have access to a computer, you have access to a
text editor for writing HTML. On Windows type in Notepad
in the Search programs and files box in your Start menu. On
Macintosh, type in TextEdit in the Spotlight. Use either the
vi or Emacs command on a Linux computer.
After you have a text editor up and running, you can
begin writing your HTML, which is defined by tags that are
written inside of less-than (<) and greater-than (>) signs.
1. Open your text editor and type the following:
2. <!doctype html>
4. <html>
6. <head>
8. <title>This is my first HTML5 page</title>
Devel operI Q | Jul y 2012
10. </head>
12. <body>
14. <h1>My First HTML Document</h1>
16. <p>This is my first HTML5 document.
18. </body>
20. Save your file as mypage.html.
Watch Out!: Check That File Extension
Make sure to check the extension of your HTML file in
your file system. Notepad will often convert it to a .txt file
if you aren’t careful. If it does, simply close Notepad and
replace the .txt extension with .html.
21.Now open this page in your favorite web browser (by
browsing to it in the File menu) to test that your page dis-
plays correctly. If it doesn’t display correctly, you’ll need to
check that you opened the right file and that you wrote the
HTML correctly.
As you can see from the missing closing tags, the HTML
is not nearly as strict as XHTML, and the first line (the
doctype or DTD) is simple to use and easy to remember.
♦ Using HTML5 with iOS and Android
Many designers are reluctant to get started using
HTML5 on their web pages because Internet Explor-
er has relatively little support for it. In fact, only Inter-
net Explorer 9 has decent HTML5 support. Other com-
puter browsers, such as Firefox, Chrome, Opera, and
Safari, all have good support for most HTML5 features.
Watch Out!: Testing Is Critical
If you plan to create
pages and applica-
tions for iOS and An-
droid devices as well
as desktop browsers,
always test your docu-
ments in Internet Ex-
plorer 8. This browser
(and IE 7) still has
the lion’s share of the
browser market, and if
your page or applica-
tion doesn’t work with it, your page or application won’t
work for most people browsing the web. If you don’t have
a Windows machine you can use an online tool such as
Browsershots (http://browsershots.org/) to test in Internet
Explorer and other browsers.
But what about mobile devices running on Android and
iOS, such as a Xoom tablet or iPad? They all come with
HTML5 support pretty much out of the box because they
each run a browser (Safari on iOS and Chrome on Android)
based on WebKit, which has excellent support for HTML5.
The best thing about designing web pages and applica-
tions using HTML5 for Android and iOS is that what you
are creating will work on future devices. Right now operat-
ing systems exist that run on tablets and phones and to some
extent televisions. But these operating systems are moving
into other devices such as cars, picture frames, and even
♦ Writing Mobile Websites
In some ways, writing websites for mobile devices is a lot
easier than it used to be. Although a lot more devices are
out there, including smart-
phones and not-so-smart
phones, tablets, internet
TV devices, and even some
picture frames, the devices
are converging in what
Devel operI Q | Jul y 2012
HTML5 features they support, and even in their sizes and
shapes (to some extent).
When you’re creating a mobile website, the first thing to
remember is that a mobile website is just a website. The best
websites are built for every browser and operating system,
or as many as possible.
However, you should still consider some basic questions
when building a website that is intended for mobile devices:
• What is the screen size and resolution of the mobile
• What content do your mobile users need?
• Is your HTML, CSS, and JavaScript valid and
• Should your site have a separate domain for mobile
• What testing does your mobile site need?
What is the Screen Size and Resolution of the Mobile
When you’re working with
mobile devices, obviously the
screen size is going to be smaller
than on a desktop. In general,
with smartphones, you have to
prepare for a few standard sizes:
• 128 × 160 pixels—Phones such as the Fujitsu DoCoMo
• 176 × 220 pixels—Phones such as the HP iPAQ 510
• 240 × 320 pixels—Smartphones such as Blackberry
8100 or the HTC Elf
• 320 × 480 pixels—PDAs such as the Garmin-AsusA50
or the Palm Pre
Tablets add to the mix by having not only an increased
screen size, but also having a variation in how they can be
viewed. For example, most tablets (and some smartphones
for that matter) can be viewed in portrait or landscape mode.
This means that sometimes you might have a 1024-pixels-
wide screen to work with, and other times 800 pixels wide
or less.
However, in general, the tablets provide a lot more screen
space for you to play with on mobile devices. You can as-
sume you have around 1024–1280 pixels by 600–800 pixels
for most tablet devices.
Browsing most websites in their standard format on an
iPad is easy because the browser is as clear and easy to use
as on a computer monitor. Plus, with the zooming capabili-
ties on both iOs and Android, making small, harder-to-read
areas bigger is easy.
What Content Do Your Mobile Users Need?
When you are designing a site for mobile devices,
remember that users don’t always want to access the same
content as someone browsing on a desktop.
For example, mobile customers are often, well, mobile.
In other words, they may be in motion or away from their
home or office and have a very specific need or desire when
they visit your site. For example, when visiting a restaurant
website on a mobile phone, a user riding in a car might need
to quickly find the location of the restaurant and the phone
number. If the mobile site doesn’t have the phone number
and location front-and-center, the user might quickly give
up on the site.
Watch Out!: Don’t Limit the Content
One thing mobile sites often get wrong is that they re-
move content from the mobile version of the site. Adjusting
the content so that information that is most important to mo-
bile users is easily available is essential. But if the content
they need isn’t on the mobile site, you must allow the user
the opportunity to look for the content on the full site.
Devel operI Q | Jul y 2012
Content for mobile sites shouldn’t be limited, how-
ever. In fact, the W3C recommends “...making, as far as
is reasonable, the same information and services avail-
able to users irrespective of the device they are using.”
This doesn’t mean that you can’t change the format or
location of your content, but getting to the same content
on a mobile device as on a computer should be possible.
Is Your HTML, CSS, and JavaScript Valid and Compact?
You don’t have to worry about writing well-formed
XHTML for mobile devices, but sticking to correct, stan-
dards-based HTML, CSS, and JavaScript ensures that your
pages are visible by the largest number of devices. Plus,
by validating your HTML, you will know it is correct.
Did you Know?: The W3C Validator
The W3C has a vali-
dator located at http://
validator.w3.org/ that
you can use to check
other markup languages.
But you can also vali-
date CSS and RSS, and
even find broken links
on your pages from this site. Don’t be afraid to check your
site in the validator periodically. You may be surprised at
what you find.
Beyond writing valid HTML, you should consider avoid-
ing a few things if you are writing web pages for mobile
• HTML tables—Avoiding tables as much as you can in
mobile layouts is best because of the small size of the
screen. Scrolling horizontally is difficult and makes the
tables hard to read.
• HTML tables for layout—You shouldn’t use HTML
tables for layout of web pages in general, but on mobile
devices they can make the pages load slower and look
bad, especially if the table doesn’t fit in the browser win-
dow. Plus, when you use tables for layout, you almost
always use nested tables, which make the pages load
slower and are much more difficult for mobile devices to
• Pop-up windows—Pop-up windows are often annoying
in general, but on mobile devices they can make the site
unusable. Some mobile browsers don’t support them and
others open them in unexpected ways (often by closing
the current window to open a new one).
• Graphics for layout—Like using tables for layout, adding
invisible graphics to add spaces and affect layout typi-
cally make many older mobile devices choke or display
the page incorrectly. Plus, they add to the download time.
• Frames and image maps—Many mobile devices don’t
support these features in HTML. In fact, HTML5 no
longer includes frames (other than the iframe) as a part
of the specification because of the usability issues in-
By the Way: Fewer Limitations for iOS and Android
Although avoiding tables, popup windows, and image
maps in mobile pages is best, if you are focusing on mobile
pages for iOS or Android, you can rest easy. Both of these
handle them without trouble. Frames, however, are not part
of HTML5, and you should not rely on their being support-
ed in iOS or Android.
Also remember that mobile users often have to pay a fee
for their bandwidth, so your web pages should be as small
(in KB) as you can make them. The fewer HTML tags and
CSS properties you use and server requests you make, the
better browsing will be for mobile users.
Should Your Site Have a Separate Domain for Mobile Users?
Many websites have a separate subdomain for their mo-
bile site. This makes finding the mobile site without hav-
ing to bother with the regular domain easy for mobile users.
Devel operI Q | Jul y 2012
These domains are typically something like m.example.com.
Having a separate mobile domain offers several advantages:
• It makes your mobile site easier to find.
• You can advertise the mobile URL separately from the
normal URL, giving you more reach.
• Having a separate mobile domain enables people on
tablets or smartphones to switch to the full site just by
switching domains.
• Detecting mobile users and sending them to a separate
domain is much easier than scripting changes to your
CSS for mobile users.
When trying to decide how to handle your mobile site ver-
sion, consider how you are going to maintain the site. You
can create the mobile domain manually with completely sep-
arate pages, or you can use a content management system.
What Testing Does Your Mobile Site Need?
Be prepared to test your site on as many mobile devices as
you possibly can. Although you can use your browser to test
or emulate things such as
screen size, you won’t see
some of the horrible things
that can go wrong if you
don’t test on mobile de-
vices directly, such as the
• Packet size limitations by mobile carriers preventing
your page or images from loading
• Images loading incorrectly or not at all
• Inability to scroll horizontally (which is nearly impos-
sible to do on some phones)
• Device-specific features not working that you were
relying on
• File formats not being supported
You likely don’t have an unlimited budget for buying
mobile phones (and their associated cellphone plans), so
what do you do? Here are some suggestions:
• Use emulators—Both online and offline emulators are
available for many different mobile devices. Most are
free to use and they give you at least a start at testing
your site for mobile devices.
• Rent time on devices—Services exist that will allow you
to rent time on multiple phones. You can justify the cost
by getting a sense of how the phones handle your appli-
• Buy some phones—This might seem like an expensive
option, but if you are planning on doing a lot of mobile
web development, it could be a reasonable investment.
• Get help from friends and co-workers—This is one of
the least expensive ways to test your site—simply ask
to borrow phones or tablets from people you know. You
just need to put your site on a live web server.
Ultimately, if you are going to do mobile development,
you should have at least one mobile device you can test your
pages on directly. The more devices you can test on, the bet-
ter your sites will be.
• Conclusion
In this article, you have learned how HTML started
and the reasons for the move from HTML to XHTML to
HTML5. You know the basic differences between HTML
4, XHTML 1, and HTML5 as well as what web applica-
tions are and how they relate to the Open Web Standard.
You learned how to write a basic HTML web page and
why HTML5 fits in so well with mobile devices. You also
learned some powerful tips for building mobile web pages.
This article is adopted and condensed from Sams
Teach Yourself HTML5 Mobile Application
Development in 24 Articles.
Devel operI Q | Jul y 2012
Struts1, Spring
and JPA app
with Netbeans 7
part 2
truts1 and Spring DI are more popular J2EE
technologies having wider adoption, but
Struts2 is a lot simpler. Pat Lightbody, one
of the lead developers of WebWork (which
formed the basis for Struts2), reviewed the
features of Ruby on Rails with the aim of making We-
bWork more productive and easier for developers to use.
The synthesis of the path-breaking ideas popularized by the
“Rails-revolution” and the experience of Struts1 and Web-
Work helped the Struts2 team to bring out a simpler frame-
work. Struts2 did not take this simplification to the extent of
completely discarding the xml configuration like the later
frameworks, such as, Wicket or Google Guice or Sitebricks.
Nor it did provide scripts to create the necessary project-
artifacts like Seam or Grails .But it adopted convention over
configuration, discarded Action Form, used interceptors to
automate data transfer, conversion, validation and other
framework features ,enabled use of Java5 annotation style
and employed ValueStack and OGNL avoiding DTOs(Data
Transfer objects) –thus did a lot of things with an eye on
simplification and reuse .(For more details on the simplifi-
cation brought about by Struts2 to web programming, the
blogs on Struts2 at http://madhansekaran.blogspot.in can
be referred)
Over-view of integration with Spring Here, for integrat-
ing Struts1 with Spring, we follow a method similar to the
one we used for integrating Struts2 with Spring. Because of
the plugin architecture and built-in support for DI in Struts2
no integration code was required. But Struts1 requires some
explicit code and tweaking in its configuration file The re-
quired steps are 1) Register the action as a bean in Spring
application context 2) register in struts-config.xml the
Spring-supplied a) ContextLoaderPlugin b) DelegatingAc-
tionProxy or c) DelegatingRequestProcessor.
Control flow in a Struts1 program Before seeing the steps
in detail, let us have a look at the following diagram which
depicts the control flow in a Struts application.

Devel operI Q | Jul y 2012
Figure 1
The Request Processor selects the action to process a
request, matching the path in an <action-mapping> <ac-
tion> block in struts-config.xml. It also instantiates the se-
lected action from the class specified in the type therein and
forwards the request to the action object instantiated by it.
When we want the action object to be dependency- injected,
we should stop the Struts Request Processor, after it selects
the action, from creating the action object and make it use
the action object created by Spring. What are the steps re-
quired to achieve our objective?
Steps in detail 1) If the action is registered as a bean in
the application context, Spring will instantiate it like any
other bean. If we provide a setter for the Spring service bean
in the action class, Spring will also inject the service bean
(the object BookDAO), .Recall the following lines in the
applicationContext.xml(marked //---5) in the sample given
in part1.
<bean name=”/query” class=”ram.QueryAction” />.
And the following lines from QueryAction.java :
public void setBookDao(BookDAO bookDao) {
this.bookDao = bookDao;
The value given in path in the <action-mapping><action>
should be used as name of the bean (not as id, as id does not
permit “/ “ in it) in applicationContext.xml . Though we
have coded a setter for service object in the action class,
we have not set BookDAO bean as a property to “/query”
bean explicitly in the applicationContext.xml .One would
have seen this setting in the earlier articles on Struts-Spring
integration by Smt Sudha , which adopted an exclusive xml
configuration approach. But we are following xml plus an-
notation approach introduced by Spring from version 2.5.
Hence the “BookDAO” was not explicitly registered in ap-
plicationContext.xml but the following line was added:
<context:component-scan base-package=”ram” />
The effect of the above line is that Spring DI will scan
all classes starting from base package ram and automati-
cally register those classes that contain annotations like @
Componet, @Service or @Resource as beans .Since the
class “BookDAOImpl is annotated with @Service, it will
be registered as a bean .In the action class, in the setter
for BookDAO(name of the interface of the above class) ,
we have used the @Autowired annotation and Spring will
auto-wire this service bean into the action- bean earlier
instantiated by it. – Remember the annotation @Autowired
on the field BookDAO without a setter will not work.
But how can we make the RequestProcessor of Struts
use it for further processing?
Extra-configurations required
2) (a) In struts-config.xml, we have to register the Spring-
supplied struts plug-in “ ContextLoaderPlugin” and declare
the location the Spring configuration file in its property
“contextConfigLocation” as shown below:
<plug-in className= “org.springframework.web.
<set-property property=”contextConfigLocation”
value=”/WEB-INF/applicationContext.xml” />
Now the Spring application context is accessible to
Struts Request Processor and it can access all the beans
configured there. But how can we make it look for the
action bean in the above application context without it-
self “instantiating” an action object? There are two ways:
Forwards request
action-path and
Request → ActionServlel
Normal Control flow in a Struts application
Devel operI Q | Jul y 2012
1) Use Spring- supplied DelegatingActionProxy in <action-
mapping <action type>, in place of real action class, as
shown below:
<action path=”…… type=
Proxy” >
Look at the following diagram.
Figure 2
Here since the type does not contain the action class,
Request Processor cannot instantiate it; the DelegatingAc-
tionProxy mentioned in the “type “ gets the control and
looks in the Spring application context loaded by “Contex-
tLoaderPlugin” for a bean of the same name (Remember
it was insisted that the name of the bean must be the value
of the path in action-mapping) and delegates control to the
dependency injected real action bean created by Spring.
2) You can replace the RequestProcessor in struts-config.
xml as shown below:

<controller processorClass=”org.springframework.
DelegatingRequestProcessor” />
Look at the following diagram:
Control flow when you use Spring provided Delegatin-
gRequestProcessor in place of Struts RequestProcessor in
Figure 3
This Spring supplied Delegating Request Processor
will automatically look for the action in the application
context of Spring loaded by ContextLoaderplugin match-
ing the action path with the name of the bean and hence
the type attribute need not be specified in the <action-
mapping><action>.Even if it is declared there will be no
effect. The request is forwarded to the Spring- created ac-
tion bean having the name matching the path in <action>.
In a nut shell, you can see there is not much difference
between the two methods. Both DelegatingActionProxy and
DelegatingRequestProcessor only look for an Action Bean
at the Spring application context loaded by ContextLoader-
Plugin . The registration of action as a bean in application-
Context.xml enables not only instantiation of Struts action
by Spring but also injection of its dependencies into it.
Full struts-config.xml
As we have tampered with the IDE-generated struts-config.
xml a lot, the full struts-config.xml is furnished here under:
delegates to
Spring Application
Spring Injected
Action Beam
action Mapping-tpe-
Request → ActionServlel
Control flow when you specify DelegatingAction proxy in <action-mapping>
in place of real action class
Request → ActionServlel
forwards request
Application Conttext
Action Bean by
Action path
Devel operI Q | Jul y 2012
<?xml version=”1.0” encoding=”UTF-8” ?>
<!DOCTYPE struts-config PUBLIC
“-//Apache Software Foundation//DTD Struts Con-
figuration 1.3//EN”
<form-bean name=”QueryForm” type=”ram.Query-




<action input=”/index.jsp” name=”QueryForm”
path=”/query” scope=”request” parameter=”choice”
<forward name=”result”
path=”/result.jsp” />
<forward name=”success”
path=”/success.jsp” />
<forward name=”searchlist”
path=”/searchlist.jsp” />

<controller processorClass=”org.springframework.web.
struts.DelegatingRequestProcessor” />

<plug-in className=”org.springframework.web.struts.
<set-property property=”contextConfigLocation”
value=”/WEB-INF/applicationContext.xml” />

Required JSP files.
In the QueryAction, the list() forwards the request to re-
sult.jsp, create() to success.jsp and search() to searchlist.jsp.
So the above JSP files are furnished here under:
<%@taglib uri=”http://struts.apache.org/tags-html” prefix=
” html”%>
<%@taglib uri=”http://struts.apache.org/tags-bean” prefix
<%@taglib uri=”http://struts.apache.org/tags-logic” pre-
fix=” logic”%>
<h1>Books List-Struts Spring JPA </h1>
<logic:iterate name=”bookList” //-------1)
id=”bookListId”> //-------2)
<bean:write name=”bookListId” property=”title”/>
<bean:write name=”bookListId” property=”author ”/>

The JSP file uses Struts tag library; but for person famil-
iar with JSTL this is not very different.
1) Accesses the “bookList” attribute set by list action in the
request scope.
2) <logic:iterate> is similar to <c:foreach>
3) “id” is similar to “var” in <c:foreach>
4) <bean:write> is similar to <c:out>
<%@taglib uri=”http://struts.apache.org/tags-html” prefix
<%@taglib uri=”http://struts.apache.org/tags-bean” prefix
Devel operI Q | Jul y 2012
<%@taglib uri=”http://struts.apache.org/tags-logic” prefix
<h1>Books List-Struts Spring JPA </h1>
<logic:iterate name=”bkList” id=”bkListId”>
<bean:write name=”bkListId” property=”title”/> ,
<bean:writename=”bkListId” property=”author”/>

<%@taglib uri=”http://struts.apache.org/tags-html” prefix
<meta http-equiv=”Content-Type” content=”text/html;
<title>Book Page</title>
<h1>Book Added!</h1>
<html:link href=”query.do?action=list”>Book List</
html:link> //--1)
1) See how <html:link> is used.
Run the Application
If you Run the application, you may get Figure-1.When You
click the button list you may get Figure-2.In figure-1, if you
fill up author as ‘Ramasamy” and click Search you may get
Figure-3.Try other buttons and see the result.
• Conclusion
Struts1 and Spring DI are widely-used J2EE technolo-
gies. In the sample, a method of integration of the two,
which resembles the one we earlier saw for Struts2-Spring
integration or Struts2-Guice integration has been used.
For Struts2 integrations, placing the plug-in jar on the
class-path and providing a setter for the service bean was
enough with its plug-in architecture which also has built-
in support for dependency injection. No integration code is
required nor does it require even the declaration of action
as a bean in application Context.xml, when you use Auto-
wiring facility provided by Spring. But Struts1 requires
you not only to entrust the responsibility of action-object
creation to Spring but also requires some “ entries “ in its
already “tricky” xml configuration, as it has no built-in sup-
port for DI. Testing the Struts1 action is also difficult be-
cause it is not a POJO and its tight integration with Servlet
API. But for the industry, these reasons are not sufficient
to discard the huge investment in man power and money
and migrate from it and it is continued to be used more
than any other Java web framework. Anyhow in the up-
coming articles we will see about the support in Netbeans
IDE for its perceived successors Struts2 and Spring MVC.
This article is written by P Madanasekaran.
For more information you can
email at sekaran.madhan@gmail.com
Figure 6
Figure 5
Figure 4
Devel operI Q | Jul y 2012
♦ Introduction
his is the third part of article series started
in June 2012 issue. In the first part (Create
Pac-Man Game using Scratch – Part I, June
2012), we designed and developed the static
structure of a game similar to Pac-Man using