<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:blogChannel="http://backend.userland.com/blogChannelModule" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">
  <id>http://kirsanov.net/</id>
  <title>Kirsanov.net</title>
  <updated>2013-02-25T04:23:12+00:00</updated>
  <link href="http://kirsanov.net/" />
  
  <subtitle>Wild Pleasure Of Exploration</subtitle>
  <author>
    <name>Dmitry Kirsanov</name>
  </author>
  <generator uri="http://dotnetblogengine.net/" version="1.0.0.0">BlogEngine.Net Syndication Generator</generator>
  <blogChannel:blogRoll>http://kirsanov.net/opml.axd</blogChannel:blogRoll>
  <blogChannel:blink>http://kirsanov.net/syndication.axd</blogChannel:blink>
  <dc:creator>Dmitry Kirsanov</dc:creator>
  <dc:description>Wild Pleasure Of Exploration</dc:description>
  <dc:language>en-US</dc:language>
  <dc:title>Kirsanov.net</dc:title>
  <geo:lat>0.000000</geo:lat>
  <geo:long>0.000000</geo:long>
  <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/Kirsanov" /><feedburner:info uri="kirsanov" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><link rel="license" type="text/html" href="http://creativecommons.org/licenses/by-nc-nd/3.0/" /><feedburner:emailServiceId>Kirsanov</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><entry>
    <id>http://kirsanov.net/post/2013/02/24/SQL-Bits-Working-with-AlwaysOn-Availability-Groups-in-SQL-Server-2012.aspx</id>
    <title>SQL Bits: Working with AlwaysOn Availability Groups in SQL Server 2012</title>
    <updated>2013-02-25T04:23:12+00:00</updated>
    <link rel="self" href="http://kirsanov.net/post.aspx?id=ca778658-7368-413c-91b8-b677c2398bee" />
    <link href="http://feedproxy.google.com/~r/Kirsanov/~3/VX3zRcxNMTE/SQL-Bits-Working-with-AlwaysOn-Availability-Groups-in-SQL-Server-2012.aspx" />
    <author>
      <name>admin</name>
    </author>
    <summary type="html">&lt;p&gt;&lt;img style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: left; padding-top: 0px; padding-left: 0px; margin: 0px 10px 10px 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" align="left" src="http://kirsanov.net/image.axd?picture=SQL2012.png" /&gt;In SQL Server 2012, we have 4 main options for High Availability: Database Mirroring, Failover Clustering, Availability Groups and Log Shipping. All but Availability Groups (AG) are available in SQL Server 2008 as well. Today we’ll review Availability Groups and how to create and use them.&lt;/p&gt;  &lt;p&gt;Before we begin, make sure you understand what is &lt;a title="Windows Server Failover Cluster" href="http://kirsanov.net/post/2012/04/19/Configuring-Failover-Cluster-in-Windows-Server-2008.aspx" target="_blank"&gt;Windows Server Failover Cluster&lt;/a&gt; (WSFC). I covered it almost a year ago for Windows Server 2008 R2 and SQL Server 2008 R2, and you’ll need WSFC in order for AG to work.&lt;/p&gt;  &lt;p&gt;A few points about Availability Groups to make sure they are what you are looking for:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Availability Groups are &lt;strong&gt;not share-nothing&lt;/strong&gt; scalability option. They are using shared storage, such as storage area network (SAN), although &lt;em&gt;it’s not a requirement&lt;/em&gt;. We’ll speak about share-nothing scalability later. &lt;/li&gt;    &lt;li&gt;For AlwaysOn Availability Groups, you need SQL Server 2012 Enterprise edition or higher. Business Intelligence edition or Standard won’t do. &lt;/li&gt;    &lt;li&gt;AG provide failover with up to 5 readable nodes. &lt;/li&gt;    &lt;li&gt;AG provide you with something like load balancing option, but &lt;strong&gt;AG is not NLB&lt;/strong&gt;. Also, all nodes can work independently, i.e. you can still connect to them to &lt;em&gt;retrieve&lt;/em&gt; information. &lt;strong&gt;Only the primary node can change information in the database&lt;/strong&gt;. &lt;/li&gt;    &lt;li&gt;AG does not require working in the same IP subnet, but it requires Active Directory domain. This means, that you can have geographically remote nodes participating in one AG, but they must be members of the same AD domain.      &lt;br /&gt;In case of multi-subnet cluster, you’ll have to implement the file replication solution on your file servers to synchronize the data. &lt;/li&gt;    &lt;li&gt;AG is database-level, as opposed to node-level failover cluster. AG serves group of databases, unlike the simple database mirroring, with 4 replicas instead of one. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Overall, the AlwaysOn Availability Groups are conceptually similar to database mirroring, but provide more advanced functionality and security.&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;h2&gt;Windows Server Failover Cluster&lt;/h2&gt;  &lt;p&gt;WSFC provides database-level high availability to AlwaysOn Groups. You need to create the WSFC and add all instances of SQL Server 2012 as members of the cluster. However, it doesn’t mean that you must install these SQL Server instances as clustered. They should be installed as standalone instances and so has it’s own dedicated storage. &lt;strong&gt;&lt;em&gt;Every node operates it’s own copy of the database&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;  &lt;p&gt;At the video in the end of the article we’ll have the cluster already installed and will only check that it’s here, up and running.&lt;/p&gt;  &lt;h2&gt;AlwaysOn Availability Groups&lt;/h2&gt;  &lt;p&gt;AlwaysOn Availability Groups may contain 2 to 5 nodes. One node is called &lt;em&gt;Primary&lt;/em&gt;, and it hosts the read-write copy of your database. Other 1 to 4 are &lt;em&gt;Secondary&lt;/em&gt; nodes, and they may or may not provide data to consumers (either users or applications). &lt;/p&gt;  &lt;p&gt;Secondary replica holds full copy of each database in availability group. When needed, you can set up read-only access to the databases on specific node, or no access at all. Read-only or no access setting will only work, when node is Secondary. If, during the &lt;em&gt;failover&lt;/em&gt; or manually, Secondary replica will be promoted to Primary, it will serve all requests.&lt;/p&gt;  &lt;h2&gt;Failover&lt;/h2&gt;  &lt;p&gt;Failover event is when your primary replica fails. In that case, Secondary node which can be automatically promoted to Primary, will be promoted automatically. Such nodes are known as Failover Targets. You may also have secondary nodes which may not be &lt;em&gt;automatically&lt;/em&gt; promoted to primary. The new primary replica then recovers its databases and makes them available to users of the availability group.&lt;/p&gt;  &lt;p&gt;There are 3 types of failover in AG:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;strong&gt;Automatic failover (without data loss)&lt;/strong&gt;. Automatic failover is only available when both the primary replica and the secondary replica are running in &lt;em&gt;synchronous-commit&lt;/em&gt; mode, and the failover mode is set to automatic. In automatic failover mode, failure of the primary replica causes failover to the secondary replica without the need for administrator intervention. No data loss will occur on failover. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Planned manual failover (without data loss)&lt;/strong&gt;. Planned manual failover is only available when both the primary replica and the secondary replica are running in synchronous-commit mode. In planned manual failover mode, a database administrator must issue a failover command to initiate failover. No data loss will occur on failover. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Forced manual failover (with possible data loss)&lt;/strong&gt;. Forced manual failover is the only failover type that you can use for replicas that are in asynchronous-commit mode. You must initiate forced manual failover manually. Any transactions that were committed on the primary replica, but which the secondary replica has not yet written to its log, will be lost. You can also use forced manual failover for replicas that are in synchronous-commit mode when the secondary replica is not showing as synchronized with the primary replica. &lt;/li&gt; &lt;/ol&gt;  &lt;h2&gt;Load balancing with Active Secondary Replicas&lt;/h2&gt;  &lt;p&gt;All your nodes can be set as Active Secondary replicas. In that case, you can route connections with read-only intent to these secondary nodes, thus reduce the workload from your primary replica. That’s the point of read-only intent – when you are connecting to the AlwaysOn Group and not specifying the intent, you’ll connect to the primary replica. If you will specify the intent when connecting to the AG, you may be redirected to active secondary replica instead.&lt;/p&gt;  &lt;p&gt;You can also take backups from Active Secondary Replicas, which can further reduce the workload placed on the primary replica.&lt;/p&gt;  &lt;h2&gt;Backups&lt;/h2&gt;  &lt;p&gt;One of the settings you’ll have to set when creating your AlwaysOn Availability Group is the backup creation policy. You’ll have to identify the nodes responsible for backing up the database. Since most of the load will be on your primary replica, I would recommend to not make backup the responsibility of the primary replica. Backups may consume significant server resources, especially when they are compressed. &lt;/p&gt;  &lt;p&gt;During the creation of AG, you’ll see a few options you have for backups.&lt;/p&gt;  &lt;p&gt;Active secondary replicas support two types of backup operations:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Log backups.&lt;/li&gt;    &lt;li&gt;Copy-only backups of the database, filegroups, or files.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;You can specify how backups are performed in the availability group by configuring the automated backup preference property of the availability group. The options for automated backup preference are:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;Only on the primary replica&lt;/strong&gt;. This setting helps ensure that all backups occur on the primary replica.       &lt;br /&gt;You can use this setting when you need to run a backup job, such as a differential backup, that is not supported on active secondary replicas.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;On secondary replicas&lt;/strong&gt;. This is the default setting. This setting runs all backups on an active secondary replica; if there is no active secondary replica available, backup jobs will run on the primary replica.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Only on secondary replicas&lt;/strong&gt;. This setting runs backup jobs on active secondary replicas only. If there are no active secondary replicas available, backup jobs will not run.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;No Preference&lt;/strong&gt;. That is – run the backup on any node. You can use the backup priority values to set the priority for specific replicas, on the scale from 0 to 100. 100 is the highest priority, and 0 means that replica won’t be used for backup jobs.&lt;/li&gt; &lt;/ul&gt;  &lt;h2&gt;Implementing AlwaysOn Availability Groups&lt;/h2&gt;  &lt;p&gt;   &lt;br /&gt;The easiest way to create an AlwaysOn Availability Group is to use the New Availability Group Wizard in SQL Server Management Studio. You can also create an availability group by using the graphical tools in SQL Server Management Studio, running Transact-SQL statements, or running &lt;a title="PowerShell tutorials" href="http://kirsanov.net/?tag=/PowerShell" target="_blank"&gt;PowerShell&lt;/a&gt; cmdlets.    &lt;br /&gt;Regardless of the tool you use to create an availability group, you must perform the following    &lt;br /&gt;tasks:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Install the Failover Clustering Windows Server feature on each server that you want to include in the availability group.&lt;/li&gt;    &lt;li&gt;Create a Windows Server failover cluster that includes all of the servers. You must specify a name and IP address for the cluster.&lt;/li&gt;    &lt;li&gt;Install a standalone-instance of SQL Server 2012 on each server in the cluster. You must install the database engine feature, and optionally the management tools feature.&lt;/li&gt;    &lt;li&gt;Use SQL Server Configuration Manager to enable AlwaysOn Availability Groups for each server in the cluster.&lt;/li&gt;    &lt;li&gt;Create a file share for the backup files used to synchronize the availability group replicas.&lt;/li&gt;    &lt;li&gt;Create the databases you want to protect on the server that will become the primary replica, and perform a full backup of each database.&lt;/li&gt;    &lt;li&gt;Create an AlwaysOn Availability Group, specifying:&lt;/li&gt; &lt;/ol&gt;  &lt;ul&gt;   &lt;li&gt;A name for the availability group.&lt;/li&gt;    &lt;li&gt;The databases to be included in the availability group.&lt;/li&gt;    &lt;li&gt;The replicas (server instances) to be included in the availability group, including the type of replica (primary or secondary), the type of failover supported (manual or automatic), the type of synchronization to be used (synchronous or asynchronous), and the read-only support (none, read intent only, or full) for each replica.&lt;/li&gt;    &lt;li&gt;The endpoints to be used by the replicas.&lt;/li&gt;    &lt;li&gt;The backup preferences for the availability group.&lt;/li&gt;    &lt;li&gt;Optionally, listener configuration for the availability group, including a DNS name, port, and IP     &lt;br /&gt;address for the listener.&lt;/li&gt;    &lt;li&gt;The file share to be used for synchronization (which should be the file share you created in step 5).&lt;/li&gt; &lt;/ul&gt;  &lt;h2&gt;The Life after Five&lt;/h2&gt;  &lt;p&gt;AlwaysOn Availability Group allows you to join up to 5 nodes into one powerful cluster. But what if you’ll have to scale out wider? There are two options. One of them is to use &lt;a title="SQL Server 2012 Parallel Data Warehouse" href="http://youtu.be/AnxJ4OtmGsk" rel="nofollow" target="_blank"&gt;SQL Server 2012 Parallel Data Warehouse&lt;/a&gt; edition – that is, to buy the appliance by either HP or Dell. It’s not cheap. Another option is to create a sophisticated share-nothing scaling solution, which we’ll cover soon, as that’s really fascinating topic. Well, if you are still reading this, anyway.&lt;/p&gt;  &lt;p&gt;Hope it was informative enough, and if so – please, leave a comment or click “like” wherever you see it – that helps to set priorities for future topics.&lt;/p&gt;  &lt;p&gt;And here’s the video of how to set up the AlwaysOn AG in your premises in 10 minutes or so. Enjoy!&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;div id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:0024d3cc-5925-4d08-bfdd-a32fd14da52d" class="wlWriterEditableSmartContent" style="float: none; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px"&gt;&lt;div&gt;&lt;object width="666" height="374"&gt;&lt;param name="movie" value="http://www.youtube.com/v/JbzcQpu3YjA?hl=en&amp;amp;hd=1"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/JbzcQpu3YjA?hl=en&amp;amp;hd=1" type="application/x-shockwave-flash" width="666" height="374"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;div style="width:666px;clear:both;font-size:.8em"&gt;Setting up the AlwaysOn Availability Group in SQL Server 2012&lt;/div&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Kirsanov/~4/VX3zRcxNMTE" height="1" width="1"/&gt;</summary>
    <published>2013-02-25T04:23:12+00:00</published>
    <link rel="related" href="http://kirsanov.net/post/2013/02/24/SQL-Bits-Working-with-AlwaysOn-Availability-Groups-in-SQL-Server-2012.aspx#disqus_thread" />
    <category term="Systems Administration" />
    <dc:publisher>admin</dc:publisher>
    <pingback:server>http://kirsanov.net/pingback.axd</pingback:server>
    <pingback:target>http://kirsanov.net/post.aspx?id=ca778658-7368-413c-91b8-b677c2398bee</pingback:target>
    <slash:comments>0</slash:comments>
    <trackback:ping>http://kirsanov.net/trackback.axd?id=ca778658-7368-413c-91b8-b677c2398bee</trackback:ping>
    <wfw:comment>http://kirsanov.net/post/2013/02/24/SQL-Bits-Working-with-AlwaysOn-Availability-Groups-in-SQL-Server-2012.aspx#disqus_thread</wfw:comment>
    <wfw:commentRss>http://kirsanov.net/syndication.axd?post=ca778658-7368-413c-91b8-b677c2398bee</wfw:commentRss>
  <feedburner:origLink>http://kirsanov.net/post/2013/02/24/SQL-Bits-Working-with-AlwaysOn-Availability-Groups-in-SQL-Server-2012.aspx</feedburner:origLink></entry>
  <entry>
    <id>http://kirsanov.net/post/2013/02/16/SQL-Bits-8-Most-Important-New-Features-In-SQL-Server-2012.aspx</id>
    <title>SQL Bits: 8 Most Important New Features In SQL Server 2012</title>
    <updated>2013-02-16T13:00:00+00:00</updated>
    <link rel="self" href="http://kirsanov.net/post.aspx?id=740cf367-c04f-442b-8710-9a735ea50660" />
    <link href="http://feedproxy.google.com/~r/Kirsanov/~3/1NpFhnvvtgE/SQL-Bits-8-Most-Important-New-Features-In-SQL-Server-2012.aspx" />
    <author>
      <name>admin</name>
    </author>
    <summary type="html">&lt;p&gt;&lt;img title="SQL Server 2012" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: left; padding-top: 0px; padding-left: 0px; margin: 0px 10px 10px 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="SQL Server 2012" align="left" src="http://kirsanov.net/image.axd?picture=SQL2012.png" width="265" height="167" /&gt;&lt;/p&gt;  &lt;p&gt;If you are developer, then you work with relational databases as well. And if you work in a Windows world, most likely your system of choice is Microsoft SQL Server.&lt;/p&gt;  &lt;p&gt;With every new &lt;a title="DataBase Management System" href="http://en.wikipedia.org/wiki/Database_management_system" rel="nofollow" target="_blank"&gt;DBMS&lt;/a&gt; release we find something that changes the way we solve common problems in new solutions. SQL Server 2012 is no exception.&lt;/p&gt;  &lt;p&gt;In SQL Server 2012, instead of just enhancing the productivity and robustness of the server, Microsoft solved a number of architectural problems we previously had to deal with in our applications when working with SQL Server.&lt;/p&gt;  &lt;p&gt;Problems like saving files in databases, load balancing database clusters and simple restoration of data, finally got the minimum viable solution, which should only improve with time.&lt;/p&gt;    &lt;br clear="all" /&gt;  &lt;h2&gt;1. Store and Query Documents with File Tables&lt;/h2&gt;  &lt;p&gt;I would say that there are two common ways to store files in your web application. First one – you store them on disk, be it share or SAN or any other persistent storage, and register information about the file in the database. That way you can backup your files separately from the database, as the file content doesn’t fill the database files, and make sure that attachments become the responsibility of file server managers.&lt;/p&gt;  &lt;p&gt;Second way, introduced in SQL 2005, is to use FILESTREAM. Same BLOBs stored in varbinary(max) fields, but physically stored differently, in NTFS stream. Also, FILESTREAM uses the NT system cache for caching file data. This helps reduce any effect that FILESTREAM data might have on Database Engine performance. The SQL Server buffer pool is not used; therefore, this memory is available for query processing.&lt;/p&gt;  &lt;p&gt;Well, both methods have their (dis)advantages out of scope of this article, but the new method of storing data files is both simple and efficient.&lt;/p&gt;  &lt;p&gt;In fact, that’s very similar method to the one I’ve used two years ago when I created my own file sending service, when I didn’t want to pay the filemail.com license. In short – you store the information about the files in the database, you store files in a file share, and monitor changes to the file system, immediately reflecting them in the database.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://kirsanov.net/image.axd?picture=Slide10.jpg"&gt;&lt;img title="SQL Server 2012 File Tables" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: left; padding-top: 0px; padding-left: 0px; margin: 0px 20px 0px 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="SQL Server 2012 File Tables" align="left" src="http://kirsanov.net/image.axd?picture=Slide10_thumb.jpg" width="240" height="136" /&gt;&lt;/a&gt;&lt;strong&gt;A few notes about File Tables:&lt;/strong&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;You can access information about your files using either normal T-SQL query, or by accessing the file directly. &lt;/li&gt;    &lt;li&gt;You can not change the schema or structure of the file table. &lt;/li&gt;    &lt;li&gt;You can’t create file tables in TEMP or SYS databases. &lt;/li&gt;    &lt;li&gt;Folder must reside in persistent storage, i.e. no memory drives. However, you can map a directory in memory disk and use it, as then SQL Server won’t know it’s volatile. &lt;/li&gt; &lt;/ul&gt;  &lt;p align="right"&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ff929144.aspx" rel="nofollow" target="_blank"&gt;More information about File Tables in MSDN&lt;/a&gt;.&lt;/p&gt;  &lt;h2&gt;2. Statistical Semantic Search&lt;/h2&gt;  &lt;p&gt;How would you like to be able to select a word document, say, a CV, and with a single click of a button to find similar CVs stored in your database? It’s never been easier, thanks to the new feature of SQL Server 2012 – the Statistical Semantic Search.&lt;/p&gt;  &lt;p&gt;SSS requires a bit more preparation, but results are like magic. First, you need to install the SSS database, which you may find in your installation media, the installation file is called SemanticLanguageDatabase.msi. It will basically extract the database file to the directory of your choice. Then, you’ll have to attach it to your instance of SQL Server, only one database per instance, and you’re ready.&lt;/p&gt;  &lt;p&gt;Make sure you don’t change that database, it’s not meant to be edited.&lt;/p&gt;  &lt;p&gt;In order to index Microsoft Office documents, especially the ones with the new document format, you’ll need to install &lt;a title="Microsoft Office filter packs" href="http://www.microsoft.com/en-us/download/details.aspx?id=17062" rel="nofollow" target="_blank"&gt;Microsoft Office filter packs&lt;/a&gt; for Microsoft Search&amp;#160; – either 32 or 64 bit. &lt;/p&gt;  &lt;p align="right"&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/gg492075.aspx" rel="nofollow" target="_blank"&gt;More information about SQL Server Statistical Semantic Search in MSDN&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;3. AlwaysOn clustering&lt;/h2&gt;  &lt;p&gt;Some time ago I covered the SQL Server 2008 R2 failover clustering. It’s a must have function for any vital database. In case the term is new for you, here is the &lt;a title="Tutorial for SQL Server 2008 failover cluster" href="http://kirsanov.net/post/2012/04/19/Configuring-Failover-Cluster-in-Windows-Server-2008.aspx" target="_blank"&gt;link to original article and video tutorial&lt;/a&gt;. The problem of failover cluster – there can be only one. You may have two servers running at the same time, but only one of them would serve the clients.&lt;/p&gt;  &lt;p&gt;It’s not so with AlwaysOn feature of SQL Server 2012. Now you may have up to 5 nodes linked into one NLB cluster (quite similar to &lt;a title="Network Load Balancing clusters" href="http://kirsanov.net/post/2011/11/14/Network-Load-Balancing-Clusters-in-Windows-2008%E2%80%93when-one-server-is-not-enough.aspx" target="_blank"&gt;IIS NLB clusters&lt;/a&gt;, which I covered in 2011), which is also a failover cluster. Practically that means – if one computer fails, another node automatically takes the primary role, but all nodes are active and can serve clients, and some of these nodes may be serving specifically the read-only requests.&lt;/p&gt;  &lt;p&gt;&lt;img title="SQL Server 2012 AlwaysOn cluster" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: left; padding-top: 0px; padding-left: 0px; margin: 0px 10px 0px 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="SQL Server 2012 AlwaysOn cluster" align="left" src="http://kirsanov.net/image.axd?picture=Slide26.jpg" width="254" height="198" /&gt;There is a principle, usually called “20/80”, which declares that usually no more than 20% of all requests to SQL server are ending with the change to the database. The rest are based on SELECTs. For example – websites and reports produce a lot of requests, but relatively not many changes.&lt;/p&gt;  &lt;p&gt;With AlwaysOn cluster, you can specify the intention of your connection, and if it’s intention to get the read-only connection, most likely you’ll be connected to the read-only node.&lt;/p&gt;  &lt;p&gt;Another benefit of AlwaysOn cluster is that connection between nodes may be synchronous or asynchronous, the latter could use your bandwidth more efficiently, but if the primary node would fail in process, some data could be lost. It depends from your cluster, anyway.&lt;/p&gt;  &lt;p&gt;Whenever you need to perform maintenance on one of the nodes, you can manually switch the primary role to another node or simply set this node “offline”, so it won’t serve clients until the maintenance is over.&lt;/p&gt;  &lt;p&gt;The AlwaysOn availability cluster doesn’t switch the master role to another node when there are problems with particular memory pages. See the last topic of this article for the ways to restore particular memory pages when needed.&lt;/p&gt;  &lt;p align="right"&gt;&lt;a title="SQL Server 2012 AlwaysOn Availability Groups" href="http://msdn.microsoft.com/en-us/library/ff877884.aspx" rel="nofollow" target="_blank"&gt;More information about AlwaysOn Availability Groups in MSDN&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;4. Contained Databases&lt;/h2&gt;  &lt;p&gt;And as we are speaking about the clustering and replication of the databases, one thing that many SQL developers find confusing or complex is the way you authenticate and authorize with SQL Server. As you know, you must have a user and a login, linked to each other. Login allows you to provide credentials to log into the SQL Server, while user account is used to claim rights and own resources.&lt;/p&gt;  &lt;p&gt;Normally, when you replicate the database, you don’t replicate the server-level logins, so you have to re-create them. Well, not necessarily if your database is contained.&lt;/p&gt;  &lt;p&gt;&lt;img title="Contained Database" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Contained Database" src="http://kirsanov.net/image.axd?picture=ContainedDB.jpg" width="650" height="189" /&gt;&lt;/p&gt;  &lt;p&gt;The contained database allows you to authenticate against the database, not the server. This feature has it’s pros and cons, but in some scenarios, like deploying our database to many customers, it could save a lot of time on supporting users, as invalid server logon is one of the most common problems.&lt;/p&gt;  &lt;p&gt;Existing databases may become contained, you just have to alter them and change the containment level to PARTIAL. There is no FULL level of containment, but the word “partial” implies that “full” may be introduced in the future.&lt;/p&gt;  &lt;p&gt;One thing that is a bit tricky now is how the authentication works now. Take a look at the algorithm:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://kirsanov.net/image.axd?picture=ContainedDBAuth.jpg"&gt;&lt;img title="Contained Database Authentication algorithm" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Contained Database Authentication algorithm" src="http://kirsanov.net/image.axd?picture=ContainedDBAuth_thumb.jpg" width="653" height="346" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;First thing that SQL Server checks is whether or not you provide the initial catalog (i.e. the database name) in connection string. If you don’t, there is no contained database authentication for you, you authenticate against the server.&lt;/p&gt;  &lt;p&gt;However, if you do specify the database, and it’s contained database, then you will authenticate against the database user, and in that case you’d better not have two users with identical usernames in both database and server, as failing to authenticate as database user will lead to authentication failure, there won’t be a fallback to server-level authentication.&lt;/p&gt;  &lt;p&gt;So always ensure your local database users have login names that you won’t ever have at server level. For example – dbJohnDoe instead of JohnDoe.&lt;/p&gt;  &lt;p align="right"&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ff929071.aspx" rel="nofollow" target="_blank"&gt;More about Contained Databases in MSDN&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;5. Transact-SQL Enhancements&lt;/h2&gt;  &lt;p&gt;As always, each new release of SQL Server brings new functions and syntax features. These are the most useful ones for me:&lt;/p&gt;  &lt;p&gt;&lt;img title="SQL Server 2012 Transact-SQL Enhancements" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="SQL Server 2012 Transact-SQL Enhancements" src="http://kirsanov.net/image.axd?picture=SQL12TSQL1.jpg" width="650" height="253" /&gt;&lt;/p&gt;  &lt;p&gt;The first one, &lt;strong&gt;WITH RESULT SETS&lt;/strong&gt; clause, allows you to automatically convert and rename the result you get from your stored procedure. In this example, stored procedure may return different fields with different names, but then the first field will be converted to nvarchar with limit of 20 chars and no NULL values, second column will be renamed and converted to integer, and so on.&lt;/p&gt;  &lt;p&gt;This way we can ensure the backward compatibility between our stored procedures and data consumers, such as applications – you won’t have to rewrite and recompile the data consuming code just because you’ve changed the stored procedure. Wonderful!&lt;/p&gt;  &lt;p&gt;The second one, &lt;strong&gt;THROW&lt;/strong&gt; statement, is pretty much like RAISEERROR, but it’s much more like what you are using in programming languages like C# or VB – you can specify &lt;em&gt;arbitrary&lt;/em&gt; error code, specify strict (i.e. non-formatted, unlike in RAISEERROR), and specify the arbitrary state byte. In RAISEERROR you would also have to specify the severity level, but here it’s always 16.&lt;/p&gt;  &lt;p&gt;The &lt;strong&gt;OFFSET&lt;/strong&gt; and &lt;strong&gt;FETCH&lt;/strong&gt; keywords are self-explanatory – perfect way to page your data set output.&lt;/p&gt;  &lt;p&gt;We’ve also got a new set of functions in T-SQL:&lt;/p&gt;  &lt;p&gt;&lt;img title="SQL Server 2012 new functions" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="SQL Server 2012 new functions" src="http://kirsanov.net/image.axd?picture=SQL12TSQL2.jpg" width="648" height="388" /&gt;&lt;/p&gt;  &lt;p&gt;As you can see in this example, we’ve got closer to what we have in .NET. For example – &lt;strong&gt;TRY_PARSE&lt;/strong&gt; will return either the result of conversion or NULL, but will not throw an exception. In the example above, we would get NULL, as we would try to convert 345 British pounds to the data type of money using the en-US culture, instead of en-GB. The same is with &lt;strong&gt;TRY_CONVERT&lt;/strong&gt;.&lt;/p&gt;  &lt;p&gt;Another function from this list that worth explaining is &lt;strong&gt;EOMONTH&lt;/strong&gt;. As you may guess, it means “end of month”, and it returns the last day of the month, which contains the date that you specified as the parameter. So, if you would specify the 16th February of 2013, it would return 28th of February, as February only has 28 days. The last parameter is optional and it’s for offset, in months, so if you would ask for EOMONTH and specify 16/02/2013 as the date and 1 as the offset, you would get &lt;strong&gt;31&lt;/strong&gt;/03/2013 as the result date – the last day of the next month after February. The offset value could be negative as well.&lt;/p&gt;  &lt;h2&gt;6. Management Tool Enhancements&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://kirsanov.net/image.axd?picture=SQL12MSEnh.jpg"&gt;&lt;img title="SQL Server 2012 Management Tools Enhancements" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: left; padding-top: 0px; padding-left: 0px; margin: 0px 10px 10px 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="SQL Server 2012 Management Tools Enhancements" align="left" src="http://kirsanov.net/image.axd?picture=SQL12MSEnh_thumb.jpg" width="240" height="209" /&gt;&lt;/a&gt;SQL Server Management Studio changed significantly, although everything looks suspiciously similar. That’s because the changes are not cosmetic, but functional. We’ve got a better intellisense, snippets and enhanced debugging, making Management Studio look and feel just like Microsoft Visual Studio.&lt;/p&gt;  &lt;p&gt;Code snippets basically allow you to paste pre-defined code fragments from intellisense menu, and it’s technique which increases productivity of .NET developers for years.&lt;/p&gt;  &lt;p&gt;Debugging with watch windows and locals and breakpoints is what .NET developers think is natural is given. Now also to DBA.&lt;/p&gt;  &lt;h2&gt;7. Security Enhancements&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://www.schneier.com/" rel="nofollow" target="_blank"&gt;Bruce Schneier&lt;/a&gt;’s “Applied Cryptography” is my desk book, and that explains why I consider security enhancements in SQL Server 2012 to be significant and important.&lt;/p&gt;  &lt;p&gt;In SQL Server 2008 and up, when you need to encrypt particular data, say, a credit card number or social security number, you need to generate &lt;a title="http://en.wikipedia.org/wiki/Advanced_Encryption_Standard" href="http://en.wikipedia.org/wiki/Advanced_Encryption_Standard" rel="nofollow" target="_blank"&gt;AES&lt;/a&gt; key and protect that key by either a password, a certificate or a database master key. Everything was cool, excerpt that &lt;strong&gt;database master key&lt;/strong&gt; was Triple-DES, which is strong but relatively slow. Anyway, not that slow to become a bottleneck for your application. But it’s like having biometric keys on all doors excerpt on the door to the server room, where biometric system stores it’s data.&lt;/p&gt;  &lt;p&gt;So, since SQL Server 2012, the database and service master keys are stored using AES algorithm. The maximum certificate length was increased to 4096 bits.&lt;/p&gt;  &lt;p&gt;When you need to store user passwords, usually you are using hashes of that passwords, so neither you or anyone who hacks into your database could see or guess the original password. For that we are using T-SQL function &lt;a title="HASHBYTES function in SQL Server 2012" href="http://msdn.microsoft.com/en-us/library/ms174415.aspx" rel="nofollow" target="_blank"&gt;HASHBYTES&lt;/a&gt;, which is very simple to use and it can use a variety of algorithms – the stronger the slower. The fastest one now is MD5, which was hacked and therefore prohibited by some security standards, and various SHA algorithms of different length. So, now it also supports SHA2 with lengths of 256 and 512 bits. Hooray.&lt;/p&gt;  &lt;p&gt;Database and server level passwords are now hashed using SHA512, which adds to the security of contained database.&lt;/p&gt;  &lt;p&gt;The RC4 algorithm is deprecated and can only be used for databases with compatibility level of 90 or 100. You can’t use it in new databases.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Auditing&lt;/strong&gt; is now enabled for all versions of SQL Server, but particular database auditing is only for Enterprise version and up.&lt;/p&gt;  &lt;h2&gt;8. Point-In-Time Restore&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://kirsanov.net/image.axd?picture=SQL12Restore.jpg"&gt;&lt;img title="SQL Server 2012 Restore" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: left; padding-top: 0px; padding-left: 0px; margin: 0px 10px 0px 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="SQL Server 2012 Restore" align="left" src="http://kirsanov.net/image.axd?picture=SQL12Restore_thumb.jpg" width="240" height="153" /&gt;&lt;/a&gt;The last thing in this list is much simplified restoration of the database. Remember the traditional way of building the whole algorithm and restore plan, with full backup, differential, transaction log and tail-log backups? Well, they are still valid, of course, but when the time comes to restore your database – there are two new features that will greatly simplify your life, even though they are simple dialog boxes for a more complex T-SQL queries.&lt;/p&gt;  &lt;p&gt;Point-In-Time Restore allows you to specify the moment in time, to which you want to restore your database. SQL Server will use all available backup sets to do it automatically.&lt;/p&gt;  &lt;p&gt;Another thing, that becomes quite useful when using the AlwaysOn availability group, is Page Restore. This method is only&amp;#160; good when there are very few pages to be restored, otherwise you may want to restore the whole files or the database.&lt;/p&gt;  &lt;p align="right"&gt;&lt;a title="Point-In-Time recovery in SQL Server 2012" href="http://msdn.microsoft.com/en-us/library/ms179451.aspx" rel="nofollow" target="_blank"&gt;More about Point-In-Time recovery in MSDN&lt;/a&gt;&lt;/p&gt;  &lt;p align="right"&gt;&lt;a title="Page Restore in SQL Server 2012" href="http://msdn.microsoft.com/en-us/library/ms175168.aspx" rel="nofollow" target="_blank"&gt;More about Page Restore in MSDN&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Kirsanov/~4/1NpFhnvvtgE" height="1" width="1"/&gt;</summary>
    <published>2013-02-16T13:00:00+00:00</published>
    <link rel="related" href="http://kirsanov.net/post/2013/02/16/SQL-Bits-8-Most-Important-New-Features-In-SQL-Server-2012.aspx#disqus_thread" />
    <category term="Software development" />
    <category term="Systems Administration" />
    <dc:publisher>admin</dc:publisher>
    <pingback:server>http://kirsanov.net/pingback.axd</pingback:server>
    <pingback:target>http://kirsanov.net/post.aspx?id=740cf367-c04f-442b-8710-9a735ea50660</pingback:target>
    <slash:comments>0</slash:comments>
    <trackback:ping>http://kirsanov.net/trackback.axd?id=740cf367-c04f-442b-8710-9a735ea50660</trackback:ping>
    <wfw:comment>http://kirsanov.net/post/2013/02/16/SQL-Bits-8-Most-Important-New-Features-In-SQL-Server-2012.aspx#disqus_thread</wfw:comment>
    <wfw:commentRss>http://kirsanov.net/syndication.axd?post=740cf367-c04f-442b-8710-9a735ea50660</wfw:commentRss>
  <feedburner:origLink>http://kirsanov.net/post/2013/02/16/SQL-Bits-8-Most-Important-New-Features-In-SQL-Server-2012.aspx</feedburner:origLink></entry>
  <entry>
    <id>http://kirsanov.net/post/2013/01/29/Introduction-to-Windows-8-Development-XAML-Controls.aspx</id>
    <title>Introduction to Windows 8 Development: XAML Controls</title>
    <updated>2013-01-29T17:00:00+00:00</updated>
    <link rel="self" href="http://kirsanov.net/post.aspx?id=78989efb-0e8c-48dd-8edd-0d13a23fa5cb" />
    <link href="http://feedproxy.google.com/~r/Kirsanov/~3/rFsx1poydXA/Introduction-to-Windows-8-Development-XAML-Controls.aspx" />
    <author>
      <name>Admin</name>
    </author>
    <summary type="html">&lt;p&gt;This is the second part of Controls section of my introduction to Windows 8 Development, and today we are going to review the developing of XAML applications for Windows Store. First part is &lt;a title="Using controls in HTML5 applications in Windows 8" href="http://kirsanov.net/post/2013/01/14/Introduction-to-Windows-8-Development-Working-with-Controls.aspx" target="_blank"&gt;available here&lt;/a&gt;.&lt;/p&gt;  &lt;h2&gt;A little off topic&lt;/h2&gt;  &lt;p&gt;One of my favorite quotes belongs to Ludwig Mies van der Rohe, and that is – “The God is in the details”. I’ve checked – this was the &lt;strong&gt;sixth&lt;/strong&gt; time I quoted him in my blog, and the &lt;em&gt;first three&lt;/em&gt; quotes insist that devil is in details as well. Depends from the details, I guess. And there are many details of both kinds in the ways you develop HTML5 or XAML applications for Windows Store or Windows Phone.&lt;/p&gt;  &lt;p&gt;Sometimes it’s pure HTML5, sometimes it’s XAML application with web browser &lt;em&gt;control&lt;/em&gt; to display HTML5 contents. Sometimes you have UI preview, and sometimes you have to use external editor, like Blend. Some controls belong to particular technology and have no counterparts in another… So when someone is saying “it’s a matter of style” again, I look like this:&lt;a href="http://kirsanov.net/image.axd?picture=CheshireCat.jpg"&gt;&lt;img title="Cheshire Cat in Tim Burton&amp;#39;s Alice in Wonderland" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: right; padding-top: 0px; padding-left: 0px; margin: 0px 0px 0px 10px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Cheshire Cat in Tim Burton&amp;#39;s Alice in Wonderland" align="right" src="http://kirsanov.net/image.axd?picture=CheshireCat_thumb.jpg" width="251" height="208" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Because when you are in nights-and-weekends marathon for having your Big Idea project done (or should I say – a marathon-long race?), you could see the difference between technologies, and it’s displayed in form of a price tag, where the currency is time.&lt;/p&gt;  &lt;p&gt;There are few things that could buy you some time. Your &lt;em&gt;expertise&lt;/em&gt; in domain is one of them, and that’s where the difference between technologies matter most. Other things include the value of your brand (if Microsoft or Google would release a copy of your project a few months later, it would be a tough time for you, so their &lt;em&gt;brands&lt;/em&gt; could buy them some time and grant market share), the availability of ready made components (elements of the framework, third party controls and libraries) and perhaps some performance boosters like &lt;a title="Resharper home page" href="http://www.jetbrains.com/resharper/" rel="nofollow" target="_blank"&gt;Resharper&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;And since I mentioned the competition, maybe you wouldn’t like to publish your work as open-source HTML5 / JavaScript project, but rather as half-compiled XAML/C# one?&lt;/p&gt;  &lt;p&gt;The point is – choose wrong technology and you &lt;em&gt;might&lt;/em&gt; be late to the party or more restricted in your ability to pivot. Besides, it wouldn’t be wise to plan your product based on technology you know. So, if you’ve chosen XAML, but your favorite technology is HTML5, fear not, as the world &lt;a title="Through The Looking Glass, the book" href="http://www.amazon.com/Through-Looking-Glass-originale-ebook/dp/B005R3YLSM" rel="nofollow" target="_blank"&gt;behind the looking glass&lt;/a&gt; will be familiar to you. But just like in Carroll’s story, you should be prepared for &lt;a title="What is Red Queen&amp;#39;s race?" href="http://en.wikipedia.org/wiki/Red_Queen's_race" rel="nofollow" target="_blank"&gt;Red Queen’s race&lt;/a&gt; then. As “it takes all the running you can do, to keep in the same place. If you want to get somewhere else, you must run at least twice as fast as that!”.     &lt;br /&gt;I mean, that when someone with knowledge of particular technology would “just do it”, you would have to learn the technology first.&lt;/p&gt;  &lt;p&gt;I’ve described most important &lt;a title="Difference between XAML and HTML5 projects" href="http://kirsanov.net/post/2012/12/30/Introduction-to-Windows-8-App-Development-HTML5-or-XAML.aspx" target="_blank"&gt;differences between XAML and HTML5&lt;/a&gt; previously, so for now we’ll focus on controls.&lt;/p&gt;  &lt;h2&gt;XAML&lt;/h2&gt;  &lt;p&gt;The process of designing XAML pages is pretty much like designing HTML5 pages – you &lt;em&gt;can&lt;/em&gt; work with markup in Visual Studio, but to view the changes you make in the user interface, you open the same file in &lt;em&gt;Blend for Visual Studio&lt;/em&gt;. In time you’ll get used to run Blend less frequently. However, XAML is not just about user interface.&lt;/p&gt;  &lt;p&gt;XAML, in case you don’t know, is XML-based [e&lt;strong&gt;x&lt;/strong&gt;tensible &lt;strong&gt;a&lt;/strong&gt;pplication] &lt;strong&gt;m&lt;/strong&gt;arkup &lt;strong&gt;l&lt;/strong&gt;anguage. &lt;em&gt;Extensible&lt;/em&gt; means, that you can extend tags with properties without breaking the compatibility, as well as add new tags when needed. If particular XAML engine won’t understand your tags or tag attributes, it will just skip them. Such engines include (or, in other words, XAML is used in… ) Windows Presentation Foundation (WPF), Silverlight (subset of WPF), Workflow Foundation (WF), Windows Phone (old 7.x and new one) and since some of these things are very popular, you can find XAML in a lot of different products, like Team Foundation Server, SharePoint, Microsoft Dynamics and many more.&lt;/p&gt;  &lt;p&gt;In other words, XAML is cool and alive and well worth learning and mastering. Just like HTML5.&lt;/p&gt;  &lt;h4&gt;Different Availability of Controls&lt;/h4&gt;  &lt;p&gt;Is the problem of XAML for those who are used to HTML5 toolbox. Some controls simply do not exist (date picker, as an example), some are similar to the ones you have in HTML5, but look and work differently.&lt;/p&gt;  &lt;p&gt;There is no problem in different looks of controls, as what customers are expecting is functionality. For example – they are expecting the possibility to pick the date with date picker, as that is the standard way of selecting the date. So standard, that it became part of HTML5. And so you’ll have to deliver.&lt;/p&gt;  &lt;h2&gt;Standard Controls&lt;/h2&gt;  &lt;p&gt;Similar to ability of using HTML5 controls in HTML5 Metro applications, you can use Windows Presentation Foundation development techniques such as DataTemplates, Styles and ControlTemplates. So your knowledge of WPF / Silverlight is still quite relevant.&lt;/p&gt;  &lt;p&gt;The standard set of controls in XAML for Metro applications is a set of WinRT controls. We’ve discussed the WinRT before as well as WinJS counterparts from HTML5 apps.&lt;/p&gt;  &lt;p&gt;Just like in &lt;a title="Developing Windows 8 Metro applications: working with controls" href="http://kirsanov.net/post/2013/01/14/Introduction-to-Windows-8-Development-Working-with-Controls.aspx" target="_blank"&gt;HTML5 article&lt;/a&gt;, let’s begin with the simplest interactive control – the Toggle Switch.&lt;/p&gt;  &lt;h4&gt;Toggle Switch&lt;/h4&gt;  &lt;p&gt;&lt;a href="http://kirsanov.net/image.axd?picture=ToggleSwitchXAML.jpg"&gt;&lt;img title="ToggleSwitchXAML" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: left; padding-top: 0px; padding-left: 0px; margin: 0px 10px 0px 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="ToggleSwitchXAML" align="left" src="http://kirsanov.net/image.axd?picture=ToggleSwitchXAML_thumb.jpg" width="434" height="174" /&gt;&lt;/a&gt;Looks and feels just like its HTML5 counterpart, the toggle switch works like a checkbox, excerpt that it’s user interface is optimized for touch.&lt;/p&gt;  &lt;p&gt;Well, I would say that it’s better for mouse as well, as users don’t have to focus on a small area of the screen, as they do with check boxes.&lt;/p&gt;  &lt;p&gt;Notice, that we attached the event handler to the control. That differs from classic approach of just letting user change the controls and read the values on submission. Like, when user clicks the “Save” button.    &lt;br /&gt;The reason is that you never know when user will switch to another application and so your application will be suspended or even terminated and you might need to save the user state. Also, in Windows 8 we usually implement changes immediately, although it’s not a rule, just a trend. And in both cases you would need to use the event handler.&lt;/p&gt;  &lt;h4&gt;App Bar&lt;/h4&gt;  &lt;p&gt;&lt;a href="http://kirsanov.net/image.axd?picture=Slide21.jpg" target="_blank"&gt;&lt;img title="AppBar" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: left; padding-top: 0px; padding-left: 0px; margin: 0px 10px 0px 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="AppBar" align="left" src="http://kirsanov.net/image.axd?picture=Slide21_thumb.jpg" width="247" height="186" /&gt;&lt;/a&gt;Application bar is the “menu” you see when right-click in your application. It doesn’t always work with touch (for example, because the swipe gesture is interpreted as scroll), so you should test it.&amp;#160; I’ve seen applications with empty app bar and with lots of buttons in it, but as the best practice you shouldn’t have less than one and more than eight buttons on it.&lt;/p&gt;  &lt;p&gt;App Bar is a control, and it acts as a commanding surface and includes buttons to operate functionality in the app.&lt;img title="XAML app bar with 5 commands" alt="XAML app bar with 5 commands" src="http://i.msdn.microsoft.com/dynimg/IC583432.png" width="655" height="109" /&gt;&lt;/p&gt;  &lt;p&gt;App Bar is a basic Windows 8 control replacing menus, which do not fit into Metro style. It can be placed either at the bottom of the screen or at the top. Or both.&lt;/p&gt;  &lt;p&gt;Buttons that you place in App Bar generally should use standard pictures from WinRT library, to avoid confusion and unnecessary learning curve. However, you can create and use your own images.&lt;/p&gt;  &lt;p&gt;It is recommended that you put global commands on the right and contextual commands on the left of App Bar. The App Bar can be programmatically invoked when an item is selected for contextual commands. That is – if you right-click while in the context of particular control or selected content, the contextual commands of the App Bar may change accordingly.&lt;/p&gt;  &lt;p&gt;App Bar can work in conjunction with a &lt;em&gt;flyout menu&lt;/em&gt;, which displays groups of related commands inside the App Bar.&lt;/p&gt;  &lt;p&gt;We place &lt;strong&gt;App Bar at the top&lt;/strong&gt; of the screen to aid navigation within the app, when navigation starts to be complicated. You shouldn’t use the top app bar instead of bottom one.&lt;/p&gt;  &lt;p&gt;While AppBar is a simple XAML tag, there is one property that you may find useful, it’s called &lt;em&gt;IsSticky&lt;/em&gt;. By default it’s False, which means that AppBar dismisses once the user touches outside of it. When you set IsSticky to True, AppBar becomes always visible and doesn’t disappear.&lt;/p&gt;  &lt;h4&gt;Other Standard XAML Controls&lt;/h4&gt;  &lt;p&gt;You can see the full list of XAML controls available for your Metro applications here: &lt;a title="http://msdn.microsoft.com/en-us/library/windows/apps/xaml/Hh465351(v=win.10).aspx" href="http://msdn.microsoft.com/en-us/library/windows/apps/xaml/Hh465351(v=win.10).aspx"&gt;http://msdn.microsoft.com/en-us/library/windows/apps/xaml/Hh465351(v=win.10).aspx&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;Adaptive Controls&lt;/h2&gt;  &lt;p&gt;Controls include some logic inside and sometimes very sophisticated one. Controls that can adapt to changing environment autonomously are called &lt;em&gt;adaptive&lt;/em&gt; controls. Such controls are built to fit as many items as they can, providing an automatic scrolling and panning experience. Therefore, they are very valuable when used inside a Metro style app. That means that when using different screen resolutions, such controls adapt to it and render accordingly, making your application look very responsive and adaptive.&lt;/p&gt;  &lt;p&gt;We’ll discuss adaptive controls, such as GridView and ListView, in the next part, when will speak about general guidelines for application layout.&lt;/p&gt;  &lt;h2&gt;Standard 3rd Party Controls&lt;/h2&gt;  &lt;p&gt;Although it sounds strange, Microsoft actually recommends using 3rd party controls for components that were not implemented by Microsoft. Among such are Date Picker, Time Picker and Rating. There are quite a few possible replacements, but for simplicity I’ll describe the ones I am using in my works.&lt;/p&gt;  &lt;h4&gt;Date Picker&lt;/h4&gt;  &lt;p&gt;&lt;img style="float: left; margin: 0px 10px 0px 0px; display: inline" align="left" src="http://kirsanov.net/image.axd?picture=DateTimePicker-looping2.jpg" /&gt;&lt;/p&gt;  &lt;p&gt;As you may notice, this is the same picture as in article about HTML5 controls. Or is it? The beauty of &lt;a title="Telerik DevTools" href="http://www.telerik.com/products/windows-8/overview.aspx" target="_blank"&gt;&lt;strong&gt;Telerik date picker control&lt;/strong&gt;&lt;/a&gt; is that it looks the same in both HTML5 and XAML versions.&lt;/p&gt;  &lt;p&gt;By default, the date selector looks like a typical combo box (aka&amp;#160; drop down list), which then unfolds into touch-friendly date selector.&lt;/p&gt;  &lt;p&gt;Changes, dictated by necessity to provide touch-first user experience, allowed to put additional information on selector tiles, such as day of the week, name of the month and leap year information.&lt;/p&gt;  &lt;p&gt;I would even call it more usable than familiar date picker we had in &lt;a title="See other ASP.NET articles" href="http://kirsanov.net/?tag=/ASPNET" target="_blank"&gt;ASP.NET&lt;/a&gt;, also provided by Telerik. I am talking about classic one-month calendar with month and year selectors. In that classic picker all elements has their own rules for picking, making control’s usability suffer. But not this time – now, all elements are picked up the same way.&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;font size="3"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;telerikInput:RadDatePicker&lt;/span&gt; &lt;span class="attr"&gt;Header&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Select arriving date&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Grid&lt;/span&gt;.&lt;span class="attr"&gt;Row&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;3&amp;quot;&lt;/span&gt; &lt;br /&gt;&lt;/font&gt;&lt;font size="3"&gt;&lt;span class="attr"&gt;x:Name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;arriveDatePicker&amp;quot; &lt;/span&gt;&lt;span class="attr"&gt;DisplayValueFormat&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;dddd, MMMM dd, yyyy&amp;quot;&lt;/span&gt; &lt;br /&gt;&lt;span class="attr"&gt;ItemLength&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;90&amp;quot;&lt;/span&gt;  &lt;span class="attr"&gt;Margin&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;0,10,0,20&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;Value&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;{Binding ArriveDate}&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;As you can see, the definition of control is pretty straightforward and looks just like HTML, with one exception – XAML is case sensitive.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://kirsanov.net/image.axd?picture=TelerikDatePickerFull.jpg"&gt;&lt;img title="Telerik Date Picker Inline" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: left; padding-top: 0px; padding-left: 0px; margin: 0px 10px 0px 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Telerik Date Picker Inline" align="left" src="http://kirsanov.net/image.axd?picture=TelerikDatePickerFull_thumb.jpg" width="244" height="158" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Another way to display the date picker control is to set it’s &lt;em&gt;DisplayMode&lt;/em&gt; property to “Inline”. In that case you will see the picker itself, without the dropdown list.&lt;/p&gt;

