« March 2012 | Main | May 2012 »

April 17, 2012

Metro App, Metro UI, What's all this?

Microsoft had introduced Phone 7 in early 2010 and released the first version in market by late 2010. The key point that MS highlighted was that Phone 7 a completely new, ground up, operating system and another immediately noticeable thing about it was the tiled based UI. While on first look the tiles looked like desktop icons, they were in fact much more than that. They were live and hence could provide updates from the application right on the home screen, so a person need not go into an application just to check basic updates.

While these live tiles were the immediately noteciable concepts, phone 7 UI also became full screen, no chrome, no unnecessary gradients, no 3D controls etc and focus shifted to content of the application and also on typography along with smooth animations. Microsoft had introduced a new design language, they called Metro. It wasn't a language like C# or VB.NET or XAML but it was more of concepts around how to design the applications for the new age apps.

While Phone 7 has now been around for a while, the Metro UI guidelines didn't pick up much because the Phone 7 sales have been low and there are very less apps on the phone 7 store also. However with Windows 8 dev preview and the later consumer preview Metro UI has suddenly gained popularity.

This has also brought forth a question and that is What really is a Metro application? Is any application that looks like a Metro application (uses tiles, uses content and no chrome etc.) a Metro application? Is an application that has a tile on Windows 8 start screen a Metro application? Is Metro application a Windows application or a Web application? Is the Tech Ed 2012 India website a Metro application? It has similar layout, it has live tiles like behavior and it even has side bar menu options.

Interestingly if you search on google for "Metro Applications" you would hardly find anything. Most content online talks about Metro Style Applications. If you have seen Windows 8 Architecture slide, you would recall two main parts to it: The desktop part and the WinRT part. In WinRT you could be using HTML5 and WinJS or XAML and C#/VB.NET. For the later there is a minimal .NET API set available within WinRT. Check the overview here

Most people go by the understanding that any application that eventually runs on WinRT is a Metro application and any that doesn't is not. So there could be apps that just visually look the same, but don't run on WinRT, like the TechEd 2012 India website and hence are not Metro apps. While this is mostly correct, there do exist hybrid apps as well that partly consume WinRT and partly the full .NET framework and hence don't pass the certification (can try with Windows Application Certification Kit (WAC)) and the eventual result is it won't get deployed on Windows 8 app store.

So to me, an application that fails WAC test and is not deployed on the store is not a Metro application. An application my redefine its look and feel to look more like the Metro apps, but in reality that application isn't a Metro app till it conforms to WAC kit requirements. Just by looking at an application it is not possible to tell if the app is a Metro application or not.

While the Windows 8 release and app store is still some months away, you can start to build Metro applications using Windows 8 consumer preview and Visual Studio 11 beta along with Expression Blend. Some additional resources that will be helpful are Making great metro style apps and UX Guidelines for Metro Style Apps.

Any comments are welcome.

April 10, 2012

Desktops / Laptops / Tablets / Smartphones

At the turn of the century (year 2000) desktops and laptops were still going strong and mobile phones had just started to appear. I had put my hands on my very first mobile phone in year 2001 as getting a landline took few weeks and the mobile phone was activated within a day or two. I had moved to a new place and hence getting connectivity was critical. The mobile phone allowed me to stay connected while on the go, and in those days, I had to pay to receive calls as well. I had not thought of how the phone would evolve into today's smart phone with significant processing power, with ability to capture and view high resolution photos and HDMI videos, with ability to let me be connected with friends over facebook and twitter all the time and with ability to download and install thousands of applications from its very own marketplace. My family is hooked onto Angry Birds :-).

The other day I was reading this article - iPad: The PC Killer. It is interesting to see that the sales of PC have dipped almost for the first time in last decade or so and those of tablets and mobile phones are fast catching up. There are other similar articles -
The PC's Darkening Future in a Mobile World  and PC Makers Should Fear Amazon's Android Gains

How will this shape up? What devices will we have in future? Here's my opinion on this trend.

I would look at it from the different types of consumers. There are essentially 3 main types of users of such device: Individual/Home users, Business Users and Developers. Needless to say developers will continue to need to devices like desktops and laptops as they need bigger screens to design and program the applications, still need keyboard and mouse devices instead of touch /gesture (which compromises speedy and accuracy) and would typically need large local storage (large hard disk).

Individual/Home users would need some device to access their emails, photos, watch videos, play games and chat with friends. While they can easily make do with external hard drives and you get 1 TB+ disks at very low cost already, lot of home user's data will also end up on cloud (Sky drive or iCloud or anything such infrastructure). Since home users will also want mobility, a tablet fits very well for their needs. Combine this along with a phone and they are done. While smart phones allow lot of the other things also, but personally I believe tablets will win over due to better real estate while still providing good mobility and phones will eventually go back to being mostly phones only. You may argue that tablets will possible also start providing audio/video call features, but a pocket sized phone device still is really more mobile than tablet. My take is that individual/home users will slowly move away from desktops/laptops and switch to tablets. 

Business users at work mostly deal with emails, viewing dashboards, or making presentations or working with documents/excels sheets, managing approvals etc. Most of these are again easily serviced by a tablet, however with the caveat that the tablet is connected to official network. With more and more focus on bring your own device to work, this will soon become a reality and business users will also find working with tablets more convenient. In few cases where they need to be high productive like writing papers/documents etc., they can also work with add-on keyboards to tablets and rest of the time, be as mobile as they need to be with their tablets.

Some home users will be business users and some will be developers and some with just pure home users, so it is a no brainer that tablets will eventually will the battle. The desktops and laptops will be left for those geeky people sitting in their cubicles and buried deep into their programming.

