Infosys Microsoft Alliance and Solutions blog

« December 2011 | Main | February 2012 »

January 27, 2012

Web Storage in HTML5

Web Storage allows writing information at client side. Using Web Storage data can be written at client side as key value pair. There is no supported query language of Web Storage. Web Storage size varies from 2 MB to 10 MB. Usual size is often 5 MB. Web Storage is different from cookies in term of capacity. Web Storage offers much more capacity than cookies. Unlikely cookies, Web Storage data are absolute client side data. Web Storage data does not go to server with each request hence improves performance of the site.

Web Storage is of two types
1 Local  : This store data for the site
2.Session: This store data for the session.

Local Web Storage stores data in client hard disk. However Session Web Storage stores data in HTTP Session. Session Web Storage data is temporary in nature and persisted only for a particular HTTP session. This data is deleted when user close the browser window.
Web Storage API are supported by below browsers

1. Chrome 4.0 +
2. Firefox 3.0 +
3. Opera  10.6+
4. Safari 4.0+
5. IE 8.0+

A browser supports Web Storage or not can be checked as below, 

<script type="text/javascript">

 

    function supportsLocalStorage() {

 

        return ('localStorage' in window) && window['localStorage'] !== null;

    }

 

 

    if (supportsLocalStorage()) {

        // Web Storage invocation here

           }

 

    else {

        alert('Sorry, your browser does not support Web Storage');

    }

  

</script>


A site can display number of visits using local storage as below,

function PageCount() {

        if (localStorage.NumberOfPageHit) {

            localStorage.NumberOfPageHit = Number(localStorage.NumberOfPageHit) + 1;

        }

        else {

            localStorage.NumberOfPageHit = 1;

        }

        document.write("Number of Visited  " + localStorage.NumberOfPageHit + " time(s).");

    }

 

Web Storage and Cookies
1.Web Storage size is much more than cookies. Maximum size of cookies can be 4Kb         whereas size of Web Storage can be up to 10 MB.
2.Web Storage data is pure client side data and unlike cached data does not travel to       and fro to the sever with each request.
3.Web Storage data need to be deleted programmatically.
4.Unlike cookies, if the Web Storage data needs to be sending to server, it should be       sent programmatically.

Different Web Storage API is as below,
1.Clear  : removes all key/value pair
2.getItem  : retrieve given item for a key
3.Key   :  retrieve given value of key
4.Length : returns total number of key value pair in storage
5.removeItem  : remove an item for given key
6.setItem  : stores key value pair
7.remainingSpace : remaining space in bytes.

Web Storage can be very useful in creating web applications where decent amount of data need to be stored and processed at client side. Web Storage can be accessed only with Java Script so should be refrained in using with critical operations.

January 25, 2012

What it means to develop Metro Applications for Windows 8

I have been coming across a lot of confusion regarding development of Windows 8 Metro style application. Will try to clear out some of the confusion in the air.

What is Metro about it?

Metro Applications follow the design principles of Metro like content before chrome, focus on typography, fast and fluid, alive in motion etc. Focus of metro application is on the content that needs to be displayed .Hence all menus, taskbar and other unnecessary controls have moved to the app bar or charms . Charms can be considered to be a system level menu that is used to perform common applications like Search\Share etc. across Metro Applications. There is a lot of emphasis on fonts, scale and weight in the Metro design. Microsoft has come up with Seago UI font for developing Metro applications. Metro UI relies on usage of tiles that are alive with notifications and animations. New controls provided with XAML and WinJS are already designed according to the Metro design principles. Hence when you use Expression Blend\Visual Studio 2011 etc. and use the controls as per the technologies selected(XAML\HTML), your application gets a Metro look automatically.

Can my HTML5 JavaScript application work on Windows 8?

Windows 8 Metro applications are locally deployed applications. Hence these applications do not access any web server. The architecture for Windows 8 has changed and there is an additional WinRT layer that sits between the Windows Core OS services and the Metro style apps. Unlike conventional apps, metro apps are not targeted to win32\IE or .Net\Silverlight. Rather they talk to WinRT APIs. Hence an existing browser based HTML5 application will not run as is on a Windows 8 machine.