&lt;p&gt;Depending from your design idea, the latter display mode may bring user experience advantage, as it would save one click for end user.&lt;/p&gt;

&lt;p&gt;The same principles are used in &lt;strong&gt;Time Picker&lt;/strong&gt; control.&lt;/p&gt;

&lt;h4&gt;Rating&lt;/h4&gt;

&lt;p&gt;There is no native control for rating in XAML, and there is no such control in Telerik package for Windows 8, but since we are talking about XAML, and it was used in WPF and Silverlight for years, there are many solutions that provide this functionality and are compatible with your Metro application. &lt;a title="MetroRate" href="http://metrorate.codeplex.com" rel="nofollow" target="_blank"&gt;&lt;strong&gt;MetroRate&lt;/strong&gt;&lt;/a&gt; is one of them. It’s free and open-source.&lt;/p&gt;

&lt;h2&gt;Non-Standard Controls&lt;/h2&gt;

&lt;p&gt;Are the ones you don’t expect to see in your toolbox out of the box. However, some of them are extremely useful. Gauge is one of them.&lt;/p&gt;

&lt;p&gt;&lt;img title="TelerikGauge" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: left; padding-top: 0px; padding-left: 0px; margin: 0px 10px 0px 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="TelerikGauge" align="left" src="http://kirsanov.net/image.axd?picture=TelerikGauge_1.jpg" width="225" height="207" /&gt;&lt;/p&gt;

