﻿<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://developers.de/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Damir Dobric Posts : jQuery</title><link />http://developers.de/blogs/damir_dobric/archive/tags/jQuery/default.aspx<description>Tags: jQuery</description><dc:language>en</dc:language><generator>CommunityServer 2008 SP1 (Build: 30619.63)</generator><item><title>Azure IoT Connected Weather Station</title><link />http://developers.de/blogs/damir_dobric/archive/2016/02/25/azure-iot-connected-weather-station.aspx<pubdate>Thu, 25 Feb 2016 22:22:13 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:1742979</guid><dc:creator>Damir Dobric</dc:creator><slash:comments>1</slash:comments><wfw:commentrss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://developers.de/blogs/damir_dobric/rsscomments.aspx?PostID=1742979</wfw:commentrss><comments>http://developers.de/blogs/damir_dobric/archive/2016/02/25/azure-iot-connected-weather-station.aspx#comments</comments><description>&lt;p&gt;This year on Azure on Tour in Frankfurt we organized an IoTLab for all interested attendees. We scheduled 3slots of 2 hours.    &lt;br /&gt;Unfortunately they all ware booked out in very short time.&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;    &lt;br /&gt;We prepared for this IoT lab a weather station on Arduino as described &lt;a href="http://thinglabs.io/azure/"&gt;here&lt;/a&gt;. If you follow provided link step by step, you will most likely be able to build your own weather station based on &lt;strong&gt;sparkfun&lt;/strong&gt; electronics &lt;a href="https://www.sparkfun.com/products/12757"&gt;red board&lt;/a&gt; (19$) and &lt;a href="https://www.sparkfun.com/products/12081"&gt;weather shield&lt;/a&gt; (39$). &lt;/p&gt;  &lt;table cellspacing="0" cellpadding="2"&gt;     &lt;tr&gt;       &lt;td&gt;&lt;a href="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_5340DE8A.png"&gt;&lt;img title="image" 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="image" src="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_6B66D996.png" width="347" height="340" /&gt;&lt;/a&gt;&lt;/td&gt;        &lt;td&gt;&lt;a href="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_2D6D48D8.png"&gt;&lt;img title="image" 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="image" src="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_038CD4A3.png" width="413" height="268" /&gt;&lt;/a&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/table&gt;  &lt;table cellspacing="0" cellpadding="2"&gt;     &lt;tr&gt;       &lt;td&gt;&lt;a href="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_73ECC991.png"&gt;&lt;img title="image" 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="image" src="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_5A189362.png" width="397" height="268" /&gt;&lt;/a&gt;&lt;/td&gt;        &lt;td&gt;&lt;a href="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_5C551C1E.png"&gt;&lt;img title="image" 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="image" src="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_7C068697.png" width="430" height="295" /&gt;&lt;/a&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/table&gt;  &lt;p&gt;The station will send telemetry data from station to Azure IoT hub. I tried to do all programming by using Arduino IDE and Visual Studio code. They all are kind of cool, but I’m Visual Studio guy. So I downloaded &lt;a href="https://github.com/Microsoft/nodejstools#readme"&gt;Node.js tools for Visual Studio&lt;/a&gt;. Here is also an interesting &lt;a href="https://channel9.msdn.com/events/Visual-Studio/Connect-event-2015/801"&gt;video&lt;/a&gt;, which describes how to use tools.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_024D5D26.png"&gt;&lt;img title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;display:inline;padding-right:0px;" border="0" alt="image" src="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_291B7366.png" width="376" height="71" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Once you have install tools, you can create new weather station project from Node.js project template shown below:&lt;/p&gt;  &lt;table cellspacing="0" cellpadding="2"&gt;     &lt;tr&gt;       &lt;td&gt;&lt;a href="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_64DB0C19.png"&gt;&lt;img title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;float:none;padding-top:0px;padding-left:0px;margin-left:auto;border-left:0px;display:block;padding-right:0px;margin-right:auto;" border="0" alt="image" src="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_59454EDA.png" width="513" height="360" /&gt;&lt;/a&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/table&gt;  &lt;p&gt;This will create all required artifacts as VS does it in every project type. As next, open project.json file and paste the project content as described &lt;a href="http://thinglabs.io/sending-telemetry/"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_26E17B5B.png"&gt;&lt;img title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;display:inline;padding-right:0px;" border="0" alt="image" src="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_1FC23EE3.png" width="317" height="308" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Content of your &lt;strong&gt;project.json&lt;/strong&gt; file should look like shown in the snipped bellow. Please note that you change main entry file from weather.js as described in LAB guide to app.js, because VS creates main file in app.js. Right now you can leave it as it is, but it is not correct.&lt;/p&gt;  &lt;table cellspacing="0" cellpadding="2"&gt;     &lt;tr&gt;       &lt;td&gt;         &lt;p class="MsoNormal" style="list-style-type:disc;margin:0in 0in 8pt;line-height:12pt;"&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font style="font-size:9.5pt;"&gt;{                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; &lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:9.5pt;"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#2e75b6"&gt;&amp;quot;name&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;: &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#a31515"&gt;&amp;quot;IoT-Labs-Arduino&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:9.5pt;"&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;,                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#2e75b6"&gt;&amp;quot;repository&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;: {                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:de;"&gt;&lt;font color="#2e75b6"&gt;&amp;quot;type&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:de;"&gt;: &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:de;"&gt;&lt;font color="#a31515"&gt;&amp;quot;git&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:de;"&gt;,                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:de;"&gt;&lt;font color="#2e75b6"&gt;&amp;quot;url&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:de;"&gt;: &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:de;"&gt;&lt;font color="#a31515"&gt;&amp;quot;https://github.com/ThingLabsIo/IoTLabs/tree/master/Arduino/Weather&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:de;"&gt;               &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;font face="Consolas"&gt;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;},                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#2e75b6"&gt;&amp;quot;version&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;: &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#a31515"&gt;&amp;quot;0.1.0&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;,                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#2e75b6"&gt;&amp;quot;private&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;: &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#0000ff"&gt;true&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;,                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#2e75b6"&gt;&amp;quot;description&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;: &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#a31515"&gt;&amp;quot;Sample app that connects a device to Azure using Node.js&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;,                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#2e75b6"&gt;&amp;quot;main&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;: &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#a31515"&gt;&amp;quot;app.js&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;,                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#2e75b6"&gt;&amp;quot;author&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;: &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#a31515"&gt;&amp;quot;Damir Dobric&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;,                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#2e75b6"&gt;&amp;quot;license&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;: &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#a31515"&gt;&amp;quot;MIT&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;,                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#2e75b6"&gt;&amp;quot;dependencies&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;: {                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#2e75b6"&gt;&amp;quot;azure-iot-device&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;: &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#a31515"&gt;&amp;quot;latest&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;,                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#2e75b6"&gt;&amp;quot;azure-iot-device-amqp&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;: &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#a31515"&gt;&amp;quot;latest&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;,                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#2e75b6"&gt;&amp;quot;azure-iot-device-http&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;: &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#a31515"&gt;&amp;quot;latest&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;,                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#2e75b6"&gt;&amp;quot;johnny-five&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;: &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#a31515"&gt;&amp;quot;latest&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;,                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#2e75b6"&gt;&amp;quot;j5-sparkfun-weather-shield&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;: &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#a31515"&gt;&amp;quot;latest&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font style="font-size:9.5pt;"&gt;               &lt;br /&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:9.5pt;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; &lt;/span&gt;}                  &lt;br /&gt;}&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/table&gt;  &lt;p&gt;After you did this step, open the “&lt;em&gt;develop command prompt for vs 2015&lt;/em&gt;” console and execute following statement in the folder where     &lt;br /&gt;project.json is located:&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&amp;gt;npm install&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;As result you will see something like this:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_54629B1E.png"&gt;&lt;img title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;display:inline;padding-right:0px;" border="0" alt="image" src="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_142C81A4.png" width="673" height="358" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Now, we need to implement the code in app.js, which collects events and sent them Azure IoT Hub. Following snippet shows all&amp;#160; required code:&lt;/p&gt;  &lt;table cellspacing="0" cellpadding="2"&gt;     &lt;tr&gt;       &lt;td&gt;         &lt;p class="MsoNormal" style="list-style-type:disc;margin:0in 0in 8pt;line-height:12pt;"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#008000" face="Consolas"&gt;&lt;font style="font-size:9.5pt;"&gt;// https://github.com/ThingLabsIo/IoTLabs/tree/master/Arduino/Weather&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:9.5pt;"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;               &lt;br /&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#a31515" face="Consolas"&gt;&amp;#39;use strict&amp;#39;&lt;/font&gt;&lt;/span&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;;                 &lt;br /&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#008000"&gt;// Define the objects you will be working with&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;               &lt;br /&gt;&lt;/span&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#0000ff"&gt;var&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; five = require(&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#a31515"&gt;&amp;quot;johnny-five&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;);                 &lt;br /&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#0000ff"&gt;var&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; Shield = require(&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#a31515"&gt;&amp;quot;j5-sparkfun-weather-shield&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;)(five);                 &lt;br /&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#0000ff"&gt;var&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; device = require(&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#a31515"&gt;&amp;#39;azure-iot-device&amp;#39;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;);                 &lt;br /&gt;                  &lt;br /&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#008000"&gt;// Use factory function from AMQP-specific package&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;               &lt;br /&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#008000" face="Consolas"&gt;// Other options include HTTP (azure-iot-device-http) and MQTT (azure-iot-device-mqtt)&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;               &lt;br /&gt;&lt;/span&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#0000ff"&gt;var&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; clientFromConnectionString = require(&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#a31515"&gt;&amp;#39;azure-iot-device-http&amp;#39;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;).clientFromConnectionString;                 &lt;br /&gt;                  &lt;br /&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#0000ff"&gt;var&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; location = process.env.DEVICE_LOCATION || &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#a31515"&gt;&amp;#39;Frankfurt Messe&amp;#39;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;;                 &lt;br /&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#0000ff"&gt;var&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; connectionString = process.env.IOTHUB_CONN || &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#a31515"&gt;YOUR CONNSTR HERE. TAKE IT FROM DeviceExplorer&amp;#39;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;;                 &lt;br /&gt;                  &lt;br /&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#008000"&gt;// Create an Azure IoT client that will manage the connection to your IoT Hub&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;               &lt;br /&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#008000" face="Consolas"&gt;// The client is created in the context of an Azure IoT device, which is why&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;               &lt;br /&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#008000" face="Consolas"&gt;// you use a device-specific connection string.&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;               &lt;br /&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#0000ff" face="Consolas"&gt;var&lt;/font&gt;&lt;/span&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; client = clientFromConnectionString(connectionString);                 &lt;br /&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#0000ff"&gt;var&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; deviceId = device.ConnectionString.parse(connectionString).DeviceId;                 &lt;br /&gt;                  &lt;br /&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#008000"&gt;// Create a Johnny-Five board instance to represent your Particle Photon&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;               &lt;br /&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#008000" face="Consolas"&gt;// Board is simply an abstraction of the physical hardware, whether is is a &lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;               &lt;br /&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#008000" face="Consolas"&gt;// Photon, Arduino, Raspberry Pi or other boards.&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;               &lt;br /&gt;&lt;/span&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#0000ff"&gt;var&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; board = &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#0000ff"&gt;new&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; five.Board({ port: &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#a31515"&gt;&amp;quot;COM8&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; });                 &lt;br /&gt;                  &lt;br /&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#008000"&gt;// The board.on() executes the anonymous function when the &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;               &lt;br /&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#008000" face="Consolas"&gt;// board reports back that it is initialized and ready.&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;               &lt;br /&gt;&lt;font face="Consolas"&gt;board.on(&lt;/font&gt;&lt;/span&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#a31515"&gt;&amp;quot;ready&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;, &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#0000ff"&gt;function&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; () {                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;console.log(&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#a31515"&gt;&amp;quot;Board connected...&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;);                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;                  &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#008000"&gt;// The SparkFun Weather Shield has two sensors on the I2C bus - &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;               &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;font face="Consolas"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#008000" face="Consolas"&gt;// a humidity sensor (HTU21D) which can provide both humidity and temperature, and a &lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;               &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;font face="Consolas"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#008000" face="Consolas"&gt;// barometer (MPL3115A2) which can provide both barometric pressure and humidity.&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;               &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;font face="Consolas"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#008000" face="Consolas"&gt;// Controllers for these are wrapped in a convenient plugin class:&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;               &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;font face="Consolas"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#0000ff"&gt;var&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; weather = &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#0000ff"&gt;new&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; Shield({                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;variant: &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#a31515"&gt;&amp;quot;ARDUINO&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;, &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#008000"&gt;// or variant: &amp;quot;PHOTON&amp;quot;,&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;               &lt;br /&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;freq: 1000,&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#008000" face="Consolas"&gt;// Set the callback frequency to 1-second&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;               &lt;br /&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;elevation: 100&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#008000" face="Consolas"&gt;// Go to http://www.WhatIsMyElevation.com to get your current elevation&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;               &lt;br /&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;});                  &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;                  &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#008000" face="Consolas"&gt;// The weather.on(&amp;quot;data&amp;quot;, callback) function invokes the anonymous callback function &lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;               &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;font face="Consolas"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#008000" face="Consolas"&gt;// whenever the data from the sensor changes (no faster than every 25ms). The anonymous &lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;               &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;font face="Consolas"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#008000" face="Consolas"&gt;// function is scoped to the object (e.g. this == the instance of Weather class object). &lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;               &lt;br /&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;weather.on(&lt;/font&gt;&lt;/span&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#a31515"&gt;&amp;quot;data&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;, &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#0000ff"&gt;function&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; () {                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#0000ff"&gt;var&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; payload = JSON.stringify({                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;deviceId: deviceId,                  &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;location: location,                  &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#008000"&gt;// celsius &amp;amp; fahrenheit are averages taken from both sensors on the shield&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;               &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;font face="Consolas"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:de;"&gt;celsius: &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:de;"&gt;&lt;font color="#0000ff"&gt;this&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:de;"&gt;.celsius,                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;fahrenheit: &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:de;"&gt;&lt;font color="#0000ff"&gt;this&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:de;"&gt;.fahrenheit,                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;relativeHumidity: &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#0000ff"&gt;this&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;.relativeHumidity,                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;pressure: &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#0000ff"&gt;this&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;.pressure,                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;feet: &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#0000ff"&gt;this&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;.feet,                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;meters: &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#0000ff"&gt;this&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;.meters                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;});                  &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;                  &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#008000"&gt;// Create the message based on the payload JSON&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;               &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;font face="Consolas"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#0000ff"&gt;var&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; message = &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#0000ff"&gt;new&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; device.Message(payload);                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;                  &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#008000"&gt;// For debugging purposes, write out the message payload to the console&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;               &lt;br /&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;console.log(&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#a31515" face="Consolas"&gt;&amp;quot;Sending message: &amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; + message.getData());                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;                  &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#008000"&gt;// Send the message to Azure IoT Hub&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;               &lt;br /&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;client.sendEvent(message, printResultFor(&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#a31515" face="Consolas"&gt;&amp;#39;send&amp;#39;&lt;/font&gt;&lt;/span&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;));                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;});                  &lt;br /&gt;});                  &lt;br /&gt;                  &lt;br /&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#008000"&gt;// Helper function to print results in the console&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;               &lt;br /&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#0000ff" face="Consolas"&gt;function&lt;/font&gt;&lt;/span&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; printResultFor(op) {                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#0000ff"&gt;return&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#0000ff"&gt;function&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; printResult(err, res) {                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#0000ff"&gt;if&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; (err) console.log(op + &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font color="#a31515"&gt;&amp;#39; error: &amp;#39;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:9.5pt;"&gt; + err.toString());                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;};                  &lt;br /&gt;}&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;            &lt;br style="mso-special-character:line-break;" /&gt;            &lt;br style="mso-special-character:line-break;" /&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/table&gt;  &lt;p&gt;To run the code, in already opened command prompt execute : &amp;gt;&lt;strong&gt;node app.js&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;If all works fine, the app will run and produce output as this one:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_13C04EAF.png"&gt;&lt;img title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;display:inline;padding-right:0px;" border="0" alt="image" src="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_6F2EC12A.png" width="782" height="156" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;If your app fails with connection error and you are sure your connection is ok, then it is most likely that AMQP ports 5671 and 5672 are blocked. In that case you will have to switch to http. To do that add dependency to HTTP library instead of amqp one:&lt;/p&gt;  &lt;table cellspacing="0" cellpadding="2"&gt;     &lt;tr&gt;       &lt;td&gt;&lt;span style="list-style-type:disc;background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:en-us;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;font color="#2e75b6" face="Consolas"&gt;&lt;font style="font-size:9.5pt;"&gt;&amp;quot;dependencies&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:9.5pt;"&gt;&lt;font face="Consolas"&gt;&lt;span style="list-style-type:disc;background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:en-us;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;: {               &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="list-style-type:disc;background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:en-us;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;font color="#2e75b6"&gt;&amp;quot;azure-iot-device&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;span style="list-style-type:disc;background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:en-us;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;: &lt;/span&gt;&lt;span style="list-style-type:disc;background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:en-us;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;font color="#a31515"&gt;&amp;quot;latest&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="list-style-type:disc;background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:en-us;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;font face="Consolas"&gt;,               &lt;br /&gt;&lt;strike&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/strike&gt;&lt;/font&gt;&lt;/span&gt;&lt;strike style="list-style-type:disc;"&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:en-us;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;font color="#2e75b6"&gt;&amp;quot;azure-iot-device-amqp&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:en-us;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;: &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:en-us;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;font color="#a31515"&gt;&amp;quot;latest&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:en-us;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;font face="Consolas"&gt;,                 &lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;/strike&gt;&lt;font style="background-color:#ffff00;"&gt;&lt;font face="Consolas"&gt;&lt;span style="list-style-type:disc;background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:yellow;mso-ansi-language:en-us;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="list-style-type:disc;background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:yellow;mso-ansi-language:en-us;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;font color="#2e75b6"&gt;&amp;quot;azure-iot-device-http&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;span style="list-style-type:disc;background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:yellow;mso-ansi-language:en-us;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;: &lt;/span&gt;&lt;span style="list-style-type:disc;background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:yellow;mso-ansi-language:en-us;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;font color="#a31515"&gt;&amp;quot;latest&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;span style="list-style-type:disc;background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:yellow;mso-ansi-language:en-us;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;,&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="list-style-type:disc;background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:en-us;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;             &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;font face="Consolas"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Consolas"&gt;&lt;span style="list-style-type:disc;background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:en-us;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;font color="#2e75b6"&gt;&amp;quot;johnny-five&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;span style="list-style-type:disc;background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:en-us;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;: &lt;/span&gt;&lt;span style="list-style-type:disc;background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:en-us;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;font color="#a31515"&gt;&amp;quot;latest&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="list-style-type:disc;background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:en-us;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;,               &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="list-style-type:disc;background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:en-us;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;font color="#2e75b6"&gt;&amp;quot;j5-sparkfun-weather-shield&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;span style="list-style-type:disc;background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:en-us;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;: &lt;/span&gt;&lt;span style="list-style-type:disc;background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:en-us;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;font color="#a31515"&gt;&amp;quot;latest&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="list-style-type:disc;background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:en-us;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;font style="font-size:9.5pt;"&gt;             &lt;br /&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:9.5pt;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; &lt;/span&gt;}&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/table&gt;  &lt;p&gt;Additionally you will have to add http package in app.js&lt;/p&gt;  &lt;p&gt;&lt;font face="Consolas"&gt;&lt;span style="list-style-type:disc;background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:en-us;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size:9.5pt;"&gt;var&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:9.5pt;"&gt;&lt;span style="list-style-type:disc;background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:en-us;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt; clientFromConnectionString = require(&lt;/span&gt;&lt;span style="list-style-type:disc;background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:en-us;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;font color="#a31515"&gt;&amp;#39;azure-iot-device-http&amp;#39;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="list-style-type:disc;background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:en-us;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;font style="font-size:9.5pt;"&gt;).clientFromConnectionString;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=1742979" width="1" height="1"&gt;</description><category domain="http://developers.de/blogs/damir_dobric/archive/tags/cloud/default.aspx">cloud</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/azure/default.aspx">azure</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/windows+azure/default.aspx">windows azure</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/jQuery/default.aspx">jQuery</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/ServiceBus/default.aspx">ServiceBus</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/Microsoft+Azure/default.aspx">Microsoft Azure</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/iot/default.aspx">iot</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/iothub/default.aspx">iothub</category></item><item><title>EventHubs support for Azure ServiceBus JavaScript SDK</title><link />http://developers.de/blogs/damir_dobric/archive/2015/01/26/eventhubs-support-for-azure-servicebus-javascript-sdk.aspx<pubdate>Mon, 26 Jan 2015 21:29:00 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:1164772</guid><dc:creator>Damir Dobric</dc:creator><slash:comments>0</slash:comments><wfw:commentrss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://developers.de/blogs/damir_dobric/rsscomments.aspx?PostID=1164772</wfw:commentrss><comments>http://developers.de/blogs/damir_dobric/archive/2015/01/26/eventhubs-support-for-azure-servicebus-javascript-sdk.aspx#comments</comments><description>&lt;p&gt;   &lt;br /&gt;We published new version of Azure Service Bus Java Script SDK &lt;strong&gt;v1.2.&lt;/strong&gt; This version provides supports for sending of events to Azure Service Bus Event Hubs.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_6D338DFC.png"&gt;&lt;img title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;display:inline;padding-right:0px;" border="0" alt="image" src="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_25DE380A.png" width="629" height="314" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Supported features:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Sending of messages to the queue &lt;/li&gt;    &lt;li&gt;Reading of messages from queue &lt;/li&gt;    &lt;li&gt;Sending of messages to Topic &lt;/li&gt;    &lt;li&gt;Sending of events to EventHub (&lt;strong&gt;&lt;font style="background-color:#ffff00;"&gt;NEW&lt;/font&gt;&lt;/strong&gt;)&lt;/li&gt;    &lt;li&gt;Reading of messages from subscription &lt;/li&gt;    &lt;li&gt;Abondon &lt;/li&gt;    &lt;li&gt;PeekLock-Read/PeekDelete-Read &lt;/li&gt;    &lt;li&gt;Complete &lt;/li&gt;    &lt;li&gt;Creating Shared Access Token Signatures &lt;/li&gt;    &lt;li&gt;Custom BrokeredMessage properties &lt;/li&gt;    &lt;li&gt;CORS&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Following sample shows how to send an event to Service Bus Event Hub.&lt;/p&gt;  &lt;table cellspacing="0" cellpadding="2"&gt;     &lt;tr&gt;       &lt;td&gt;         &lt;p class="MsoNormal" style="list-style-type:disc;margin:0cm 0cm 0pt;line-height:normal;mso-layout-grid-align:none;"&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;font style="font-size:9.5pt;"&gt;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font style="font-size:9.5pt;"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font color="#800000"&gt;script&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt; &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font color="#ff0000"&gt;type&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font color="#0000ff"&gt;=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:9.5pt;"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;               &lt;br /&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;$(document).ready(&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:9.5pt;"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font color="#0000ff"&gt;function&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font style="font-size:9.5pt;"&gt; () {&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;          &lt;p class="MsoNormal" style="list-style-type:disc;margin:0cm 0cm 0pt;line-height:normal;mso-layout-grid-align:none;"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;             &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:9.5pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font style="font-size:9.5pt;"&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font color="#0000ff"&gt;var&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt; clear = &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font color="#0000ff"&gt;function&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt; () {                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;$(&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font color="#a31515"&gt;&amp;quot;#result&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;).html(&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font color="#a31515"&gt;&amp;quot;&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:9.5pt;"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;);                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;$(&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font color="#a31515"&gt;&amp;quot;#msgId&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;).html(&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font color="#a31515"&gt;&amp;quot;&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font style="font-size:9.5pt;"&gt;);&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;          &lt;p class="MsoNormal" style="list-style-type:disc;margin:0cm 0cm 0pt;line-height:normal;mso-layout-grid-align:none;"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;             &lt;br /&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;font style="font-size:9.5pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:9.5pt;"&gt;}                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;             &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:9.5pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font style="font-size:9.5pt;"&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font color="#0000ff"&gt;var&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt; ehubClient = &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font color="#0000ff"&gt;new&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt; EventHubClient(                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;{                  &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font color="#a31515"&gt;&amp;#39;name&amp;#39;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;: ‘eintrachtfrankfurt’,                 &lt;br /&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;          &lt;p class="MsoNormal" style="list-style-type:disc;margin:0cm 0cm 0pt;line-height:normal;mso-layout-grid-align:none;"&gt;&lt;font style="font-size:9.5pt;"&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font color="#008000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // This is by spec a partition key if specified. &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:9.5pt;"&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font color="#a31515"&gt;&amp;#39;devicename&amp;#39;&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;: &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font color="#a31515"&gt;&amp;#39;jssimulator&amp;#39;&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;, &lt;/span&gt;&lt;/font&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;               &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;font face="Consolas"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font color="#a31515"&gt;&amp;#39;namespace&amp;#39;&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;: &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font color="#a31515"&gt;&amp;quot;mynamespace&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;,                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font color="#a31515"&gt;&amp;#39;sasKey&amp;#39;&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;: &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font color="#a31515"&gt;&amp;quot;Hakan:)**/bU=&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;,                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font color="#a31515"&gt;&amp;#39;sasKeyName&amp;#39;&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;: &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font color="#a31515"&gt;&amp;quot;send_events&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;,                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font color="#a31515"&gt;&amp;#39;timeOut&amp;#39;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:9.5pt;"&gt;: 10,                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;});&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;          &lt;p class="MsoNormal" style="list-style-type:disc;margin:0cm 0cm 0pt;line-height:normal;mso-layout-grid-align:none;"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:9.5pt;"&gt;&amp;#160;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;          &lt;p class="MsoNormal" style="list-style-type:disc;margin:0cm 0cm 0pt;line-height:normal;mso-layout-grid-align:none;"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;             &lt;br /&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;font style="font-size:9.5pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:9.5pt;"&gt;$(&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:9.5pt;"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font color="#a31515"&gt;&amp;quot;#btnSend&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;).click(&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font color="#0000ff"&gt;function&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font style="font-size:9.5pt;"&gt; () {&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;          &lt;p class="MsoNormal" style="list-style-type:disc;margin:0cm 0cm 0pt;line-height:normal;mso-layout-grid-align:none;"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;             &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:9.5pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:9.5pt;"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font color="#0000ff"&gt;var&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt; eventBody = { &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font color="#a31515"&gt;&amp;quot;24&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;: txtTemp.value,                  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font color="#a31515"&gt;&amp;quot;area&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font style="font-size:9.5pt;"&gt;: “Frankfurt am Main”};                 &lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:9.5pt;"&gt;                   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:9.5pt;"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font color="#0000ff"&gt;var&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt; msg = &lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font color="#0000ff"&gt;new&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font style="font-size:9.5pt;"&gt; EventData(eventBody);&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;          &lt;p class="MsoNormal" style="list-style-type:disc;margin:0cm 0cm 0pt;line-height:normal;mso-layout-grid-align:none;"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;             &lt;br /&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;font style="font-size:9.5pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;font style="font-size:9.5pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:9.5pt;"&gt;ehubClient.sendMessage(msg, &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:9.5pt;"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font color="#0000ff" face="Consolas"&gt;function&lt;/font&gt;&lt;/span&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt; (messagingResult) {                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;$(&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font color="#a31515"&gt;&amp;quot;#result&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;).html(messagingResult.result);                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;$(&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font color="#a31515"&gt;&amp;quot;#eventData&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;mso-ansi-language:en-us;"&gt;&lt;font face="Consolas"&gt;).html(JSON.stringify(eventBody));                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;mso-highlight:white;"&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:9.5pt;"&gt;});                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;});&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;          &lt;p class="MsoNormal" style="list-style-type:disc;margin:0cm 0cm 8pt;line-height:12pt;"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-highlight:white;"&gt;             &lt;br /&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;font style="font-size:9.5pt;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:9.5pt;"&gt;});                 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:9.5pt;"&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-highlight:white;"&gt;&lt;font color="#0000ff"&gt;&amp;lt;/&lt;/font&gt;&lt;/span&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-highlight:white;"&gt;&lt;font color="#800000"&gt;script&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="background-image:none;background-repeat:repeat;background-attachment:scroll;background-position:0% 0%;line-height:10pt;mso-highlight:white;"&gt;&lt;font style="font-size:9.5pt;" color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/table&gt;  &lt;p&gt;Open Source Project on &lt;a href="https://github.com/ddobric/ServiceBusJavaScriptSdk/wiki/Welcome-to-Azure-Service-Bus-JavaScript-SDK-1.2"&gt;GitHub&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;Nuget Packages &lt;a href="https://www.nuget.org/packages/SbJsSdk/"&gt;sbjssdk 1.2.0&lt;/a&gt; and &lt;a href="https://www.nuget.org/packages/SbJsSdkSample/"&gt;sbjssdk 1.2.0 samples&lt;/a&gt;.&lt;/p&gt;  &lt;h4&gt;Related Samples:&lt;/h4&gt;  &lt;p&gt;   &lt;br /&gt;1. How to send messages to Service Bus from .NET Microframework (Example Gadgeteer SPIDER):    &lt;br /&gt;&lt;a title="http://developers.de/blogs/damir_dobric/archive/2014/12/09/iot-and-industrie-4-0-for-sharepoint-part-i.aspx" href="http://developers.de/blogs/damir_dobric/archive/2014/12/09/iot-and-industrie-4-0-for-sharepoint-part-i.aspx"&gt;http://developers.de/blogs/damir_dobric/archive/2014/12/09/iot-and-industrie-4-0-for-sharepoint-part-i.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;2. How to build SharePoint and Office 365 Apps which send messages to Service Bus and consume device events in JavaScript Microservice on top of Service Bus messaging.   &lt;br /&gt;&lt;a title="http://developers.de/blogs/damir_dobric/archive/2014/12/16/iot-and-industrie-4-0-for-sharepoint-part-ii.aspx" href="http://developers.de/blogs/damir_dobric/archive/2014/12/16/iot-and-industrie-4-0-for-sharepoint-part-ii.aspx"&gt;http://developers.de/blogs/damir_dobric/archive/2014/12/16/iot-and-industrie-4-0-for-sharepoint-part-ii.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;3. EventHubDashDemo provides code to visualize how &lt;a href="http://azure.microsoft.com/en-us/services/event-hubs/"&gt;Azure Event Hubs&lt;/a&gt; enables very large scale data ingestion from a large number of sources and very high throughput event consumption through the use of partitioned consumers.    &lt;br /&gt;&lt;a href="https://github.com/juanjperez/EventHubDashDemo"&gt;https://github.com/juanjperez/EventHubDashDemo&lt;/a&gt;&lt;/p&gt;  &lt;h4&gt;Related Articles&lt;/h4&gt;  &lt;p&gt;1. Introduction in SBJSSDK:    &lt;br /&gt;&lt;a title="http://developers.de/blogs/damir_dobric/archive/2014/08/07/welcome-azure-servicebus-javascript-sdk.aspx" href="http://developers.de/blogs/damir_dobric/archive/2014/08/07/welcome-azure-servicebus-javascript-sdk.aspx"&gt;http://developers.de/blogs/damir_dobric/archive/2014/08/07/welcome-azure-servicebus-javascript-sdk.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;2. Jumpstart SBJSSDK   &lt;br /&gt;&lt;a title="http://developers.de/blogs/damir_dobric/archive/2014/08/12/jumpstart-azure-service-bus-javascript-sdk.aspx" href="http://developers.de/blogs/damir_dobric/archive/2014/08/12/jumpstart-azure-service-bus-javascript-sdk.aspx"&gt;http://developers.de/blogs/damir_dobric/archive/2014/08/12/jumpstart-azure-service-bus-javascript-sdk.aspx&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=1164772" width="1" height="1"&gt;</description><category domain="http://developers.de/blogs/damir_dobric/archive/tags/cloud/default.aspx">cloud</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/azure/default.aspx">azure</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/windows+azure/default.aspx">windows azure</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/jQuery/default.aspx">jQuery</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/ServiceBus/default.aspx">ServiceBus</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/Apps+and+Devices/default.aspx">Apps and Devices</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/Microsoft+Azure/default.aspx">Microsoft Azure</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/Devices+and+Services/default.aspx">Devices and Services</category></item><item><title>Getting binding context on event in knockout</title><link />http://developers.de/blogs/damir_dobric/archive/2014/03/06/getting-binding-context-on-event-in-knockout.aspx<pubdate>Thu, 06 Mar 2014 10:25:00 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:841923</guid><dc:creator>Damir Dobric</dc:creator><slash:comments>0</slash:comments><wfw:commentrss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://developers.de/blogs/damir_dobric/rsscomments.aspx?PostID=841923</wfw:commentrss><comments>http://developers.de/blogs/damir_dobric/archive/2014/03/06/getting-binding-context-on-event-in-knockout.aspx#comments</comments><description>&lt;p&gt;This post is just for documentation purposes. We have often a requirement to obtain the binding context instance of the DOM element.    &lt;br /&gt;This is usually the case when you for example subscribe some event. Following sample shows a keyup event as a INPUT element which is a child of some DIV element.    &lt;br /&gt;The parent DIV of clicked INPUT element holds the binding context.&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom:0pt;line-height:normal;mso-layout-grid-align:none;"&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;"&gt;$(&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:#a31515;mso-highlight:white;"&gt;&amp;quot;input[data-iscontentchange=&amp;#39;true&amp;#39;]&amp;quot;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;"&gt;).keyup(&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:blue;mso-highlight:white;"&gt;function&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;"&gt; (e){     &lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160; var clickedParentElement = $(e.originalEvent.target).parents()[0];      &lt;br /&gt;&amp;#160;&amp;#160; ko.contextFor(clickedParentElement).$data.IsConfigSettingDirty(&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:blue;mso-highlight:white;"&gt;true&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;"&gt;);     &lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;line-height:107%;mso-highlight:white;"&gt;});&lt;/span&gt;    &lt;p&gt;&lt;/p&gt; &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;The ko.contextFor(clickedParentElement).$data holds the instance of the object which is bound to parent element.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=841923" width="1" height="1"&gt;</description><category domain="http://developers.de/blogs/damir_dobric/archive/tags/Asp.Net/default.aspx">Asp.Net</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/jQuery/default.aspx">jQuery</category></item><item><title>Page Transition between with JQuery Mobile and Knockout.js</title><link />http://developers.de/blogs/damir_dobric/archive/2013/10/01/page-transition-between-with-jquery-mobile-and-knockout-js.aspx<pubdate>Tue, 01 Oct 2013 17:41:00 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:580118</guid><dc:creator>Damir Dobric</dc:creator><slash:comments>0</slash:comments><wfw:commentrss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://developers.de/blogs/damir_dobric/rsscomments.aspx?PostID=580118</wfw:commentrss><comments>http://developers.de/blogs/damir_dobric/archive/2013/10/01/page-transition-between-with-jquery-mobile-and-knockout-js.aspx#comments</comments><description>&lt;p&gt;If you are fan of &lt;strong&gt;jQuery&lt;/strong&gt; mobile and &lt;strong&gt;Knockout&lt;/strong&gt;, you have probably noticed that page transition is a &lt;strong&gt;true&lt;/strong&gt; issue. If you want to understand why,    &lt;br /&gt;you can try &lt;a href="http://vsnomad.com/2013/02/08/crm-sample-transitioning-between-pages/"&gt;here&lt;/a&gt; and&amp;#160; &lt;a href="http://www.scottlogic.com/blog/2012/10/23/integrating-knockout-and-jquerymobile.html"&gt;here&lt;/a&gt; and many, many other. All very nice articles, which obviously explaining some peace of technology which MUST work.    &lt;br /&gt;    &lt;br /&gt;To make this clear, take a look on following code:&lt;/p&gt;  &lt;table cellspacing="0" cellpadding="2"&gt;     &lt;tr&gt;       &lt;td&gt;         &lt;p class="MsoNormal" style="margin-bottom:0pt;line-height:normal;mso-layout-grid-align:none;"&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;"&gt;&lt;span style="mso-tab-count:1;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; &lt;br /&gt;&lt;/span&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; $(&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:#a31515;mso-highlight:white;"&gt;&amp;quot;div[data-isclickable=&amp;#39;true&amp;#39;]&amp;quot;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;"&gt;).click(&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:blue;mso-highlight:white;"&gt;function&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;"&gt; (e) {             &lt;p&gt;&lt;/p&gt;           &lt;/span&gt;&lt;/p&gt;          &lt;p class="MsoNormal" style="margin-bottom:0pt;line-height:normal;mso-layout-grid-align:none;"&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;"&gt;$.mobile.changePage(&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:#a31515;mso-highlight:white;"&gt;&amp;quot;#activityDetailPage&amp;quot;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;"&gt;);&lt;/span&gt;&lt;/p&gt;          &lt;p class="MsoNormal"&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;line-height:107%;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;});&lt;/span&gt;            &lt;p&gt;&lt;/p&gt;         &lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/table&gt;  &lt;p&gt;This peace of code will navigate to next page called ‘’&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:#a31515;mso-highlight:white;"&gt;activityDetailPage&lt;/span&gt;’ when some div tag is clicked.    &lt;br /&gt;If the code above is executed in the page which represents for example the list of items then &lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:#a31515;mso-highlight:white;"&gt;activityDetailPage&lt;/span&gt; should represents the item details.    &lt;br /&gt;This is common navigation requirement.     &lt;br /&gt;Assuming that the detail page is bound to some object named ‘SelectedObject’ the HTML would look like:    &lt;br /&gt;    &lt;br /&gt;&lt;/p&gt;  &lt;table cellspacing="0" cellpadding="2"&gt;     &lt;tr&gt;       &lt;td&gt;         &lt;p&gt;&amp;lt;div data-role=&amp;quot;fieldcontain&amp;quot; class=&amp;quot;ui-field-contain ui-body ui-br&amp;quot;&amp;gt; &lt;/p&gt;          &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;label for=&amp;quot;ActivityId&amp;quot; class=&amp;quot;ui-input-text&amp;quot;&amp;gt;Activity ID:&amp;lt;/label&amp;gt;           &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;input&amp;#160; data-mini=&amp;quot;true&amp;quot; name=&amp;quot;textarea&amp;quot; id=&amp;quot;ActivityId&amp;quot; data-bind=&amp;quot;value: ActivityId&amp;quot;/&amp;gt; &lt;/p&gt;          &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;label for=&amp;quot;Status&amp;quot; class=&amp;quot;ui-input-text&amp;quot;&amp;gt;Status:&amp;lt;/label&amp;gt;           &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;input readonly=&amp;quot;readonly&amp;quot; data-mini=&amp;quot;true&amp;quot; name=&amp;quot;textarea&amp;quot; id=&amp;quot;Status&amp;quot; data-bind=&amp;quot;value: Status&amp;quot;/&amp;gt; &lt;/p&gt;          &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;label for=&amp;quot;ProcessName&amp;quot; class=&amp;quot;ui-input-text&amp;quot;&amp;gt;ProcessName:&amp;lt;/label&amp;gt;           &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;input readonly=&amp;quot;readonly&amp;quot; data-mini=&amp;quot;true&amp;quot; name=&amp;quot;textarea&amp;quot; id=&amp;quot;ProcessName&amp;quot; data-bind=&amp;quot;value: ProcessName&amp;quot;/&amp;gt; &lt;/p&gt;          &lt;p&gt;&amp;#160; &amp;lt;/div&amp;gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/table&gt;  &lt;p class="MsoNormal" style="margin-bottom:0pt;line-height:normal;mso-layout-grid-align:none;"&gt;Unfortunately when you navigate to this page, the data will not be bound to HTML elements. This is because, the knockout binding has run before the user has clicked on item (div tag).   &lt;br /&gt;In every normal application framework this is something which just should work. .NET, Silverlight and WPF developers are mostly frustrated, because some elementary and trivial things just do not work.    &lt;br /&gt;jQuery Mobile might be nice and knockout too, but both together? Hmmm? If you don’t understand why somebody might be disappointed, because such things do not work then try to image what would happen when 1+1 sometime is 2 and sometimes 3.    &lt;br /&gt;in this century architects expect binding to work like ‘+’ operator. It just works.&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom:0pt;line-height:normal;mso-layout-grid-align:none;"&gt;So, here is the solution:   &lt;br /&gt;&lt;/p&gt;  &lt;table cellspacing="0" cellpadding="2"&gt;     &lt;tr&gt;       &lt;td&gt;         &lt;p class="MsoNormal" style="margin-bottom:0pt;line-height:normal;mso-layout-grid-align:none;"&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; $(document).bind(&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:#a31515;mso-highlight:white;"&gt;&amp;#39;pagechange&amp;#39;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;"&gt;, &lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:blue;mso-highlight:white;"&gt;function&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;"&gt; () {             &lt;p&gt;&lt;/p&gt;           &lt;/span&gt;&lt;/p&gt;          &lt;p class="MsoNormal" style="margin-bottom:0pt;line-height:normal;mso-layout-grid-align:none;"&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;ko.applyBindings(yourModelInstamce.SelectedItem, document.getElementById(&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:#a31515;mso-highlight:white;"&gt;&amp;quot;activityDetailPage&amp;quot;&lt;/span&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;"&gt;));             &lt;p&gt;&lt;/p&gt;           &lt;/span&gt;&lt;/p&gt;          &lt;p class="MsoNormal" style="margin-bottom:0pt;line-height:normal;mso-layout-grid-align:none;"&gt;&lt;span style="font-size:9.5pt;font-family:consolas;background:white;color:black;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;});&lt;/span&gt;            &lt;p&gt;&lt;/p&gt;         &lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/table&gt;  &lt;p class="MsoNormal" style="margin-bottom:0pt;line-height:normal;mso-layout-grid-align:none;"&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=580118" width="1" height="1"&gt;</description><category domain="http://developers.de/blogs/damir_dobric/archive/tags/Asp.Net/default.aspx">Asp.Net</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/knockout/default.aspx">knockout</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/jQuery/default.aspx">jQuery</category></item><item><title>Nuget Install-Package error</title><link />http://developers.de/blogs/damir_dobric/archive/2012/07/25/nuget-install-package-error.aspx<pubdate>Wed, 25 Jul 2012 16:44:23 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:323106</guid><dc:creator>Damir Dobric</dc:creator><slash:comments>0</slash:comments><wfw:commentrss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://developers.de/blogs/damir_dobric/rsscomments.aspx?PostID=323106</wfw:commentrss><comments>http://developers.de/blogs/damir_dobric/archive/2012/07/25/nuget-install-package-error.aspx#comments</comments><description>&lt;p&gt;When trying to install the NuGet package you might experience following error:&lt;/p&gt;  &lt;p&gt;PM&amp;gt; install-package *package name*&lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;Install-Package : The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.    &lt;br /&gt;At line:1 char:16    &lt;br /&gt;+ install-package &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;#160; AspNetWebApi    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; + CategoryInfo&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; : NotSpecified: (:) [Install-Package], WebException    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand&lt;/p&gt;  &lt;p&gt;This error is caused by untrusted RapidSSL CA certificate, which is used to sign the NuGet package.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_12697D89.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_042B0499.png" width="397" height="388" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Usually is this certification root trusted. If not put it in Trusted Root Certification Authorities.&lt;/p&gt;  &lt;p&gt;Mote that this error can often happen if the Fiddler is running in the background an Fiddler’s certificate is not trusted. In this case either just close the fiddler or trust its certificate.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=323106" width="1" height="1"&gt;</description><category domain="http://developers.de/blogs/damir_dobric/archive/tags/Asp.Net/default.aspx">Asp.Net</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/jQuery/default.aspx">jQuery</category></item><item><title>Speedup your Web Application with Windows Azure Web and new “Cache Worker Role”</title><link />http://developers.de/blogs/damir_dobric/archive/2012/06/17/speedup-your-web-application-with-windows-azure-web-and-new-cache-worker-role.aspx<pubdate>Sun, 17 Jun 2012 18:13:21 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:314226</guid><dc:creator>Damir Dobric</dc:creator><slash:comments>1</slash:comments><wfw:commentrss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://developers.de/blogs/damir_dobric/rsscomments.aspx?PostID=314226</wfw:commentrss><comments>http://developers.de/blogs/damir_dobric/archive/2012/06/17/speedup-your-web-application-with-windows-azure-web-and-new-cache-worker-role.aspx#comments</comments><description>&lt;p&gt;This article describes how to create ASP.NET MVC application as a WebRole and to speed it up by using CacheRole introduced in Windows Azure Platform release 1.7 (also called Spring Release [2012]). The way how the distributed cashe works and how it can be consumed by an application didn’t really change. Because of that I will focus only new features, because the way how they are build up and how they works has been slightly changed in this release.&lt;/p&gt;  &lt;h3&gt;Create Solution with Cache Role&lt;/h3&gt;  &lt;p&gt;To build solution I&lt;em&gt;&amp;#160; &lt;/em&gt;will use Visual Studio 2012 and Windows Azure SDK 1.7. If you didn’t install it already do it as described in my previous post&amp;#160; &lt;a href="http://developers.de/blogs/damir_dobric/archive/2012/06/10/starting-with-visual-studio-2012-and-windows-azure.aspx"&gt;here&lt;/a&gt;.    &lt;br /&gt;Now create the solution and add one WebRole (for example ASP.NET MVC4) and the CacheWorkerRole (I will explain it a bit latter).    &lt;br /&gt;    &lt;br /&gt;&lt;a href="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_70406BDC.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:block;float:none;margin-left:auto;border-top:0px;margin-right:auto;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_56D868A2.png" width="232" height="143" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The project SharePointFastDataReaderCache is of type CacheWorkerRole and it represents the virtual machine which will host dedicated instance of distributed cache. This cache will be consumed by project (WebRole) SharePointFastdata reader. Please don’t&amp;#39; be confused with SharePoint name. It is not my focus in this article. I just used an existing solution which does the more or less same thing with SharePoint.   &lt;br /&gt;    &lt;br /&gt;The just created role is in fact WorkerRole which is place holder for Distributed Cache Service. That means: “&lt;u&gt;Do not add any code to that role&lt;/u&gt;!!” Before you do deployment select the Worker Cache Role and go to properties (dbl-click on SharePointFastDataReaderCache ). Select enable cache and click on Dedicated Role as shown below.    &lt;br /&gt;&lt;a href="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_2F9E1F6D.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:block;float:none;margin-left:auto;border-top:0px;margin-right:auto;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_0863D638.png" width="337" height="177" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;If you have added Cache as role project, you should select “dedicated role”. In this case Windows Azure will during deployment process allocate Virtual Machine (or more if you have selected more than one instance) and install Distributed Cache Service on it (them). If you don’t want to have dedicated machine for cache then go to properties of you WebRole and select Co-located Role, Windows Azure will in this case install distributed cash service on the same machine where you web role is running. In this case you even don’t need Worker Cache Role as project.&amp;#160; But you can have it. It might be that you are doing lot of caching and from architecture point of view this might also be a valid solution. I means you have Worker Cache Role as dedicated cache and you also have co-located cache at the WebRole. Physically you would by deployment allocate two different caches with number of chosen instances for each of them.&lt;/p&gt;  &lt;p&gt;If you ever worked with Windows Server AppFabric (WSA) similar version of cache will be installed in the slightly different version of cache. In contract to WSA the new one is called simply &lt;em&gt;&lt;strong&gt;CacheService&lt;/strong&gt;&lt;/em&gt;. Remember, WSA cache service is called “&lt;em&gt;&lt;strong&gt;AppFabricCachingService&lt;/strong&gt;&lt;/em&gt;”. Following pictures shows task manager of the WinAzure machine which host cache as dedicated role.     &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_1A406A05.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;float:left;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" align="left" src="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_39EF43CD.png" width="367" height="287" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160; &lt;a href="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_40A24D50.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_67706390.png" width="416" height="137" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;I captured pictures by connecting to dedicated worker cache role (if Dedicated Role is used) and by connecting to WebRole (if Co-Located cache has been used).   &lt;br /&gt;If the WebRole don’t specify the cache processes and services shown above will not be installed on the machine.    &lt;br /&gt;Co-located cache-role would be configured as shown at the next picture.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_60512718.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_14F18354.png" width="711" height="355" /&gt;&lt;/a&gt;    &lt;br /&gt;    &lt;br /&gt;In the picture above is also shown how to add additional caches to the cache instance. remember, this has not been possible by using Windows Azure Cache in version 1.6.    &lt;br /&gt;    &lt;br /&gt;Note that emulator of cache is also provided. The cache is emulated by the cache service emulator. In the picture below, I captured emulator for two cache instances.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_3B226D0E.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_56C6F904.png" width="655" height="178" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;Last, but not least the cache instance provisioned here (v1.7) is different one than cache instance v1.6 known as Windows Azure AppFabric Cache, which is shown at the picture below:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_1485505F.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:block;float:none;margin-left:auto;border-top:0px;margin-right:auto;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_78749173.png" width="177" height="135" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h3&gt;Installing cache Client components&lt;/h3&gt;  &lt;p&gt;After that you have created the solution you will have to install Windows Azure Caching (currently in preview.) libraries by using NuGet. Note that value “Include Prereleases“ (see picture below) is selected in the combo. Otherwise you will find the NuGet package Windows Azure Caching (almost the same name), which is related to version 1.6. That one will not work in this scenario.&amp;#160; Even better to say, this one will work, but you will have to use Windows Azure AppFabric cache, which is not the same as Windows Azure Cache Role, which we will focus in this article. Following picture shows what and how to&amp;#160; install by NuGet.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_1F42A7B4.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_53E303EF.png" width="861" height="258" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;After the package has been successfully installed following references are added to project.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_45A48AFF.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:block;float:none;margin-left:auto;border-top:0px;margin-right:auto;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_056E7185.png" width="338" height="266" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Additionally the package inserts following section in the configuration file. This section looks slightly different that the common caching section.   &lt;br /&gt;The identifier specified in &lt;u&gt;dataCacheClient&lt;/u&gt; element is the name of the role which hosts physically distributed cache. For example following configuration will setup using of dedicated cache deployed by the Worker Cache Role.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_174B0552.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;float:left;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" align="left" src="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_5714EBD7.png" width="642" height="114" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;If you rather used the Co-located cache in your WebRole (no Worker Cache Role used) then only identifier has to be changed to the name of the WebRole instead of dedicated cache role as shown below:   &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_2BD054D0.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;float:left;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" align="left" src="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_6B9A3B55.png" width="576" height="113" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;In the MVC (WebRole) application I defined two actions PutCacheValue and GetCacheValue. Please note in picture below that output-cache has been disabled. This is very important, because output-caching (which is feature of ASP.NET) would prevent the system to work properly.   &lt;br /&gt;    &lt;br /&gt;&lt;a href="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_2B6421DB.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_0429D8A6.png" width="665" height="353" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The JavaScript functions which puts value in the cache and gets it out look like:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_71E111E3.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_31AAF869.png" width="640" height="378" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;At the end the sample application looks like:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_43878C36.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_1C4D4301.png" width="642" height="339" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;More about Caching: &lt;a title="https://www.windowsazure.com/en-us/develop/net/how-to-guides/cache/" href="https://www.windowsazure.com/en-us/develop/net/how-to-guides/cache/"&gt;https://www.windowsazure.com/en-us/develop/net/how-to-guides/cache/&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=314226" width="1" height="1"&gt;</description><category domain="http://developers.de/blogs/damir_dobric/archive/tags/WCF/default.aspx">WCF</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/cloud/default.aspx">cloud</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/AppFabric/default.aspx">AppFabric</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/windows+azure/default.aspx">windows azure</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/jQuery/default.aspx">jQuery</category></item><item><title>Knockout out of stack space</title><link />http://developers.de/blogs/damir_dobric/archive/2012/06/13/knockout-out-of-stack-space.aspx<pubdate>Wed, 13 Jun 2012 12:14:15 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:311208</guid><dc:creator>Damir Dobric</dc:creator><slash:comments>0</slash:comments><wfw:commentrss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://developers.de/blogs/damir_dobric/rsscomments.aspx?PostID=311208</wfw:commentrss><comments>http://developers.de/blogs/damir_dobric/archive/2012/06/13/knockout-out-of-stack-space.aspx#comments</comments><description>&lt;p&gt;When working with knockout and drop-down lists (combo-boxes) you might get following error.&lt;/p&gt;  &lt;p&gt;SCRIPT28: Out of stack space    &lt;br /&gt;jquery-1.7.2.min.js, line 2 character 22680&lt;/p&gt;  &lt;p&gt;This seems to be knockout framework bug or it is by design. Whatever the case is, the issue can be described as follows. Assume, you have a model like this one:&lt;/p&gt;  &lt;p&gt;{   &lt;br /&gt; &amp;quot;MyPropertyOk&amp;quot;: null,    &lt;br /&gt;&amp;#160; &amp;quot;MyPropertyBad&amp;quot;: ko.observable(“”)    &lt;br /&gt;}&lt;/p&gt;  &lt;p&gt;Usually, you need to define all properties as observable. To demonstrate this issue, I have two properties. First one is not observable (MyPropertyOK) and second one is observable (MyPropertyBad).   &lt;br /&gt;    &lt;br /&gt;To bind them I used two combo boxes:&lt;/p&gt;  &lt;p&gt;&amp;lt;select&amp;#160; id=&amp;quot;comboOk&amp;quot; data-bind=&amp;quot;value: MyPropertyOk&amp;quot;&amp;gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;option value=&amp;quot;1&amp;quot;&amp;gt;Jedan&amp;lt;/option&amp;gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;option value=&amp;quot;2&amp;quot;&amp;gt;Dva&amp;lt;/option&amp;gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;option value=&amp;quot;3&amp;quot;&amp;gt;Tri&amp;lt;/option&amp;gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;option value=&amp;quot;4&amp;quot;&amp;gt;Cetiri&amp;lt;/option&amp;gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/select&amp;gt;    &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;&amp;lt;select id=&amp;quot;comboBad&amp;quot; data-bind=&amp;quot;value: MyPropertyBad&amp;quot;&amp;gt;    &lt;br /&gt;    &lt;br /&gt;&amp;lt;option value=&amp;quot;1&amp;quot;&amp;gt;Jedan&amp;lt;/option&amp;gt;    &lt;br /&gt;&amp;lt;option value=&amp;quot;2&amp;quot;&amp;gt;Dva&amp;lt;/option&amp;gt;    &lt;br /&gt;&amp;lt;option value=&amp;quot;3&amp;quot;&amp;gt;Tri&amp;lt;/option&amp;gt;    &lt;br /&gt;&amp;lt;option value=&amp;quot;4&amp;quot;&amp;gt;Cetiri&amp;lt;/option&amp;gt;    &lt;br /&gt;&amp;lt;/select&amp;gt;    &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;If you start this code, the error shown above will be thrown. The error is caused by MyPropertyBad. To make this working, you model has to look like:   &lt;br /&gt;&lt;/p&gt; {  &lt;br /&gt;&amp;quot;MyPropertyOk&amp;quot;: null,  &lt;br /&gt;&amp;quot;MyPropertyBad&amp;quot;: null  &lt;br /&gt;}  &lt;p&gt;Hope this will save a bit of your time. &lt;img style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/wlEmoticon_2D00_smile_5F00_354A186D.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=311208" width="1" height="1"&gt;</description><category domain="http://developers.de/blogs/damir_dobric/archive/tags/knockout/default.aspx">knockout</category><category domain="http://developers.de/blogs/damir_dobric/archive/tags/jQuery/default.aspx">jQuery</category></item></channel></rss>