Where is Metro App rendered?

Metro Apps are rendered using IE10 rendering engine. However, the Addressbar and other 'chrome' are not visible to the users. Although they are rendered on a web platform, they are different from web applications as they interact with WinRT APIs

What are the technology choices available to create Metro Applications on Windows 8?

Currently, Metro Applications can be built using either XAML or HTML5. With XAML, we have choice of C++\C# and VB as the development language and with HTML5 we need to use javascript - WinJS. WinJS is a collection of Javascript files. WinJS offers controls (with Metro Look) and API's for various tasks like calling a web service etc. WinJS and C#\VB\C++ interact with WinRT APIs.

Why don't I have a close button for my Metro Apps?

The lifecycle of Metro apps is managed by the system. Users may want to return to a recently opened application and for users who are on the go, the delay of opening up the application from scratch might be unacceptable. Hence the application goes to the suspended state from where they can be resumed instantaneously. The applications also run the risk of being terminated when the system is under memory pressure and hence it is a good practice to keep saving state intermittently. For more details, you can refer http://www.infosysblogs.com/microsoft/2012/01/understanding_lifecycle_of_win.html.

Can I develop non metro applications for Windows8?

Windows8 can run in metro and desktop mode. In the desktop mode, the environment is similar to the conventional Windows 7 environment(though there are some enhancements). Hence all existing apps continue to run in the desktop mode.You can have run WPF and Silverlight based applications in this mode. In Metro mode only metro applications can run.

January 24, 2012

Windows 8 convertible laptops: Who will get it right?

Further to the Windows 8 blogs by my colleagues Atul and Mani, I would like to look at a rather different subject - the interesting shift Windows 8 is bringing in personal computing devices. With the new Metro-style interface, Windows 8 is uniquely poised to cater to both touch devices like tablets and devices with keyboard input like desktops and laptops. In fact, we are today witnessing an upheaval of laptop design to accommodate a tablet mode, which is bound to become an indispensible feature of Windows 8 laptops. Consumers are now demanding the best of both worlds - a laptop that can be dually used as a tablet (also called convertible laptops/tablets or as some people call it - "laplets"). There have been a few designs of this type earlier, but Windows 8 seems to have set this market alight.