&lt;p&gt;Gauge seems to me like more suitable for line of business applications, when you need real time metrics of performance. For example, measuring the SLA (service level agreement) compliance is constantly monitored by technical support providers – such gauge may show whether it’s customer who should pay for your service, or you are close to having to pay to your customer.&lt;/p&gt;

&lt;p&gt;But that’s relatively simple control. There are things, that would benefit the look and feel of your application, but would require efforts, enormous enough to shelve the idea. For example, the &lt;strong&gt;Hub Tile&lt;/strong&gt; control from the same Telerik package would allow you to build the screen which resembles the functionality of the Windows start page, with live tiles. Although it wouldn’t really replace the genuine live tiles, your customers wouldn’t feel the difference, and the user experience would not be hurt by anything unusual, despite the complexity.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pagination&lt;/strong&gt; control would allow you to create very ergonomic multi-page view, suitable for photo browsing or something more complex like team member profile browser.&lt;/p&gt;

&lt;h2&gt;Resume&lt;/h2&gt;

&lt;p&gt;This concludes the chapter about controls in Windows, and although it’s not complete, I hope it gave you an overview of what we have to deal with in Windows 8, Windows Phone 8 and Windows RT. Next time we’ll speak about the best practices in building the user interface, to not repeat the mistakes you can find in Windows Store apps today.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Kirsanov/~4/rFsx1poydXA" height="1" width="1"/&gt;</summary>
    <published>2013-01-29T17:00:00+00:00</published>
    <link rel="related" href="http://kirsanov.net/post/2013/01/29/Introduction-to-Windows-8-Development-XAML-Controls.aspx#disqus_thread" />
    <category term="Software development" />
    <dc:publisher>Admin</dc:publisher>
    <pingback:server>http://kirsanov.net/pingback.axd</pingback:server>
    <pingback:target>http://kirsanov.net/post.aspx?id=78989efb-0e8c-48dd-8edd-0d13a23fa5cb</pingback:target>
    <slash:comments>1</slash:comments>
    <trackback:ping>http://kirsanov.net/trackback.axd?id=78989efb-0e8c-48dd-8edd-0d13a23fa5cb</trackback:ping>
    <wfw:comment>http://kirsanov.net/post/2013/01/29/Introduction-to-Windows-8-Development-XAML-Controls.aspx#disqus_thread</wfw:comment>
    <wfw:commentRss>http://kirsanov.net/syndication.axd?post=78989efb-0e8c-48dd-8edd-0d13a23fa5cb</wfw:commentRss>
  <feedburner:origLink>http://kirsanov.net/post/2013/01/29/Introduction-to-Windows-8-Development-XAML-Controls.aspx</feedburner:origLink></entry>
  <entry>
    <id>http://kirsanov.net/post/2013/01/25/E-Learning-Providers-for-Software-Developers.aspx</id>
    <title>E-Learning Providers for Software Developers</title>
    <updated>2013-01-25T12:00:00+00:00</updated>
    <link rel="self" href="http://kirsanov.net/post.aspx?id=9f552974-ebbe-4b58-aace-d793da6c044f" />
    <link href="http://feedproxy.google.com/~r/Kirsanov/~3/wYwF_coNISw/E-Learning-Providers-for-Software-Developers.aspx" />
    <author>
      <name>admin</name>
    </author>
    <summary type="html">&lt;p&gt;I get this question quite frequently – what are, in my opinion, the best &lt;a href="http://kirsanov.net/post.aspx?id=01fb15c5-a8fc-4a1a-be17-23cf28ec1b7e" target="_blank"&gt;e-learning&lt;/a&gt; providers for software developers. So, here is &lt;em&gt;my&lt;/em&gt; top, sorted by effectiveness:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Pluralsight &lt;/li&gt;    &lt;li&gt;AppDev &lt;/li&gt;    &lt;li&gt;Lynda.com &lt;/li&gt;    &lt;li&gt;Career Academy &lt;/li&gt;    &lt;li&gt;TrainSignal (non-developers) &lt;/li&gt;    &lt;li&gt;Channel9, MVA and others &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Note, that none of the top 5 are free, they all provide professional grade training courses with varying degree of effectiveness. In most cases, variation is insignificant, but the ratio of brilliant works resembles the position in this top.&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;h2&gt;Pluralsight&lt;/h2&gt;  &lt;p&gt;These guys rock. Having more than 100 trainers and hundreds of courses in the library, they provide access to the whole library for as low as 29$ per month. Courses are in form of screencasts, but the real gem is the list of trainers. Among them you can find Microsoft gurus, such as John Papa and Michael Palermo.&lt;/p&gt;  &lt;p&gt;Enough to say that having free access to all mentioned resources, I am using Pluralsight more often than anything else. Free trial is available.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pluralsight.com" rel="nofollow" target="_blank"&gt;http://www.pluralsight.com&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;AppDev&lt;/h2&gt;  &lt;p&gt;Also known as “LearnNowPlus”. More classic courses, made by professional trainers, usually real world experts. Just like Pluralsight, they are creating video courses for anything that’s on the edge, focusing more on Microsoft-related software development. Actually, AppDev is short for “application development”.&lt;/p&gt;  &lt;p&gt;The size of the course library is impressive and unlike the Pluralsight courses, you actually see the trainer. Which is not necessarily an advantage, as some students whine about trainer not being sexy model. Seriously, I’ve heard that a few times.&lt;/p&gt;  &lt;p&gt;Having about 35 trainers, they don’t publicly disclose the prices, but that’s always a few hundred dollars per course. As much as I understand it, they switched to serving corporate customers, as the market offer for individuals became unattractive, due to the price.&lt;/p&gt;  &lt;p&gt;The disadvantage of AppDev is “jack of all trades” approach, when you see one trainer presenting different courses, but this rarely affects the quality.&lt;/p&gt;  &lt;h2&gt;Lynda.com&lt;/h2&gt;  &lt;p&gt;Sometimes brilliant, sometimes not, Lynda.com has hundreds of authors and covers more topics than anyone else. They offer it at attractive price of 25$ per month and free trial is available, so you can see whether the course is good for you. Actually, 7 days are enough to cover couple of courses. And once you do, you’ll come for more.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.lynda.com" rel="nofollow" target="_blank"&gt;http://www.lynda.com&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;Career Academy&lt;/h2&gt;  &lt;p&gt;Could be the biggest library of video training courses covering software development, system administration, security, cisco, project management, virtualization and design, they might be called the leader of the industry.&lt;/p&gt;  &lt;p&gt;However, the quality of courses generally is below the ones listed above, and quite often very different topics are covered by the same trainers, and in this case it really does affect the quality, as &lt;em&gt;sometimes&lt;/em&gt; trainers clearly don’t fully understand the subject. Courses are classic, i.e. you see the trainer as he explains the subject.&lt;/p&gt;  &lt;p&gt;The prices vary, from less than hundred to about $800 per course or about $2000 per library of a few courses.&lt;/p&gt;  &lt;p&gt;It’s only number 4 in this top, because we are talking about software development training. Speaking about system administration, networking and security, Career Academy is number 2, after the Pluralsight.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.careeracademy.com" rel="nofollow" target="_blank"&gt;http://www.careeracademy.com&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;Trainsignal&lt;/h2&gt;  &lt;p&gt;Just like the rest, they are on the edge of technologies, offering hundreds of courses, usually at the price of a few hundred dollars per course, but the quality of content, in my opinion, is not better.&lt;/p&gt;  &lt;p&gt;They don’t provide training on software development, but do for SQL Server administration and querying, and in my experience they showed quite good results in training people Exchange Server and Windows administration, which is highly useful for software developers anyway.&lt;/p&gt;  &lt;p&gt;So, when others don’t provide anything useful, Trainsignal is the way to go: &lt;a href="http://www.trainsignal.com" rel="nofollow" target="_blank"&gt;http://www.trainsignal.com&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;Other e-learning websites&lt;/h2&gt;  &lt;h4&gt;&lt;a href="http://channel9.msdn.com" rel="nofollow" target="_blank"&gt;Channel9&lt;/a&gt;&lt;/h4&gt;  &lt;p&gt;When I am asking students whether they know about Channel9, more often than not they say “no”. This is the “&lt;a href="http://www.youtube.com/user/CononymousAnward" target="_blank"&gt;YouTube&lt;/a&gt; of Microsoft” – place, where Microsoft gurus place their videos about new technologies, present new ways of doing things and entertain software developers.&lt;/p&gt;  &lt;p&gt;It is also the place where you can watch dev events live. For example, in &lt;strong&gt;October 2011&lt;/strong&gt; Microsoft presented the Windows 8 Developer Edition – the very first usable release of Windows 8, together with what is now known as Visual Studio 2012. Live at Channel9, in the event called //build conference, and that was one year before the system was shipped.     &lt;br /&gt;In November 2012 they repeated the event, now full of new information about developing software for Windows 8, Azure, &lt;a title="See other ASP.NET articles" href="http://kirsanov.net/?tag=/ASPNET" target="_blank"&gt;ASP.NET&lt;/a&gt; and more – it would take a full week to watch videos from all events of &lt;a href="http://channel9.msdn.com/Events/Build/2012" rel="nofollow" target="_blank"&gt;//build/ 2012&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Sometimes Microsoft creates full scale courses for technologies like HTML5 and JavaScript and these are as good as commercial video courses. However, sometimes the videos at Channel9 are better than their commercial counterparts. See for yourself.&lt;/p&gt;  &lt;p&gt;When you need explanation on particular topic, Channel9 is THE best solution.&lt;/p&gt;  &lt;h4&gt;&lt;a title="Microsoft Virtual Academy website" href="http://www.microsoftvirtualacademy.com" rel="nofollow" target="_blank"&gt;Microsoft Virtual Academy&lt;/a&gt;&lt;/h4&gt;  &lt;p&gt;However, the contents of Channel9 flows like the river – today the front page is about the latest and greatest online event, but tomorrow you’ll have to search for it. And that’s where Microsoft Virtual Academy comes to rescue.&lt;/p&gt;  &lt;p&gt;It’s basically a collection of free courses about anything and everything related to Microsoft technologies. Usually course consists of text, multimedia and videos, and videos are hosted at Channel9. So, I would say that MVA is a collection of links to Channel9, and a very good one.&lt;/p&gt;  &lt;p&gt;The benefit of MVA is that they award you points for completion of course topics. So you can see how close you are to become the “best in your country”, even though you won’t ever become the best, as some people employ web bots to click through all possible courses. Don’t ask me why :)&lt;/p&gt;  &lt;h4&gt;YouTube&lt;/h4&gt;  &lt;p&gt;Called the “search engine #2” for it is only second to Google search engine by the amount of requests served, YouTube is the home for some of the best independent training materials in the Net. For example, personally, I’ve created courses on TFS 2010 and &lt;a title="PowerShell tutorials" href="http://kirsanov.net/?tag=/PowerShell" target="_blank"&gt;PowerShell&lt;/a&gt; made available in my YouTube channel, and there are hundreds of other professionals who did the same on other subjects.&lt;/p&gt;  &lt;p&gt;Even though there are more materials for system administrators than for software developers, YouTube collection of training videos constantly grows, so it’s worth checking every time you need detailed explanation of the subject.&lt;/p&gt;  &lt;h2&gt;Resume&lt;/h2&gt;  &lt;p&gt;These are not all resources you can use for independent study, but surely the most important ones. If you know other and want to share the experience – feel free to use the comments section!&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Kirsanov/~4/wYwF_coNISw" height="1" width="1"/&gt;</summary>
    <published>2013-01-25T12:00:00+00:00</published>
    <link rel="related" href="http://kirsanov.net/post/2013/01/25/E-Learning-Providers-for-Software-Developers.aspx#disqus_thread" />
    <category term="Training" />
    <dc:publisher>admin</dc:publisher>
    <pingback:server>http://kirsanov.net/pingback.axd</pingback:server>
    <pingback:target>http://kirsanov.net/post.aspx?id=9f552974-ebbe-4b58-aace-d793da6c044f</pingback:target>
    <slash:comments>0</slash:comments>
    <trackback:ping>http://kirsanov.net/trackback.axd?id=9f552974-ebbe-4b58-aace-d793da6c044f</trackback:ping>
    <wfw:comment>http://kirsanov.net/post/2013/01/25/E-Learning-Providers-for-Software-Developers.aspx#disqus_thread</wfw:comment>
    <wfw:commentRss>http://kirsanov.net/syndication.axd?post=9f552974-ebbe-4b58-aace-d793da6c044f</wfw:commentRss>
  <feedburner:origLink>http://kirsanov.net/post/2013/01/25/E-Learning-Providers-for-Software-Developers.aspx</feedburner:origLink></entry>
  <entry>
    <id>http://kirsanov.net/post/2013/01/16/Why-you-don’t-have-to-close-applications-in-Windows-8.aspx</id>
    <title>Why you don’t have to close applications in Windows 8</title>
    <updated>2013-01-16T22:19:52+00:00</updated>
    <link rel="self" href="http://kirsanov.net/post.aspx?id=21e18786-898e-41a2-b0e9-97626006ce2d" />
    <link href="http://feedproxy.google.com/~r/Kirsanov/~3/e1R2wPDuC4c/Why-you-don’t-have-to-close-applications-in-Windows-8.aspx" />
    <author>
      <name>admin</name>
    </author>
    <summary type="html">&lt;p&gt;I had to answer this basic question today, so I guess others may have it as well, so I thought it’s worth sharing :)&lt;/p&gt;  &lt;p&gt;If you had a chance to play with new Windows 8, you should have noticed that applications do not have a “close” button or even the menu item to exit the application. You still can close the application by pressing Alt + F4, or drag the title of the application to the bottom of the screen to exit it, but that’s not convenient, right?&lt;/p&gt;  &lt;p&gt;The reason for that is that &lt;em&gt;&lt;strong&gt;you don’t have to do that&lt;/strong&gt;&lt;/em&gt;.&lt;/p&gt;  &lt;p&gt;As I’ve &lt;a href="http://kirsanov.net/post/2012/12/29/Introduction-to-Windows-8-Apps-for-Software-Developers.aspx" target="_blank"&gt;illustrated earlier&lt;/a&gt;, in Windows 8 the “Metro” application doesn’t get any resources once it loses focus. So when you start another application, press Start button on your device or the keyboard, or browse back from your application – it takes up to five seconds to stop the execution of that application. It may still reside in memory, but only while that memory is not claimed by anyone else, so the performance of the computer doesn’t suffer.&lt;/p&gt;  &lt;p&gt;The advantage of leaving the application “open” is that you can later switch back to the app, and you’ll see exactly the screen you were on when you’ve switched from that app. So you will not have to waste your time to navigate there. It’s like teleporting to the living room instead of opening all the doors of your house, navigating through the corridor… You get the point.&lt;/p&gt;  &lt;p&gt;Even though it appears like your application is open somewhere in the background and “consumes resources” – it doesn’t. So that makes the gesture of closing your application an anachronism, a habit from the past which lost it’s reason.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;NB:&lt;/strong&gt; Of course, it doesn’t apply to &lt;em&gt;desktop&lt;/em&gt; applications, the ones that have classic buttons to minimize, maximize and close the window and can be resized. These applications are not affected by WinRT and will continue to use resources unless you close them.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Kirsanov/~4/e1R2wPDuC4c" height="1" width="1"/&gt;</summary>
    <published>2013-01-16T22:19:52+00:00</published>
    <link rel="related" href="http://kirsanov.net/post/2013/01/16/Why-you-don’t-have-to-close-applications-in-Windows-8.aspx#disqus_thread" />
    <category term="QA" />
    <dc:publisher>admin</dc:publisher>
    <pingback:server>http://kirsanov.net/pingback.axd</pingback:server>
    <pingback:target>http://kirsanov.net/post.aspx?id=21e18786-898e-41a2-b0e9-97626006ce2d</pingback:target>
    <slash:comments>0</slash:comments>
    <trackback:ping>http://kirsanov.net/trackback.axd?id=21e18786-898e-41a2-b0e9-97626006ce2d</trackback:ping>
    <wfw:comment>http://kirsanov.net/post/2013/01/16/Why-you-don’t-have-to-close-applications-in-Windows-8.aspx#disqus_thread</wfw:comment>
    <wfw:commentRss>http://kirsanov.net/syndication.axd?post=21e18786-898e-41a2-b0e9-97626006ce2d</wfw:commentRss>
  <feedburner:origLink>http://kirsanov.net/post/2013/01/16/Why-you-don’t-have-to-close-applications-in-Windows-8.aspx</feedburner:origLink></entry>
  <entry>
    <id>http://kirsanov.net/post/2013/01/14/Introduction-to-Windows-8-Development-Working-with-Controls.aspx</id>
    <title>Introduction to Windows 8 Development: Working with Controls</title>
    <updated>2013-01-14T14:00:00+00:00</updated>
    <link rel="self" href="http://kirsanov.net/post.aspx?id=50b4edea-9f74-4996-ada6-2c4173dcffbc" />
    <link href="http://feedproxy.google.com/~r/Kirsanov/~3/FG3CsNRJgVw/Introduction-to-Windows-8-Development-Working-with-Controls.aspx" />
    <author>
      <name>admin</name>
    </author>
    <summary type="html">&lt;p&gt;&lt;a href="http://kirsanov.net/image.axd?picture=controls.jpg"&gt;&lt;img title="Windows 8 everyday controls" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: left; padding-top: 0px; padding-left: 0px; margin: 0px 10px 0px 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Windows 8 everyday controls" align="left" src="http://kirsanov.net/image.axd?picture=controls_thumb.jpg" width="293" height="220" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;One essential part of Windows 8 software development is developing the user interface. Which means – placing right controls in right place, and make them an organic part of overall user experience. And what an exciting topic is that!&lt;/p&gt;  &lt;p&gt;In Windows 8, there are only few &lt;em&gt;new&lt;/em&gt; controls, but the ones you knew were changed drastically. You can choose either &lt;a title="Choosing between XAML and HTML5" href="http://kirsanov.net/post/2012/12/30/Introduction-to-Windows-8-App-Development-HTML5-or-XAML.aspx" target="_blank"&gt;XAML or HTML5&lt;/a&gt; for your application, and among other things, the set of available controls will change, so now you’ll have to master your skills of using more controls than before.&lt;/p&gt;  &lt;p&gt;The “same” controls may look the same at the screen, but they are different inside. HTML5 provides you with additional controls specified in HTML5 standard, and you don’t have to worry about multi-browser support (unless you want to keep the certain degree of compatibility, anyway), but the problem is – HTML5 is not covered fully by MSIE 10, which provides you it’s HTML5 engine – the Trident.&lt;/p&gt;  &lt;p&gt;We’ll cover both native and 3rd party controls available to you for both XAML and HTML5 applications. For the sake of simplicity, this article will be more about HTML5, while the next one – about XAML controls, and the third part – about general rules and principles of user interface design in Windows 8. Then we’ll cover Windows Phone 8 controls as well.&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;h2&gt;Touch First&lt;/h2&gt;  &lt;p&gt;The switch of the UX paradigm to “touch first” affected the shape of existing controls, making them more tap-friendly, suitable for fingers. We’ve got an alternate checkbox control, called &lt;em&gt;&lt;strong&gt;Toggle Switch&lt;/strong&gt;&lt;/em&gt;, and ability to apply different &lt;em&gt;styles&lt;/em&gt; to others. But these changes are rather cosmetic, while changes in some controls were more drastic, as you’ll see further.&lt;/p&gt;  &lt;p&gt;For example, you can see that although the familiar Combo Box looks just like before, when you click on it – the space in between the items is wider, making it much easier to tap. It is also recommended to increase the margin between the components in your page, comparing to what you did before Windows 8. Always keep in mind the diameter of a typical fingertip and how it may affect the usability.&lt;/p&gt;  &lt;h2&gt;HTML5 Controls&lt;/h2&gt;  &lt;p&gt;When building HTML5 applications, obviously you can use the typical HTML5 elements, such as video player, date and time pickers and others. The only problem is – some of these components are not yet implemented in MSIE10. The last time I checked for browser compatibility, the only browser that displayed date picker was Opera. The MSIE, Firefox, Chrome and Safari displayed something else – be it text box or masked edit control.&lt;/p&gt;  &lt;p&gt;When building applications for Windows 8 using HTML5, we don’t really care how (and whether) our HTML code would be rendered by other browser. And of course HTML 5.0 will be completely supported by MSIE till the end of 2014 (and 5.1 by 2016), but currently you would have to resort to 3rd party controls to ensure best user experience and functionality.&lt;/p&gt;  &lt;p&gt;HTML5 controls which normally do not depend from WinJS include Audio, File Upload, Email input box, Canvas, Video and many more. Anyway, always test before assuming you can use them in your application.&lt;/p&gt;  &lt;p&gt;Although HTML5 controls are defined by independent standard, they are extended with additional properties and events, specifically for use in Windows 8 applications. Make sure you check with MSDN before implementing them.&lt;/p&gt;  &lt;h2&gt;JQuery&lt;/h2&gt;  &lt;p&gt;One of the beauties of programming applications using HTML5 is that you can use well known libraries, such as JQuery. It’s worth to note, that in Windows 8 Store Apps, your JavaScript is running with additional security-related restrictions, so chances are – you would have to tinker your library or avoid using functions that violate Windows security restrictions.&lt;/p&gt;  &lt;p&gt;So, while technically you &lt;em&gt;can&lt;/em&gt; use libraries, test thoroughly. To use the external JavaScript library, all you need to do is to reference it by specifying it’s .js file as the source:&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;font size="3"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;script&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;text/javascript&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;src&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;/js/jquery-1.8.3.min.js&amp;quot; /&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;style type="text/css"&gt;