There are multiple vendors with iPad the clear winner as of today. However there is a new kid on the block: Windows 8 and there could be reasons for Windows 8 giving iPad a run for its money.http://www.itbusinessedge.com/slideshows/show.aspx?c=95196. Which of these eventually wins or both survive, only time will tell, but tablets are here to stay for sure.

In addition to this smart phones and tablets have also made touch and basic gestures on these devices as almost first citizens. Touch and gestures have taken away the need for mouse and onscreen virtual keyboards have made hardware keyboards redundant. For high productivity needs of programming intensive work, keyboard and mouse will still continue to be relevant. Alongside there is also evolution of touch less devices like Microsoft Kinect and Sixth Sense like technologies. These technologies will play an important role in the way we will be interacting with future devices.

April 4, 2012

SQL Server Unstructured Data Analysis (Semantic Search)

In my previous blog here, we had seen the file table feature introduced in SQL 2012 to store unstructured data. From business perspective, it is very important to find ways to analyze this unstructured data to gain useful insights into behavior and patterns. Normal SQL query search wouldn't work efficiently on this type of data, as the "Like" kind of operators work on character patterns. Additionally, the "like" pattern search can take a long time, as normal text data cannot be indexed properly.

Full Text Search introduced in 2005 started the work on bridging this gap by introducing an integrated search platform to search non-relational data. Full text search allows efficient search by using word breaker and indexing of keywords in text data. 

Statistical Semantic Search, introduced in SQL 2012 builds on the existing functionality of full text search to discover statistically relevant insight through efficient keywords search. Statistical semantic search provides good insight into unstructured data stored in SQL Server by extracting and indexing statistically relevant phrases. It helps in extracting metadata from documents, listing key concepts, finding similar or related document, and integrating given concepts across documents.

Installation
There is standalone msi file which is shipped with SQL 2012 setup for installing semantic search. Installing this msi will extract the semantic DB on your server which is needed for semantic search. Once extracted, you can attach the DB to SQL server instance through management studio or T-SQL commands.

Registration
Semantic db needs to be registered before it can be used. The following query can be executed to register the DB

EXEC sp_fulltext_semantic_register_language_statistics_db N'SemanticsDataBase'

To verify if that DB was successfully installed/registered, run the following query:

select * from sys.fulltext_semantic_language_statistics_database

 
SemanticSearch_Register.jpg

Semantic search needs a full text index to be defined with semantic statistics on

CREATE FULLTEXT INDEX ON DocumentStore

    (

    file_stream

        TYPE COLUMN file_type

        LANGUAGE 2057

        STATISTICAL_SEMANTICS)

    KEY INDEX PK__Document__5A5B77D56085CCE2

 

SemanticSearch_Properties.jpg

Once full text index is populated, there are 3 functions which can be used to provide insights into the documents.

SEMANTICKEYPHRASETABLE

This table valued function is used to find keyphrases in the document.
   • This function is generated by crawling FTS (full text search) fragments generated through full  text parser.
   • Each word is assigned a weight during crawl and stored in heap structure
   • The weight depends on the frequency in document and statistical relevancy

-- Find the Key Phrases in a Document

DECLARE @DocID hierarchyid

SELECT @DocID = path_locator from documentstore where name = 'SQL Server 2012 database enhancements.docx'

SELECT keyphrase, score

    FROM SEMANTICKEYPHRASETABLE(DocumentStore, *, @DocID)

    ORDER BY score DESC

GO

select @@ROWCOUNT as RowsCount

GO

 SemanticSearch_SEMANTICKEYPHRASETABLE.jpg 

As you can see, the function returns the TOP 100 keyphrase index for each document, with a relative score.

SEMANTICSIMILARITYTABLE

This table valued function is used to find similar or related documents.
   • This function measures the "cosine similarity" between documents "keyphrase vectors"
   • Function rewards common phrases with similar weights and penalizes exclusive phrases or  dissimilar weights

-- Find Similar or Related Documents

DECLARE @DocID hierarchyid

SELECT @DocID = path_locator from documentstore where name = 'SQL Server 2012 database enhancements.docx'

 

SELECT 'SQL Server 2012 database enhancements.docx' as SourceTitle, Name AS MatchedTitle,path_locator, score

FROM SEMANTICSIMILARITYTABLE(DocumentStore, *, @DocID)

INNER JOIN DocumentStore ON path_locator = matched_document_key 

ORDER BY score DESC

 

SemanticSearch_SEMANTICSIMILARITYTABLE.jpg

The score gives a relative value for similarity of the source document in its relationship to all the other similar documents.

SEMANTICSIMILARITYDETAILSTABLE

This function returns a table containing the key phrases common across two documents whose content is semantically similar.

-- Find the Key Phrases That Make Documents Similar or Related

declare @SourceTitle nvarchar(100),@MatchedTitle  nvarchar(100), @SourceDocID hierarchyid, @MatchedDocID hierarchyid

SET @SourceTitle = 'SQL Server 2012 database enhancements.docx'

SET @MatchedTitle = 'SQL Server 2012 BI enhancements.docx'

  

SELECT @SourceDocID = path_locator FROM DocumentStore WHERE Name = @SourceTitle

SELECT @MatchedDocID = path_locator FROM DocumentStore WHERE Name = @MatchedTitle

 

SELECT @SourceTitle AS SourceTitle, @MatchedTitle AS MatchedTitle, keyphrase, score

FROM semanticsimilaritydetailstable(DocumentStore, file_stream,

@SourceDocID, file_stream, @MatchedDocID)

ORDER BY score DESC

 

SemanticSearch_SEMANTICSIMILARITYDETAILSTABLE.jpg

The score gives a relative value for similarity of the source document in its relationship to all the other similar documents.

Subscribe to this blog's feed

Follow us on

Blogger Profiles

Infosys on Twitter