Of late, we see the market abuzz with a host of competing designs, each one parading their benefits and stylish looks. One design, which got a lot of press at CES 2012 is the Lenovo Ideapad Yoga, an aptly named device as the touch-screen of the laptop flips 360 degrees all the way back to become a tablet. This device will be exclusively released with Windows 8 later this year (http://news.lenovo.com/article_display.cfm?article_id=1551, http://www.gizmag.com/lenovo-ideapad-yoga-13/21073/). Another model showcased at CES 2012 is the Toshiba Protege M930 - when in laptop mode the screen can be lifted up from its base and pulled forward to cover the keyboard. This device appears to be awaiting Windows 8 for its commercial launch as the demoed version having Windows 7 isn't available on retail. (http://www.theverge.com/2012/1/13/2705350/toshiba-portege-m930-a-windows-7-tablet-with-a-keyboard-and-rotating). One other contender, the ASUS Eee Pad Transformer is essentially a tablet with a detachable docking keyboard.  An Android version is already available, with a Windows 8 model to be launched later this year - which is a very positive indication of the market outlook for Windows 8 going ahead (http://www.pcworld.com/article/230202/asus_may_put_windows_8_in_next_eee_pad_transformer_tablet.html). Dell Inspiron Duo has been around for some while now and features a flip-hinge design where the screen can be flipped 180 degrees on its horizontal axis so that when closed, it covers the keyboard with the screen facing upwards to work in tablet mode (http://www.dell.com/content/topics/topic.aspx/global/products/landing/en/inspiron?c=us&l=en). It is currently available with Windows 7, but users who have installed the developer preview of Windows 8 report a much improved user experience. Windows 8 is surely going to shake up the market.

With all these designs around, some are bound to gain popularity, while others will fade away. We saw a parallel in the evolution of mobile phone design; the once very popular flip mobile phones are now giving way to elegant slide-out keyboard designs. In the market for convertible laptops, style, substance (specifications and features) and robustness will play an important part. It is to be seen in the war of the laplets, which designs will prevail in the long run.

January 20, 2012

HPC Steroids for Big Data

Cloud and HPC together helps to resolve significant number of challenges around Big Data processing. However one needs to consider several aspects while weaving a Big Data solution around them. As part of "Data Insight and Social BI" executive update for CXOs, here is a whitepaper published with Cutter and can be downloaded by Cutter users only.
However for the readers of this forum, I have explicitly requested access and Cutter has been kind enough to provide a URL for our reader's access.

January 10, 2012

Windows 8 Blogs

We have been working on Windows 8 for few months now and understanding the new programming paradigm for Metro apps along with understanding of HTML5, WinJS, WinRT, XAML Apps etc.

We will be sharing our learning here. Keep checking back for updates. For starters, my colleague, Mani, has written her first blog here.

January 9, 2012

Enterprise Cloud Adoption Strategic Roadmap

Adoption of Cloud in an enterprise is more of a strategic decision than an operational or tactical. Cloud adoption needs to be seen more from enterprise architecture strategy perspective rather than an isolated application architecture specific strategy for the simple reason that it has several short and long term implications on enterprise strategy which may be beyond the specific application's business or technology footprint.

So far many enterprises have experimented and played around with Cloud, done successful pilots and learnt their lessons but when it comes to cloud adoption as an enterprise strategy, they are still in a Go, No Go kind of state. The reasons could be several from where to start, what to move first, what are the risks, etc.

The following figure depicts how an enterprise can approach adoption of cloud, which areas can be addressed first and where adoption can happen slightly delayed.

 
CloudAdoptionStrategicRoadmap.png

Source: Infosys Research

To broadly look at this, the above figure depicts various segments as segment 0 to segment 5, each specifying what the segment indicates,

Segment 0 "Support Services"
In this, early adopting enterprise can look at leveraging cloud to capture low hanging fruits such as hosting applications as is on cloud, migrating applications which are easy to migrate(less complex and easy to fit in cloud architecture), or could be for tasks as simple as just for storing data backups.

Segment 1 "On-Premise to Off Premise Integration"
Leverage cloud for having part of your application on cloud for example only database or for building integration kind of scenarios such as partner integration. These scenarios need establishing data/application connectivity between on-premise and off-premise components.

Segment 2 "Offload to Cloud"
This is an offshoot of Segment 1, in this approach you offload compute or data intensive operations of an application on the cloud as against the complete application.
e.g. NY Times converted more than 130 years' worth of articles (11 million articles in TIFF format) into PDFs using Hadoop and Amazon EC2 thus improving compliance and saving substantial costs in a very short time.
e.g. Harvard's Laboratory is using Cloud to simulate various genome analysis testing models to expedite their experiments in research laboratory.

Segment 3 "Multi Channel Scenarios (Smart Phone, Kiosk, Web, etc.)"
Building multi-channel applications that are available across various form factors such as Desktops, Web, Kiosk, smartphone, etc. and provide value added services such as rich reporting, dashboards, context exchange, etc.
e.g. Nike+ Cloud based multi-channel applications to improve customer engagement by providing value added services.
Apple iCloud based apps. is another example.

Segment 4 "Social, Elasticity on demand Apps"
Building applications for which the user base is not pre-determined or profiles identified. Architecting such applications needs significant different approach than traditional ones to take care of counter spikes in usage like product launch or social apps, providing federated authentication, etc.
e.g. Nike+ is using Cloud based multi-channel applications to improve customer engagement by providing value added services.

Segment 5 "Specialized Services"
When enterprise wants to provide a specific functionality as an end service to its users or customers such as HPC, mobility or Analytics as a Service where users can upload their datasets and run these services falls under this segment. This is different from what is mentioned in Segment 2 in the sense that these services are abstracted at the same time specialized to highest extent and meant for providing ".....as a Service" as against running only a specific component in cloud.

As depicted, the architecture complexity and associated risk gradually increases from segment 0 to segment 5 and hence it is recommended that enterprise should take a phased, step by step approach while weaving cloud in an enterprise architecture strategy.
While the above segments are for guidance, depending on enterprise risk appetite, process and technology maturity, an enterprise can also directly start from segment 2 or 3 as deem fit.

Understanding lifecycle of Windows 8 apps

One major differentiating factor for Metro applications on Windows 8 is that the application lifetime would be managed by the OS. To the end user, this would mean that they would be unable to close applications using a close button. This has also been discussed here .

Let us now understand how the OS handles the application lifetime and what are the implying considerations for Windows 8 development. An application can be in one of the 3 states - Running, Suspended and Terminated. When an application is brought in the foreground, it becomes a running application. If second application is launched, the first one moves to the suspended state after a short delay. Again, if a third application is launched, both first and second applications move to the suspended state. This repeats until the system becomes low on memory. When the system becomes low on memory, the applications consuming maximum memory is terminated. Applications can also get terminated due to system shutdown, application crash or if the user terminates it from the task manager.

More than one application can be in the running state if they are snapped.  The system resources are available to running or foreground application. When the application moves to Suspended state, it gets notified through suspend and restore events. The application gets 5 seconds to act on the notification and save its state. Once an application is suspended, it does not get access to CPU, network, hard disk and other system resources. However, the application still remains in memory.   It gets resumed instantaneously from the suspended state. Thus the suspended state enables instant switching between applications. When the application is resumed from the suspended state, the application maintains its state automatically.  However, by handling the restore event, tasks such as refreshing the screens with the latest data etc. can be carried out.

windows8 taskmanagerscreenshot.png


As seen in the screenshot above,the task manager of a windows 8 machine shows more than one application in the suspended state. While the application still consumes memory in the suspended state, the CPU utilization is 0%.

Unlike the suspended state, the applications do not get any notifications on being terminated.  Therefore, applications do not get a chance to save their state before being terminated. Even on being suspended apps get only 5 seconds to save their states. Hence it is a recommended that applications should keep saving the data incrementally when the application is running. When an application is restarted after being terminated, it should be a seamless experience for the user. Hence application state when it was last launched should be persisted on the suspended event. It should be read on the activation event and the application should be launched accordingly.


As seen above the lifecycle of Windows apps is different from traditional and desktop windows applications. It provides users the ability to instantly switch between applications and gives them a better user experience. This does look promising for users with tablets and mobile devices. But might be overkill for the desktop users!

January 6, 2012

Considerations for Big Data processing using Cloud Computing

The data (structured and un-structured) influencing enterprise decisions is increasing exponentially every year. This data includes not only internal generated data within the enterprise but also external influencers such as social media, government regulations, external public data sets, etc.

The storage and compute capacity within the enterprise is usually limited and cannot scale or grow at the same rate as the data because of various reasons such as lead times to procure infrastructure, increased hardware and software costs to process data, etc. Many a times, this imbalance causes opportunity loss for enterprise for not being able to process the data in the necessary window.

Cloud Computing helps to resolve this in a very subtle manner as it provides a turnkey solution for on-demand network, compute and storage which essentially are the critical building blocks of any big data processing solution.

Dealing with large volume of data and reducing the latency of data processing are an important dimension in Big Data and architecting a solution on Cloud helps provide that OoB.
However, there are certain considerations that enterprises needs to make before considering Cloud (Public Cloud) as part of their Big Data solution, some of these are:

Regulations - Certain government regulations do not allow storing the local national data outside of the country geography. European Union doesn't allow storing data outside of their geography [1].HIPAA doesn't allow patient records to be stored outside of the patient residing geography [2].
However, such restrictions can be addressed by choosing the Cloud data center in the specific geography for storing such region sensitive information. Almost all the leading cloud vendors have data centers spanning across the world and provides the option of choosing the data center.

Data Security and Privacy -Not all Cloud providers provides transparency with the way they manage data privacy of their data centers. Though there are certain established international standard data center certification agencies, not all the vendor data centers are certified.  Appropriate compliance of the data center to these certifications should be verified based on the business needs. Microsoft has published a few papers to discuss the security framework and various certifications they comply for their data centers and are mentioned in END NOTES [3].

Cost Considerations - The storage cost of data on-premise could be significantly different than the storage cost of data off-premise based on the vendor and technical solution selected. Enterprise should carefully evaluate their storage strategies while architecting Big Data solution on cloud. E.g. Microsoft's SQL Azure (relational storage) is to the tune of 100 times costlier than Microsoft's Windows Azure Table storage cost (NoSQL type Table storage) and hence straight forward migration of on-premise SQL Server relational database to off-premise SQL Azure database can have very high operational/running cost over time.

Data Migration Considerations - Most of the enterprise data sources or LoB apps are built using relational data storage. Migrating it to Cloud on non-relational data storage solution can pose technical challenges in terms mapping the relational data elements to flat structure Table storage. E.g. Migrating a SQL Server relational Database to Windows Azure Table storage can be challenging and technically complex task especially when the data stored in Windows Azure Table Storage is in the form of key values as against relations in SQL Server. This type of data migration can break the data integrity, consistency and introduce redundancy.

Data Movement to Cloud - Data movement to cloud is one of the major obstacles for processing data on the cloud. Most of the times, the enterprise data warehouse to the tune of GB and TBs of data are difficult to ship to cloud unless a very high network bandwidth solutions are used to transport data to the cloud.

Technology readiness/maturity -As Cloud Computing is still evolving and still there are lots of technology vendors who have not made their products Cloud ready although they could be leaders in on-premise technology solutions. In such cases, not all the time, there is a corresponding Cloud technology solution to the existing on-premise technology solution and at times it can become the major limitation for choosing Big Data processing solution.  E.g. Microsoft's SQL Server Analysis Services, Integration Services are BI technologies for on-premise but aren't supported on Windows Azure (Cloud).

To address some of the above mentioned challenges, some intermediate solutions can be considered such as,

Leveraging public cloud for non-regulation sensitive data - In this strategy, only non-regulation specific business data is moved to public cloud for processing. The processed results are then combined with any regulation sensitive data on-premise to deliver combined results.

Participating through Community Cloud -Enterprises having similar concerns or business objectives can form an association to poll resources amongst participants. This is a recommended approach when there is a high degree of inter-op and data sharing is required amongst the participating organizations and at the same time the data needs to be secured or sandboxed for their respective private usage only.
E.g. NYSE created a community cloud for financial traders [4] to deal with use cases such as rapid provisioning of hedge fund Compute-on-Demand for agency brokers, Processing large volume of market data for regulatory reports for investment bank, temporary requirement of large farm for compute farm to test and validate strategy for low-latency hedge funds, and testing custom developed applications in large farm for all size financial service firms.

Creating Private Cloud - Create an enterprise private cloud by leveraging existing infrastructure or procure private cloud infrastructure from 3rd party like hosting Microsoft's Windows Azure Appliance, etc. This is suggested when the enterprise cannot afford to put any of its data beyond the enterprise boundary and wants strict control on its data.

Creating Hybrid Cloud - Extend the private cloud to leverage additional compute, storage from Public Cloud to deal with excess demand during peak periods. This helps achieve best of both the worlds but also has the complexity of management, adherence to SLAs, etc.

END NOTES
[1] Basic Principles of European Union Consent and Data Protection, Posted on July 25, 2011 by Christina Hultsch http://www.technologylawsource.com/2011/07/articles/privacy-1/basic-principles-of-european-union-consent-and-data-protection/index.html#axzz1TD0LUlgu
[2] Definition, HIPAA (Health Insurance Portability and Accountability Act) http://searchdatamanagement.techtarget.com/definition/HIPAA
[3] Resources discussing compliance to Security and privacy for Microsoft Data Centers and Microsoft Window's Azure http://www.globalfoundationservices.com/security/
[4] NYSE Technologies Introduces the World's First Capital Markets Community Platform, June 1, 2011 http://www.nyse.com/press/1306838249812.html
http://ir.nyse.com/phoenix.zhtml?p=irol-eventDetails&c=129145&eventID=4098814

Subscribe to this blog's feed

Follow us on

Blogger Profiles

Infosys on Twitter