.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;This also means, that if you have some favorite design elements that depend from JQuery or other JavaScript library, you may try to use them in your Windows 8 application.&lt;/p&gt;

&lt;h2&gt;WinJS Controls&lt;/h2&gt;

&lt;p&gt;These are the ones you are going to use most. They look and feel exactly like controls that are available for your XAML Windows 8 apps, except that there are &lt;em&gt;more&lt;/em&gt; controls for HTML / JavaScript apps, and they are different inside. In other words, the only thing that HTML controls share with XAML controls is the look.&lt;/p&gt;

&lt;p&gt;&lt;img title="Toggle Switch example" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: left; padding-top: 0px; padding-left: 0px; margin: 0px 10px 0px 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Toggle Switch example" align="left" src="http://kirsanov.net/image.axd?picture=Slide5.jpg" width="381" height="196" /&gt;&lt;/p&gt;

&lt;p&gt;WinJS is the JavaScript library that provides (among other things) the connection between the user interface of your controls and the code behind them. You can only use it in Windows 8 apps, as it is part of WinRT, and that, of course, decreases the degree of compatibility of your HTML5 / JavaScript code with other platforms.&lt;/p&gt;

&lt;p&gt;You declare your WinJS controls as the &lt;strong&gt;div&lt;/strong&gt; tag, with control definition set in div tag attributes. During rendering of your html page, the control definitions will be transformed into control’s HTML and JavaScript code.&lt;/p&gt;

&lt;p&gt;The controls in HTML5 applications work very similar to controls in ASP.NET – they are rendered as HTML and JavaScript to the end user, even though their backend logic may be written in C#, VB.NET or C++. However, you don’t have to think about it, unless you are authoring your own control. And if you are thinking about creating the control by yourself, your HTML and JavaScript doesn’t have to be compatible with anything but MSIE 10, so in that sense developing controls for Windows 8 is somewhat easier than for ASP.NET.&lt;/p&gt;

&lt;p&gt;Some controls you’ll see in the toolbox, you may know from other frameworks, such as .NET, but here are some of the other, new controls, available to us at the moment:&lt;/p&gt;

&lt;h4&gt;Date Picker&lt;/h4&gt;

&lt;p&gt;&lt;img title="Date Picker WinJS" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: left; padding-top: 0px; padding-left: 0px; margin: 0px 10px 0px 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Date Picker WinJS" align="left" src="http://kirsanov.net/image.axd?picture=DatePickerWinJS.png" width="240" height="41" /&gt;&lt;/p&gt;

&lt;p&gt;As I said before, no modern browsers support the HTML5 date picker tag at this time, excerpt for Opera, and so there was a need to create such control for Windows 8 HTML applications. &lt;img title="Telerik Date Picker" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: right; padding-top: 0px; padding-left: 0px; margin: 0px 0px 0px 10px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Telerik Date Picker" align="right" src="http://kirsanov.net/image.axd?picture=DateTimePicker-looping2.jpg" width="192" height="329" /&gt;However, this component is not available for XAML, so you will have to resort to 3rd party control.&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;font size="3"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;div&lt;/span&gt; &lt;span class="attr"&gt;data-win-control&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;WinJS.UI.DatePicker&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;div&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;

&lt;p&gt;That’s how you declare the date picker control in HTML code of your application page. Personally, I am using &lt;a title="Telerik date picker control for Windows 8" href="http://www.telerik.com/products/windows-8/controls/date-picker.aspx" target="_blank"&gt;Telerik date picker control&lt;/a&gt;, as it increases the degree of compatibility between my XAML and HTML5 code, as well as to have the same look.&lt;/p&gt;

&lt;p&gt;As you can see, it looks a bit different (even though they both may look different using the CSS styling) and more touch-friendly out of the box, but that’s the matter of style. We’ll cover 3rd party controls a bit later here.&lt;/p&gt;

&lt;h4&gt;Time Picker&lt;/h4&gt;

&lt;p&gt;The same as date picker, but for time. The difference with 3rd party controls is the same – not decisive, but helps to maintain the style if you’re using something else (from the same package of controls).&lt;/p&gt;

&lt;p&gt;&lt;img title="Time Picker WinJS" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: left; padding-top: 0px; padding-left: 0px; margin: 0px 10px 0px 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Time Picker WinJS" align="left" src="http://kirsanov.net/image.axd?picture=TimePickerWinJS.png" width="240" height="53" /&gt;&lt;/p&gt;

&lt;p&gt;Here’s the original WinJS time picker control as it would look out of the box using the declaration below:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;font size="3"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;div&lt;/span&gt; &lt;span class="attr"&gt;data-win-control&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;WinJS.UI.TimePicker&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;h4&gt;Rating&lt;/h4&gt;

&lt;p&gt;It’s too important to miss, ratings are everywhere now. It is so common now, it’s treated as the violation of your base human rights when you can’t leave rating on whatever content you have access to. &lt;/p&gt;

&lt;p&gt;&lt;img title="Rating WinJS" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: left; padding-top: 0px; padding-left: 0px; margin: 0px 10px 0px 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Rating WinJS" align="left" src="http://kirsanov.net/image.axd?picture=RatingWinJS.png" width="199" height="45" /&gt;&lt;/p&gt;

&lt;p&gt;And that’s how it looks. If you were developing ASP.NET controls, then you have a solution to place a rating on your website already, but if not – there are few of them at CodeProject available for free, as well as the one in mentioned Telerik controls for ASP.NET.&lt;/p&gt;

&lt;p&gt;Anyway, for Windows 8 apps you don’t have to look for 3rd party solutions, as here it is, available for HTML5 apps:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;font size="3"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;div&lt;/span&gt; &lt;span class="attr"&gt;data-win-control&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;WinJS.UI.Rating&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;&lt;/pre&gt;

&lt;h4&gt;Semantic Zoom&lt;/h4&gt;

&lt;p&gt;One of the great features of Windows 8 is called “Semantic Zoom” – when you pinch and stretch your fingers to “open” an object on your screen, or using Ctrl + mouse wheel or Ctrl + Shift + (plus) or (minus) key. In HTML apps, that’s yet another HTML control which looks like that:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;font size="3"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;div&lt;/span&gt; &lt;span class="attr"&gt;data-win-control&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;WinJS.UI.SemanticZoom&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;

  &lt;span class="rem"&gt;&amp;lt;!-- Control that provides the zoomed-in view. --&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;div&lt;/span&gt; &lt;span class="attr"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;zoomedInView&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;data-win-control&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;WinJS.UI.ListView&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;div&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;

  &lt;span class="rem"&gt;&amp;lt;!-- Control that provides the zoomed-out view. --&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;div&lt;/span&gt; &lt;span class="attr"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;zoomedOutView&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;data-win-control&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;WinJS.UI.ListView&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;div&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;

&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;div&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;&lt;/pre&gt;

&lt;p&gt;Speaking about Semantic Zoom, think of it as about the microscope – when you are looking at some object and “magnifying your lenses”, you start to see the the contents of the object.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://kirsanov.net/image.axd?picture=Slide22.jpg"&gt;&lt;img title="Semantic Zoom example" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Semantic Zoom example" src="http://kirsanov.net/image.axd?picture=Slide22_thumb.jpg" width="662" height="306" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Semantic Zoom uses two distinct modes of classification (or zoom levels) for organizing and presenting the content: one low-level (or zoomed-in) mode that is typically used to display items in a flat, all-up structure; and another, high-level (or zoomed out) mode that displays items in Groups and enables a user to quickly navigate and browse through the content.&lt;/p&gt;

&lt;p&gt;You could use it, among other things, to display a product catalog, a photo album or an address book.&lt;/p&gt;

&lt;h4&gt;Progress Bar&lt;/h4&gt;

&lt;p&gt;One of the most difficult to master, Progress Bar control indicates the work in progress. It’s actually the HTML5 control, not WinJS, but worth mentioning nevertheless, since it was extended by WinJS.&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;font size="3"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;progress&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;

&lt;p&gt;And it looks like that:&lt;/p&gt;

&lt;p&gt;&lt;img title="Progress Bar HTML5" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: left; padding-top: 0px; padding-left: 0px; margin: 0px 10px 0px 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Progress Bar HTML5" align="left" src="http://kirsanov.net/image.axd?picture=ProgressBarHTML.png" width="486" height="180" /&gt;The progress bar could show either the precise progress of the ongoing work, or the fact of such work. &lt;/p&gt;

&lt;p&gt;When you don’t specify the Value argument, it won’t show the progress.&lt;/p&gt;

&lt;p&gt;You can change the appearance of Progress Bar by simply changing the class attribute of the tag.&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;font size="3"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;progress&lt;/span&gt; &lt;span class="attr"&gt;class&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;win-ring&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;

&lt;p&gt;Obviously, the “&lt;strong&gt;win&lt;/strong&gt;-ring” thing is not the part of the HTML5 standard, but extension provided by WinJS. And it’s not the &lt;em&gt;only&lt;/em&gt; extension for this tag.&lt;/p&gt;

&lt;p&gt;The code in the example above would render the simple ring without any text. However, if you’d like to add some text, you would have to add additional element:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;font size="3"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;label&lt;/span&gt; &lt;span class="attr"&gt;class&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;progressRingText&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;progress&lt;/span&gt; &lt;span class="attr"&gt;class&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;win-ring withText&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
    Processing
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;label&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;

&lt;p&gt;I was just kidding about the difficulty here.&lt;/p&gt;

&lt;h2&gt;Third Party Controls&lt;/h2&gt;

&lt;p&gt;HTML app developers have a way better toolbox than XAML. However, some essential controls are not available in either of tool boxes. Charts, gauges, sliders – these controls are not members of the HTML5 family of controls provided by WinJS. Yet, they are paramount in many scenarios, especially the line-of-business applications.&lt;/p&gt;

&lt;p&gt;Let’s confess, we don’t like using 3rd party controls. Who likes to voluntarily add dependency from someone else’s code and hope that author did test his stuff at least as good as you do test yours?&lt;/p&gt;

&lt;p&gt;Well, sometimes 3rd party control means meeting the deadline and not having to reinvent the quite expensive wheel. More often than not, we have no free developers, who could develop awesome component. So we have to rely on others and in that case we’d better rely on the best.&lt;/p&gt;

&lt;p&gt;Personally, I always try to minimize the use of 3rd party components, but there is no way I would invest my time in developing something like Telerik Chart control:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://kirsanov.net/image.axd?picture=TelerikChartScatter.jpg"&gt;&lt;img title="Telerik Chart Control" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Telerik Chart Control" src="http://kirsanov.net/image.axd?picture=TelerikChartScatter_thumb.jpg" width="663" height="199" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;or their Gauge control:&lt;/p&gt;

&lt;p&gt;&lt;img title="Telerik Gauge" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: left; padding-top: 0px; padding-left: 0px; margin: 0px 10px 0px 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Telerik Gauge" align="left" src="http://kirsanov.net/image.axd?picture=TelerikGauge.jpg" width="266" height="378" /&gt;&lt;/p&gt;

&lt;p&gt;The benefits of using 3rd party controls, &lt;em&gt;when they are necessary&lt;/em&gt;, include having the same styles across diverse platforms – when one company has similar solutions for different platforms (like Windows 8 HTML, Windows 8 XAML, Windows Phone 8 and finally – ASP.NET and maybe even Silverlight), it could ensure that they all look and feel the same, even if my own code behind the user interface would have to be different.&lt;/p&gt;

&lt;p&gt;If you never had to use 3rd party controls in your applications, here are few questions you should ask yourself before making such decision:&lt;/p&gt;

&lt;p&gt;1. How much do you need &lt;em&gt;exactly this&lt;/em&gt; functionality, or this part of user interface to look exactly &lt;em&gt;this way&lt;/em&gt;. Remember the Agile principle – YAGNI – You Ain’t Gonna Need It.&lt;/p&gt;

&lt;p&gt;2. How much would it cost for you to develop this feature yourself. How experienced you are with this technology? Wouldn’t it be cheaper to buy the existing component? Make sure you understand the pricing of both the component and of your own time.&lt;/p&gt;

&lt;p&gt;3. If the component is free, are you sure you can use it in your project / environment? Read the license!&lt;/p&gt;

&lt;p&gt;4. Does the company provide the technical support? Do they have community of users, which could support you in the absence of technical support?&lt;/p&gt;

&lt;p&gt;5. Is the source code provided? That means – if you will need to make changes necessary to fix the bug or add the feature to the control, would you be able to do that?&lt;/p&gt;

&lt;p&gt;I reviewed some controls available for Windows 8 at the market – ComponentOne, DevExpress, Telerik and a few others, and I advise you to do the same, but for me at this moment the favorite is Telerik Windows 8 controls, both objectively (price-quality-compliance to 5 values above) and subjectively (a few years experience with their ASP.NET controls), so I suggest you to go to Windows Store and search for Telerik Examples app (just search for “Telerik”) – there are two example apps showing the controls for both HTML5 and XAML apps. We’ll cover a few of their XAML controls next time.&lt;/p&gt;

&lt;p&gt;That’s all for the part one, next time we’ll talk about XAML and will cover some common controls and UI development principles in part 3.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Kirsanov/~4/FG3CsNRJgVw" height="1" width="1"/&gt;</summary>
    <published>2013-01-14T14:00:00+00:00</published>
    <link rel="related" href="http://kirsanov.net/post/2013/01/14/Introduction-to-Windows-8-Development-Working-with-Controls.aspx#disqus_thread" />
    <category term="Software development" />
    <dc:publisher>admin</dc:publisher>
    <pingback:server>http://kirsanov.net/pingback.axd</pingback:server>
    <pingback:target>http://kirsanov.net/post.aspx?id=50b4edea-9f74-4996-ada6-2c4173dcffbc</pingback:target>
    <slash:comments>1</slash:comments>
    <trackback:ping>http://kirsanov.net/trackback.axd?id=50b4edea-9f74-4996-ada6-2c4173dcffbc</trackback:ping>
    <wfw:comment>http://kirsanov.net/post/2013/01/14/Introduction-to-Windows-8-Development-Working-with-Controls.aspx#disqus_thread</wfw:comment>
    <wfw:commentRss>http://kirsanov.net/syndication.axd?post=50b4edea-9f74-4996-ada6-2c4173dcffbc</wfw:commentRss>
  <feedburner:origLink>http://kirsanov.net/post/2013/01/14/Introduction-to-Windows-8-Development-Working-with-Controls.aspx</feedburner:origLink></entry>
  <entry>
    <id>http://kirsanov.net/post/2013/01/05/Introduction-to-Windows-8-Development-Hardware-Sensors.aspx</id>
    <title>Introduction to Windows 8 Development: Working with Sensors</title>
    <updated>2013-01-05T15:00:00+00:00</updated>
    <link rel="self" href="http://kirsanov.net/post.aspx?id=447f8676-497e-4a8f-bde8-c9c036a3c35a" />
    <link href="http://feedproxy.google.com/~r/Kirsanov/~3/gxmBgmCwd3I/Introduction-to-Windows-8-Development-Hardware-Sensors.aspx" />
    <author>
      <name>admin</name>
    </author>
    <summary type="html">&lt;p&gt;&lt;img style="float: left; margin: 0px 10px 0px 0px; display: inline" alt="" align="left" src="http://kirsanov.net/image.axd?picture=Windows-8-logo-300x300.jpg" width="217" height="217" /&gt;&lt;/p&gt;  &lt;p&gt;Nearly all mobile devices (not necessarily cell phones, but anything that’s &lt;em&gt;mobile enough&lt;/em&gt;) these days have sensors. And that will be our topic for today.&lt;/p&gt;  &lt;p&gt;By the way, the way the term “mobile” is used today, reminds me an old anecdote with lady asking an IT guy, who tried to explain the difference between floppy disk and hard disk, whether that floppy disk isn’t hard enough for him. So, let’s settle on the definition that &lt;em&gt;mobile devices are not stationery&lt;/em&gt;.&lt;/p&gt;  &lt;p&gt;As we found previously, Windows 8 supports many platforms, and each platform has it’s own sensors, and new sensors are invented and need to be supported by OS.&lt;/p&gt;  &lt;p&gt;Also, you may find out that your mobile device has more sensors than listed in your device specs. For instance, you may enjoy such sensors as compass and inclinometer, even though you have no such hardware in your device, and that’s because some sensors are “fusion”, or “virtual” – i.e. their data are results of computational analysis of data from other, “real” or “raw” sensors.&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;h2&gt;Using hardware resources in Windows 8&lt;/h2&gt;  &lt;p&gt;There are few things you should know about sensors and devices at all.&lt;/p&gt;  &lt;p&gt;First of all: some of them can only be accessed by one application at the same time. It can be explained using various reasons, but the most important of them, which explains a lot about how Windows 8 works, is the fact that new Windows is all about saving resources, that is – energy, and &lt;strong&gt;doing more&lt;/strong&gt; (work) &lt;strong&gt;with less&lt;/strong&gt; (powerful hardware). Quoting once again the German-American architect Ludwig Mies van der Rohe, the &lt;em&gt;less is more&lt;/em&gt;.&lt;/p&gt;  &lt;p&gt;You can find the same principle in the UI concept of Windows 8, where less graphical “enhancements” provide more space for content, but it’s also true for the way that Windows 8 works with hardware – by consuming less hardware it provides you with more time to work, and also more features, since resources are not locked by other applications.&lt;/p&gt;  &lt;p&gt;For example – the camera. Only one application can use it at any given time. If your application is using the camera, no one else could. But once your Metro application is deactivated (for example – user pressed Start button on his tablet or phone and switched to the Start menu), that resource is taken from your application and other app can use it.&lt;/p&gt;  &lt;p&gt;This calls for some logical exercises. Like – you were using the resource, then your application was deactivated and after the re-activation you are attempting to use that resource again. And fail, because it was not re-connected. Which means, that you should always keep the track on what resources you are using and whether they need to be re-connected.&lt;/p&gt;  &lt;h2&gt;Sensor Types&lt;/h2&gt;  &lt;p&gt;&lt;img title="Windows 8 Sensor Types" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: left; padding-top: 0px; padding-left: 0px; margin: 0px 10px 0px 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Windows 8 Sensor Types" align="left" src="http://kirsanov.net/image.axd?picture=Slide13.jpg" width="297" height="191" /&gt;&lt;/p&gt;  &lt;p&gt;As I said in the beginning, sensors can be divided into three groups – simple, raw and fusion.&lt;/p&gt;  &lt;p&gt;Quite obviously, fusion sensors need raw sensors to work in order to calculate their own data. Meaning that Compass will need both 3D Gyro and 3D Magnetometer to be powered on and functioning, in order to provide your application with the direction to True North.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;Simple&lt;/em&gt; sensor level is the easiest way to get information about things like flipping or rotation of device. Combine it with ambient light sensor and now you have many more use scenarios for your application. How about the 3D model of the environment, where user can use his tablet as the “window” into your, say, car shop?&lt;/p&gt;  &lt;p&gt;Raw sensors are for complex scenarios, when you know what to do with the data. For example, the ambient light sensor provides you with value in LUX units (lumens per m&lt;sup&gt;2&lt;/sup&gt;). I could use that particular sensor for measuring whether there is enough light in public place (a standard is about 100 lux) and use it to compare with how many customers we have in that room and maybe even adjust lights automatically.&lt;/p&gt;  &lt;p&gt;Fusion sensors are based on data, received from raw sensors. Since &lt;em&gt;fusion&lt;/em&gt; sensors are not really devices, there are no hardware implications with locking the device, and no same algorithm to use two different sensors.&lt;/p&gt;  &lt;p&gt;Some sensors and other data-providing devices are faster than others, as some things are easier to measure. For example – Light Sensor just measures the luminous emittance, which is very fast, while GPS (which is not sensor, but provides data the same way as one) needs a minute (depending from hardware, but it’s never below 40 seconds for “cold start”) to receive and analyze data from satellites. But Windows 8 is quite smart, so for example, in Windows Phone 8, when you are requesting the GPS position, you can get the last registered position without waiting for GPS. Quite handy, especially taking into account the amount of energy used by typical GPS device.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://kirsanov.net/image.axd?picture=Slide15.jpg"&gt;&lt;img title="Sensor Fusion Inputs and Outputs" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: right; padding-top: 0px; padding-left: 0px; margin: 0px 0px 0px 10px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Sensor Fusion Inputs and Outputs" align="right" src="http://kirsanov.net/image.axd?picture=Slide15_thumb.jpg" width="244" height="184" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;That’s why you need to test your applications on physical device, preferably a few, from different vendors, as different sensor and geolocation devices may behave differently. Preferably, invest your time and money into engaging your users in beta tests, so you’ll get more insight of how your application is working with faulty [Company Name] sensor.&lt;/p&gt;  &lt;p&gt;Remember, that Windows Store is rating-driven, so it’s better to get information about faults from your users directly, not by reading about their adventures in Windows Store.&lt;/p&gt;  &lt;p&gt;You can find all sensors in &lt;strong&gt;Windows.Devices.Sensors&lt;/strong&gt; namespace, and here is how you can use them:&lt;/p&gt;  &lt;h2&gt;Sensor Events&lt;/h2&gt;  &lt;p&gt;First of all, you connect to the device, then you subscribe to it’s events. And reading them. Let’s take an Accelerometer as an example:&lt;/p&gt;  &lt;p&gt;&lt;img title="Windows 8 Accelerometer sample code" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Windows 8 Accelerometer sample code" src="http://kirsanov.net/image.axd?picture=Slide14.jpg" width="659" height="345" /&gt;&lt;/p&gt;  &lt;p&gt;As you may notice – everything is pretty straightforward. Of course, different sensors have different properties and events, but the principle is the same.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Interesting Facts:&lt;/strong&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Accelerometer is the only sensor which is part of Windows Phone specifications. Other sensors may not be there, so you should always check.&lt;/li&gt;    &lt;li&gt;Some sensors only support limited amount of instances per application. Always check MSDN articles about every specific class before making decision about the architecture of your application.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;We’ll cover sensors a bit later in some examples. But for now, here is the sample code to play around and see how it works:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://kirsanov.net/file.axd?file=2013%2f1%2fSteeringWheel.7z"&gt;SteeringWheel.7z (2.79 mb)&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Kirsanov/~4/gxmBgmCwd3I" height="1" width="1"/&gt;</summary>
    <published>2013-01-05T15:00:00+00:00</published>
    <link rel="related" href="http://kirsanov.net/post/2013/01/05/Introduction-to-Windows-8-Development-Hardware-Sensors.aspx#disqus_thread" />
    <category term="Software development" />
    <dc:publisher>admin</dc:publisher>
    <pingback:server>http://kirsanov.net/pingback.axd</pingback:server>
    <pingback:target>http://kirsanov.net/post.aspx?id=447f8676-497e-4a8f-bde8-c9c036a3c35a</pingback:target>
    <slash:comments>0</slash:comments>
    <trackback:ping>http://kirsanov.net/trackback.axd?id=447f8676-497e-4a8f-bde8-c9c036a3c35a</trackback:ping>
    <wfw:comment>http://kirsanov.net/post/2013/01/05/Introduction-to-Windows-8-Development-Hardware-Sensors.aspx#disqus_thread</wfw:comment>
    <wfw:commentRss>http://kirsanov.net/syndication.axd?post=447f8676-497e-4a8f-bde8-c9c036a3c35a</wfw:commentRss>
  <feedburner:origLink>http://kirsanov.net/post/2013/01/05/Introduction-to-Windows-8-Development-Hardware-Sensors.aspx</feedburner:origLink></entry>
  <entry>
    <id>http://kirsanov.net/post/2013/01/04/Classic-Start-Menu-in-Windows-8.aspx</id>
    <title>Classic Start Menu in Windows 8</title>
    <updated>2013-01-04T20:16:00+00:00</updated>
    <link rel="self" href="http://kirsanov.net/post.aspx?id=4fcae665-6420-431a-a6aa-88ae737a2081" />
    <link href="http://feedproxy.google.com/~r/Kirsanov/~3/S3y0lr7x3GQ/Classic-Start-Menu-in-Windows-8.aspx" />
    <author>
      <name>Admin</name>
    </author>
    <summary type="html">&lt;p&gt;&lt;img style="background-image: none; float: left; padding-top: 0px; padding-left: 0px; margin: 0px 10px 0px 0px; display: inline; padding-right: 0px; border-width: 0px;" title="Clasic Shell screenshot - Windows XP theme" src="http://kirsanov.net/image.axd?picture=screenshot.png" alt="Clasic Shell screenshot - Windows XP theme" width="271" height="188" align="left" border="0" /&gt;With beta version of Windows 8, we had &lt;a title="Classic start menu in Windows 8 beta" href="http://kirsanov.net/post/2011/11/14/Windows-8-Classic-Start-Menu.aspx" target="_blank"&gt;native legacy start menu&lt;/a&gt;, which disappeared in the release version of the OS. For many people it is still the reason to not upgrade, but seems there is the light at the end of the tunnel, after all.&lt;/p&gt;
&lt;p&gt;Even though this might be old news by now, but there are few free applications, which provide the classic start menu to your Windows 8. And I just tried the most popular one, the &lt;a title="Classic Shell homepage at SourceForge" href="http://sourceforge.net/projects/classicshell/?source=navbar" target="_blank"&gt;Classic Shell&lt;/a&gt;. It&amp;rsquo;s more advanced than even the original Start menu of Windows 7 / Vista / XP, as it may look as you want and you can tune just about anything in it. See for yourself.&lt;/p&gt;
&lt;p&gt;Frankly, I wouldn&amp;rsquo;t install it, as I have no problems with adopting the new Start menu of Windows 8, but the last update to Windows 8 just killed the new Start menu in one of my laptops. Of course I used the &amp;ldquo;sfc / scannow&amp;rdquo; command to fix the problem, but I felt need a backup just in case.&lt;/p&gt;
&lt;p&gt;This thing reminds me the &amp;ldquo;good old&amp;rdquo; days of Windows 3.1 with application called &lt;a title="Calmira for Windows 3.1 homepage" href="http://www.calmira.de/downloads/index.htm" rel="nofollow" target="_blank"&gt;Calmira&lt;/a&gt; &amp;ndash; the Start menu of Windows 95 for Windows 3.1.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Kirsanov/~4/S3y0lr7x3GQ" height="1" width="1"/&gt;</summary>
    <published>2013-01-04T20:16:00+00:00</published>
    <link rel="related" href="http://kirsanov.net/post/2013/01/04/Classic-Start-Menu-in-Windows-8.aspx#disqus_thread" />
    <category term="Software" />
    <dc:publisher>Admin</dc:publisher>
    <pingback:server>http://kirsanov.net/pingback.axd</pingback:server>
    <pingback:target>http://kirsanov.net/post.aspx?id=4fcae665-6420-431a-a6aa-88ae737a2081</pingback:target>
    <slash:comments>0</slash:comments>
    <trackback:ping>http://kirsanov.net/trackback.axd?id=4fcae665-6420-431a-a6aa-88ae737a2081</trackback:ping>
    <wfw:comment>http://kirsanov.net/post/2013/01/04/Classic-Start-Menu-in-Windows-8.aspx#disqus_thread</wfw:comment>
    <wfw:commentRss>http://kirsanov.net/syndication.axd?post=4fcae665-6420-431a-a6aa-88ae737a2081</wfw:commentRss>
  <feedburner:origLink>http://kirsanov.net/post/2013/01/04/Classic-Start-Menu-in-Windows-8.aspx</feedburner:origLink></entry>
  <entry>
    <id>http://kirsanov.net/post/2012/12/30/Introduction-to-Windows-8-App-Development-HTML5-or-XAML.aspx</id>
    <title>Introduction to Windows 8 App Development: HTML5 or XAML?</title>
    <updated>2012-12-30T21:19:00+00:00</updated>
    <link rel="self" href="http://kirsanov.net/post.aspx?id=33ffad3e-8419-4043-a174-17cf801a2c23" />
    <link href="http://feedproxy.google.com/~r/Kirsanov/~3/IHK2x2XTWng/Introduction-to-Windows-8-App-Development-HTML5-or-XAML.aspx" />
    <author>
      <name>Admin</name>
    </author>
    <summary type="html">&lt;p&gt;As you, perhaps, already know, in Windows 8 you can develop Windows Store applications by using one of 3 ways:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://kirsanov.net/image.axd?picture=MetroLanguageProjections.jpg"&gt;&lt;img style="background-image: none; float: left; padding-top: 0px; padding-left: 0px; margin: 0px 10px 0px 0px; display: inline; padding-right: 0px; border-width: 0px;" title="MetroLanguageProjections" src="http://kirsanov.net/image.axd?picture=MetroLanguageProjections_thumb.jpg" alt="MetroLanguageProjections" width="304" height="229" align="left" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s either C++ &lt;em&gt;native&lt;/em&gt; application using DirectX, or C# / VB .NET application using XAML, or HTML5 / CSS3 / JavaScript application.&lt;/p&gt;
&lt;p&gt;Although Microsoft says that it&amp;rsquo;s more a matter of style, there are some advantages and disadvantages in using each of these methods and we are going to discuss them now.&lt;/p&gt;
&lt;p&gt;As you know, Windows 8 is the first Microsoft&amp;rsquo;s operating system whose kernel works on servers, workstations, tablets and even mobile phones, which means that it supports a lot of scenarios beyond the scope of any single platform. Windows 8 shares it&amp;rsquo;s kernel with Windows Server 2012 (servers), Windows RT (ARM based tablets) and Windows Phone 8 (mobile phones), but fortunately you can&amp;rsquo;t build application that would work on each platform without changes. This reminds me Linux (shares kernel with Android) and MacOS (shares kernel with iOS) &amp;ndash; even though at low level it&amp;rsquo;s the same OS, what&amp;rsquo;s stands on the shoulders of that kernel is what makes real difference. As Ludwig Mies van der Rohe said, &amp;ldquo;the God is in the details&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Because WinRT is part of the core of Windows 8, it is included in all mentioned Windows systems, and so they all support Windows Store applications, formerly known as Metro. Which also means, that you can choose either of 3 available paths to build your apps.&lt;/p&gt;
&lt;p&gt;&lt;img style="background-image: none; float: left; padding-top: 0px; padding-left: 0px; margin: 0px 10px 0px 0px; display: inline; padding-right: 0px; border-width: 0px;" title="WindowsCore8" src="http://kirsanov.net/image.axd?picture=WindowsCore8.png" alt="WindowsCore8" width="423" height="332" align="left" border="0" /&gt;&lt;/p&gt;
&lt;p&gt;Mobile devices are very limited in resources, so any additional layer, consuming more system resources, may potentially lead to issues with performance. Since in Metro we have only one active application, the location of the bottleneck always depends from the context of your app.&lt;/p&gt;
&lt;p&gt;If what you have is a simple calculator application, there is no difference in what platform you would choose for your app &amp;ndash; either way it would have enough resources. But if that&amp;rsquo;s a game app, you may want to think twice.&lt;/p&gt;
&lt;p&gt;And speaking about frameworks, there are few things you need to take into consideration.&lt;/p&gt;
&lt;h2&gt;.NET&lt;/h2&gt;
&lt;p&gt;In normal .NET, your application is shipped in form of MSIL, which is compiled into machine code the first time your application is run. So the first time is always the slowest. The same is with &lt;a title="See other ASP.NET articles" href="http://kirsanov.net/?tag=/ASPNET" target="_blank"&gt;ASP.NET&lt;/a&gt; websites &amp;ndash; first request after update is the longest. But it&amp;rsquo;s not so with Windows Phone, when your application is shipped using Windows Store. Since all phones share the same &lt;a title="Hardware Abstraction Layer" href="http://en.wikipedia.org/wiki/HAL_9000" rel="nofollow" target="_blank"&gt;HAL&lt;/a&gt;, your application is pre-compiled during the submission process, so your recipients receive &lt;em&gt;machine code&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;But .NET framework is loaded nevertheless, since you reference it. Depending from your references, the memory footprint may grow. However, .NET 4.5 is quite limited here, so don&amp;rsquo;t overestimate the drawbacks. And you mostly use &lt;a title="Article about WinRT" href="http://kirsanov.net/post/2012/12/29/Introduction-to-Windows-8-Apps-for-Software-Developers.aspx" target="_blank"&gt;WinRT, which is asynchronous&lt;/a&gt;, taking advantage of multiple cores of your mobile device.&lt;/p&gt;
&lt;p&gt;So, I would say, that even though CoreCLR is loaded, it doesn&amp;rsquo;t make a difference &lt;em&gt;for most&lt;/em&gt; applications. But if your app is something like Microsoft Office or Angry Birds &amp;ndash; you may want to exclude additional layers and ensure you have no interpreted code.&lt;/p&gt;
&lt;h2&gt;HTML5, CSS3 and JavaScript&lt;/h2&gt;
&lt;p&gt;In Windows Phone 8 they are, in fact, XAML applications with a single browser control which navigates to the local page. In normal Windows 8 apps - they aren't. JavaScript in that local page is capable of interacting with WinRT through the use of WinJS library, making it more powerful and interactive than ordinary HTML page.&lt;/p&gt;
&lt;p&gt;Windows 8 features Internet Explorer&amp;rsquo;s Trident HTML parsing engine, introduced by Microsoft in MSIE9, as well as Chakra JavaScript engine, from the same MSIE9. Since your HTML5 and JavaScript code is only a few kilobytes long, there should be no problems with parsing your application&amp;rsquo;s user interface. Besides, HTML5 and JS apps may be using C# or VB.NET code or even components written in C++, so you may have high performance code elements written in native code, while keeping user interface simple and manageable with HTML5 and JavaScript.&lt;/p&gt;
&lt;p&gt;Regarding the JavaScript performance, it&amp;rsquo;s worth mentioning, that modern JavaScript is no less powerful than most other languages. Here is an example &amp;ndash; &lt;a title="x86 emulator written in JavaScript" href="http://bellard.org/jslinux/" rel="nofollow" target="_blank"&gt;x86 emulator written in JavaScript&lt;/a&gt;. It usually works the same way as Java/.NET &amp;ndash; i.e. the JS code is pre-compiled when it&amp;rsquo;s first executed, so all calls after the first one are fast and native. Yes, machine code.&lt;/p&gt;
&lt;p&gt;But there are many JavaScript engines out there. Chakra is one of them, but there are others, like &lt;a title="V8 JavaScript Engine" href="http://en.wikipedia.org/wiki/V8_(JavaScript_engine)" rel="nofollow" target="_blank"&gt;V8&lt;/a&gt; in Chrome or SpiderMonkey in Firefox &amp;ndash; they are designed by different teams of highly skilled professionals and don&amp;rsquo;t duplicate each other, so we never can state that JavaScript is parsed exactly this way, and not another.&lt;/p&gt;
&lt;p&gt;Trident and Chakra are not the fastest HTML parser and JavaScript engine on Earth, but with the volume of your application and pre-compilation it doesn&amp;rsquo;t really matter.&lt;/p&gt;
&lt;p&gt;However, you can&amp;rsquo;t create WinRT components using JavaScript. You can only use C#, VB.NET or C/C++ to create WinRT libraries. Which can be easily consumed by your HTML5/JS application. Just beware, that if your libraries are written in .NET, the CoreCLR will be loaded just like when you are having the .NET application, so if you are counting every megabyte of memory, you might want to use C++ instead, at least for custom WinRT components. Such applications are called Hybrid.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;C++ Applications&lt;/h2&gt;
&lt;p&gt;Are, in fact, on the rise. There are good reasons for C++ developers to not trade their skills for C#, as we&amp;rsquo;ve re-entered the era of slow computing. Obviously, not for a long period of time, as I believe mobile devices will become very powerful in the next 5-6 years, but for that time, if you are C++ developer with Windows Store skills, you are on demand.&lt;/p&gt;
&lt;p&gt;Casual games like Angry Birds can be written in HTML5/JS and run even on weak devices like HTC 8S, with only 512Mb of RAM (just note, that this RAM is for both - operating system &lt;em&gt;and&lt;/em&gt; applications). But games like 3D shooters? Hardly. That&amp;rsquo;s where you might want a game engine (one is provided by Microsoft, by the way) and good new and enhanced C++.&lt;/p&gt;
&lt;p&gt;Benefits? No Trident, Chakra, CoreCLR are loaded, nearly all bottlenecks can be fixed in &lt;em&gt;your&lt;/em&gt; code.&lt;/p&gt;
&lt;h2&gt;So what would I do?&lt;/h2&gt;
&lt;p&gt;I would develop 3D games with C++. Period. I would do the rest with the rest.&lt;/p&gt;
&lt;p&gt;We often hear, that it&amp;rsquo;s a matter of style and you could benefit from using the skills you already have in developing Windows Store apps. For example, if you are web developer, you could use HTML5 to develop apps as well. How I see it, though, is that you are not only consuming, but also gaining the skills in the process, so if your LOB (Line-Of-Business) or LOF (Line-Of-Fun) application consists not only of the client application, but also of the website and perhaps web services, then perhaps you&amp;rsquo;d like to use the same technologies, to improve your skills and avoid &lt;em&gt;switching&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;Switching is never good, unless we speak about switching between work and rest. When you are switching between projects and tasks, your performance suffers. That&amp;rsquo;s why we use &lt;em&gt;&lt;a title="Wikipedia article for Kanban" href="http://en.wikipedia.org/wiki/Kanban" rel="nofollow" target="_blank"&gt;Kanban&lt;/a&gt;&lt;/em&gt; to handle that problem. When you are switching between technologies within a project, it&amp;rsquo;s not &lt;em&gt;that&lt;/em&gt; bad, but similar.&lt;/p&gt;
&lt;p&gt;So, if I am developing website in WPF or ASP.NET MVC, I would use XAML for Metro app. If I would use ASP.NET Forms for website, I would use HTML5 for Metro, it&amp;rsquo;s that easy.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Kirsanov/~4/IHK2x2XTWng" height="1" width="1"/&gt;</summary>
    <published>2012-12-30T21:19:00+00:00</published>
    <link rel="related" href="http://kirsanov.net/post/2012/12/30/Introduction-to-Windows-8-App-Development-HTML5-or-XAML.aspx#disqus_thread" />
    <category term="Software development" />
    <dc:publisher>Admin</dc:publisher>
    <pingback:server>http://kirsanov.net/pingback.axd</pingback:server>
    <pingback:target>http://kirsanov.net/post.aspx?id=33ffad3e-8419-4043-a174-17cf801a2c23</pingback:target>
    <slash:comments>1</slash:comments>
    <trackback:ping>http://kirsanov.net/trackback.axd?id=33ffad3e-8419-4043-a174-17cf801a2c23</trackback:ping>
    <wfw:comment>http://kirsanov.net/post/2012/12/30/Introduction-to-Windows-8-App-Development-HTML5-or-XAML.aspx#disqus_thread</wfw:comment>
    <wfw:commentRss>http://kirsanov.net/syndication.axd?post=33ffad3e-8419-4043-a174-17cf801a2c23</wfw:commentRss>
  <feedburner:origLink>http://kirsanov.net/post/2012/12/30/Introduction-to-Windows-8-App-Development-HTML5-or-XAML.aspx</feedburner:origLink></entry>
  <entry>
    <id>http://kirsanov.net/post/2012/12/29/Introduction-to-Windows-8-Apps-for-Software-Developers.aspx</id>
    <title>Introduction to Windows 8 Apps for Software Developers</title>
    <updated>2012-12-29T22:24:04+00:00</updated>
    <link rel="self" href="http://kirsanov.net/post.aspx?id=f51f8038-15da-45c5-8897-874d061da701" />
    <link href="http://feedproxy.google.com/~r/Kirsanov/~3/qJsdiWd9UuA/Introduction-to-Windows-8-Apps-for-Software-Developers.aspx" />
    <author>
      <name>admin</name>
    </author>
    <summary type="html">&lt;p&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: 0px 10px 10px 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" border="0" align="left" src="http://kirsanov.net/image.axd?picture=Windows-8-logo-300x300.jpg" width="195" height="195" /&gt;&lt;/p&gt;  &lt;p&gt;Earlier this month, I wrote an &lt;a href="http://kirsanov.net/post/2012/12/15/Creating-Windows-8-Store-Apps-Introduction-to-Windows-Store-for-Software-Developers.aspx" target="_blank"&gt;introduction to Windows 8 Store&lt;/a&gt; for those who didn’t attend any course or online event, but would like to learn about it.&lt;/p&gt;  &lt;p&gt;I met quite a few people so far, who wanted to go through Windows 8 development &lt;em&gt;labs&lt;/em&gt; without knowing anything about how Windows 8 works, what are the new key components and so on. Needless to say, practice without even the basic theory is a waste of time.&lt;/p&gt;  &lt;p&gt;So, this is the second part of about 10-part introduction to Windows 8 for Software Developers, and this time we’ll talk about the Metro Style application principles – what they are, how they work, what you should know first.&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;h2&gt;The difference between Windows 7 and Windows 8&lt;/h2&gt;  &lt;p&gt;I think you’ve already seen the new graphical user interface (UI) of Windows 8, so you already know how differently it looks from Windows 7 or Vista. However, that’s just the tip of the iceberg. The real difference of Windows 8 is how it works.&lt;/p&gt;  &lt;p&gt;Here are the main difference points at glance:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;New Windows Runtime (WinRT) &lt;/li&gt;    &lt;li&gt;New User Experience (UX) &lt;/li&gt;    &lt;li&gt;New Application Execution environment (with it’s own rules) &lt;/li&gt;    &lt;li&gt;Windows Store &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;I spoke about the Windows Store previously, as I consider it to be a very important difference, but just the names of other three are not convincing enough, especially the “new user experience”, which sounds like an empty buzz word. So, what are they?&lt;/p&gt;  &lt;h2&gt;WinRT&lt;/h2&gt;  &lt;p&gt;Windows Runtime, or WinRT, can be explained as the new .NET framework, but different.&lt;/p&gt;  &lt;p&gt;The first difference is that it’s not the framework that &lt;em&gt;loads each time&lt;/em&gt; your application is executed, like we have with .NET. The problem of .NET is that every time you execute an application, system resources are spent of components that your application depends from. Not a big deal for powerful machines, but mobile phones and tablets have very limited resources – be it RAM or CPU, and if you can exclude that layer from equation, you’ll win in performance.&lt;/p&gt;  &lt;p&gt;.NET framework is passive. It loads when your app starts, it follows your commands, it unloads when there are no .NET apps to execute. It doesn’t manage your application’s execution, even though it cleans up some resources and has some active elements like &lt;a title="See other ASP.NET articles" href="http://kirsanov.net/?tag=/ASPNET" target="_blank"&gt;ASP.NET&lt;/a&gt; State management.&lt;/p&gt;  &lt;p&gt;WinRT is active. It manages the life cycle of your app (see below), it is part of the system and doesn’t need to load specifically for your application, and what’s very important – it’s &lt;em&gt;asynchronous&lt;/em&gt;, meaning that your applications are multi-threaded by default.&lt;/p&gt;  &lt;p&gt;Speaking about &lt;strong&gt;asynchronous&lt;/strong&gt; operations, it’s a &lt;strike&gt;giant leap&lt;/strike&gt; big achievement and a well known head ache of the past.&lt;/p&gt;  &lt;p&gt;With Pentium 4 processors in 2002 (and XEON processors a bit earlier that year), we’ve got the technology called &lt;a href="http://en.wikipedia.org/wiki/Hyper-threading" rel="nofollow" target="_blank"&gt;Hyper-Threading&lt;/a&gt;(HT). It provided us with virtual processor cores – basically, you would have two pipelines of tasks for each physical processor, so if your application would consume two or more threads, they would execute simultaneously and finish earlier.&lt;/p&gt;  &lt;p&gt;But not everything was cool about Hyper-Threading – for example, most of applications we made with .NET were single-threaded, especially web applications. And I’ve seen cases, when such web applications could perform about &lt;em&gt;twice slower&lt;/em&gt; when HT was enabled, than when HT was switched off. So it’s a double-edged sword.&lt;/p&gt;  &lt;p&gt;However, for a multi-threaded applications, HT was a bliss, so we tried to use multiple threads whenever possible. It was whatever you want, but not a simple task, especially when it comes to debugging, so when Microsoft was working on .NET 4.5, they made asynchronous execution a native part of the language and of the framework. You can just use the &lt;strong&gt;&lt;em&gt;async&lt;/em&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;em&gt;await&lt;/em&gt;&lt;/strong&gt; keywords to execute functions asynchronously, and for .NET 4 (&lt;a href="http://kirsanov.net/post/2012/09/24/Time-To-Leave-the-NET-35-Behind.aspx" target="_blank"&gt;the last .NET version supported by Windows XP&lt;/a&gt;) they made an async library, which provides just the same functionality.&lt;/p&gt;  &lt;p&gt;But .NET itself is not asynchronous by default. WinRT is. Since the majority of processors we are using now, including the ones in the mobile devices, are having multiple cores, asynchronous operations is a must. In some mobile scenarios this could even save the energy, as you could run more operations consuming a particular device within a shortest time frame possible.&lt;/p&gt;  &lt;p&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="rubiks-cube" border="0" alt="rubiks-cube" align="left" src="http://kirsanov.net/image.axd?picture=rubiks-cube.jpg" width="160" height="160" /&gt;WinRT also serves as a postman between different applications, allowing them to share data – that’s what Microsoft is calling &lt;em&gt;&lt;strong&gt;winning as one&lt;/strong&gt;&lt;/em&gt;. Imagine it as Rubik’s cube – where many separate components form a new entity.     &lt;br /&gt;Using other applications as the source of content, you can form truly unique ecosphere, where many different things form a masterpiece.&lt;/p&gt;  &lt;p&gt;As you’ll learn from examples, WinRT looks and feels just like .NET, from developer’s perspective. Namespaces, classes, functions and data types – everything is similar. The main difference is that WinRT makes it simpler, is orchestrating the suite in which your app is soloist, and is enforcing best practices in resource management, making your life easier.&lt;/p&gt;  &lt;h2&gt;New User Experience&lt;/h2&gt;  &lt;p&gt;I won’t use words “better” or “worse” when describing the new Windows 8 user &lt;em&gt;interface&lt;/em&gt;. The user experience (UX) is not only about Metro, and it’s not even about “natural behavior” and science of cognitive psychology that was involved in development of new user interface. What’s more important about the new user &lt;em&gt;&lt;strong&gt;experience&lt;/strong&gt;&lt;/em&gt; is that everything becomes &lt;em&gt;predictable&lt;/em&gt;.&lt;/p&gt;  &lt;p&gt;Microsoft developed quite broad guidelines to follow when developing “Metro” style applications (now called Windows Store apps) – some of them in form of proposal and some of them are enforced (read: your app will be rejected if requirement is not met). &lt;/p&gt;  &lt;p&gt;Same elements, at the same places, same principles of placing the content, same behavior of applications (because now many things are managed by WinRT, not by you as developer) – applications look like they were developed by the same UX experts. This &lt;a title="Devigners" href="http://kirsanov.net/post/2012/09/11/Devign-Intervention.aspx" target="_blank"&gt;greatly simplifies development&lt;/a&gt; and at the same time – allows to cut the learning curve. If users know how to use other Windows 8 application, they know how to use yours.&lt;/p&gt;  &lt;p&gt;Because of the mentioned &lt;em&gt;winning as one&lt;/em&gt;, i.e. using &lt;em&gt;contracts&lt;/em&gt; to get specific information from other applications, users can do more with Windows 8, than previously. For example – get information / photos / lists of contacts from user’s social networks accounts without even knowing that such social networks exist or that such social networks even allow connecting using API. Just because user has official applications that can provide you with that information.&lt;/p&gt;  &lt;p&gt;Interactive tiles, cloud computing and management – all these features are native now and do not require any hardcore software development experience. In fact, usually it’s up to 5 lines of code.&lt;/p&gt;  &lt;p&gt;We’ll cover it later.&lt;/p&gt;  &lt;h2&gt;Windows 8 Application Execution environment&lt;/h2&gt;  &lt;p&gt;Your application is an interactive content now. Very interactive, indeed, but it’s not independent anymore. When user expresses the wish to execute your application, it’s WinRT that loads your application – it’s code and resources, and it’s WinRT who makes decisions, your application only obeys.&lt;/p&gt;  &lt;h4&gt;There Can Be Only One&lt;/h4&gt;  &lt;p&gt;Only one active application is allowed to run and consume resources.    &lt;br /&gt;As soon as user switches to another application, your application get’s suspended. WinRT waits for 5 seconds and, unless user switches back, informs your application that it’s time to pack things and wait the end. Literally.&lt;/p&gt;  &lt;p&gt;What your application must do then, is to save it’s state to disk, after that it stops getting any CPU cycles. Application becomes partially unloaded from memory, gets no CPU and so it doesn’t work, which also means it doesn’t drain the battery of mobile device.&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:4aa4e1ce-6f94-4bdd-84bd-b3801184471e" class="wlWriterEditableSmartContent"&gt;&lt;div&gt;&lt;object width="649" height="365"&gt;&lt;param name="movie" value="http://www.youtube.com/v/SjozlQNmSDU?hl=en&amp;amp;hd=1"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/SjozlQNmSDU?hl=en&amp;amp;hd=1" type="application/x-shockwave-flash" width="649" height="365"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;div style="width:649px;clear:both;font-size:.8em"&gt;How apps get suspended and terminated in Windows 8&lt;/div&gt;&lt;/div&gt;  &lt;p&gt;When user decides to switch back to your application, the first thing you have to do is to load the saved state. Interesting, that you can load that state even when and if your app was terminated.&lt;/p&gt;  &lt;p&gt;And speaking about &lt;strong&gt;termination&lt;/strong&gt; – as you might guess, you get no warning about it, for two reasons: first, you’ve got no CPU cycles to listen to any event and react, and second – you’ve already saved the application state, so there is nothing else you could do. WinRT will terminate your application automatically.&lt;/p&gt;  &lt;p&gt;Termination may occur, for example, when system experiences deficit of resources. Since your application still uses most of RAM it used when was active, unloading it can save the day. Other reasons may include switching users, system shutdown, application crash… WinRT will inform you about it when your app is executed next time, when it’s time to make decision of what to display to your user – the previous state of the app or starting from scratch.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;What advantages we can get from that principle&lt;/strong&gt; of having only one soloist in orchestra? Well, for example, if you are eager to count how much time your employees are working in your business application, you can instruct your program to ping your web service every minute or so. When user switches from your application, the app gets suspended, gets no CPU cycles, and so can’t check-in in your web service.&lt;/p&gt;  &lt;p&gt;Another advantage, is that your application is granted most, if not all, screen “real estate”, so you shouldn’t worry about elements not seen in the screen, because user resizes your application to 400*400 pixels square.&lt;/p&gt;  &lt;p&gt;And, of course, you get all resources of the device.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;What are the disadvantages?&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Obviously, you must entertain user, to keep his attention. In multi-window environment, it’s ok to have many applications working in background even if you have no immediate interest in them. In Metro – they will be suspended or at least restricted in functionality.&lt;/p&gt;  &lt;p&gt;I would like to stress it out – you must entertain your user with your content.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Here we are now entertain us&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;You may be asking now – why should you care about the user’s attention span and “entertain” him more than previously? Here is the list:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Your application is not working (and that’s the rule with exceptions, of course) when it’s not on the screen. And only one application can be on the a particular screen. Yes, some users may have more than one screen. &lt;/li&gt;    &lt;li&gt;When your application is forgotten for two weeks in Windows Phone 8 device, it loses it’s background task rights. &lt;/li&gt;    &lt;li&gt;Your application is only one click away from uninstall. &lt;/li&gt;    &lt;li&gt;Start menu is like billboard top – unless your application is pinned, it will sink in the list of other apps. So make sure your users love your app enough to pin it. &lt;/li&gt; &lt;/ol&gt;  &lt;h4&gt;Starting the Application in Windows 8&lt;/h4&gt;  &lt;p&gt;Is very different from Windows 7. See, we have no shortcuts now, and tiles are not exactly the same thing as shortcuts. First of all – they can lead you to a particular page of the application. For example – the Finances application in Windows 8 has multiple sections – for stocks, currencies and whatever. So you can pin a particular page, say, with currency exchange rate for British pound, to your start menu, and every time you’ll click that tile you’ll go to GBP rate page.&lt;/p&gt;  &lt;p&gt;Tiles are glass doors to your apps. They show you the latest updates (for example – mail application may show you the subject line of the latest e-mail) without showing the main page of the application. You can update them even from the cloud, without executing a line of code from within your application. As I said earlier – your app is a very interactive content now, a book that can be opened at any page and closed at any time.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Execution = Trigger + Condition&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;And that’s not the only new way to run your app. Or should I say – to run the code from your app. Here is another example – the Lock Screen.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://kirsanov.net/image.axd?picture=MetroLockScreen.jpg"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: 0px 10px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Metro Lock Screen" border="0" alt="Metro Lock Screen" align="left" src="http://kirsanov.net/image.axd?picture=MetroLockScreen_thumb.jpg" width="244" height="139" /&gt;&lt;/a&gt;Your application can display information on the lock screen and update it using the system triggers with certain conditions met. Like when internet becomes available and user present (so you could ask him for login and password to get connection to your network, for instance).&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://kirsanov.net/image.axd?picture=MetroAppExecution.jpg"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: 0px 10px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Metro App Execution Trigger Condition" border="0" alt="Metro App Execution Trigger Condition" align="right" src="http://kirsanov.net/image.axd?picture=MetroAppExecution_thumb.jpg" width="244" height="184" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;And as I mentioned earlier, WinRT will inform you, when your application starts, what was the reason your app was terminated last time. Was that user, system shutdown or something else. But that’s not all the information you’ll get.&lt;/p&gt;  &lt;p&gt;You also get the information about the states of various services and conditions, &lt;/p&gt;  &lt;br clear="all" /&gt;  &lt;h4&gt;Rules of a thumb&lt;/h4&gt;  &lt;p&gt;There are few. &lt;strong&gt;First&lt;/strong&gt; of them – your users have no idea about suspension and termination. Which means – there shall be no sign that your application was terminated, if it was terminated from suspended state. &lt;/p&gt;  &lt;p&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px 10px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; border-top: 0px; border-right: 0px; padding-top: 0px" title="Metro App Activation Rules" border="0" alt="Metro App Activation Rules" align="left" src="http://kirsanov.net/image.axd?picture=MetroBestPracticesSuspension_1.jpg" width="244" height="198" /&gt;As I said, you get that information during the activation of your app, so it’s up to you to make that decision. However, for your app to be predictable, it should behave the same way as other applications.&lt;/p&gt;  &lt;p&gt;As you can understand, system is not going to wait forever for your user state to serialize to disk, so if there is a lot of stuff to save, you should do it incrementally, when things change. Then, when system will inform you that you should prepare for immediate suspension, you won’t have any problems.&lt;/p&gt;  &lt;p&gt;Obviously, the user state should not be restored after the application was crashed, and it should not be restored if user used the tile to activate your application, as it usually means he wants to start from scratch.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Second&lt;/strong&gt; rule – do not wait for data to be loaded. Load it asynchronously, and update the list when you get fresh information. Take, for example, the People application in Windows 8. Once you connect it to your social network account, it starts loading contacts from it, but you see the program’s user interface immediately, with new contacts beautifully appearing where they should be.&lt;/p&gt;  &lt;p&gt;You never know the speed of the internet connection of your users, and you only have &lt;em&gt;&lt;strong&gt;15 seconds&lt;/strong&gt;&lt;/em&gt; to show your main window, or your application will be terminated. I’ve seen applications that didn’t really follow this guideline, but it doesn’t mean that your application may get the same indulgence.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Third&lt;/strong&gt; rule – do not “enhance” your user interface with “chrome”, i.e. elements that have no purpose. 3D buttons, shades, frames – forget about them altogether. Only add things that have a good reason to be added and bring a message with them. Use animations and glyphs that are part of WinRT, so your users will re-use their existing experience, instead of learning basics of user interface for your particular app.&lt;/p&gt;          &lt;p&gt;That’s all for today, sorry for a long long text, but much more to come, I’m afraid :)&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Kirsanov/~4/qJsdiWd9UuA" height="1" width="1"/&gt;</summary>
    <published>2012-12-29T22:24:04+00:00</published>
    <link rel="related" href="http://kirsanov.net/post/2012/12/29/Introduction-to-Windows-8-Apps-for-Software-Developers.aspx#disqus_thread" />
    <category term="Software development" />
    <dc:publisher>admin</dc:publisher>
    <pingback:server>http://kirsanov.net/pingback.axd</pingback:server>
    <pingback:target>http://kirsanov.net/post.aspx?id=f51f8038-15da-45c5-8897-874d061da701</pingback:target>
    <slash:comments>1</slash:comments>
    <trackback:ping>http://kirsanov.net/trackback.axd?id=f51f8038-15da-45c5-8897-874d061da701</trackback:ping>
    <wfw:comment>http://kirsanov.net/post/2012/12/29/Introduction-to-Windows-8-Apps-for-Software-Developers.aspx#disqus_thread</wfw:comment>
    <wfw:commentRss>http://kirsanov.net/syndication.axd?post=f51f8038-15da-45c5-8897-874d061da701</wfw:commentRss>
  <feedburner:origLink>http://kirsanov.net/post/2012/12/29/Introduction-to-Windows-8-Apps-for-Software-Developers.aspx</feedburner:origLink></entry>
</feed>
