<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-27381059098267211</id><updated>2025-05-12T22:08:46.228+01:00</updated><category term="scripting"/><category term="cisco"/><category term="Apple"/><category term="python"/><category term="error"/><category term="jabber"/><category term="wcf"/><category term="iOS"/><category term="silverlight"/><category term="linux"/><category term="powershell"/><category term="c#"/><category term="mac"/><category term="visio"/><category term=".net"/><category term="database"/><category term="linq"/><category term="raspberry pi"/><category term="arduino"/><category term="asp.net"/><category term="ef"/><category term="javascript"/><category term="node.js"/><category term="siri"/><category term="spark"/><category term="xml"/><category term="3d"/><category term="apple tv"/><category term="blender"/><category term="cg"/><category term="d3.js"/><category term="design"/><category term="google"/><category term="hue"/><category term="ifttt"/><category term="mqtt"/><category term="php"/><category term="ruby"/><category term="sqlite"/><category term="unityconnection"/><category term="webmatrix"/><title type='text'>Parky&#39;s Place</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://blog.darrenparkinson.uk/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://blog.darrenparkinson.uk/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Darren Parkinson</name><uri>http://www.blogger.com/profile/01084077294541066454</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>67</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-27381059098267211.post-2935277725700769063</id><published>2016-06-01T09:01:00.000+01:00</published><updated>2016-06-01T09:02:09.565+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="cisco"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="node.js"/><category scheme="http://www.blogger.com/atom/ns#" term="raspberry pi"/><category scheme="http://www.blogger.com/atom/ns#" term="spark"/><title type='text'>Adding Face Recognition to my Doorbell</title><content type='html'>&lt;br /&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
Why?&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
First things first, why is my doorbell internet connected? There are various reasons, but to cut a long story long, when my front door was replaced, the wires to the original 1960s mechanical door chime were lost forever, which was a shame because it sounds much nicer than any modern wireless door chime you can buy. To rectify this, I bought a new wireless chime and hooked it up to a raspberry pi so that when the button is pressed, the old chime goes off instead of the nasty new one. I’m half way through a post about that which I’ve never quite got around to finishing.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
As a result, I get a notification in my home automation&amp;nbsp;&lt;a href=&quot;http://www.ciscospark.com/&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;Cisco Spark&lt;/a&gt;&amp;nbsp;room whenever the doorbell is pressed. On it’s own, that’s not very useful. I have been thinking of hooking that up to a camera so that I can take a photo at the time the button is pressed and send that to the room too. At least then I’d know who it was. Clearly this is a much longer term project, since ultimately I’d hook up a two way voice/video call (potentially via Spark) so that I could speak to the person at the door and maybe unlock the garage for them to leave a parcel or whatever. There is a long way to go before I get there (given the number of usable bank holidays we get a year) and this post is one step on that journey.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
Secondly then, why do I want to add face recognition?&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
One reason could be that it appears I have become slightly obsessed with ‘AI’ type services, but that’s not really it.&lt;br /&gt;
&lt;br /&gt;
Whilst getting a picture of the visitor in the room is in the right direction, it means that every time the doorbell is pressed (although to be clear, we don’t get that many visitors), I have to check the Spark room for the photo to see who it is. I happen to have a Garmin activity tracker which takes notifications from my iPhone but does not show photos, so it would be useful to get a text notification of who the person is so I can quickly make a decision about my next action (i.e. look at the photo of an unknown visitor, call the police, open the door for a parcel, etc.), or perhaps even take that action automatically. It also means I don&#39;t have to take my giant phone out of my pocket to see who it is. &amp;nbsp;Again, we’re a way off yet, but one step at a time.&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
For now, the idea would be to go from this which I get today:&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWZQ0YxmWVmUcL5sx87aYxSAJQVNBKEi6d-fieYXV4ekjtU8uiggxv1A5kWjVN7p27bE8LH3njbTkh4y3PF4GLF8cuSc6Xp1T_haXRHQXrf8HM0mJ5PteFvZF4orAFCAldxgl8PvRmOP8/s1600/2016-06-DoorbellPressed.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;145&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWZQ0YxmWVmUcL5sx87aYxSAJQVNBKEi6d-fieYXV4ekjtU8uiggxv1A5kWjVN7p27bE8LH3njbTkh4y3PF4GLF8cuSc6Xp1T_haXRHQXrf8HM0mJ5PteFvZF4orAFCAldxgl8PvRmOP8/s400/2016-06-DoorbellPressed.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
to this:&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVQPXKH2ChN4IJTgEZp1ZpcTnpgb-tKnRAoRItaRQeR3HPI56V98ukkcB82Xs3_mlXsThhr1MzAK63a-A5id6aoW1xnWhFfHmPfE4hO_eeyL5dM8UqHVy5joFRlqbIIjhUWwSCWBt2mPM/s1600/2016-06-PostmanRang.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;148&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVQPXKH2ChN4IJTgEZp1ZpcTnpgb-tKnRAoRItaRQeR3HPI56V98ukkcB82Xs3_mlXsThhr1MzAK63a-A5id6aoW1xnWhFfHmPfE4hO_eeyL5dM8UqHVy5joFRlqbIIjhUWwSCWBt2mPM/s400/2016-06-PostmanRang.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
At this point, the assumption is that the doorbell is all up and running and capable of taking photos which can then be sent to a Spark Room and also to a service for face recognition. Whilst I was looking into natural language recognition for&amp;nbsp;&lt;a href=&quot;http://blog.darrenparkinson.uk/2016/05/adding-natural-language-to-my-cisco.html&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;my last post&lt;/a&gt;, I discovered the&amp;nbsp;&lt;a href=&quot;https://www.microsoft.com/cognitive-services/en-us/face-api&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;Microsoft Cognitive Services Face API&lt;/a&gt;, so I thought I would take a look at that for this project.&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
In order to use the Face API to achieve face recognition, we have to create a group of people that we want to use as part of the recognition.&lt;br /&gt;
&lt;br /&gt;
In my case this would be regular visitors. For the purposes of this post (since I’ve recently seen Captain America Civil War), I’ll be using Avengers.&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
To create the group, there are various steps:&lt;/div&gt;
&lt;ol style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px; margin-top: 0px; padding: 0px 0px 0px 2em;&quot;&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;Get a Subscription Key&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;Create a Person Group&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;Create one or more Persons (belonging to the Person Group)&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;Add one or more Person Faces to the person&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;Train the Person Group (to use the Person Face information for recognition)&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
Once these steps are complete we can then get to the task of Face Identification.&lt;/div&gt;
&lt;h3 id=&quot;preparingforfaceidentification&quot; style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 1.5em; line-height: 1.43; margin-bottom: 16px; margin-top: 1em; position: relative;&quot;&gt;
Preparing for Face Identification&lt;/h3&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
First of all you will need a Subscription Key. To get this, go to the&amp;nbsp;&lt;a href=&quot;https://www.microsoft.com/cognitive-services&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;Microsoft Cognitive Services Page&lt;/a&gt;&amp;nbsp;and select “Get Started For Free”. Sign in with your Microsoft account and select the “Face-Preview” subscription. After subscribing you get access to a key that will provide for up to 30,000 transactions per month, 20 per minute for free – that seems like enough.&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
Once we have the key, we then need to create a Person Group. The simplest way to do this is via the&amp;nbsp;&lt;a href=&quot;https://dev.projectoxford.ai/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;API Reference&lt;/a&gt;&amp;nbsp;documentation using the “API Testing Console”. Simply fill in a name for the&amp;nbsp;&lt;code style=&quot;background-color: rgba(0, 0, 0, 0.0392157); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; margin: 0px; padding: 0.2em 0px;&quot;&gt;personGroupId&lt;/code&gt;, paste your key into the&amp;nbsp;&lt;code style=&quot;background-color: rgba(0, 0, 0, 0.0392157); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; margin: 0px; padding: 0.2em 0px;&quot;&gt;Ocp-Apim-Subscription-Key&lt;/code&gt;&amp;nbsp;box and fill in the&amp;nbsp;&lt;code style=&quot;background-color: rgba(0, 0, 0, 0.0392157); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; margin: 0px; padding: 0.2em 0px;&quot;&gt;name&lt;/code&gt;&amp;nbsp;and&amp;nbsp;&lt;code style=&quot;background-color: rgba(0, 0, 0, 0.0392157); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; margin: 0px; padding: 0.2em 0px;&quot;&gt;userData&lt;/code&gt;&amp;nbsp;fields in the JSON body (seen in the following screenshot), before hitting&amp;nbsp;&lt;code style=&quot;background-color: rgba(0, 0, 0, 0.0392157); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; margin: 0px; padding: 0.2em 0px;&quot;&gt;Send&lt;/code&gt;:&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWLeYjYEUz683ZLy2FtusjV0iNG4xfLiYrxrmJ4_oHSsXQW8HsMnC3YIQrLbfVdR-XEUYxY7sH9N2ORts0h0mkeOOBQtYJBAXTQNfvuUr32HzkKm1k1eUbqH0k2vIDRoCKyu36opN5xDk/s1600/2016-06-PersonGroup.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;491&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWLeYjYEUz683ZLy2FtusjV0iNG4xfLiYrxrmJ4_oHSsXQW8HsMnC3YIQrLbfVdR-XEUYxY7sH9N2ORts0h0mkeOOBQtYJBAXTQNfvuUr32HzkKm1k1eUbqH0k2vIDRoCKyu36opN5xDk/s640/2016-06-PersonGroup.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
Once we’ve done that, we can begin adding people to the group. Again, for a small number, the easiest way is via the API Testing Console on the&amp;nbsp;&lt;a href=&quot;https://dev.projectoxford.ai/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523c&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;Create a Person&lt;/a&gt;page. For this page, fill in the&amp;nbsp;&lt;code style=&quot;background-color: rgba(0, 0, 0, 0.0392157); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; margin: 0px; padding: 0.2em 0px;&quot;&gt;personGroupId&lt;/code&gt;&amp;nbsp;from the previous step, in our case&amp;nbsp;&lt;code style=&quot;background-color: rgba(0, 0, 0, 0.0392157); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; margin: 0px; padding: 0.2em 0px;&quot;&gt;superheroes&lt;/code&gt;, then paste in the relevant values for&amp;nbsp;&lt;code style=&quot;background-color: rgba(0, 0, 0, 0.0392157); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; margin: 0px; padding: 0.2em 0px;&quot;&gt;name&lt;/code&gt;&amp;nbsp;and&amp;nbsp;&lt;code style=&quot;background-color: rgba(0, 0, 0, 0.0392157); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; margin: 0px; padding: 0.2em 0px;&quot;&gt;userData&lt;/code&gt;&amp;nbsp;in the JSON body before pressing&amp;nbsp;&lt;code style=&quot;background-color: rgba(0, 0, 0, 0.0392157); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; margin: 0px; padding: 0.2em 0px;&quot;&gt;Send&lt;/code&gt;. Make a note of the “personId” you get back in the response (we could get this via the List Persons in a Person Group later if necessary).&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrRoii6bkrIzvW0Sa87tksoUVkoz9R7cbobS-_dRpOILjHPN5y6TuBA1TwACHtDJbXZwqDLYd2kcyZm7C2ISpfCL-FqiQqmQAannrcaQBNQfdz5pxvV6MBJCMFcTnabVLqXD9bpoM9XKI/s1600/2016-06-CreatePerson.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;496&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrRoii6bkrIzvW0Sa87tksoUVkoz9R7cbobS-_dRpOILjHPN5y6TuBA1TwACHtDJbXZwqDLYd2kcyZm7C2ISpfCL-FqiQqmQAannrcaQBNQfdz5pxvV6MBJCMFcTnabVLqXD9bpoM9XKI/s640/2016-06-CreatePerson.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
Now we’ve added all the super heroes we want to recognise, we just need to add faces to them so the system has something to recognise by. Clearly as with most of these things, the more faces you add for a person, the more likley it is to provide accurate recognition. You could do this via the API Testing Console for&amp;nbsp;&lt;a href=&quot;https://dev.projectoxford.ai/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523b/&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;Add a Person Face&lt;/a&gt;, but it would be quite laborious since we have to provide a URL for the photo and a&amp;nbsp;&lt;code style=&quot;background-color: rgba(0, 0, 0, 0.0392157); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; margin: 0px; padding: 0.2em 0px;&quot;&gt;targetFace&lt;/code&gt;&amp;nbsp;which is a set of coordinates for the face rectangle which you can get from the&amp;nbsp;&lt;a href=&quot;https://dev.projectoxford.ai/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;Face - Detect&lt;/a&gt;&amp;nbsp;API call.&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
I want to use locally held photos (rather than a URL) and I don’t want to manually enter the rectangles each time, so for this we’ll create a quick and dirty&amp;nbsp;&lt;a href=&quot;https://nodejs.org/en/&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;node&lt;/a&gt;&amp;nbsp;script to programmatically use the Face-Detect API to get the rectangle and then use that along with the photo to add to the person.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
The photos I have are in the same directory as the script:&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUJU3tQzybod-EJS5hMRQHgR3RNHHYVME3whhMXeW14rjnFWymq7CEGOaobGlAB3DC2MKkuL8acRVK6NrgqbZVmY2gzo5Ay7qgG_R3Y_KH-dHIaex3WFimGT09c4cQr9i2uWH4c7WtZzQ/s1600/2016-06-Faces1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;236&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUJU3tQzybod-EJS5hMRQHgR3RNHHYVME3whhMXeW14rjnFWymq7CEGOaobGlAB3DC2MKkuL8acRVK6NrgqbZVmY2gzo5Ay7qgG_R3Y_KH-dHIaex3WFimGT09c4cQr9i2uWH4c7WtZzQ/s640/2016-06-Faces1.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
&lt;em style=&quot;box-sizing: border-box;&quot;&gt;Just a note, I got these images using the ‘Labeled for noncommercial reuse’ search on google images.&lt;/em&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
The code to upload these photos along with their rectangles is as follows:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; height: 1726px; line-height: 1.45; margin-bottom: 16px; overflow: auto; padding: 16px; tab-size: 4; word-wrap: normal;&quot;&gt;&lt;code class=&quot;hljs coffeescript&quot; style=&quot;border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; box-sizing: border-box; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; height: auto; line-height: inherit; margin: 0px; padding: 0.5em; word-wrap: normal;&quot;&gt;const https = &lt;span class=&quot;hljs-built_in&quot; style=&quot;box-sizing: border-box; color: #0086b3;&quot;&gt;require&lt;/span&gt;(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;https&#39;&lt;/span&gt;);
const fs = &lt;span class=&quot;hljs-built_in&quot; style=&quot;box-sizing: border-box; color: #0086b3;&quot;&gt;require&lt;/span&gt;(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;fs&#39;&lt;/span&gt;);

const subscriptionKey = &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;your key here&#39;&lt;/span&gt;;

const superHeroPersonIds = {
    &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;antMan&#39;&lt;/span&gt;:&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;your person id for antMan here&#39;&lt;/span&gt;,
    &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;captainAmerica&#39;&lt;/span&gt;: &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;your person id for captain america here&#39;&lt;/span&gt;,
    &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;ironMan&#39;&lt;/span&gt;: &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;your person id for ironman here&#39;&lt;/span&gt;
}

addPhotoToHeroes(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;./robert_downey_jr.jpg&#39;&lt;/span&gt;, superHeroPersonIds.ironMan);
addPhotoToHeroes(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;./paul_rudd.jpg&#39;&lt;/span&gt;, superHeroPersonIds.antMan);
addPhotoToHeroes(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;./chris_evans.jpg&#39;&lt;/span&gt;, superHeroPersonIds.captainAmerica);

function addPhotoToHeroes(photoFile, personId) {
    
  const options = {
        &lt;span class=&quot;hljs-attribute&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;hostname&lt;/span&gt;: &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;api.projectoxford.ai&#39;&lt;/span&gt;,
        &lt;span class=&quot;hljs-attribute&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;method&lt;/span&gt;: &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;POST&#39;&lt;/span&gt;,
        &lt;span class=&quot;hljs-attribute&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;path&lt;/span&gt;: &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;/face/v1.0/detect?returnFaceId=false&amp;amp;returnFaceLandmarks=false&amp;amp;returnFaceAttributes=age,gender,facialHair,glasses&#39;&lt;/span&gt;,
        &lt;span class=&quot;hljs-attribute&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;headers&lt;/span&gt;: {
                &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;Content-Type&#39;&lt;/span&gt;: &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;application/octet-stream&#39;&lt;/span&gt;,
                &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;Ocp-Apim-Subscription-Key&#39;&lt;/span&gt;:subscriptionKey
        }
   };
  var responseData = &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;&#39;&lt;/span&gt;;
  var req = https.request(options, &lt;span class=&quot;hljs-function&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span class=&quot;hljs-params&quot; style=&quot;box-sizing: border-box; color: #990000; font-weight: bold;&quot;&gt;(res)&lt;/span&gt; =&amp;gt;&lt;/span&gt; {
    res.&lt;span class=&quot;hljs-literal&quot; style=&quot;box-sizing: border-box;&quot;&gt;on&lt;/span&gt;(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;data&#39;&lt;/span&gt;, &lt;span class=&quot;hljs-function&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span class=&quot;hljs-params&quot; style=&quot;box-sizing: border-box; color: #990000; font-weight: bold;&quot;&gt;(d)&lt;/span&gt; =&amp;gt;&lt;/span&gt; {
      responseData += d;
    });
    res.&lt;span class=&quot;hljs-literal&quot; style=&quot;box-sizing: border-box;&quot;&gt;on&lt;/span&gt;(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;end&#39;&lt;/span&gt;, &lt;span class=&quot;hljs-function&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span class=&quot;hljs-params&quot; style=&quot;box-sizing: border-box; color: #990000; font-weight: bold;&quot;&gt;()&lt;/span&gt; =&amp;gt;&lt;/span&gt; {
      var people = JSON.parse(responseData);
      addTargetFaceToHeroes(photoFile, &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;superheroes&#39;&lt;/span&gt;, personId, people[&lt;span class=&quot;hljs-number&quot; style=&quot;box-sizing: border-box; color: #009999;&quot;&gt;0&lt;/span&gt;].faceRectangle);
    })
  });

  req.&lt;span class=&quot;hljs-literal&quot; style=&quot;box-sizing: border-box;&quot;&gt;on&lt;/span&gt;(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;error&#39;&lt;/span&gt;, &lt;span class=&quot;hljs-function&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span class=&quot;hljs-params&quot; style=&quot;box-sizing: border-box; color: #990000; font-weight: bold;&quot;&gt;(e)&lt;/span&gt; =&amp;gt;&lt;/span&gt; {
    &lt;span class=&quot;hljs-built_in&quot; style=&quot;box-sizing: border-box; color: #0086b3;&quot;&gt;console&lt;/span&gt;.log(`&lt;span class=&quot;javascript&quot; style=&quot;box-sizing: border-box;&quot;&gt;problem &lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;with&lt;/span&gt; request: ${e.message}&lt;/span&gt;`);
  });

  fs.readFile(photoFile, &lt;span class=&quot;hljs-function&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span class=&quot;hljs-params&quot; style=&quot;box-sizing: border-box; color: #990000; font-weight: bold;&quot;&gt;(err,data)&lt;/span&gt; =&amp;gt;&lt;/span&gt; {
    &lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;if&lt;/span&gt; (err) &lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;throw&lt;/span&gt; err;
    req.end(data);
  }); 

}

function addTargetFaceToHeroes(photoFile, groupId, personId, targetFaceRectangle) {
    
    &lt;span class=&quot;hljs-regexp&quot; style=&quot;box-sizing: border-box; color: #009926;&quot;&gt;//&lt;/span&gt; &lt;span class=&quot;hljs-attribute&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;https&lt;/span&gt;:&lt;span class=&quot;hljs-regexp&quot; style=&quot;box-sizing: border-box; color: #009926;&quot;&gt;//&lt;/span&gt;api.projectoxford.ai&lt;span class=&quot;hljs-regexp&quot; style=&quot;box-sizing: border-box; color: #009926;&quot;&gt;/face/v1.0/persongroups/&lt;/span&gt;{personGroupId}&lt;span class=&quot;hljs-regexp&quot; style=&quot;box-sizing: border-box; color: #009926;&quot;&gt;/persons/&lt;/span&gt;{personId}/persistedFaces[?userData][&amp;amp;targetFace]
    
    &lt;span class=&quot;hljs-regexp&quot; style=&quot;box-sizing: border-box; color: #009926;&quot;&gt;//&lt;/span&gt; rectangle needs to be left, top, width, height
    var rectangle = `&lt;span class=&quot;javascript&quot; style=&quot;box-sizing: border-box;&quot;&gt;${targetFaceRectangle.left},${targetFaceRectangle.top},${targetFaceRectangle.width},${targetFaceRectangle.height}&lt;/span&gt;`;
    
    const options = {
        &lt;span class=&quot;hljs-attribute&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;hostname&lt;/span&gt;: &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;api.projectoxford.ai&#39;&lt;/span&gt;,
        &lt;span class=&quot;hljs-attribute&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;method&lt;/span&gt;: &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;POST&#39;&lt;/span&gt;,
        &lt;span class=&quot;hljs-attribute&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;path&lt;/span&gt;: &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;/face/v1.0/persongroups/&#39;&lt;/span&gt; + groupId + &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;/persons/&#39;&lt;/span&gt; + personId + &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;/persistedFaces?targetFace=&#39;&lt;/span&gt; + rectangle,
        &lt;span class=&quot;hljs-attribute&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;headers&lt;/span&gt;: {
                &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;Content-Type&#39;&lt;/span&gt;: &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;application/octet-stream&#39;&lt;/span&gt;,
                &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;Ocp-Apim-Subscription-Key&#39;&lt;/span&gt;:subscriptionKey
        }
   };
  var responseData = &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;&#39;&lt;/span&gt;;
  var req = https.request(options, &lt;span class=&quot;hljs-function&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span class=&quot;hljs-params&quot; style=&quot;box-sizing: border-box; color: #990000; font-weight: bold;&quot;&gt;(res)&lt;/span&gt; =&amp;gt;&lt;/span&gt; {
    res.&lt;span class=&quot;hljs-literal&quot; style=&quot;box-sizing: border-box;&quot;&gt;on&lt;/span&gt;(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;data&#39;&lt;/span&gt;, &lt;span class=&quot;hljs-function&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span class=&quot;hljs-params&quot; style=&quot;box-sizing: border-box; color: #990000; font-weight: bold;&quot;&gt;(d)&lt;/span&gt; =&amp;gt;&lt;/span&gt; {
      responseData += d;
    });
    res.&lt;span class=&quot;hljs-literal&quot; style=&quot;box-sizing: border-box;&quot;&gt;on&lt;/span&gt;(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;end&#39;&lt;/span&gt;, &lt;span class=&quot;hljs-function&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span class=&quot;hljs-params&quot; style=&quot;box-sizing: border-box; color: #990000; font-weight: bold;&quot;&gt;()&lt;/span&gt; =&amp;gt;&lt;/span&gt; {
      &lt;span class=&quot;hljs-built_in&quot; style=&quot;box-sizing: border-box; color: #0086b3;&quot;&gt;console&lt;/span&gt;.log(responseData);
    })
  });

  req.&lt;span class=&quot;hljs-literal&quot; style=&quot;box-sizing: border-box;&quot;&gt;on&lt;/span&gt;(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;error&#39;&lt;/span&gt;, &lt;span class=&quot;hljs-function&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span class=&quot;hljs-params&quot; style=&quot;box-sizing: border-box; color: #990000; font-weight: bold;&quot;&gt;(e)&lt;/span&gt; =&amp;gt;&lt;/span&gt; {
    &lt;span class=&quot;hljs-built_in&quot; style=&quot;box-sizing: border-box; color: #0086b3;&quot;&gt;console&lt;/span&gt;.log(`&lt;span class=&quot;javascript&quot; style=&quot;box-sizing: border-box;&quot;&gt;problem &lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;with&lt;/span&gt; request: ${e.message}&lt;/span&gt;`);
  });

  fs.readFile(photoFile, &lt;span class=&quot;hljs-function&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span class=&quot;hljs-params&quot; style=&quot;box-sizing: border-box; color: #990000; font-weight: bold;&quot;&gt;(err,data)&lt;/span&gt; =&amp;gt;&lt;/span&gt; {
    &lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;if&lt;/span&gt; (err) &lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;throw&lt;/span&gt; err;
    req.end(data);
  }); 
    
}
&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
This will give you ‘persistedFaceIds’ for each Person. To check, we can go to&amp;nbsp;&lt;a href=&quot;https://dev.projectoxford.ai/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395241&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;Person - List Persons in a Person Group&lt;/a&gt;&amp;nbsp;to see them.&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2AnhKLHktUjl3lC89VJNlvDB3yhhBGHBqmA5EMwBrqo9MY_U6nRBhPJKRg1fu2X7_Nl10oG8iv5xsBYCMuLEj3wFsNe1AUDVDhdRfnA4ks5Tx5kK9L43Nlt4Wv4ci1mnI1KDu-vDl6Gc/s1600/2016-06-ListPersons.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2AnhKLHktUjl3lC89VJNlvDB3yhhBGHBqmA5EMwBrqo9MY_U6nRBhPJKRg1fu2X7_Nl10oG8iv5xsBYCMuLEj3wFsNe1AUDVDhdRfnA4ks5Tx5kK9L43Nlt4Wv4ci1mnI1KDu-vDl6Gc/s640/2016-06-ListPersons.png&quot; width=&quot;608&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;freesans&amp;quot; , &amp;quot;clean&amp;quot; , sans-serif; font-size: 16px;&quot;&gt;Finally, we can train the system using the&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://dev.projectoxford.ai/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395249&quot; style=&quot;box-sizing: border-box; color: #4183c4; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; text-decoration: none;&quot;&gt;Person Group - Train Person Group&lt;/a&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;freesans&amp;quot; , &amp;quot;clean&amp;quot; , sans-serif; font-size: 16px;&quot;&gt;&amp;nbsp;API call, again via the API console.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;freesans&amp;quot; , &amp;quot;clean&amp;quot; , sans-serif; font-size: 16px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;freesans&amp;quot; , &amp;quot;clean&amp;quot; , sans-serif; font-size: 16px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEik_mYhWunIdwEijqSWGo0MVDsESA1nyMcb7MU7X6wCERGuzhyphenhypheniafU7f2xmjeUeNQv9vcQrgLw2OOs2NWHdXpiMU4ytj3aG7bBsrrGjd0frMOR1rpQNw35tgBice4MUCtbyzZ8D40ghimk/s1600/2016-06-Train.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;324&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEik_mYhWunIdwEijqSWGo0MVDsESA1nyMcb7MU7X6wCERGuzhyphenhypheniafU7f2xmjeUeNQv9vcQrgLw2OOs2NWHdXpiMU4ytj3aG7bBsrrGjd0frMOR1rpQNw35tgBice4MUCtbyzZ8D40ghimk/s640/2016-06-Train.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;freesans&amp;quot; , &amp;quot;clean&amp;quot; , sans-serif; font-size: 16px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333;&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;box-sizing: border-box; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
If we check the status of the Train request to ensure it’s finished, using the&amp;nbsp;&lt;a href=&quot;https://dev.projectoxford.ai/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395247/&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;Person Group - Get Person Group Training Status&lt;/a&gt;&amp;nbsp;we can then proceed to the task at hand, namely Face Identification.&lt;/div&gt;
&lt;div style=&quot;box-sizing: border-box; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 id=&quot;faceidentification&quot; style=&quot;box-sizing: border-box; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 1.5em; line-height: 1.43; margin-bottom: 16px; margin-top: 1em; position: relative;&quot;&gt;
Face Identification&lt;/h3&gt;
&lt;div style=&quot;box-sizing: border-box; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
Once we’ve created our group of people and faces and trained the system, we can quite easily pass a photo to the service for facial recognition using the&amp;nbsp;&lt;a href=&quot;https://dev.projectoxford.ai/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;Face - Identify&lt;/a&gt;&amp;nbsp;call. You basically send a photo along with the group you’d like to compare it against and the response will be a match and a confidence score. The only challenge is that instead of a photo, you have to send a faceId for the photo which we get from the Face - Detect call.&lt;/div&gt;
&lt;div style=&quot;box-sizing: border-box; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
Again, I’ll use a quick and dirty node script to test, since ultimately we’ll be wanting to do this in code anyway.&lt;/div&gt;
&lt;div style=&quot;box-sizing: border-box; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
First of all I’ll test with the actual photos I used, then I’ll get some others to see how well it works.&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; height: 1906px; line-height: 1.45; margin-bottom: 16px; overflow: auto; padding: 16px; tab-size: 4; word-wrap: normal;&quot;&gt;&lt;code class=&quot;javascript hljs&quot; style=&quot;border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; box-sizing: border-box; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; height: auto; line-height: inherit; margin: 0px; padding: 0.5em; word-wrap: normal;&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;const&lt;/span&gt; https = &lt;span class=&quot;hljs-built_in&quot; style=&quot;box-sizing: border-box; color: #0086b3;&quot;&gt;require&lt;/span&gt;(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;https&#39;&lt;/span&gt;);
&lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;const&lt;/span&gt; fs = &lt;span class=&quot;hljs-built_in&quot; style=&quot;box-sizing: border-box; color: #0086b3;&quot;&gt;require&lt;/span&gt;(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;fs&#39;&lt;/span&gt;);

&lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;const&lt;/span&gt; subscriptionKey = &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;your subscription key here&#39;&lt;/span&gt;;

identifyPerson(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;superheroes&#39;&lt;/span&gt;, &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;./paul_rudd.jpg&#39;&lt;/span&gt;);
identifyPerson(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;superheroes&#39;&lt;/span&gt;, &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;./robert_downey_jr.jpg&#39;&lt;/span&gt;);
identifyPerson(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;superheroes&#39;&lt;/span&gt;, &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;./chris_evans.jpg&#39;&lt;/span&gt;);

&lt;span class=&quot;hljs-function&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;hljs-title&quot; style=&quot;box-sizing: border-box;&quot;&gt;identifyPerson&lt;/span&gt;(&lt;span class=&quot;hljs-params&quot; style=&quot;box-sizing: border-box;&quot;&gt;groupId, photoFile&lt;/span&gt;) &lt;/span&gt;{
    &lt;span class=&quot;hljs-comment&quot; style=&quot;box-sizing: border-box; color: #999988; font-style: italic;&quot;&gt;// https://api.projectoxford.ai/face/v1.0/identify  &lt;/span&gt;

    &lt;span class=&quot;hljs-comment&quot; style=&quot;box-sizing: border-box; color: #999988; font-style: italic;&quot;&gt;// First get the face IDs we can pass to identify&lt;/span&gt;
    getFaceIdsForPhoto(photoFile, faceIds =&amp;gt; {
        &lt;span class=&quot;hljs-comment&quot; style=&quot;box-sizing: border-box; color: #999988; font-style: italic;&quot;&gt;// This should return faceIds for anyone recognised in the photo  &lt;/span&gt;
        &lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;const&lt;/span&gt; postData = { &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;personGroupId&quot;&lt;/span&gt;: groupId, &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;faceIds&quot;&lt;/span&gt;: faceIds, &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;maxNumOfCandidatesReturned&quot;&lt;/span&gt;: &lt;span class=&quot;hljs-number&quot; style=&quot;box-sizing: border-box; color: #009999;&quot;&gt;1&lt;/span&gt;};
        
        &lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;const&lt;/span&gt; options = {
            hostname: &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;api.projectoxford.ai&#39;&lt;/span&gt;,
            method: &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;POST&#39;&lt;/span&gt;,
            path: &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;/face/v1.0/identify&#39;&lt;/span&gt;,
            headers: {
                    &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;Content-Type&#39;&lt;/span&gt;: &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;application/json&#39;&lt;/span&gt;,
                    &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;Ocp-Apim-Subscription-Key&#39;&lt;/span&gt;:subscriptionKey
            }
        };
        &lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;var&lt;/span&gt; responseData = &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;&#39;&lt;/span&gt;;
        &lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;var&lt;/span&gt; req = https.request(options, (res) =&amp;gt; {
            res.on(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;data&#39;&lt;/span&gt;, (d) =&amp;gt; {
                responseData += d;
            });
                res.on(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;end&#39;&lt;/span&gt;, () =&amp;gt; {
                &lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;var&lt;/span&gt; identifyResult = &lt;span class=&quot;hljs-built_in&quot; style=&quot;box-sizing: border-box; color: #0086b3;&quot;&gt;JSON&lt;/span&gt;.parse(responseData);
                &lt;span class=&quot;hljs-comment&quot; style=&quot;box-sizing: border-box; color: #999988; font-style: italic;&quot;&gt;//&lt;span class=&quot;hljs-doctag&quot; style=&quot;box-sizing: border-box;&quot;&gt;TODO:&lt;/span&gt; Do this for each person in the response since we might have multiple face Ids&lt;/span&gt;
                &lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;var&lt;/span&gt; percentChance = &lt;span class=&quot;hljs-built_in&quot; style=&quot;box-sizing: border-box; color: #0086b3;&quot;&gt;Math&lt;/span&gt;.round(identifyResult[&lt;span class=&quot;hljs-number&quot; style=&quot;box-sizing: border-box; color: #009999;&quot;&gt;0&lt;/span&gt;].candidates[&lt;span class=&quot;hljs-number&quot; style=&quot;box-sizing: border-box; color: #009999;&quot;&gt;0&lt;/span&gt;].confidence * &lt;span class=&quot;hljs-number&quot; style=&quot;box-sizing: border-box; color: #009999;&quot;&gt;100&lt;/span&gt;);
                &lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;var&lt;/span&gt; personId = identifyResult[&lt;span class=&quot;hljs-number&quot; style=&quot;box-sizing: border-box; color: #009999;&quot;&gt;0&lt;/span&gt;].candidates[&lt;span class=&quot;hljs-number&quot; style=&quot;box-sizing: border-box; color: #009999;&quot;&gt;0&lt;/span&gt;].personId;
                getPersonWithPersonId(personId, returnedPerson =&amp;gt; {
                    &lt;span class=&quot;hljs-built_in&quot; style=&quot;box-sizing: border-box; color: #0086b3;&quot;&gt;console&lt;/span&gt;.log(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;`&lt;span class=&quot;hljs-subst&quot; style=&quot;box-sizing: border-box; color: #333333;&quot;&gt;${photoFile}&lt;/span&gt; : &lt;span class=&quot;hljs-subst&quot; style=&quot;box-sizing: border-box; color: #333333;&quot;&gt;${percentChance}&lt;/span&gt;% chance this is &lt;span class=&quot;hljs-subst&quot; style=&quot;box-sizing: border-box; color: #333333;&quot;&gt;${returnedPerson}&lt;/span&gt;`&lt;/span&gt;);
                });
            })
        });

        req.on(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;error&#39;&lt;/span&gt;, (e) =&amp;gt; {
            &lt;span class=&quot;hljs-built_in&quot; style=&quot;box-sizing: border-box; color: #0086b3;&quot;&gt;console&lt;/span&gt;.log(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;`problem with request: &lt;span class=&quot;hljs-subst&quot; style=&quot;box-sizing: border-box; color: #333333;&quot;&gt;${e.message}&lt;/span&gt;`&lt;/span&gt;);
        });

        req.write(&lt;span class=&quot;hljs-built_in&quot; style=&quot;box-sizing: border-box; color: #0086b3;&quot;&gt;JSON&lt;/span&gt;.stringify(postData));
        req.end();    
             
    }); &lt;span class=&quot;hljs-comment&quot; style=&quot;box-sizing: border-box; color: #999988; font-style: italic;&quot;&gt;// end of getFaceIdsForPhoto callback&lt;/span&gt;
    
}


&lt;span class=&quot;hljs-function&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;hljs-title&quot; style=&quot;box-sizing: border-box;&quot;&gt;getFaceIdsForPhoto&lt;/span&gt;(&lt;span class=&quot;hljs-params&quot; style=&quot;box-sizing: border-box;&quot;&gt;photoFile, callback&lt;/span&gt;) &lt;/span&gt;{
    &lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;const&lt;/span&gt; options = {
        hostname: &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;api.projectoxford.ai&#39;&lt;/span&gt;,
        method: &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;POST&#39;&lt;/span&gt;,
        path: &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;/face/v1.0/detect?returnFaceId=true&amp;amp;returnFaceLandmarks=false&amp;amp;returnFaceAttributes=age,gender,facialHair,glasses&#39;&lt;/span&gt;,
        headers: {
                &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;Content-Type&#39;&lt;/span&gt;: &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;application/octet-stream&#39;&lt;/span&gt;,
                &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;Ocp-Apim-Subscription-Key&#39;&lt;/span&gt;:subscriptionKey
        }
   };
  &lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;var&lt;/span&gt; responseData = &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;&#39;&lt;/span&gt;;
  &lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;var&lt;/span&gt; req = https.request(options, (res) =&amp;gt; {
    res.on(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;data&#39;&lt;/span&gt;, (d) =&amp;gt; {
      responseData += d;
    });
    res.on(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;end&#39;&lt;/span&gt;, () =&amp;gt; {
      result = &lt;span class=&quot;hljs-built_in&quot; style=&quot;box-sizing: border-box; color: #0086b3;&quot;&gt;JSON&lt;/span&gt;.parse(responseData);
      &lt;span class=&quot;hljs-comment&quot; style=&quot;box-sizing: border-box; color: #999988; font-style: italic;&quot;&gt;// Use map in case there are multiple faces&lt;/span&gt;
      &lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;var&lt;/span&gt; onlyFaceIds = result.map(obj =&amp;gt; {
        &lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;return&lt;/span&gt; obj.faceId;
      });
      callback(onlyFaceIds);
    })
  });

  req.on(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;error&#39;&lt;/span&gt;, (e) =&amp;gt; {
    &lt;span class=&quot;hljs-built_in&quot; style=&quot;box-sizing: border-box; color: #0086b3;&quot;&gt;console&lt;/span&gt;.log(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;`problem with request: &lt;span class=&quot;hljs-subst&quot; style=&quot;box-sizing: border-box; color: #333333;&quot;&gt;${e.message}&lt;/span&gt;`&lt;/span&gt;);
    callback();
  });

  fs.readFile(photoFile, (err,data) =&amp;gt; {
    &lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;if&lt;/span&gt; (err) &lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;throw&lt;/span&gt; err;
    req.end(data);
  }); 

}
&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;box-sizing: border-box; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
The output from running this is:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; height: 106px; line-height: 1.45; margin-bottom: 16px; overflow: auto; padding: 16px; tab-size: 4; word-wrap: normal;&quot;&gt;&lt;code class=&quot;md hljs markdown&quot; style=&quot;border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; box-sizing: border-box; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; height: auto; line-height: inherit; margin: 0px; padding: 0.5em; word-wrap: normal;&quot;&gt;./robert&lt;span class=&quot;hljs-emphasis&quot; style=&quot;box-sizing: border-box;&quot;&gt;_downey_&lt;/span&gt;jr.jpg : 99% chance this is Iron Man
./chris_evans.jpg : 100% chance this is Captain America
./paul_rudd.jpg : 99% chance this is Ant Man
&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;box-sizing: border-box; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
So let’s try with some new photos. I’m not expecting much given I’ve only uploaded a single photo for each person:&lt;/div&gt;
&lt;div style=&quot;box-sizing: border-box; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhb-ahw76A30-YHTqxk-uirJhyWqPuu15MWa299LjaVg8DpfW8YEO92ifkY9xtmQ4rx391UJM5_SlrtZcmuOknjFUkrVa9w88o63nF5jdrvLwSqLxp_2Af05PDCI-WCPYEU2XtIO8rLqNM/s1600/2016-06-Faces2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;236&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhb-ahw76A30-YHTqxk-uirJhyWqPuu15MWa299LjaVg8DpfW8YEO92ifkY9xtmQ4rx391UJM5_SlrtZcmuOknjFUkrVa9w88o63nF5jdrvLwSqLxp_2Af05PDCI-WCPYEU2XtIO8rLqNM/s640/2016-06-Faces2.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;box-sizing: border-box; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;box-sizing: border-box; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
The results for these images are as follows:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; height: 126px; line-height: 1.45; margin-bottom: 16px; overflow: auto; padding: 16px; tab-size: 4; word-wrap: normal;&quot;&gt;&lt;code class=&quot;md hljs markdown&quot; style=&quot;border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; box-sizing: border-box; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; height: auto; line-height: inherit; margin: 0px; padding: 0.5em; word-wrap: normal;&quot;&gt;./robert&lt;span class=&quot;hljs-emphasis&quot; style=&quot;box-sizing: border-box;&quot;&gt;_downey_&lt;/span&gt;jr2.jpg : 72% chance this is Iron Man
./paul_rudd2.jpg : 71% chance this is Ant Man
./chris_evans2.jpg : 65% chance this is Captain America

&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;box-sizing: border-box; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px;&quot;&gt;
Not bad, considering… Clearly I picked images that were similar – I’m going to need some error checking in the code before it’ll handle&amp;nbsp;anything else ;).&lt;/div&gt;
&lt;div style=&quot;box-sizing: border-box; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;box-sizing: border-box; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px;&quot;&gt;
Finally, to show where the notification would be coming from, here is a screen shot of my Cisco Spark room:&lt;/div&gt;
&lt;div style=&quot;box-sizing: border-box; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1qJmvClMOh73CEoJyIsH1tOJEIeriLDlByTzMlwh5FDp2ZNPefV8bzZ2EaQenLLiDWVQHtnjtayTI4XA8-h5hOj6mVw8ayRaxHOtbBk87bkk_VzsvzBsNJu_OthILXRh_GJCQahEwJbs/s1600/2016-06-Spark.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1qJmvClMOh73CEoJyIsH1tOJEIeriLDlByTzMlwh5FDp2ZNPefV8bzZ2EaQenLLiDWVQHtnjtayTI4XA8-h5hOj6mVw8ayRaxHOtbBk87bkk_VzsvzBsNJu_OthILXRh_GJCQahEwJbs/s640/2016-06-Spark.png&quot; width=&quot;360&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;freesans&amp;quot; , &amp;quot;clean&amp;quot; , sans-serif; font-size: 16px;&quot;&gt;Now I just need to work out how to initiate a call in the Spark room automatically so that anyone in that room could basically &#39;take the call&#39; and have a video chat with the visitor. &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;freesans&amp;quot; , &amp;quot;clean&amp;quot; , sans-serif; font-size: 16px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;freesans&amp;quot; , &amp;quot;clean&amp;quot; , sans-serif; font-size: 16px;&quot;&gt;I have a bit of work on the &lt;a href=&quot;https://en.wikipedia.org/wiki/Wife_acceptance_factor&quot;&gt;WAF&lt;/a&gt; to get approval for adding video to the front door yet though...&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;freesans&amp;quot; , &amp;quot;clean&amp;quot; , sans-serif; font-size: 16px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;freesans&amp;quot; , &amp;quot;clean&amp;quot; , sans-serif; font-size: 16px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;freesans&amp;quot; , &amp;quot;clean&amp;quot; , sans-serif; font-size: 16px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;freesans&amp;quot; , &amp;quot;clean&amp;quot; , sans-serif; font-size: 16px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://blog.darrenparkinson.uk/feeds/2935277725700769063/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.darrenparkinson.uk/2016/06/adding-face-recognition-to-my-doorbell.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/2935277725700769063'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/2935277725700769063'/><link rel='alternate' type='text/html' href='http://blog.darrenparkinson.uk/2016/06/adding-face-recognition-to-my-doorbell.html' title='Adding Face Recognition to my Doorbell'/><author><name>Darren Parkinson</name><uri>http://www.blogger.com/profile/01084077294541066454</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWZQ0YxmWVmUcL5sx87aYxSAJQVNBKEi6d-fieYXV4ekjtU8uiggxv1A5kWjVN7p27bE8LH3njbTkh4y3PF4GLF8cuSc6Xp1T_haXRHQXrf8HM0mJ5PteFvZF4orAFCAldxgl8PvRmOP8/s72-c/2016-06-DoorbellPressed.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27381059098267211.post-276524635139704244</id><published>2016-05-27T14:16:00.000+01:00</published><updated>2016-05-27T14:17:10.028+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="cisco"/><category scheme="http://www.blogger.com/atom/ns#" term="spark"/><title type='text'>Adding Natural Language to my Cisco Spark bot</title><content type='html'>&lt;br /&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
Since “Bots” are all the rage these days, I created a simple bot to integrate with&amp;nbsp;&lt;a href=&quot;https://web.ciscospark.com/&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;Cisco Spark&lt;/a&gt;. This was mainly in order to experiment with the&amp;nbsp;&lt;a href=&quot;https://developer.ciscospark.com/&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;Cisco Spark APIs&lt;/a&gt;. Cisco Spark, for those that don’t know, is a business messaging / team collaboration service provided by Cisco. The idea is that you get more work done, faster, and more effectively than ever before, with the added bonus of reducing the size of your inbox.&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
The Spark APIs look great, and are well worth investigating, but for me, the value won’t come until they finally release what they call “machine accounts” (essentially just a different OAuth 2 grant type, apparently coming ‘soon’) where we can then truly tie the system into our backend processes. Whilst there are workarounds, today I’m sticking with basic webhook integrations provided via the web client (which I hope to cover in a future post).&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
Most bots that I’ve seen for Spark (including mine) consist mainly of “slash commands”, popularised by&amp;nbsp;&lt;a href=&quot;https://get.slack.help/hc/en-us/articles/201259356-Using-slash-commands&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;Slack&lt;/a&gt;. These commands essentially start with a&amp;nbsp;&lt;code style=&quot;background-color: rgba(0, 0, 0, 0.0392157); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; margin: 0px; padding: 0.2em 0px;&quot;&gt;&quot;/&quot;&lt;/code&gt;&amp;nbsp;followed by the query you want to make. For example, my simple bot supports:&lt;/div&gt;
&lt;ul style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px; margin-top: 0px; padding: 0px 0px 0px 2em;&quot;&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;code style=&quot;background-color: rgba(0, 0, 0, 0.0392157); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; margin: 0px; padding: 0.2em 0px;&quot;&gt;/weather&lt;/code&gt;&amp;nbsp;for weather information;&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;code style=&quot;background-color: rgba(0, 0, 0, 0.0392157); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; margin: 0px; padding: 0.2em 0px;&quot;&gt;/tube&lt;/code&gt;&amp;nbsp;for tube status information;&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;code style=&quot;background-color: rgba(0, 0, 0, 0.0392157); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; margin: 0px; padding: 0.2em 0px;&quot;&gt;/stock&lt;/code&gt;&amp;nbsp;for stock prices;&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;code style=&quot;background-color: rgba(0, 0, 0, 0.0392157); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; margin: 0px; padding: 0.2em 0px;&quot;&gt;/currency&lt;/code&gt;&amp;nbsp;for currency conversions; and&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;code style=&quot;background-color: rgba(0, 0, 0, 0.0392157); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; margin: 0px; padding: 0.2em 0px;&quot;&gt;/places&lt;/code&gt;&amp;nbsp;for finding places!&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
In addition, it also supports language translation which is automatically recognised (no slash command required). Moving forward, I wanted to add some internal domain specific commands to make use of some of our internal APIs, for example identifying the team members aligned to a particular customer, or listing support tickets for that customer etc.&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
One thing that bothers me though is that slash commands are so 1990s. They remind me of using really bad&amp;nbsp;&lt;a href=&quot;https://en.wikipedia.org/wiki/Internet_Relay_Chat#Commands_and_replies&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;IRC&lt;/a&gt;&amp;nbsp;clients – in fact, sometimes, I wonder if we’ve come very far at all when you look at the capabilities IRC had back then (including chat, slash commands and bots).&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
To me, bots are only really going to become useful if they start to recognise natural language requests for information. After a quick google, it seems&amp;nbsp;&lt;a href=&quot;http://www.theverge.com/2016/1/6/10718282/internet-bots-messaging-slack-facebook-m&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;I’m not the only one&lt;/a&gt;&amp;nbsp;&lt;a href=&quot;http://fortune.com/2016/05/20/battle-of-the-bots/&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;that thinks that&lt;/a&gt;&amp;nbsp;. As an example, I previously connected a&amp;nbsp;&lt;a href=&quot;http://www.cisco.com/c/en/us/products/collateral/collaboration-endpoints/telepresence-mx-series/data-sheet-c78-729734.html&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;Cisco MX300&lt;/a&gt;&amp;nbsp;up to Siri so that I could make room-based video calls using natural language – perhaps with the&amp;nbsp;&lt;a href=&quot;http://www.apple.com/uk/pr/library/2015/08/31Apple-and-Cisco-Partner-to-Deliver-Fast-Lane-for-iOS-Enterprise-Users.html&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;special relationship Cisco has with Apple&lt;/a&gt;&amp;nbsp;now, they might do that too. &amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
The use of natural language means that people don&#39;t have to learn or remember convoluted commands to find the information they need.&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
So, to add natural language to my bot (until Cisco adds it natively?), it seems there are plenty of options – most of them using the&amp;nbsp;&lt;code style=&quot;background-color: rgba(0, 0, 0, 0.0392157); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; margin: 0px; padding: 0.2em 0px;&quot;&gt;.ai&lt;/code&gt;&amp;nbsp;domain suffix. A couple to mention are&amp;nbsp;&lt;a href=&quot;http://api.ai/&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;&lt;code style=&quot;background-color: rgba(0, 0, 0, 0.0392157); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; margin: 0px; padding: 0.2em 0px;&quot;&gt;api.ai&lt;/code&gt;&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href=&quot;http://wit.ai/&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;&lt;code style=&quot;background-color: rgba(0, 0, 0, 0.0392157); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; margin: 0px; padding: 0.2em 0px;&quot;&gt;wit.ai&lt;/code&gt;&lt;/a&gt;&amp;nbsp;which I’ve heard are pretty good. In addition, there are similar services from well know organisations like&amp;nbsp;&lt;a href=&quot;http://www.ibm.com/smarterplanet/us/en/ibmwatson/watson-cloud.html&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;IBM (with Watson)&lt;/a&gt;&amp;nbsp;and Microsoft.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
For the purposes of this post, I opted to take a look at what Microsoft is doing in this space, given the fairly recent announcement of their&amp;nbsp;&lt;a href=&quot;https://dev.botframework.com/&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;Bot Framework&lt;/a&gt;. I could potentially use their bot framework in it’s entirety, but given I want to integrate this with my existing script and I’m just dipping my toe in the water at this point, I thought I would look at the&amp;nbsp;&lt;a href=&quot;http://docs.botframework.com/builder/node/guides/understanding-natural-language/#navtitle&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;natural language engine&lt;/a&gt;&amp;nbsp;they use behind that in the form of&amp;nbsp;&lt;a href=&quot;http://luis.ai/&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;LUIS&lt;/a&gt;.&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
LUIS (Language Understanding Intelligent Service), in the words of Microsoft,&amp;nbsp;&lt;em style=&quot;box-sizing: border-box;&quot;&gt;offers a fast and effective way of adding language understanding to applications.&lt;/em&gt;&amp;nbsp;That sounds exactly like what I need. For this example, I’m going to use LUIS to answer a simple question that gets asked quite frequently: “who is the ‘&lt;em style=&quot;box-sizing: border-box;&quot;&gt;job role&lt;/em&gt;’ for ‘&lt;em style=&quot;box-sizing: border-box;&quot;&gt;a specific customer&lt;/em&gt;’?”, for example, “Who is the Account Manager for Cisco?” (n.b. all customer names and people are fictitious for the purposes of this post).&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
The following video shows the result of this set up:&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;iframe allowfullscreen=&quot;&quot; class=&quot;YOUTUBE-iframe-video&quot; data-thumbnail-src=&quot;https://i.ytimg.com/vi/vRGaL6u-Q60/0.jpg&quot; frameborder=&quot;0&quot; height=&quot;266&quot; src=&quot;https://www.youtube.com/embed/vRGaL6u-Q60?feature=player_embedded&quot; width=&quot;320&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
In the video, I’m using a prefix for the question so that I only make requests when required, but ultimately, you’d send every request so that the bot always answers when it identifies a matching intent (but at least I’m not using a “&lt;code style=&quot;background-color: rgba(0, 0, 0, 0.0392157); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; margin: 0px; padding: 0.2em 0px;&quot;&gt;/&lt;/code&gt;”!).&lt;/div&gt;
&lt;h3 id=&quot;settingupluis&quot; style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 1.5em; line-height: 1.43; margin-bottom: 16px; margin-top: 1em; position: relative;&quot;&gt;
Setting up LUIS&lt;/h3&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
To set up LUIS, it is a case of logging in using a Microsoft account, creating an application and adding context for your question. Once you’ve done this, you publish the application which then allows you to pass sentences to it for resolution via a given URL. LUIS will then pass back a json document consisting of a score relating to how much the question matched the ‘intents’ you provide.&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
After logging in, select&amp;nbsp;&lt;code style=&quot;background-color: rgba(0, 0, 0, 0.0392157); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; margin: 0px; padding: 0.2em 0px;&quot;&gt;New App&lt;/code&gt;&amp;nbsp;and choose&amp;nbsp;&lt;code style=&quot;background-color: rgba(0, 0, 0, 0.0392157); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; margin: 0px; padding: 0.2em 0px;&quot;&gt;New Application&lt;/code&gt;. You can choose from a couple of prebuilt templates that Microsoft has created, but they’re not relevant to us here.&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_GZPP2MMu_T2zig51vJX9qbLit-qYTJVAwYkN9kHRoVlxSQYO2y_9H9ogkhsxe8C6_eWWaEro6_IdwKJJVK45qIx3bTvjL_dYArO26oRTlIiL4fxbMIelidrGpHDNvYqNY02mtjKSMFI/s1600/2016-05-NewApplication.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;108&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_GZPP2MMu_T2zig51vJX9qbLit-qYTJVAwYkN9kHRoVlxSQYO2y_9H9ogkhsxe8C6_eWWaEro6_IdwKJJVK45qIx3bTvjL_dYArO26oRTlIiL4fxbMIelidrGpHDNvYqNY02mtjKSMFI/s640/2016-05-NewApplication.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;figure style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin: 1em 40px;&quot;&gt;&lt;figcaption style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/figcaption&gt;&lt;/figure&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
You can then give it a name and description, in my case I’ve chosen&amp;nbsp;&lt;code style=&quot;background-color: rgba(0, 0, 0, 0.0392157); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; margin: 0px; padding: 0.2em 0px;&quot;&gt;Spark Bot&lt;/code&gt;.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtUHMZxaonWq62u-YP_D9cKbt5fJOmXWia4tVkZfuOpRvE-IL0yGjRdbwi5UXr4m5l_PnESuqhrCfLPCCAedDwT7wmfrEhURIu1Neu-tjShlS_lggSsDj1BMSdRIGZ59b-BNqr2NATksg/s1600/2016-05-NewApplication2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;392&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtUHMZxaonWq62u-YP_D9cKbt5fJOmXWia4tVkZfuOpRvE-IL0yGjRdbwi5UXr4m5l_PnESuqhrCfLPCCAedDwT7wmfrEhURIu1Neu-tjShlS_lggSsDj1BMSdRIGZ59b-BNqr2NATksg/s640/2016-05-NewApplication2.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;figure style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin: 1em 40px;&quot;&gt;&lt;br /&gt;&lt;figcaption style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/figcaption&gt;&lt;/figure&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
After that, I added some&amp;nbsp;&lt;code style=&quot;background-color: rgba(0, 0, 0, 0.0392157); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; margin: 0px; padding: 0.2em 0px;&quot;&gt;entities&lt;/code&gt;&amp;nbsp;which relate to things you want to identify in the sentence. In this case, I added&amp;nbsp;&lt;code style=&quot;background-color: rgba(0, 0, 0, 0.0392157); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; margin: 0px; padding: 0.2em 0px;&quot;&gt;accountTeam&lt;/code&gt;&amp;nbsp;and&amp;nbsp;&lt;code style=&quot;background-color: rgba(0, 0, 0, 0.0392157); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; margin: 0px; padding: 0.2em 0px;&quot;&gt;customer&lt;/code&gt;&amp;nbsp;since I’ll need both of those to perform the lookup on our API.&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhq05kCksehyphenhyphenn6Mz0pappccVLgCj7Mfs6UIgJH-Ix9GLKp3XO7eK-vAPpfGGcCTZL3yTJo1q9D8ds7X-3C1QlisB_AFWYGLoWcn3fNlnX4c4_DAJrSvfFdpyw0sje4WbS98uug4D9ALzr0/s1600/2016-05-AddingEntities.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;143&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhq05kCksehyphenhyphenn6Mz0pappccVLgCj7Mfs6UIgJH-Ix9GLKp3XO7eK-vAPpfGGcCTZL3yTJo1q9D8ds7X-3C1QlisB_AFWYGLoWcn3fNlnX4c4_DAJrSvfFdpyw0sje4WbS98uug4D9ALzr0/s400/2016-05-AddingEntities.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;figure style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin: 1em 40px;&quot;&gt;&lt;br /&gt;&lt;figcaption style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/figcaption&gt;&lt;/figure&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
Then it is a case of adding your&amp;nbsp;&lt;code style=&quot;background-color: rgba(0, 0, 0, 0.0392157); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; margin: 0px; padding: 0.2em 0px;&quot;&gt;intent&lt;/code&gt;&amp;nbsp;and training the system. My intent is to find a team or more specifically, someone in a team, so I called mine&amp;nbsp;&lt;code style=&quot;background-color: rgba(0, 0, 0, 0.0392157); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; margin: 0px; padding: 0.2em 0px;&quot;&gt;team.find&lt;/code&gt;.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKtOfZLElZwPeSz61tdzfu8Kn00v7ljay9fqG4Drw8Ydlmizf454ImYQH-L_KeQVa2ukj7CTMg_pbnyo7kON5hTFxTjxRGTO0A4go6xR2cZ5erDI4rSAVwQHaU5dijCqRuK3ogkCu6QX4/s1600/2016-05-IntentsAndEntities.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKtOfZLElZwPeSz61tdzfu8Kn00v7ljay9fqG4Drw8Ydlmizf454ImYQH-L_KeQVa2ukj7CTMg_pbnyo7kON5hTFxTjxRGTO0A4go6xR2cZ5erDI4rSAVwQHaU5dijCqRuK3ogkCu6QX4/s320/2016-05-IntentsAndEntities.png&quot; width=&quot;299&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;figure style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin: 1em 40px;&quot;&gt;&lt;br /&gt;&lt;figcaption style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/figcaption&gt;&lt;/figure&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
Training the system involves typing in&amp;nbsp;&lt;code style=&quot;background-color: rgba(0, 0, 0, 0.0392157); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; margin: 0px; padding: 0.2em 0px;&quot;&gt;new utterances&lt;/code&gt;&amp;nbsp;which are essentially just sentences you think people will type to find the information. You then assign entities to the sentence to help it learn and tell it which intent it should match.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJBUyKgoCwXv7-OyHjDGYRH7MLyMfaNmV6xKp-cbPssGbLneZeVXxbFYt6HwqLOhZHLUalgcb8vrHCxJEkdNAKvjvjgD0b6CDLHW5amQlMkJeV3OiKcg7-5qITywT0XrqUa5Rrs8znqLA/s1600/2016-05-NewUtterances.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;318&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJBUyKgoCwXv7-OyHjDGYRH7MLyMfaNmV6xKp-cbPssGbLneZeVXxbFYt6HwqLOhZHLUalgcb8vrHCxJEkdNAKvjvjgD0b6CDLHW5amQlMkJeV3OiKcg7-5qITywT0XrqUa5Rrs8znqLA/s640/2016-05-NewUtterances.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;figure style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin: 1em 40px;&quot;&gt;&lt;br /&gt;&lt;figcaption style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/figcaption&gt;&lt;/figure&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
After adding a few of those, you can click the&amp;nbsp;&lt;code style=&quot;background-color: rgba(0, 0, 0, 0.0392157); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; margin: 0px; padding: 0.2em 0px;&quot;&gt;train&lt;/code&gt;&amp;nbsp;button in the bottom left corner – that will enable the&amp;nbsp;&lt;code style=&quot;background-color: rgba(0, 0, 0, 0.0392157); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; margin: 0px; padding: 0.2em 0px;&quot;&gt;publish&lt;/code&gt;&amp;nbsp;button if it isn’t already. Once trained, click&amp;nbsp;&lt;code style=&quot;background-color: rgba(0, 0, 0, 0.0392157); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; margin: 0px; padding: 0.2em 0px;&quot;&gt;Publish&lt;/code&gt;&amp;nbsp;and give it a go.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWMEWx9m7TyScEltgg3GBr7YYKAb_78jyJP0_U7m5X2WkPmLFiZNX-ibQQlYbhF5Y-dmA3_u5NRSeCK3x2VoLs97dxMhaiU3ocDYKlDrPn_bN34AwcfRBwhI-T0Q31mS2exUZ6zfPoATA/s1600/2016-05-Publish%2528obfuscated%2529.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;249&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWMEWx9m7TyScEltgg3GBr7YYKAb_78jyJP0_U7m5X2WkPmLFiZNX-ibQQlYbhF5Y-dmA3_u5NRSeCK3x2VoLs97dxMhaiU3ocDYKlDrPn_bN34AwcfRBwhI-T0Q31mS2exUZ6zfPoATA/s640/2016-05-Publish%2528obfuscated%2529.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;figure style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin: 1em 40px;&quot;&gt;&lt;br /&gt;&lt;figcaption style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/figcaption&gt;&lt;/figure&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
Simply type in your query and click the resulting link which will present you with the results of your query.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIYac3hvcXWNRdl6xBIpGSMJKSQ2eQGYdg_lhQRmIJPEvJxoZh5Uj2jp3BvdpAXisaIpDBe5-lH5kNrcW_F8ZkMKsPY2_XpzV0bOddEi7fomrfmE9jvHadfMz6qQDoL8FvbfQorShYmwk/s1600/2016-05-Result.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIYac3hvcXWNRdl6xBIpGSMJKSQ2eQGYdg_lhQRmIJPEvJxoZh5Uj2jp3BvdpAXisaIpDBe5-lH5kNrcW_F8ZkMKsPY2_XpzV0bOddEi7fomrfmE9jvHadfMz6qQDoL8FvbfQorShYmwk/s320/2016-05-Result.png&quot; width=&quot;276&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;figure style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin: 1em 40px;&quot;&gt;&lt;br /&gt;&lt;figcaption style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/figcaption&gt;&lt;/figure&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
To help it along, I also added a Phrase List. This just gives it exchangeable expressions to more easily recognise the intent.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgo0KP0Du-ysKXZMK-x6KC1UXgGEZ7sRlLKfDfJF5Aa1DTDd_kshgkmGHsagLykx7iFBhSbDnc6Kp_j_QkMM2dWp8AIrV5eliDfYlgaSDpb5JLnbYvPHHjiGXqU53fIzZx4oFfbE0s4EMY/s1600/2016-05-PhraseList.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgo0KP0Du-ysKXZMK-x6KC1UXgGEZ7sRlLKfDfJF5Aa1DTDd_kshgkmGHsagLykx7iFBhSbDnc6Kp_j_QkMM2dWp8AIrV5eliDfYlgaSDpb5JLnbYvPHHjiGXqU53fIzZx4oFfbE0s4EMY/s320/2016-05-PhraseList.png&quot; width=&quot;196&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;figure style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin: 1em 40px;&quot;&gt;&lt;br /&gt;&lt;ins id=&quot;firstdiff&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; box-sizing: border-box; display: inline-block; left: -8px; position: absolute; text-decoration: none !important;&quot;&gt;&lt;/ins&gt;&lt;figcaption style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/figcaption&gt;&lt;/figure&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
Clearly the more assistance and utterances you give it the more accurate it will be, but the addition of the phrase list allows me to interchange titles in the query, I’ve used ‘ps’ in this example in place of ‘product specialist’:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; height: 626px; line-height: 1.45; margin-bottom: 16px; overflow: auto; padding: 16px; tab-size: 4; word-wrap: normal;&quot;&gt;&lt;code class=&quot;hljs json&quot; style=&quot;border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; box-sizing: border-box; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; height: auto; line-height: inherit; margin: 0px; padding: 0.5em; word-wrap: normal;&quot;&gt;{
  &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;query&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;who is the ps for apple&quot;&lt;/span&gt;&lt;/span&gt;,
  &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;intents&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot; style=&quot;box-sizing: border-box;&quot;&gt;[
    {
      &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;intent&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;team.find&quot;&lt;/span&gt;&lt;/span&gt;,
      &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;score&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span class=&quot;hljs-number&quot; style=&quot;box-sizing: border-box; color: #009999;&quot;&gt;0.998044&lt;/span&gt;
    &lt;/span&gt;},
    {
      &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;intent&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;None&quot;&lt;/span&gt;&lt;/span&gt;,
      &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;score&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span class=&quot;hljs-number&quot; style=&quot;box-sizing: border-box; color: #009999;&quot;&gt;0.0141958371&lt;/span&gt;
    &lt;/span&gt;}
  ]&lt;/span&gt;,
  &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;entities&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot; style=&quot;box-sizing: border-box;&quot;&gt;[
    {
      &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;entity&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;apple&quot;&lt;/span&gt;&lt;/span&gt;,
      &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;type&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;my_company.customer&quot;&lt;/span&gt;&lt;/span&gt;,
      &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;startIndex&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span class=&quot;hljs-number&quot; style=&quot;box-sizing: border-box; color: #009999;&quot;&gt;18&lt;/span&gt;&lt;/span&gt;,
      &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;endIndex&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span class=&quot;hljs-number&quot; style=&quot;box-sizing: border-box; color: #009999;&quot;&gt;22&lt;/span&gt;&lt;/span&gt;,
      &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;score&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span class=&quot;hljs-number&quot; style=&quot;box-sizing: border-box; color: #009999;&quot;&gt;0.985388041&lt;/span&gt;
    &lt;/span&gt;},
    {
      &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;entity&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;ps&quot;&lt;/span&gt;&lt;/span&gt;,
      &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;type&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;my_company.accountTeam&quot;&lt;/span&gt;&lt;/span&gt;,
      &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;startIndex&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span class=&quot;hljs-number&quot; style=&quot;box-sizing: border-box; color: #009999;&quot;&gt;11&lt;/span&gt;&lt;/span&gt;,
      &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;endIndex&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span class=&quot;hljs-number&quot; style=&quot;box-sizing: border-box; color: #009999;&quot;&gt;12&lt;/span&gt;&lt;/span&gt;,
      &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;score&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span class=&quot;hljs-number&quot; style=&quot;box-sizing: border-box; color: #009999;&quot;&gt;0.999506&lt;/span&gt;
    &lt;/span&gt;}
  ]
&lt;/span&gt;}
&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
Now that I’ve got the recognition set up, it’s just a case of using the URL specified earlier and checking the results for a match. In this case, I’m checking for a score of greater than 0.8 to decide that it’s most likely a match. Then I’m using the entities to identify the customer and the role to perform the search.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
When I add more intents, I’ll just look for the one with the highest score. The bot framework discussed earlier takes care of a lot of this for you if you decide to use that.&amp;nbsp;&lt;/div&gt;
&lt;h3 id=&quot;nextsteps&quot; style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 1.5em; line-height: 1.43; margin-bottom: 16px; margin-top: 1em; position: relative;&quot;&gt;
Next Steps&lt;/h3&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px;&quot;&gt;
To finish this project off I’ll need to connect it up to our internal APIs. Then once that’s working, I’d like to extend it by adding other question types (or intents) that make sense in our business.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://blog.darrenparkinson.uk/feeds/276524635139704244/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.darrenparkinson.uk/2016/05/adding-natural-language-to-my-cisco.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/276524635139704244'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/276524635139704244'/><link rel='alternate' type='text/html' href='http://blog.darrenparkinson.uk/2016/05/adding-natural-language-to-my-cisco.html' title='Adding Natural Language to my Cisco Spark bot'/><author><name>Darren Parkinson</name><uri>http://www.blogger.com/profile/01084077294541066454</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/vRGaL6u-Q60/default.jpg" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27381059098267211.post-4011907080212777955</id><published>2016-01-10T19:52:00.000+00:00</published><updated>2016-01-10T19:52:36.564+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="d3.js"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="scripting"/><category scheme="http://www.blogger.com/atom/ns#" term="visio"/><title type='text'>New Year, New Org Chart - Visualising organisation data with d3.js</title><content type='html'>&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
With a new year comes a new organisation chart. This is due to some new faces in addition to some role changes that typically happen at this time of year (including my own this time).&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
Sometimes it’s hard to keep track of the changes and it would be useful to have an up-to-date diagram to refer to. For now this is using static data, but clearly there are various changes throughout the year too, so time permitting, a live updated version will be a future enhancement.&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
Creating an organisation chart can easily be achieved using something like Microsoft Visio which allows you to&amp;nbsp;&lt;a href=&quot;https://support.office.com/en-us/article/Create-a-Visio-organization-chart-abb3dd17-2692-439f-9945-3a015767d96a&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;import data directly from Microsoft Exchange&lt;/a&gt;&amp;nbsp;or an Excel spreadsheet.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
There are various reasons I didn’t go this route, including:&lt;/div&gt;
&lt;ul style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px; margin-top: 0px; padding: 0px 0px 0px 2em;&quot;&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;We happen to be using Office 365 – the Visio Wizard&amp;nbsp;&lt;a href=&quot;https://community.office365.com/en-us/f/172/t/260556&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;doesn’t seem to play nicely&lt;/a&gt;&amp;nbsp;when importing the data from here;&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;The Visio output is very static and doesn’t provide any interactivity;&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;It’s not platform independent;&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;Sharing the information is not as easy as it should be. A web-based approach would be preferred;&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;There is no opportunity to learn something new;&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;It’s not much fun!&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
Since we’re using Office 365, it seemed that Office 365 would also allow me to do this easily by using the ‘Organization Browser’ web-part on our site. Honestly though, it’s shockingly bad and really doesn’t work. This led me to look for a better solution that I can perhaps later incorporate into Sharepoint that is always up to date. It’s a shame because it seems everything is there for this to work, especially if you look at Delve – maybe I’m just missing something, but it isn’t obvious if that’s the case.&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
Finally, I decided that since I’ve been experimenting with data visualisations using&amp;nbsp;&lt;a href=&quot;http://d3js.org/&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;d3.js&lt;/a&gt;, perhaps I could use use this as an opportunity to learn a bit more about it.&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
The following screenshot is an example of what I have so far using the organisation chart for Apple. Anyone with a team below them has their details on the left and has a purple circle – these can be clicked to expand their team.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOSNlSW_QqAjSosmmIIH6a5XDrDrxG71casQZQxms2WG5hf4Q4kVRUx0x1YZC2qumYaQt5LDL4ddIE8QCm9_RpijHxhfVW_2ij-S2a3qCK2O8mzGlTWBRNAutzU3LtjVKpXt9IaelPZMg/s1600/orgchart.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOSNlSW_QqAjSosmmIIH6a5XDrDrxG71casQZQxms2WG5hf4Q4kVRUx0x1YZC2qumYaQt5LDL4ddIE8QCm9_RpijHxhfVW_2ij-S2a3qCK2O8mzGlTWBRNAutzU3LtjVKpXt9IaelPZMg/s640/orgchart.png&quot; width=&quot;580&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
If you’d like, you can&amp;nbsp;&lt;a href=&quot;https://jsfiddle.net/dparkinson/o4ck6bg8/&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;jump straight to the code to try it out&lt;/a&gt;.&lt;/div&gt;
&lt;h2 id=&quot;gettingthedata&quot; style=&quot;background-color: white; border-bottom-color: rgb(238, 238, 238); border-bottom-style: solid; border-bottom-width: 1px; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 1.75em; line-height: 1.225; margin-bottom: 16px; margin-top: 1em; padding-bottom: 0.3em; position: relative;&quot;&gt;
Getting the Data&lt;/h2&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
Before we get started, we’re going to get the raw data. For now, I’m going to do this using Powershell.&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
We need access to Active Directory via Powershell and in this case, I’m using Windows 10, so to access Active Directory I need to install the&amp;nbsp;&lt;a href=&quot;https://www.microsoft.com/en-gb/download/details.aspx?id=45520&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;Remote Server Administration Tools for Windows 10.&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
Once this is done, we can run the ‘Active Directory Module for Windows Powershell’ which will automatically load the Active Directory module.&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
At this point I can type&amp;nbsp;&lt;code style=&quot;background-color: rgba(0, 0, 0, 0.0392157); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; margin: 0px; padding: 0.2em 0px;&quot;&gt;Get-ADUser username&lt;/code&gt;&amp;nbsp;to return details of a single user and this confirms I have everything I need to access AD and get the details I need.&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
To extract the details for everyone and format the output to paste into my web page, I just need to run the following Powershell script:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; height: 241px; line-height: 1.45; margin-bottom: 16px; overflow: auto; padding: 16px; tab-size: 4; word-wrap: normal;&quot;&gt;&lt;code class=&quot;.ps1 hljs xquery&quot; style=&quot;border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; box-sizing: border-box; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; height: auto; line-height: inherit; margin: 0px; padding: 0.5em; word-wrap: normal;&quot;&gt;Import-Module ActiveDirectory  
&lt;span class=&quot;hljs-variable&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;$UKUsers&lt;/span&gt; = Get-ADUser -Searchbase &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;OU=Your,OU=Searchbase,OU=Here,DC=company,DC=com&quot;&lt;/span&gt; -Filter * -Properties * `  
 | select-object displayName, department, title, givenName, surname, @{Name=&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;manager&#39;&lt;/span&gt;;Expression={(Get-ADUser $&lt;span class=&quot;hljs-number&quot; style=&quot;box-sizing: border-box; color: #009999;&quot;&gt;_&lt;/span&gt;.Manager).Name}}, samaccountname  
foreach(&lt;span class=&quot;hljs-variable&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;$user&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;hljs-variable&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;$UKUsers&lt;/span&gt;) {  
     if (&lt;span class=&quot;hljs-variable&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;$user&lt;/span&gt;.manager) {  
        &lt;span class=&quot;hljs-variable&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;$photo&lt;/span&gt; = &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;http://our.photo.server/photo/&#39;&lt;/span&gt; + &lt;span class=&quot;hljs-variable&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;$user&lt;/span&gt;.samaccountname + &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;.jpg&#39;&lt;/span&gt;  
     Write-Output (&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;{&quot;name&quot;:&quot;&#39;&lt;/span&gt; + &lt;span class=&quot;hljs-variable&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;$user&lt;/span&gt;.displayname + &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;&quot;, &quot;manager&quot;:&quot;&#39;&lt;/span&gt; + &lt;span class=&quot;hljs-variable&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;$user&lt;/span&gt;.manager + &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;&quot;, &quot;photo&quot;:&quot;&#39;&lt;/span&gt;+ &lt;span class=&quot;hljs-variable&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;$photo&lt;/span&gt;  + &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;&quot;, &quot;title&quot;:&quot;&#39;&lt;/span&gt;+ &lt;span class=&quot;hljs-variable&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;$user&lt;/span&gt;.title  + &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;&quot;, &quot;&lt;/span&gt;&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;depart&lt;/span&gt;&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;ment&quot;:&quot;&#39;&lt;/span&gt;+ &lt;span class=&quot;hljs-variable&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;$user&lt;/span&gt;.department + &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;&quot; },&#39;&lt;/span&gt;)   
     }  
 }  
&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
I should note there are probably much better ways of doing this, including exporting all the data as CSV using&amp;nbsp;&lt;code style=&quot;background-color: rgba(0, 0, 0, 0.0392157); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; margin: 0px; padding: 0.2em 0px;&quot;&gt;$UKUsers | Export-CSV &quot;UserList.csv&quot;&lt;/code&gt;. Of note is that doing this would allow you to use the data for Visio too. I just wanted to paste it into the page for now.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
There are two things that I would highlight about this Powershell script. Firstly, I know that the Searchbase I used will return all currently employed people since the IT team keep that up to date and move the occasional leaver to another group. Secondly, it’s also fortunate that we store all our people photos on a centralised server.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
If the photos were stored in Active Directory though, I could easily get those by using the script in&amp;nbsp;&lt;a href=&quot;http://blog.darrenparkinson.uk/2013/12/using-powershell-to-extract-active.html&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;my previous post&lt;/a&gt;. I’d need to return the&amp;nbsp;&lt;code style=&quot;background-color: rgba(0, 0, 0, 0.0392157); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; margin: 0px; padding: 0.2em 0px;&quot;&gt;thumbnailPhoto&lt;/code&gt;&amp;nbsp;property and do the following:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; height: 146px; line-height: 1.45; margin-bottom: 16px; overflow: auto; padding: 16px; tab-size: 4; word-wrap: normal;&quot;&gt;&lt;code class=&quot;.ps1 hljs xquery&quot; style=&quot;border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; box-sizing: border-box; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; height: auto; line-height: inherit; margin: 0px; padding: 0.5em; word-wrap: normal;&quot;&gt;foreach (&lt;span class=&quot;hljs-variable&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;$user&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;hljs-variable&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;$UKUsers&lt;/span&gt;)
{
    &lt;span class=&quot;hljs-variable&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;$username&lt;/span&gt; = &lt;span class=&quot;hljs-variable&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;$user&lt;/span&gt;.displayname
    &lt;span class=&quot;hljs-variable&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;$user&lt;/span&gt;.thumbnailPhoto | Set-Content images/&lt;span class=&quot;hljs-variable&quot; style=&quot;box-sizing: border-box; color: teal;&quot;&gt;$username&lt;/span&gt;.png -Encoding byte
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 data-orig-id=&quot;d3.js-visualisingthedata.&quot; id=&quot;d3js-visualisingthedata&quot; style=&quot;background-color: white; border-bottom-color: rgb(238, 238, 238); border-bottom-style: solid; border-bottom-width: 1px; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 1.75em; line-height: 1.225; margin-bottom: 16px; margin-top: 1em; padding-bottom: 0.3em; position: relative;&quot;&gt;
D3.js - Visualising the data.&lt;/h2&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
To visualise the data, I’m using the&amp;nbsp;&lt;a href=&quot;file:///Users/darren/Dropbox%20(Personal)/Blog%20Posts/dparkinson.blogspot.co.uk/In%20Progress/d3js.org&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;d3.js&lt;/a&gt;&amp;nbsp;library. It is best described by the site as&amp;nbsp;&lt;em style=&quot;box-sizing: border-box;&quot;&gt;a JavaScript library for manipulating documents based on data. D3 helps you bring data to life using HTML, SVG, and CSS. D3’s emphasis on web standards gives you the full capabilities of modern browsers without tying yourself to a proprietary framework, combining powerful visualization components and a data-driven approach to DOM manipulation.&lt;/em&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
It’s a library that gives you the flexibility to create visualisations in whatever way you can imagine them. It doesn’t provide a bunch of canned diagrams (like Excel for example) but does provide some frameworks.&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
For this visualisation, I’m using a&amp;nbsp;&lt;em style=&quot;box-sizing: border-box;&quot;&gt;&lt;a href=&quot;https://github.com/mbostock/d3/wiki/Tree-Layout&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;Tree Layout&lt;/a&gt;&lt;/em&gt;&amp;nbsp;and specifically borrowing a lot of code from the&amp;nbsp;&lt;em style=&quot;box-sizing: border-box;&quot;&gt;&lt;a href=&quot;http://bl.ocks.org/mbostock/4339083&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;Collapsible Tree Layout ‘Block’&lt;/a&gt;&lt;/em&gt;, along with some of the ideas mentioned in&amp;nbsp;&lt;a href=&quot;http://www.d3noob.org/2014/01/tree-diagrams-in-d3js_11.html&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;this article&lt;/a&gt;. It is an incredibly flexible layout and I’m only scratching the surface of it here.&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
Since those posts do a great job of outlining the tree layout, I’ll simply highlight the things that I modified to come up with the example I have so far.&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
First of all, the data I’m getting is flat rather than hierarchical due to the way I’m getting it from AD, so I used the method in the aforementioned article to map the flat data into a format that the tree layout requires.&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; height: 346px; line-height: 1.45; margin-bottom: 16px; overflow: auto; padding: 16px; tab-size: 4; word-wrap: normal;&quot;&gt;&lt;code class=&quot;.js hljs crmsh&quot; style=&quot;border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; box-sizing: border-box; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; height: auto; line-height: inherit; margin: 0px; padding: 0.5em; word-wrap: normal;&quot;&gt;var dataMap = flatdata.reduce(function(map, &lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;node&lt;/span&gt;&lt;span class=&quot;hljs-identifier&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;hljs-title&quot; style=&quot;box-sizing: border-box; color: #990000; font-weight: bold;&quot;&gt;) {
    map&lt;/span&gt;[&lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;node&lt;/span&gt;.&lt;span class=&quot;hljs-identifier&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;hljs-title&quot; style=&quot;box-sizing: border-box; color: #990000; font-weight: bold;&quot;&gt;name&lt;/span&gt;] = &lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;node&lt;/span&gt;&lt;span class=&quot;hljs-identifier&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;hljs-title&quot; style=&quot;box-sizing: border-box; color: #990000; font-weight: bold;&quot;&gt;;
    return&lt;/span&gt; map;
}, {});

var treeData = [];

flatdata.forEach(function(&lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;node&lt;/span&gt;&lt;span class=&quot;hljs-identifier&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;hljs-title&quot; style=&quot;box-sizing: border-box; color: #990000; font-weight: bold;&quot;&gt;) {
    var&lt;/span&gt; manager = dataMap[&lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;node&lt;/span&gt;.&lt;span class=&quot;hljs-identifier&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;hljs-title&quot; style=&quot;box-sizing: border-box; color: #990000; font-weight: bold;&quot;&gt;manager&lt;/span&gt;];
    if (manager) {
        (manager.children || (manager.children = [])).push(&lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;node&lt;/span&gt;&lt;span class=&quot;hljs-identifier&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;hljs-title&quot; style=&quot;box-sizing: border-box; color: #990000; font-weight: bold;&quot;&gt;);
    } else&lt;/span&gt; { 
        treeData.push(&lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;node&lt;/span&gt;&lt;span class=&quot;hljs-identifier&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;hljs-title&quot; style=&quot;box-sizing: border-box; color: #990000; font-weight: bold;&quot;&gt;);
    }
});
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
I suspect this can be improved and moving forward, I’ll probably create a small API to return the JSON structure I need directly.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
We then set up everything else pretty much exactly as the&amp;nbsp;&lt;a href=&quot;http://bl.ocks.org/mbostock/4339083&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;example&lt;/a&gt;&amp;nbsp;shows with the exception of using our data instead of loading it from a json file.&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
I made the circles larger by editing the radius:&amp;nbsp;&lt;code style=&quot;background-color: rgba(0, 0, 0, 0.0392157); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; margin: 0px; padding: 0.2em 0px;&quot;&gt;.attr(&quot;r&quot;, 40)&lt;/code&gt;, and in doing so, I found that since the example is using small circles and no text, I needed a bit more room for each person. To do that, I edited the following line to increase the ‘depth’ and therefore the distance, between each level.&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; height: 66px; line-height: 1.45; margin-bottom: 16px; overflow: auto; padding: 16px; tab-size: 4; word-wrap: normal;&quot;&gt;&lt;code class=&quot;.js hljs php&quot; style=&quot;border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; box-sizing: border-box; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; height: auto; line-height: inherit; margin: 0px; padding: 0.5em; word-wrap: normal;&quot;&gt;nodes.&lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;forEach&lt;/span&gt;(&lt;span class=&quot;hljs-function&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;hljs-params&quot; style=&quot;box-sizing: border-box;&quot;&gt;(d)&lt;/span&gt; &lt;/span&gt;{ d.y = d.depth * &lt;span class=&quot;hljs-number&quot; style=&quot;box-sizing: border-box; color: #009999;&quot;&gt;300&lt;/span&gt;; });
&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
To add the photo, I appended an image to each node and used a clip path to turn it into a circle, using the same dimensions of the nodes circle. I modified&amp;nbsp;&lt;a href=&quot;http://bl.ocks.org/d3noob/9662ab6d5ac823c0e444&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;another example&lt;/a&gt;&amp;nbsp;to achieve this:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; height: 306px; line-height: 1.45; margin-bottom: 16px; overflow: auto; padding: 16px; tab-size: 4; word-wrap: normal;&quot;&gt;&lt;code class=&quot;.js hljs go&quot; style=&quot;border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; box-sizing: border-box; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; height: auto; line-height: inherit; margin: 0px; padding: 0.5em; word-wrap: normal;&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;var&lt;/span&gt; defs = nodesLayer.&lt;span class=&quot;hljs-built_in&quot; style=&quot;box-sizing: border-box; color: #0086b3;&quot;&gt;append&lt;/span&gt;(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;defs&#39;&lt;/span&gt;);
&lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;var&lt;/span&gt; clipPath = defs.&lt;span class=&quot;hljs-built_in&quot; style=&quot;box-sizing: border-box; color: #0086b3;&quot;&gt;append&lt;/span&gt;(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;clipPath&#39;&lt;/span&gt;)
    .attr(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;id&#39;&lt;/span&gt;, &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;clip-circle&#39;&lt;/span&gt;)
    .&lt;span class=&quot;hljs-built_in&quot; style=&quot;box-sizing: border-box; color: #0086b3;&quot;&gt;append&lt;/span&gt;(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;circle&#39;&lt;/span&gt;)
    .attr(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;r&#39;&lt;/span&gt;, &lt;span class=&quot;hljs-number&quot; style=&quot;box-sizing: border-box; color: #009999;&quot;&gt;40&lt;/span&gt;);

nodeEnter.&lt;span class=&quot;hljs-built_in&quot; style=&quot;box-sizing: border-box; color: #0086b3;&quot;&gt;append&lt;/span&gt;(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;image&quot;&lt;/span&gt;)
      .attr(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;xlink:href&quot;&lt;/span&gt;, function(d) { &lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;return&lt;/span&gt; d.photo; })
      .attr(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;x&quot;&lt;/span&gt;, &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;-43px&quot;&lt;/span&gt;)
      .attr(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;y&quot;&lt;/span&gt;, &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;-43px&quot;&lt;/span&gt;)
      .attr(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;width&quot;&lt;/span&gt;, &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;86px&quot;&lt;/span&gt;)
      .attr(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;height&quot;&lt;/span&gt;, &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;86px&quot;&lt;/span&gt;)
      .attr(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;clip-path&#39;&lt;/span&gt;, &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&#39;url(#clip-circle)&#39;&lt;/span&gt;);
&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
Finally, I added the text to each node as follows:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 14px; height: 406px; line-height: 1.45; margin-bottom: 16px; overflow: auto; padding: 16px; tab-size: 4; word-wrap: normal;&quot;&gt;&lt;code class=&quot;hljs actionscript&quot; style=&quot;border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; box-sizing: border-box; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; height: auto; line-height: inherit; margin: 0px; padding: 0.5em; word-wrap: normal;&quot;&gt;nodeEnter.append(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;text&quot;&lt;/span&gt;)
    .attr(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;x&quot;&lt;/span&gt;, &lt;span class=&quot;hljs-function&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;hljs-params&quot; style=&quot;box-sizing: border-box;&quot;&gt;(d)&lt;/span&gt; &lt;/span&gt;{ &lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;return&lt;/span&gt; d.children || d._children ? -&lt;span class=&quot;hljs-number&quot; style=&quot;box-sizing: border-box; color: #009999;&quot;&gt;55&lt;/span&gt; : &lt;span class=&quot;hljs-number&quot; style=&quot;box-sizing: border-box; color: #009999;&quot;&gt;55&lt;/span&gt;; })
    .attr(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;dy&quot;&lt;/span&gt;, &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;-15&quot;&lt;/span&gt;)
    .attr(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;text-anchor&quot;&lt;/span&gt;, &lt;span class=&quot;hljs-function&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;hljs-params&quot; style=&quot;box-sizing: border-box;&quot;&gt;(d)&lt;/span&gt; &lt;/span&gt;{ &lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;return&lt;/span&gt; d.children || d._children ? &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;end&quot;&lt;/span&gt; : &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;start&quot;&lt;/span&gt;; })
    .text(&lt;span class=&quot;hljs-function&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;hljs-params&quot; style=&quot;box-sizing: border-box;&quot;&gt;(d)&lt;/span&gt; &lt;/span&gt;{ &lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;return&lt;/span&gt; d.name; })
    .style(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;fill-opacity&quot;&lt;/span&gt;, &lt;span class=&quot;hljs-number&quot; style=&quot;box-sizing: border-box; color: #009999;&quot;&gt;1&lt;/span&gt;);
nodeEnter.append(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;text&quot;&lt;/span&gt;)
    .attr(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;x&quot;&lt;/span&gt;, &lt;span class=&quot;hljs-function&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;hljs-params&quot; style=&quot;box-sizing: border-box;&quot;&gt;(d)&lt;/span&gt; &lt;/span&gt;{ &lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;return&lt;/span&gt; d.children || d._children ? -&lt;span class=&quot;hljs-number&quot; style=&quot;box-sizing: border-box; color: #009999;&quot;&gt;55&lt;/span&gt; : &lt;span class=&quot;hljs-number&quot; style=&quot;box-sizing: border-box; color: #009999;&quot;&gt;55&lt;/span&gt;; })
    .attr(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;dy&quot;&lt;/span&gt;, &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;0&quot;&lt;/span&gt;)
    .attr(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;text-anchor&quot;&lt;/span&gt;, &lt;span class=&quot;hljs-function&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;hljs-params&quot; style=&quot;box-sizing: border-box;&quot;&gt;(d)&lt;/span&gt; &lt;/span&gt;{ &lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;return&lt;/span&gt; d.children || d._children ? &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;end&quot;&lt;/span&gt; : &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;start&quot;&lt;/span&gt;; })
    .text(&lt;span class=&quot;hljs-function&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;hljs-params&quot; style=&quot;box-sizing: border-box;&quot;&gt;(d)&lt;/span&gt; &lt;/span&gt;{ &lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;return&lt;/span&gt; d.title; })
    .style(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;fill-opacity&quot;&lt;/span&gt;, &lt;span class=&quot;hljs-number&quot; style=&quot;box-sizing: border-box; color: #009999;&quot;&gt;1&lt;/span&gt;);
nodeEnter.append(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;text&quot;&lt;/span&gt;)
    .attr(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;x&quot;&lt;/span&gt;, &lt;span class=&quot;hljs-function&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;hljs-params&quot; style=&quot;box-sizing: border-box;&quot;&gt;(d)&lt;/span&gt; &lt;/span&gt;{ &lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;return&lt;/span&gt; d.children || d._children ? -&lt;span class=&quot;hljs-number&quot; style=&quot;box-sizing: border-box; color: #009999;&quot;&gt;55&lt;/span&gt; : &lt;span class=&quot;hljs-number&quot; style=&quot;box-sizing: border-box; color: #009999;&quot;&gt;55&lt;/span&gt;; })
    .attr(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;dy&quot;&lt;/span&gt;, &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;15&quot;&lt;/span&gt;)
    .attr(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;text-anchor&quot;&lt;/span&gt;, &lt;span class=&quot;hljs-function&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;hljs-params&quot; style=&quot;box-sizing: border-box;&quot;&gt;(d)&lt;/span&gt; &lt;/span&gt;{ &lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;return&lt;/span&gt; d.children || d._children ? &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;end&quot;&lt;/span&gt; : &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;start&quot;&lt;/span&gt;; })
    .text(&lt;span class=&quot;hljs-function&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;hljs-params&quot; style=&quot;box-sizing: border-box;&quot;&gt;(d)&lt;/span&gt; &lt;/span&gt;{ &lt;span class=&quot;hljs-keyword&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;(&quot;&lt;/span&gt; + d.department + &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;)&quot;&lt;/span&gt;; })
    .style(&lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: #dd1144;&quot;&gt;&quot;fill-opacity&quot;&lt;/span&gt;, &lt;span class=&quot;hljs-number&quot; style=&quot;box-sizing: border-box; color: #009999;&quot;&gt;1&lt;/span&gt;);
&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
I feel like this could probably be consolidated too.&lt;/div&gt;
&lt;h2 id=&quot;nextsteps&quot; style=&quot;background-color: white; border-bottom-color: rgb(238, 238, 238); border-bottom-style: solid; border-bottom-width: 1px; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 1.75em; line-height: 1.225; margin-bottom: 16px; margin-top: 1em; padding-bottom: 0.3em; position: relative;&quot;&gt;
Next Steps&lt;/h2&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 16px;&quot;&gt;
These few simple modifications were all I required in order to help me visualise the new structure easily. In terms of follow up, these are some of the things I’d like to add:&lt;/div&gt;
&lt;ul style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin-bottom: 0px !important; margin-top: 0px; padding: 0px 0px 0px 2em;&quot;&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;Use real-time data from Active Directory so I don’t have to export it using PowerShell;&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;Embed it into Office 365 or load it onto Azure so that it’s available outside the network to a wider (authenticated) audience;&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;Improve the styling and add our corporate branding;&lt;/li&gt;
&lt;li style=&quot;box-sizing: border-box;&quot;&gt;Perhaps incorporate drag and drop capability from&amp;nbsp;&lt;a href=&quot;http://bl.ocks.org/robschmuecker/7880033&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #4183c4; text-decoration: none;&quot;&gt;this example&lt;/a&gt;&amp;nbsp;to allow for a larger, fully expanded diagram;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;span style=&quot;color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #333333; font-family: helvetica, arial, freesans, clean, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://blog.darrenparkinson.uk/feeds/4011907080212777955/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.darrenparkinson.uk/2016/01/new-year-new-org-chart-visualising.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/4011907080212777955'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/4011907080212777955'/><link rel='alternate' type='text/html' href='http://blog.darrenparkinson.uk/2016/01/new-year-new-org-chart-visualising.html' title='New Year, New Org Chart - Visualising organisation data with d3.js'/><author><name>Darren Parkinson</name><uri>http://www.blogger.com/profile/01084077294541066454</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOSNlSW_QqAjSosmmIIH6a5XDrDrxG71casQZQxms2WG5hf4Q4kVRUx0x1YZC2qumYaQt5LDL4ddIE8QCm9_RpijHxhfVW_2ij-S2a3qCK2O8mzGlTWBRNAutzU3LtjVKpXt9IaelPZMg/s72-c/orgchart.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27381059098267211.post-2213175676752145271</id><published>2015-02-25T13:12:00.001+00:00</published><updated>2015-02-25T19:59:15.408+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="hue"/><category scheme="http://www.blogger.com/atom/ns#" term="jabber"/><category scheme="http://www.blogger.com/atom/ns#" term="scripting"/><title type='text'>Lighting a Cisco Jabber Video Call with Philips Hue</title><content type='html'>&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 15px;&quot;&gt;
With the recent release of the beautiful new&amp;nbsp;&lt;a href=&quot;http://www.cisco.com/c/en/us/products/collaboration-endpoints/ix5000-series/index.html&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;Cisco TelePresence IX5000&lt;/a&gt;&amp;nbsp;with ‘integrated lighting’, it got me thinking about my lighting in the home office for video calls again.&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg14PoQptibp-CxHoHUUBM4GFicmg9qrpKd-fx6IdTJ2sJjWD8m9EYifmOQacPLVlUyi7zGeu010K0Nfq7b-80c909W789aamYKcuEJypMlBR0Whe2Tizm0hn7VTodvZZi2O25cL9BVzk0/s1600/cisco-ix5000.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg14PoQptibp-CxHoHUUBM4GFicmg9qrpKd-fx6IdTJ2sJjWD8m9EYifmOQacPLVlUyi7zGeu010K0Nfq7b-80c909W789aamYKcuEJypMlBR0Whe2Tizm0hn7VTodvZZi2O25cL9BVzk0/s1600/cisco-ix5000.jpg&quot; height=&quot;197&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
I also have a passing interest in photography and had&amp;nbsp;&lt;a href=&quot;https://fstoppers.com/video/three-easy-steps-improve-your-lighting-webcam-9397&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;read an article&lt;/a&gt;&amp;nbsp;earlier last year specifically about the topic of improving webcam lighting and it’s something I’ve often thought could use improvement at my end.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
It’s definitely worth watching the&amp;nbsp;&lt;a href=&quot;http://www.spreecast.com/events/illuminating-the-face-tutorial-launch&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;video&lt;/a&gt;&amp;nbsp;linked in the article and skipping through to 02:56 when Peter brings in Patrick and then skipping to 04:25 where Patrick gives a quick tour of his setup.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Whilst that lighting might be a bit extreme for non-photographers and for everyday video calls, the general principles remain the same.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
So, with that in mind, and the ability to have&amp;nbsp;&lt;a href=&quot;file:///Users/darren/Dropbox%20(Personal)/Blog%20Posts/dparkinson.blogspot.co.uk/In%20Progress/%22http://dparkinson.blogspot.co.uk/2014/11/cisco-jabber-custom-tabs-cti-screen-pop.html&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;custom tabs in Jabber&lt;/a&gt;, along with the recent arrival of some&amp;nbsp;&lt;a href=&quot;http://www2.meethue.com/en-gb/&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;Philips Hue&lt;/a&gt;&amp;nbsp;lighting, I thought now would be an ideal time to investigate this further and add some automation.&amp;nbsp;&lt;/div&gt;
&lt;h3 id=&quot;lighting&quot; style=&quot;background-color: white; cursor: text; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 1.5em; line-height: 1.7; margin: 1em 0px 15px; padding: 0px; position: relative;&quot;&gt;
Lighting&lt;/h3&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 15px;&quot;&gt;
For the lighting setup, based on the layout of the room, it seemed the easiest way to achieve reasonable lighting was to use the following:&amp;nbsp;&lt;/div&gt;
&lt;ul style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; padding-left: 30px;&quot;&gt;
&lt;li&gt;main room light as some backlighting, providing highlight to my head and shoulders;&lt;/li&gt;
&lt;li&gt;rear lamp for additional backlighting to provide separation from the background;&lt;/li&gt;
&lt;li&gt;front lamp to provide a consistent key light for my face;&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Also important is the colour of the light. If you’ve ever been on a video call with a dozen people or so, it’s easy to tell the ones working from home later on in the day as they have that typical orange look you get from tungsten lights.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
The hue lights are capable of lots of different whites and colours so I should be able to find something that works. Cisco, in their video design guide, specifically suggest the following:&amp;nbsp;&lt;/div&gt;
&lt;blockquote style=&quot;background-color: white; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 4px; color: #777777; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin: 15px 0px; padding: 0px 15px;&quot;&gt;
Generally a good light color temperature&lt;br /&gt;is 4000 kelvin, but consider&lt;br /&gt;increasing this number if you depend&lt;br /&gt;mostly on daylight as your light source.&lt;br /&gt;A color-rendering index (CRI) of 80 or&lt;br /&gt;better is important. Avoid mixing technologies&lt;br /&gt;such as fluorescents and LED&lt;br /&gt;because their color profiles differ.&amp;nbsp;&lt;/blockquote&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Philips uses a subset of the CIE colour space for its bulbs. For white light, hue supports colour temperatures from 2000K (warm) to 6500K (cold). From the&amp;nbsp;&lt;a href=&quot;http://www.developers.meethue.com/documentation/core-concepts&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;core concepts&lt;/a&gt;&amp;nbsp;development page, it says :&amp;nbsp;&lt;/div&gt;
&lt;blockquote style=&quot;background-color: white; border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 4px; color: #777777; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin: 15px 0px; padding: 0px 15px;&quot;&gt;
To set the light to a white value you need to interact with the “ct” (color temperature) resource, which takes values in a scale called “reciprocal megakelvin” or “mirek”. Using this scale, the warmest color 2000K is 500 mirek (“ct”:500) and the coldest color 6500K is 153 mirek (“ct”:153)&amp;nbsp;&lt;/blockquote&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
So I think that makes 4000 kelvin equal to about 346 mirek. In reality, I’m going to set a scene consisting of various lights set to colours that represent what looks to be a good white light for video calls.&amp;nbsp;&lt;/div&gt;
&lt;h3 id=&quot;philipshue&quot; style=&quot;background-color: white; cursor: text; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 1.5em; line-height: 1.7; margin: 1em 0px 15px; padding: 0px; position: relative;&quot;&gt;
Philips Hue&lt;/h3&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 15px;&quot;&gt;
In case you don’t know or haven’t worked it out already, Philips Hue is an LED lighting system that consists of a bridge and bulbs that let you select an entire spectrum of colours and whites from a mobile app. You can also set preset ‘scenes’ of light that you can then assign to alarms or timers or use in conjunction with geofencing capability.&amp;nbsp;&lt;/div&gt;
&lt;h4 id=&quot;settingthescene&quot; style=&quot;background-color: white; cursor: text; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 1.2em; line-height: 1.7; margin: 1em 0px 15px; padding: 0px; position: relative;&quot;&gt;
Setting the Scene&lt;/h4&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 15px;&quot;&gt;
First of all, we’ll set the lights up as we’d like them to be for a video call and save the various settings for each of the bulbs into a scene.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Using the iPhone app, I’ve created a new Scene called ‘Study Video’ which is based on a preset ‘Light Recipe’ of ‘Concentrate’ that I think creates a nice white light for video calls. Looking at the settings, it appears to have a&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;ct&lt;/code&gt;&amp;nbsp;(Colour Temperature) value of 234 mirek. This is a little cooler than the 4000k (346 mirek) discussed earlier, but it seems pretty good so long as you keep the brightness under control. In fact I tried setting&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;ct&lt;/code&gt;&amp;nbsp;to 346 and it was definitely too warm for a video call in my opinion, so either my calculations are wrong or I prefer a more daylight look.&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyiPKXZuQGjfuLK6CBAZtzZImga4AK6KdN-XgxTTAkrbQTnT27pqoiBe8Dg5XlXbCMA2DdP81PI0RbqtppnnZhIaBKUIeKJYWZzHSPiEZbgtpce2pDoE49TYTVYolfBBUTGf5FOKqGCUA/s1600/image1.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyiPKXZuQGjfuLK6CBAZtzZImga4AK6KdN-XgxTTAkrbQTnT27pqoiBe8Dg5XlXbCMA2DdP81PI0RbqtppnnZhIaBKUIeKJYWZzHSPiEZbgtpce2pDoE49TYTVYolfBBUTGf5FOKqGCUA/s1600/image1.PNG&quot; height=&quot;400&quot; width=&quot;225&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
This scene will then consist of all the bulbs that I want to use during a video call along with their brightness settings:&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhn7mhyTsa8SQSRNVzUcxG_e_sM6dTKsjJzNj6QDTDq7nCdk3YWpFdzPkkVDOs86_OhAoQcTAhiOpwi3ymCh-ugboaQnJkCKUovtk9XyuJYf90JcRFjFm5c9TqeEC6YbJKGtY3LuiJdp8A/s1600/image3.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhn7mhyTsa8SQSRNVzUcxG_e_sM6dTKsjJzNj6QDTDq7nCdk3YWpFdzPkkVDOs86_OhAoQcTAhiOpwi3ymCh-ugboaQnJkCKUovtk9XyuJYf90JcRFjFm5c9TqeEC6YbJKGtY3LuiJdp8A/s1600/image3.PNG&quot; height=&quot;400&quot; width=&quot;225&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Then I just need to set that scene when I’m on a video call. I could do that manually, which I’m doing at present, but where is the fun in that?&amp;nbsp;&lt;/div&gt;
&lt;h4 id=&quot;developinghue&quot; style=&quot;background-color: white; cursor: text; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 1.2em; line-height: 1.7; margin: 1em 0px 15px; padding: 0px; position: relative;&quot;&gt;
Developing Hue&lt;/h4&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 15px;&quot;&gt;
There is&amp;nbsp;&lt;ins id=&quot;firstdiff&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; display: inline-block; left: -8px; position: absolute; text-decoration: none !important;&quot;&gt;&lt;/ins&gt;a&amp;nbsp;&lt;a href=&quot;http://www.developers.meethue.com/&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;developer program&lt;/a&gt;&amp;nbsp;for anyone interested in playing around with the platform. That’s good for us since that’s what we want to do here. We want to access the hue platform to set the scene programmatically when we’re on a video call.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Following the details in the&amp;nbsp;&lt;a href=&quot;http://www.developers.meethue.com/documentation/getting-started&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;Getting Started&lt;/a&gt;&amp;nbsp;section of the developer site, that’s quite straight forward.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
First of all, if we don’t already know it, we need to identify the IP address of our bridge, either from the app, or by visiting&amp;nbsp;&lt;a href=&quot;file:///Users/darren/Dropbox%20(Personal)/Blog%20Posts/dparkinson.blogspot.co.uk/In%20Progress/www.meethue.com/api/nupnp&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;www.meethue.com/api/nupnp&lt;/a&gt;.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Once we have that, we can visit the debug tool at&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;http://&lt;bridge address=&quot;&quot; ip=&quot;&quot;&gt;/debug/clip.html&lt;/bridge&gt;&lt;/code&gt;&amp;nbsp;and create a new user for Cisco Jabber to use for setting the scene. First press the button on the bridge and then click the POST button:&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtmghZcNY99BvFKNpwhrn2Zi6l6DeL2FqcBkU1RtLhs_jf3j4vSjmsUW-4zFSMW0WbcOqbJ2MyuHUo7fDX6fIBZUyd-QmxXdNljNSC3EW21-oDM7Y0LiZBbnlnJ9_RGfNFM92ZuDYMub8/s1600/CreatingHueUser.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtmghZcNY99BvFKNpwhrn2Zi6l6DeL2FqcBkU1RtLhs_jf3j4vSjmsUW-4zFSMW0WbcOqbJ2MyuHUo7fDX6fIBZUyd-QmxXdNljNSC3EW21-oDM7Y0LiZBbnlnJ9_RGfNFM92ZuDYMub8/s1600/CreatingHueUser.png&quot; height=&quot;320&quot; width=&quot;292&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Once we’ve done this, we can find our scene’s unique reference by using the GET method on&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;/api/ciscojabber/scenes&lt;/code&gt;. For the scene I created earlier, this returns the following:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 14px; line-height: 19px; margin-bottom: 26px; margin-top: 26px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot; hljs makefile&quot; style=&quot;border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: none; color: #333333; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;&quot;a6f3d23ca-on-0&quot;: {
  &lt;span class=&quot;hljs-string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;name&quot;&lt;/span&gt;: &lt;span class=&quot;hljs-string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;Study Video Call&quot;&lt;/span&gt;,
  &lt;span class=&quot;hljs-string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;lights&quot;&lt;/span&gt;: [
   &lt;span class=&quot;hljs-string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;1&quot;&lt;/span&gt;,
   &lt;span class=&quot;hljs-string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;2&quot;&lt;/span&gt;,
   &lt;span class=&quot;hljs-string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;3&quot;&lt;/span&gt;
  ],
  &lt;span class=&quot;hljs-string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;active&quot;&lt;/span&gt;: true
}&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
I also created an additional scene to turn the lights off at the end of the call which looks like this:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 14px; line-height: 19px; margin-bottom: 26px; margin-top: 26px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot; hljs makefile&quot; style=&quot;border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: none; color: #333333; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;&quot;a87ff679a-off-0&quot;: {
  &lt;span class=&quot;hljs-string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;name&quot;&lt;/span&gt;: &lt;span class=&quot;hljs-string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;Study Video Call Off&quot;&lt;/span&gt;,
  &lt;span class=&quot;hljs-string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;lights&quot;&lt;/span&gt;: [
   &lt;span class=&quot;hljs-string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;1&quot;&lt;/span&gt;,
   &lt;span class=&quot;hljs-string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;2&quot;&lt;/span&gt;,
   &lt;span class=&quot;hljs-string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;3&quot;&lt;/span&gt;
  ],
  &lt;span class=&quot;hljs-string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;active&quot;&lt;/span&gt;: true
}&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Running the scene is a little more complicated. Essentially, you have to use the&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;PUT&lt;/code&gt;&amp;nbsp;method and pass in a small amount of JSON containing the scene reference to a special group. Group 0 consists of all the lights, but when you pass in the scene, it only applies to the lights within that scene:&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
So performing a&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;PUT&lt;/code&gt;&amp;nbsp;to&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;/api/newdeveloper/groups/0/action&lt;/code&gt;&amp;nbsp;with the body of&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;{&quot;scene&quot;:&quot;a6f3d23ca-on-0&quot;}&lt;/code&gt;, using the scene reference we obtained earlier, activates our scene.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
This will return as response as follows:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 14px; line-height: 19px; margin-bottom: 26px; margin-top: 26px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot; hljs json&quot; style=&quot;border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: none; color: #333333; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;[
 {
  &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;color: teal;&quot;&gt;success&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot;&gt;{
   &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;color: teal;&quot;&gt;/groups/0/action/scene&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot;&gt;&lt;span class=&quot;hljs-string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;a6f3d23ca-on-0&quot;&lt;/span&gt;
  &lt;/span&gt;}
 &lt;/span&gt;}
]&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Now that we know this, it just remains for us to identify when we are on a video call and perform the same action. We can also use the ‘off’ scene to turn all the lights off after the call. For a better solution, we should really check what the lights are set to before the video call and set them back to the same state, but that’s for another day.&amp;nbsp;&lt;/div&gt;
&lt;h3 id=&quot;ciscojabber&quot; style=&quot;background-color: white; cursor: text; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 1.5em; line-height: 1.7; margin: 1em 0px 15px; padding: 0px; position: relative;&quot;&gt;
Cisco Jabber&lt;/h3&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 15px;&quot;&gt;
To identify when we are on a call, we will use the JavaScript API that is available in Custom Tabs for the Cisco Jabber client. I’ve&amp;nbsp;&lt;a href=&quot;file:///Users/darren/Dropbox%20(Personal)/Blog%20Posts/dparkinson.blogspot.co.uk/In%20Progress/%22http://dparkinson.blogspot.co.uk/2014/11/cisco-jabber-custom-tabs-cti-screen-pop.html&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;spoken about Custom Tabs before&lt;/a&gt;, so I won’t repeat too much except to say that I added the tab locally using the&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;File --&amp;gt; New --&amp;gt; Custom Tab&lt;/code&gt;&amp;nbsp;option.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Unfortunately at present, it doesn’t appear that the Jabber API allows us to distinguish between voice and video calls, but since my calls are increasingly video enabled by default, then it’s not too much of an issue.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
As before, we require a simple HTML file, something like this:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 14px; line-height: 19px; margin-bottom: 26px; margin-top: 26px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot; hljs xml&quot; style=&quot;border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: none; color: #333333; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;hljs-doctype&quot; style=&quot;color: #999999; font-weight: bold;&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;hljs-tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-title&quot;&gt;html&lt;/span&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;hljs-tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-title&quot;&gt;head&lt;/span&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;hljs-tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-title&quot;&gt;title&lt;/span&gt;&amp;gt;&lt;/span&gt;Hue App&lt;span class=&quot;hljs-tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-title&quot;&gt;title&lt;/span&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;hljs-tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-title&quot;&gt;script&lt;/span&gt; &lt;span class=&quot;hljs-attribute&quot; style=&quot;color: teal;&quot;&gt;src&lt;/span&gt;=&lt;span class=&quot;hljs-value&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;jquery.min.js&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;javascript&quot;&gt;&lt;/span&gt;&lt;span class=&quot;hljs-tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-title&quot;&gt;script&lt;/span&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;hljs-tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-title&quot;&gt;script&lt;/span&gt; &lt;span class=&quot;hljs-attribute&quot; style=&quot;color: teal;&quot;&gt;src&lt;/span&gt;=&lt;span class=&quot;hljs-value&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;hue-lights.js&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;javascript&quot;&gt;&lt;/span&gt;&lt;span class=&quot;hljs-tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-title&quot;&gt;script&lt;/span&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;hljs-tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-title&quot;&gt;head&lt;/span&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;hljs-tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-title&quot;&gt;body&lt;/span&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;hljs-tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-title&quot;&gt;h1&lt;/span&gt;&amp;gt;&lt;/span&gt;Hue App&lt;span class=&quot;hljs-tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-title&quot;&gt;h1&lt;/span&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;hljs-tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-title&quot;&gt;div&lt;/span&gt; &lt;span class=&quot;hljs-attribute&quot; style=&quot;color: teal;&quot;&gt;id&lt;/span&gt;=&lt;span class=&quot;hljs-value&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;ctilog&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;hljs-tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-title&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;hljs-tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-title&quot;&gt;body&lt;/span&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;hljs-tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-title&quot;&gt;html&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
I’ve added jQuery to make the HTTP PUT request and a reference to our basic javascript in&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;hue-lights.js&lt;/code&gt;&amp;nbsp;for making the calls to the hue bridge.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
The&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;hue-lights.js&lt;/code&gt;&amp;nbsp;file then looks as follows:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 14px; line-height: 19px; margin-bottom: 26px; margin-top: 26px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot; hljs javascript&quot; style=&quot;border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: none; color: #333333; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;font-weight: bold;&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;hljs-title&quot;&gt;OnTelephonyConversationStateChanged&lt;/span&gt;&lt;span class=&quot;hljs-params&quot;&gt;(json)&lt;/span&gt; &lt;/span&gt;{
 &lt;span class=&quot;hljs-keyword&quot; style=&quot;font-weight: bold;&quot;&gt;var&lt;/span&gt; myDiv = &lt;span class=&quot;hljs-built_in&quot; style=&quot;color: #0086b3;&quot;&gt;document&lt;/span&gt;.getElementById(&lt;span class=&quot;hljs-string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;ctilog&quot;&lt;/span&gt;);
    &lt;span class=&quot;hljs-keyword&quot; style=&quot;font-weight: bold;&quot;&gt;var&lt;/span&gt; conversation = &lt;span class=&quot;hljs-built_in&quot; style=&quot;color: #0086b3;&quot;&gt;JSON&lt;/span&gt;.parse(json);
    
    &lt;span class=&quot;hljs-comment&quot; style=&quot;color: #999988; font-style: italic;&quot;&gt;// Turn the lights on for an incoming call&lt;/span&gt;
    &lt;span class=&quot;hljs-keyword&quot; style=&quot;font-weight: bold;&quot;&gt;if&lt;/span&gt; (conversation.acceptanceState == &lt;span class=&quot;hljs-string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;Pending&quot;&lt;/span&gt; &amp;amp;&amp;amp; conversation.state == &lt;span class=&quot;hljs-string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;Started&quot;&lt;/span&gt;) {
     myDiv.innerHTML += &lt;span class=&quot;hljs-string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;
Turning Lights On 
&quot;&lt;/span&gt;;
   $.ajax({
    url: &lt;span class=&quot;hljs-string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;http://192.168.1.6/api/ciscojabber/groups/0/action&#39;&lt;/span&gt;,
    type: &lt;span class=&quot;hljs-string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;PUT&#39;&lt;/span&gt;,
    data: &lt;span class=&quot;hljs-string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;{&quot;scene&quot;:&quot;a6f3d23ca-on-0&quot;}&#39;&lt;/span&gt;,
    success: &lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;font-weight: bold;&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;hljs-params&quot;&gt;(response)&lt;/span&gt; &lt;/span&gt;{
     myDiv.innerHTML += &lt;span class=&quot;hljs-string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;Hue Response:
&quot;&lt;/span&gt; + &lt;span class=&quot;hljs-built_in&quot; style=&quot;color: #0086b3;&quot;&gt;JSON&lt;/span&gt;.stringify(response) + &lt;span class=&quot;hljs-string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;
&quot;&lt;/span&gt;;
    }
   });
  }
  
  &lt;span class=&quot;hljs-comment&quot; style=&quot;color: #999988; font-style: italic;&quot;&gt;// Turn the lights off when the call ends&lt;/span&gt;
  &lt;span class=&quot;hljs-keyword&quot; style=&quot;font-weight: bold;&quot;&gt;if&lt;/span&gt; (conversation.acceptanceState == &lt;span class=&quot;hljs-string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;Rejected&quot;&lt;/span&gt; &amp;amp;&amp;amp; conversation.state == &lt;span class=&quot;hljs-string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;Ended&quot;&lt;/span&gt;) {
   myDiv.innerHTML += &lt;span class=&quot;hljs-string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;
Turning Lights Off 
&quot;&lt;/span&gt;;
   $.ajax({
    url: &lt;span class=&quot;hljs-string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;http://192.168.1.6/api/ciscojabber/groups/0/action&#39;&lt;/span&gt;,
    type: &lt;span class=&quot;hljs-string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;PUT&#39;&lt;/span&gt;,
    data: &lt;span class=&quot;hljs-string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;{&quot;scene&quot;:&quot;19a493ad2-off-0&quot;}&#39;&lt;/span&gt;,
    success: &lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;font-weight: bold;&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;hljs-params&quot;&gt;(response)&lt;/span&gt; &lt;/span&gt;{
     myDiv.innerHTML += &lt;span class=&quot;hljs-string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;Hue Response:
 &quot;&lt;/span&gt; + &lt;span class=&quot;hljs-built_in&quot; style=&quot;color: #0086b3;&quot;&gt;JSON&lt;/span&gt;.stringify(response) + &lt;span class=&quot;hljs-string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;
&quot;&lt;/span&gt;;
    }
   });
  }
}
 &lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
We don’t really need a UI for this, but the following shows the simple UI provided by the HTML and Javascript we added above:&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjS8LYCWIm55AlOe5p9yJj-inJRiplKUtGK1fRa0II9HtTt3ghN0DmRwML6pSegABAydTi2HP9BU53hLDeExmVitsDV24oOiHp6aLnPVgnGDdotmJ4O96zRy7PGUzRgxR4LcDj0fUtLG4Y/s1600/cisco_hueapp.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjS8LYCWIm55AlOe5p9yJj-inJRiplKUtGK1fRa0II9HtTt3ghN0DmRwML6pSegABAydTi2HP9BU53hLDeExmVitsDV24oOiHp6aLnPVgnGDdotmJ4O96zRy7PGUzRgxR4LcDj0fUtLG4Y/s1600/cisco_hueapp.png&quot; height=&quot;400&quot; width=&quot;296&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
After some initial testing, it’s working great. I also have a more visual notification now of incoming calls too which is a bonus.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-top: 15px;&quot;&gt;
Clearly there are quite a few improvements I could make, but hopefully this provides an overview of what’s possible with a few simple lines of code.&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-top: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-top: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://blog.darrenparkinson.uk/feeds/2213175676752145271/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.darrenparkinson.uk/2015/02/lighting-cisco-jabber-video-call-with.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/2213175676752145271'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/2213175676752145271'/><link rel='alternate' type='text/html' href='http://blog.darrenparkinson.uk/2015/02/lighting-cisco-jabber-video-call-with.html' title='Lighting a Cisco Jabber Video Call with Philips Hue'/><author><name>Darren Parkinson</name><uri>http://www.blogger.com/profile/01084077294541066454</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg14PoQptibp-CxHoHUUBM4GFicmg9qrpKd-fx6IdTJ2sJjWD8m9EYifmOQacPLVlUyi7zGeu010K0Nfq7b-80c909W789aamYKcuEJypMlBR0Whe2Tizm0hn7VTodvZZi2O25cL9BVzk0/s72-c/cisco-ix5000.jpg" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27381059098267211.post-2581338227738016318</id><published>2014-11-26T13:18:00.001+00:00</published><updated>2014-11-26T13:18:43.527+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="cisco"/><category scheme="http://www.blogger.com/atom/ns#" term="jabber"/><category scheme="http://www.blogger.com/atom/ns#" term="scripting"/><title type='text'>Cisco Jabber Custom Tabs, CTI Screen Pop and Presence</title><content type='html'>&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px;&quot;&gt;
Cisco Jabber for Windows has had the ability to add “Custom Embedded Tabs” for quite some time. This capability allows you to embed line of business applications within the Cisco Jabber client. This is particularly useful if they are related to communications events of course.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Where I work, we’ve used them for adding a couple of custom tabs to Jabber:&amp;nbsp;&lt;/div&gt;
&lt;ul style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; padding-left: 30px;&quot;&gt;
&lt;li&gt;CRM integration - where we can search our CRM database and click-to-call the results;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://dparkinson.blogspot.co.uk/2013/12/using-ews-managed-api-to-access-meeting_13.html&quot; style=&quot;color: #4183c4; margin-top: 0px; text-decoration: none;&quot;&gt;Meeting Room Availability Information&lt;/a&gt;&amp;nbsp;- where we can instantly see Outlook Meeting Room availability (with future capability to book immediate meetings from Jabber).&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
With the release of Jabber 10.5, Cisco introduced a few enhancements to the customisation options which has renewed my interest in the topic.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
You can now get events for presence state changes, locale information and “hub” events (i.e. when you activate or resize your Jabber window), in addition to call events.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Before we get into Call Events, I’ll just mention the Presence Subscription capability.&amp;nbsp;&lt;/div&gt;
&lt;h3 id=&quot;presence-state&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; background-color: white; color: #333333; cursor: text; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 18px; margin: 20px 0px 10px; padding: 0px; transition: background-color 0.2s ease-out;&quot;&gt;
Presence State&lt;/h3&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px;&quot;&gt;
With the presence state change information, you can add tabs which contain active presence information from the Jabber client.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
For example you could build an ‘expert finder’ tab for your organisation that would have live presence information in the search results so you can contact the most appropriate person for a particular requirement.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Or, if your environment has different people performing a certain role at different times, you could also add this to Jabber to help people find the person doing that job more quickly.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
The following screen shot shows an example application for a fictitious aircraft maintenance company where people need to contact the relevant individual responsible for a particular part of a plane, but that group of people changes on a regular basis.&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsadmxrD_Ku50SAm-ChUi50LFlnOOD-kcN4uzrBl8OG55FVIbsAbGpsTFnfx-lzKxUDWgc-WnM_PUmylU6byz5lerCUWv5tdmDEM_m1wzkVjE8Xk-DL7Q9-dDOmmGQvQ0Qx8jVCoop5cU/s1600/Screen+Shot+2014-10-16+at+12.06.00.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsadmxrD_Ku50SAm-ChUi50LFlnOOD-kcN4uzrBl8OG55FVIbsAbGpsTFnfx-lzKxUDWgc-WnM_PUmylU6byz5lerCUWv5tdmDEM_m1wzkVjE8Xk-DL7Q9-dDOmmGQvQ0Qx8jVCoop5cU/s1600/Screen+Shot+2014-10-16+at+12.06.00.png&quot; height=&quot;640&quot; width=&quot;275&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Another thing I was thinking about was having the ability to receive a notification when someone becomes available so I don’t have to keep checking. Maybe Cisco will add this to the core product at some point (it looks like it might be an update for the 10.6 client).&amp;nbsp;&lt;/div&gt;
&lt;h3 id=&quot;adding-custom-tabs&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; background-color: white; color: #333333; cursor: text; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 18px; margin: 20px 0px 10px; padding: 0px; transition: background-color 0.2s ease-out;&quot;&gt;
Adding Custom Tabs&lt;/h3&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px;&quot;&gt;
With Cisco Jabber for Windows 10.5, there are now three methods of adding a custom tab:&amp;nbsp;&lt;/div&gt;
&lt;ol style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; padding-left: 30px;&quot;&gt;
&lt;li&gt;Enterprise wide Jabber configuration&lt;/li&gt;
&lt;li&gt;Local Jabber configuration&lt;/li&gt;
&lt;li&gt;The New Custom Tab menu option&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 id=&quot;enterprisewidejabberconfiguration&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; background-color: white; color: #333333; cursor: text; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin: 20px 0px 10px; padding: 0px; transition: background-color 0.2s ease-out;&quot;&gt;
Enterprise Wide Jabber Configuration&lt;/h4&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px;&quot;&gt;
For enterprise wide distribution of your custom tab once you’ve finished development, you would&amp;nbsp;&lt;a href=&quot;http://www.cisco.com/c/en/us/td/docs/voice_ip_comm/jabber/10_5/CJAB_BK_D6497E98_00_deployment-installation-guide-ciscojabber/CJAB_BK_D6497E98_00_deployment-installation-guide-ciscojabber_chapter_01001.html#CJAB_CN_SABB1845_00&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;edit the global configuration file and upload to your TFTP server&lt;/a&gt;, including the relevant settings for&amp;nbsp;&lt;a href=&quot;http://www.cisco.com/c/en/us/td/docs/voice_ip_comm/jabber/10_5/CJAB_BK_D6497E98_00_deployment-installation-guide-ciscojabber/CJAB_BK_D6497E98_00_deployment-installation-guide-ciscojabber_chapter_01001.html#CJAB_RF_CACE1507_00&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;custom tabs&lt;/a&gt;.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
For the purposes of this post and for development, you would use one of the other two methods.&amp;nbsp;&lt;/div&gt;
&lt;h4 id=&quot;localjabberconfiguration&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; background-color: white; color: #333333; cursor: text; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin: 20px 0px 10px; padding: 0px; transition: background-color 0.2s ease-out;&quot;&gt;
Local Jabber Configuration&lt;/h4&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px;&quot;&gt;
To add a custom tab using local Jabber configuration, it is simply a case of adding a&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;jabber-config-user.xml&lt;/code&gt;&amp;nbsp;file in your Jabber Config folder:&lt;br /&gt;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;C:\Users\*your_username*\AppData\Roaming\Cisco\Unified Communications\Jabber\CSF\Config&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
The format of this file is covered in the&amp;nbsp;&lt;a href=&quot;http://www.cisco.com/c/en/us/td/docs/voice_ip_comm/jabber/10_5/CJAB_BK_D6497E98_00_deployment-installation-guide-ciscojabber/CJAB_BK_D6497E98_00_deployment-installation-guide-ciscojabber_chapter_01001.html#CJAB_RF_C8487A52_00&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;documentation&lt;/a&gt;&amp;nbsp;but, for reference, may look as follows:&amp;nbsp;&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;xml&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;pi&quot; style=&quot;color: #999999; font-weight: bold;&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;config&lt;/span&gt; &lt;span class=&quot;attribute&quot; style=&quot;color: teal;&quot;&gt;version&lt;/span&gt;=&lt;span class=&quot;value&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;1.0&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;Client&lt;/span&gt;&amp;gt;&lt;/span&gt;
   &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;jabber-plugin-config&lt;/span&gt;&amp;gt;&lt;/span&gt;
       &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;browser-plugin&lt;/span&gt;&amp;gt;&lt;/span&gt;
           &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;page&lt;/span&gt; &lt;span class=&quot;attribute&quot; style=&quot;color: teal;&quot;&gt;preload&lt;/span&gt;=&lt;span class=&quot;value&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;false&quot;&lt;/span&gt; &lt;span class=&quot;attribute&quot; style=&quot;color: teal;&quot;&gt;refresh&lt;/span&gt;=&lt;span class=&quot;value&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;true&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;
               &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;tooltip&lt;/span&gt;&amp;gt;&lt;/span&gt;Your Custom Tab&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;tooltip&lt;/span&gt;&amp;gt;&lt;/span&gt;
               &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;icon&lt;/span&gt;&amp;gt;&lt;/span&gt;http://your_server/your_custom_icon.png&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;icon&lt;/span&gt;&amp;gt;&lt;/span&gt;
               &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;url&lt;/span&gt;&amp;gt;&lt;/span&gt;http://your_server/index.html/&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;url&lt;/span&gt;&amp;gt;&lt;/span&gt; 
           &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;page&lt;/span&gt;&amp;gt;&lt;/span&gt;
       &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;browser-plugin&lt;/span&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;jabber-plugin-config&lt;/span&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;Client&lt;/span&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;config&lt;/span&gt;&amp;gt;&lt;/span&gt;  
&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
This points to a web page which will be rendered within the Jabber client.&amp;nbsp;&lt;/div&gt;
&lt;h4 id=&quot;customtabmenu&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; background-color: white; color: #333333; cursor: text; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin: 20px 0px 10px; padding: 0px; transition: background-color 0.2s ease-out;&quot;&gt;
Custom Tab Menu&lt;/h4&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px;&quot;&gt;
In addition to the previous methods, Jabber for Windows 10.5 now allows you to easily add Custom Tabs for testing from the Jabber client itself. You can do this by selecting “File -&amp;gt; New - Custom Tab”&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjocwxD46REo-IfA83ppM31andDvgBnmMRYvu9puMnGRHKsH54xprStsHJvHE5HPf-HpQzUfrCENBgvnWCFLa0aTuxVNnULJGKtV8eOE8AJ58ENVq2LrYh__fAEHRldRAD1GP2BLQwkigk/s1600/Screen+Shot+2014-10-16+at+12.50.17+copy.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjocwxD46REo-IfA83ppM31andDvgBnmMRYvu9puMnGRHKsH54xprStsHJvHE5HPf-HpQzUfrCENBgvnWCFLa0aTuxVNnULJGKtV8eOE8AJ58ENVq2LrYh__fAEHRldRAD1GP2BLQwkigk/s1600/Screen+Shot+2014-10-16+at+12.50.17+copy.png&quot; height=&quot;140&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
When you do this, you’ll be prompted for the Name and URL of the web page to be used for the Custom Tab. Note that you don’t have the option of setting a Custom Tab Icon with this method.&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpjDHSCrWSq-Hx-5Sn2AOxidWPHs9rDif0lx3_h981p8cbj2tYJvzZcFlBAdYSL85RiwgYj-wsrflZmoKqIBTz-XJlAUv7P3SAg-pnC8njwj81H4ENjWrhE6Oqd6YnpFdaESsJiXZEJNc/s1600/Screen+Shot+2014-10-16+at+12.51.40.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpjDHSCrWSq-Hx-5Sn2AOxidWPHs9rDif0lx3_h981p8cbj2tYJvzZcFlBAdYSL85RiwgYj-wsrflZmoKqIBTz-XJlAUv7P3SAg-pnC8njwj81H4ENjWrhE6Oqd6YnpFdaESsJiXZEJNc/s1600/Screen+Shot+2014-10-16+at+12.51.40.png&quot; height=&quot;152&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Also note that this menu option is enabled by default, but it is possible for your system administrator to disable it. So, if you don’t have access to that menu item, you could ask your system administrator to turn it on, or use the previous method for Local Jabber configuration.&amp;nbsp;&lt;/div&gt;
&lt;h4 id=&quot;customtabicons&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; background-color: white; color: #333333; cursor: text; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin: 20px 0px 10px; padding: 0px; transition: background-color 0.2s ease-out;&quot;&gt;
Custom Tab Icons&lt;/h4&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px;&quot;&gt;
While we’re talking about Custom Tabs, I should mention Custom Tab Icons. With the first two methods of creating a custom tab, it is possible to add a custom icon.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
With previous versions, it was a little more cumbersome, but to create your own custom icon for 10.5, you now only require a single 20x20 pixel PNG image consisting predominantly of white to match the existing icons.&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiChfs56K2VJs4PUlI6l5j-Q0GRA-TJuu8IHgVqy6sVCoRaVZjJBnGJydwEeLeb-pJfZjgdC3oSQxG_KzxzzM_YHFRHlzJXJWuyS49YzDUMMh5jObaawP7rql383ASfedw5QGJwkVpV2NQ/s1600/Screen+Shot+2014-10-14+at+15.08.30+copy.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiChfs56K2VJs4PUlI6l5j-Q0GRA-TJuu8IHgVqy6sVCoRaVZjJBnGJydwEeLeb-pJfZjgdC3oSQxG_KzxzzM_YHFRHlzJXJWuyS49YzDUMMh5jObaawP7rql383ASfedw5QGJwkVpV2NQ/s1600/Screen+Shot+2014-10-14+at+15.08.30+copy.png&quot; height=&quot;400&quot; width=&quot;85&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 id=&quot;callevents&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; background-color: white; color: #333333; cursor: text; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 18px; margin: 20px 0px 10px; padding: 0px; transition: background-color 0.2s ease-out;&quot;&gt;
Call Events&lt;/h3&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px;&quot;&gt;
Now that we know how to add custom tabs, it just remains for us to create the web page that will be used for embedding into the Jabber for Windows Client.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
For this example, we will be creating a simple tab that monitors for Call Events and will allow you to launch an external web page based on the calling number. This will consist of a simple HTML file and a separate JavaScript file.&amp;nbsp;&lt;/div&gt;
&lt;h4 id=&quot;fixingwindows&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; background-color: white; color: #333333; cursor: text; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin: 20px 0px 10px; padding: 0px; transition: background-color 0.2s ease-out;&quot;&gt;
Fixing Windows&lt;/h4&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px;&quot;&gt;
Before we get started though, by default, Microsoft inflicts the IE7 browser emulation on any applications that use embedded browser functionality. This isn’t a problem if your page is very basic, but if your page will have stylesheets, it would be better to use a later version.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
To enable a more recent browser version, we have to edit our registry with the following settings. I believe Cisco will automatically be adding this in an upcoming maintenance release and Cisco Jabber for Windows 10.6, but for now open up&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;regedit.exe&lt;/code&gt;&amp;nbsp;and ensure you have the following key:&amp;nbsp;&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;undefined&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION]

&quot;CiscoJabber.exe&quot;=dword:00002710&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Now that we’ve done that, if you are familiar with creating web sites, you can create whatever you like and just embed the relevant JavaScript for the new events.&amp;nbsp;&lt;/div&gt;
&lt;h4 id=&quot;files&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; background-color: white; color: #333333; cursor: text; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 16px; margin: 20px 0px 10px; padding: 0px; transition: background-color 0.2s ease-out;&quot;&gt;
Files&lt;/h4&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px;&quot;&gt;
For this example, we will create the following files and folders:&amp;nbsp;&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;undefined&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt; ./index.html
 |-- js
 |    +-- tpop.js
 +--  css
      +-- bootstrap.min.css&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
The HTML file will just have a container for logging information in addition to a reference to the javascript that we’ll add to the tpop.js file:&amp;nbsp;&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;xml&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;doctype&quot; style=&quot;color: #999999; font-weight: bold;&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;html&lt;/span&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;head&lt;/span&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;meta&lt;/span&gt; &lt;span class=&quot;attribute&quot; style=&quot;color: teal;&quot;&gt;charset&lt;/span&gt;=&lt;span class=&quot;value&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;utf-8&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;title&lt;/span&gt;&amp;gt;&lt;/span&gt;Jabber CTI Test&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;title&lt;/span&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;link&lt;/span&gt; &lt;span class=&quot;attribute&quot; style=&quot;color: teal;&quot;&gt;rel&lt;/span&gt;=&lt;span class=&quot;value&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;stylesheet&quot;&lt;/span&gt; &lt;span class=&quot;attribute&quot; style=&quot;color: teal;&quot;&gt;href&lt;/span&gt;=&lt;span class=&quot;value&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;css/bootstrap.min.css&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;script&lt;/span&gt; &lt;span class=&quot;attribute&quot; style=&quot;color: teal;&quot;&gt;src&lt;/span&gt;=&lt;span class=&quot;value&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;js/tpop.js&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;javascript&quot;&gt;&lt;/span&gt;&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;script&lt;/span&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;head&lt;/span&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;body&lt;/span&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;h4&lt;/span&gt;&amp;gt;&lt;/span&gt;CTI Log&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;h4&lt;/span&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;div&lt;/span&gt; &lt;span class=&quot;attribute&quot; style=&quot;color: teal;&quot;&gt;id&lt;/span&gt;=&lt;span class=&quot;value&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;ctilog&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;body&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
You will also notice a reference to the bootstrap.min.css file here. It’s not necessary in this example, but if you’re going to add some additional elements to the page, it’s an easy way to get started. It basically provides a framework for&amp;nbsp;&lt;a href=&quot;http://en.wikipedia.org/wiki/Responsive_web_design&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;responsive web design&lt;/a&gt;&amp;nbsp;projects and since we’re typically filling a smaller window, it’s pretty handy. You can find more detail on using bootstrap, as well as the download&amp;nbsp;&lt;a href=&quot;http://getbootstrap.com/&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;on their site&lt;/a&gt;.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
In the referenced&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;js/tpop.js&lt;/code&gt;&amp;nbsp;we can then simply add the the function&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;OnTelephonyConversationStateChanged&lt;/code&gt;&amp;nbsp;as referenced in the&amp;nbsp;&lt;a href=&quot;http://www.cisco.com/c/en/us/td/docs/voice_ip_comm/jabber/10_5/CJAB_BK_D6497E98_00_deployment-installation-guide-ciscojabber/CJAB_BK_D6497E98_00_deployment-installation-guide-ciscojabber_chapter_01001.html#CJAB_RF_CA029B15_00&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;documentation&lt;/a&gt;:&amp;nbsp;&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;javascript&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;function&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;title&quot;&gt;OnTelephonyConversationStateChanged&lt;/span&gt;&lt;span class=&quot;params&quot;&gt;(json)&lt;/span&gt; {&lt;/span&gt;
}&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Within this function, we can then reference our&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;&lt;div id=&quot;ctilog&quot;&gt;
&lt;/div&gt;
&lt;/code&gt;&amp;nbsp;in the HTML file so that we can log events there and visually see what’s going on:&amp;nbsp;&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;cs&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;var&lt;/span&gt; myDiv = document.getElementById(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;ctilog&quot;&lt;/span&gt;);&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
We can then interrogate the&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;json&lt;/code&gt;&amp;nbsp;object for each event that occurs and add some details to the HTML output:&amp;nbsp;&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;xml&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;var conversation = JSON.parse(json);
myDiv.innerHTML += &quot;State: &quot; + conversation.state + &quot;&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;br&lt;/span&gt;/&amp;gt;&lt;/span&gt;&quot;;
myDiv.innerHTML += &quot;Acceptance: &quot; + conversation.acceptanceState + &quot;&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;br&lt;/span&gt;/&amp;gt;&lt;/span&gt;&quot;;
myDiv.innerHTML += &quot;Type: &quot; + conversation.callType + &quot;&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;br&lt;/span&gt;/&amp;gt;&lt;/span&gt;&quot;;
myDiv.innerHTML += &quot;&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;br&lt;/span&gt;/&amp;gt;&lt;/span&gt;&quot;;&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
And finally, pop a new window with some of the details if it matches the criteria we set, in this case, for any new incoming call:&amp;nbsp;&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;xml&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;if (conversation.acceptanceState == &quot;Pending&quot; &amp;amp;&amp;amp; conversation.state == &quot;Started&quot;) {
    myDiv.innerHTML += &quot;About to screen pop&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;br&lt;/span&gt;/&amp;gt;&lt;/span&gt;&quot;;
    for (var i=0; i&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;conversation.remoteParticipants.length;&lt;/span&gt; &lt;span class=&quot;attribute&quot; style=&quot;color: teal;&quot;&gt;i&lt;/span&gt;++) { 
        &lt;span class=&quot;attribute&quot; style=&quot;color: teal;&quot;&gt;myDiv.innerHTML&lt;/span&gt; += &quot;&lt;span class=&quot;attribute&quot; style=&quot;color: teal;&quot;&gt;Popping&lt;/span&gt; &lt;span class=&quot;attribute&quot; style=&quot;color: teal;&quot;&gt;with&lt;/span&gt; &lt;span class=&quot;attribute&quot; style=&quot;color: teal;&quot;&gt;number:&lt;/span&gt; &quot; + &lt;span class=&quot;attribute&quot; style=&quot;color: teal;&quot;&gt;conversation.remoteParticipants&lt;/span&gt;[&lt;span class=&quot;attribute&quot; style=&quot;color: teal;&quot;&gt;i&lt;/span&gt;]&lt;span class=&quot;attribute&quot; style=&quot;color: teal;&quot;&gt;.translatedNumber&lt;/span&gt; + &#39;&amp;lt;&lt;span class=&quot;attribute&quot; style=&quot;color: teal;&quot;&gt;br&lt;/span&gt;/&amp;gt;&lt;/span&gt;&#39;;
        window.open(&quot;http://url_to_your_crm_app/customer.html?number=&quot; + conversation.remoteParticipants[i].translatedNumber);
    }
}&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Which in my test case, where I&#39;m just taking the number passed and presenting it on screen, looks as follows:&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMAdVu6N5ppMhXrFdRbuKli7HsbZbHH306CPGHLDBgzV_cCHdT7uyOpcakPkK2whOSnIHeEhborlndWbyIeZP5ycxgOggEvbQ0fmp19UH2Y44yHmGqfizaKiodYVuTh4Cxj1u1_Pkh6M4/s1600/Screen+Shot+2014-11-26+at+13.10.03+copy.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMAdVu6N5ppMhXrFdRbuKli7HsbZbHH306CPGHLDBgzV_cCHdT7uyOpcakPkK2whOSnIHeEhborlndWbyIeZP5ycxgOggEvbQ0fmp19UH2Y44yHmGqfizaKiodYVuTh4Cxj1u1_Pkh6M4/s1600/Screen+Shot+2014-11-26+at+13.10.03+copy.png&quot; height=&quot;400&quot; width=&quot;330&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
And that’s pretty much it. Clearly this example isn’t very sophisticated and you’d probably want to do some more checking, rather than blindly popping a screen for each participant, but you get the picture.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-top: 15px;&quot;&gt;
&lt;b id=&quot;firstdiff&quot; style=&quot;-webkit-transition: color 0.2s ease-in-out; border: none !important; display: block; left: 0px; position: absolute; transition: color 0.2s ease-in-out;&quot;&gt;&lt;/b&gt;In addition, if you needed to pop something other than an HTML page, you could register an application with a&amp;nbsp;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ie/aa767914(v=vs.85).aspx&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;custom URI scheme&lt;/a&gt;&amp;nbsp;which you could then call in the same way – that’s maybe a topic for another time.&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-top: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-top: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://blog.darrenparkinson.uk/feeds/2581338227738016318/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.darrenparkinson.uk/2014/11/cisco-jabber-custom-tabs-cti-screen-pop.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/2581338227738016318'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/2581338227738016318'/><link rel='alternate' type='text/html' href='http://blog.darrenparkinson.uk/2014/11/cisco-jabber-custom-tabs-cti-screen-pop.html' title='Cisco Jabber Custom Tabs, CTI Screen Pop and Presence'/><author><name>Darren Parkinson</name><uri>http://www.blogger.com/profile/01084077294541066454</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsadmxrD_Ku50SAm-ChUi50LFlnOOD-kcN4uzrBl8OG55FVIbsAbGpsTFnfx-lzKxUDWgc-WnM_PUmylU6byz5lerCUWv5tdmDEM_m1wzkVjE8Xk-DL7Q9-dDOmmGQvQ0Qx8jVCoop5cU/s72-c/Screen+Shot+2014-10-16+at+12.06.00.png" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27381059098267211.post-2564079811908769978</id><published>2014-08-27T13:26:00.000+01:00</published><updated>2014-10-16T17:56:54.668+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="cisco"/><category scheme="http://www.blogger.com/atom/ns#" term="jabber"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><category scheme="http://www.blogger.com/atom/ns#" term="scripting"/><title type='text'>Searching Jabber Release Notes</title><content type='html'>&lt;h2 id=&quot;section-summary&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; cursor: text; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 24px; margin: 20px 0px 10px; padding: 0px; transition: background-color 0.2s ease-out;&quot;&gt;
&lt;br /&gt;&lt;/h2&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px;&quot;&gt;
It’s often necessary to identify exactly which version of software a particular feature was introduced.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
To do this requires opening up each set of release notes for all the versions available and finding the one that has the feature you need.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Needless to say, this is very boring, time-consuming and unproductive.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
I’m guessing there is an easier way to do this, but this was pretty quick for me and I didn’t want to think too hard about it.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
In this instance, I just wanted to search all the Jabber release notes for a particular feature.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
There are really two ways of achieving this:&lt;/div&gt;
&lt;ul style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; padding-left: 30px;&quot;&gt;
&lt;li&gt;Firstly, you can search the Cisco website directly&lt;/li&gt;
&lt;li&gt;Secondly, you can download all the release notes and search them locally&lt;/li&gt;
&lt;/ul&gt;
&lt;hr style=&quot;background-image: url(data:image/png; background-position: 0px 0px; background-repeat: repeat no-repeat; border: 0px none; color: #cccccc; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; height: 4px; line-height: 22px; padding: 0px;&quot; /&gt;
&lt;h2 id=&quot;section-searchingweb&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; cursor: text; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 24px; margin: 20px 0px 10px; padding: 0px; transition: background-color 0.2s ease-out;&quot;&gt;
Searching the Cisco Website&lt;/h2&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px;&quot;&gt;
Searching the Cisco website can be painful sometimes. However, if you know where to search and what search terms will yield the best result, this might be just right.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
For example, to search the release notes for the phrase&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;XenApp&lt;/code&gt;&amp;nbsp;for example, I could go to Google and use the following search term:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;cs&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;XenApp site:http:&lt;span class=&quot;comment&quot; style=&quot;color: #999988; font-style: italic;&quot;&gt;//www.cisco.com/c/en/us/td/docs/voice_ip_comm/jabber/Windows&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Since I know that all of the release notes reside under&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;http://www.cisco.com/c/en/us/td/docs/voice_ip_comm/jabber/Windows&lt;/code&gt;.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
However, this does also search all of the Installation and Configuration notes too, which is fine if that’s what you want.&lt;/div&gt;
&lt;hr style=&quot;background-image: url(data:image/png; background-position: 0px 0px; background-repeat: repeat no-repeat; border: 0px none; color: #cccccc; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; height: 4px; line-height: 22px; padding: 0px;&quot; /&gt;
&lt;h2 id=&quot;section-download&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; cursor: text; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 24px; margin: 20px 0px 10px; padding: 0px; transition: background-color 0.2s ease-out;&quot;&gt;
Downloading the release notes&lt;/h2&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px;&quot;&gt;
The second option is downloading all the PDF documents from Cisco and then using Adobe PDF Reader to search all them.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Firstly, you’ll need a list of the locations of all the Cisco Jabber release notes. That’s easy, as I’ve done that for you – you can find it as a&amp;nbsp;&lt;a href=&quot;https://gist.github.com/darrenparkinson/d18307554ed2b5142f4f&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;Gist on Github&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Then, you’ll need a script to go through that list and download each of the release notes – I’ve created a python script, as below and&amp;nbsp;&lt;a href=&quot;https://gist.github.com/darrenparkinson/c5c82dbd973540a61f93&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;also available as a Gist&lt;/a&gt;:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;python&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;import&lt;/span&gt; csv &lt;span class=&quot;comment&quot; style=&quot;color: #999988; font-style: italic;&quot;&gt;# for reading the csv file of files&lt;/span&gt;
&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;import&lt;/span&gt; urllib &lt;span class=&quot;comment&quot; style=&quot;color: #999988; font-style: italic;&quot;&gt;# for downloading the file&lt;/span&gt;

&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;with&lt;/span&gt; open(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;Jabber.csv&#39;&lt;/span&gt;, &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;rb&#39;&lt;/span&gt;) &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;as&lt;/span&gt; csvfile:
 filereader = csv.reader(csvfile, delimiter=&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;,&#39;&lt;/span&gt;)
 &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;for&lt;/span&gt; row &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;in&lt;/span&gt; filereader:
  original_filename = row[&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;1&lt;/span&gt;].split(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;/&#39;&lt;/span&gt;)[-&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;1&lt;/span&gt;]
  new_filename = row[&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;0&lt;/span&gt;] + &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39; &#39;&lt;/span&gt; + original_filename
  &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;Retrieving : &#39;&lt;/span&gt; + new_filename
  urllib.urlretrieve(row[&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;1&lt;/span&gt;], new_filename )
&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;b id=&quot;firstdiff&quot; style=&quot;-webkit-transition: color 0.2s ease-in-out; border: none !important; display: block; left: 0px; position: absolute; transition: color 0.2s ease-in-out;&quot;&gt;&lt;/b&gt;Obviously I’ve created a python script here, but you could just as easily do it with command line tools such as&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;curl&lt;/code&gt;&amp;nbsp;etc.&lt;/div&gt;
&lt;hr style=&quot;background-image: url(data:image/png; background-position: 0px 0px; background-repeat: repeat no-repeat; border: 0px none; color: #cccccc; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; height: 4px; line-height: 22px; padding: 0px;&quot; /&gt;
&lt;h2 id=&quot;section-searchingpdf&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; cursor: text; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 24px; margin: 20px 0px 10px; padding: 0px; transition: background-color 0.2s ease-out;&quot;&gt;
Searching PDFs&lt;/h2&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px;&quot;&gt;
To search PDFs, the absolute easiest way to do this is to use the Adobe PDF Reader and use the Advanced Search feature (Cmd+Shift+F), then in the “Where would you like to search?” section, you can specify the folder where all the release notes just downloaded.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-top: 15px;&quot;&gt;
That’s it. A nice short one so that I can remember for next time.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://blog.darrenparkinson.uk/feeds/2564079811908769978/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.darrenparkinson.uk/2014/08/searching-jabber-release-notes.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/2564079811908769978'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/2564079811908769978'/><link rel='alternate' type='text/html' href='http://blog.darrenparkinson.uk/2014/08/searching-jabber-release-notes.html' title='Searching Jabber Release Notes'/><author><name>Darren Parkinson</name><uri>http://www.blogger.com/profile/01084077294541066454</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27381059098267211.post-8602771959366312751</id><published>2014-04-04T21:59:00.000+01:00</published><updated>2014-04-04T22:07:26.368+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="cisco"/><category scheme="http://www.blogger.com/atom/ns#" term="node.js"/><category scheme="http://www.blogger.com/atom/ns#" term="scripting"/><category scheme="http://www.blogger.com/atom/ns#" term="xml"/><title type='text'>Accessing the Cisco Administrative XML (AXL) API with Node.js</title><content type='html'>&lt;br /&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px;&quot;&gt;
I was recently asked for a quick script to help update a large number of user ids on a Cisco Communications Manager platform. To do this I modified a perl script, which I’ve heard did the job quite nicely (thanks Matt).&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
I’m also taking a look at node.js at the moment for various reasons and I thought it might be nice to see if I could replicate the perl script with it.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
I’m not sure if node.js is really meant for this kind of thing, but given the simplicity of installation, the platform independence and the excellent package management it has, I thought it might be a nicer way of distributing scripts to people for this kind of work. Also, I’m a bit rusty at perl so I might as well learn something new.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
If you’ve ever tried to write in other script languages on a different platform to the one it’s going to run on, you’ll know it’s no fun. So far, node.js has appeared to be pretty good at it.&lt;/div&gt;
&lt;hr style=&quot;background-image: url(data:image/png; background-position: 0px 0px; background-repeat: repeat no-repeat; border: 0px none; color: #cccccc; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; height: 4px; line-height: 22px; padding: 0px;&quot; /&gt;
&lt;h2 id=&quot;what-is-it&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; cursor: text; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 24px; margin: 20px 0px 10px; padding: 0px; transition: background-color 0.2s ease-out;&quot;&gt;
What is Node.js&lt;/h2&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px;&quot;&gt;
From the&amp;nbsp;&lt;a href=&quot;http://nodejs.org/&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;node.js website&lt;/a&gt;&amp;nbsp;it’s&amp;nbsp;&lt;em&gt;a platform built on Chrome’s JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.&lt;/em&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
At a high level, it provides the ability to write network based applications in Javascript, so if you already know Javascript, you’re well on your way.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
See&amp;nbsp;&lt;a href=&quot;http://www.toptal.com/nodejs/why-the-hell-would-i-use-node-js&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;this article&lt;/a&gt;&amp;nbsp;for an overview of when you should, could and shouldn’t use node.js.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;There is also a nice project for IOT worth taking a look at if you’re interested in that kind of thing called&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;http://nodered.org/&quot; style=&quot;background-color: white; color: #4183c4; text-decoration: none;&quot;&gt;Node-RED&lt;/a&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&amp;nbsp;which is using node.js as the platform.&lt;/span&gt;&lt;/div&gt;
&lt;hr style=&quot;background-image: url(data:image/png; background-position: 0px 0px; background-repeat: repeat no-repeat; border: 0px none; color: #cccccc; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; height: 4px; line-height: 22px; padding: 0px;&quot; /&gt;
&lt;h2 id=&quot;installation&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; cursor: text; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 24px; margin: 20px 0px 10px; padding: 0px; transition: background-color 0.2s ease-out;&quot;&gt;
Installation&lt;/h2&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px;&quot;&gt;
Installation of node.js is super simple on the two main platforms (Windows / Mac OS X). You just visit the website and click the&amp;nbsp;&lt;em&gt;Install&lt;/em&gt;&amp;nbsp;button. The website sorts out which installation is suitable for your platform. There aren’t different things to download for the different platforms, or a ton of dependencies or anything, it’s really straight forward. This is notable because other scripting environments definitely aren’t this easy. For reference, I tested it on Windows 7 and Mac OS X 10.9.2.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
For Linux, as with all things Linux, nothing is ever that simple, so the installation to my Linux Mint installation was a little more convoluted, but nothing major – if you’re using Linux, you’re expecting it anyway. It’s probably best to stick with&amp;nbsp;&lt;a href=&quot;https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;your package manager&lt;/a&gt;, so for me, a&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;sudo apt-get install nodejs&lt;/code&gt;&amp;nbsp;did the trick – it’s a slightly older version as usual though.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
To check it’s working, open a command prompt and type&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;node -v&lt;/code&gt;&amp;nbsp;to see the version (or&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;nodejs -v&lt;/code&gt;if you’re on Linux). No messing about having to add it to your&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;PATH&lt;/code&gt;&amp;nbsp;or your&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;.profile&lt;/code&gt;&amp;nbsp;or your&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;.bash_profile&lt;/code&gt;&amp;nbsp;or whatever, it just works.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
At the most basic level, you then write your scripts and type&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;node yourscriptname.js&lt;/code&gt;&amp;nbsp;and you’re away.&lt;/div&gt;
&lt;hr style=&quot;background-image: url(data:image/png; background-position: 0px 0px; background-repeat: repeat no-repeat; border: 0px none; color: #cccccc; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; height: 4px; line-height: 22px; padding: 0px;&quot; /&gt;
&lt;h2 id=&quot;axl&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; cursor: text; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 24px; margin: 20px 0px 10px; padding: 0px; transition: background-color 0.2s ease-out;&quot;&gt;
Administrative XML API&lt;/h2&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px;&quot;&gt;
AXL is the Administrative XML API for Communications Manager and pretty much lets you script everything you can think of on the Communications Manager platform. Clearly be careful if you’re doing this on a production system – test everything on a dev system first as always and I’m not responsible if you mess it up ;).&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
The detail for AXL is available under the top-level&amp;nbsp;&lt;a href=&quot;http://www.cisco.com/c/en/us/support/unified-communications/unified-communications-manager-callmanager/products-programming-reference-guides-list.html&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;Programming Guides page&amp;nbsp;&lt;/a&gt;for Communications Manager.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Pick the XML Developers Guide for your version. I’m currently using version 9.1 so I picked&amp;nbsp;&lt;a href=&quot;http://www.cisco.com/c/en/us/td/docs/voice_ip_comm/cucm/devguide/9_1_1/xmldev-911/axl.html&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;that one&lt;/a&gt;. This will tell you everything you need to know about getting started with it.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Essentially however, it’s a SOAP based API which involves sending xml-based SOAP messages to get the job done. You can use wrappers with most languages for SOAP, but I’ve found it easier just to send the appropriate requests manually.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
For this test, we’re going to access the AXL service on Communications Manager to list details of a particular line – in this case, line 2001. To do this, we need to send the following SOAP object to AXL:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;xml&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;soapenv:Envelope&lt;/span&gt; &lt;span class=&quot;attribute&quot; style=&quot;color: teal;&quot;&gt;xmlns:soapenv&lt;/span&gt;=&lt;span class=&quot;value&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&lt;/span&gt; &lt;span class=&quot;attribute&quot; style=&quot;color: teal;&quot;&gt;xmlns:axl&lt;/span&gt;=&lt;span class=&quot;value&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;http://www.cisco.com/AXL/API/9.1&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;
   &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;soapenv:Header&lt;/span&gt;/&amp;gt;&lt;/span&gt;
   &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;soapenv:Body&lt;/span&gt;&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;axl:listLine&lt;/span&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;searchCriteria&lt;/span&gt;&amp;gt;&lt;/span&gt;
          &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;pattern&lt;/span&gt;&amp;gt;&lt;/span&gt;2001&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;pattern&lt;/span&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;searchCriteria&lt;/span&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;returnedTags&lt;/span&gt;&amp;gt;&lt;/span&gt;
          &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;pattern&lt;/span&gt;/&amp;gt;&lt;/span&gt;
          &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;description&lt;/span&gt;/&amp;gt;&lt;/span&gt;
          &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;usage&lt;/span&gt;/&amp;gt;&lt;/span&gt;
          &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;routePartitionName&lt;/span&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;returnedTags&lt;/span&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;axl:listLine&lt;/span&gt;&amp;gt;&lt;/span&gt;
   &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;soapenv:Body&lt;/span&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;soapenv:Envelope&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
We know this due to the detail in the Cisco Unified Administration XML Interface Specification available at the&amp;nbsp;&lt;a href=&quot;http://www.cisco.com/c/en/us/support/unified-communications/unified-communications-manager-callmanager/products-programming-reference-guides-list.html&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;Programming Guides site&lt;/a&gt;&amp;nbsp;mentioned previously. It’s a downloadable zip archive and contains information on the whole API. Details on the&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;listLine&lt;/code&gt;&amp;nbsp;feature we’re using here look like this:&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-mHHk9-z74WTxsTiqHS-WScKPB0JxElL469dcPSHQftHBVx9KgEiJXkHor9t8_smnAERNuxSemTNKB3gehMmxzH-qiE2Mqt3TvAvXLjvS8omAX93W0x1TjbmpPV3I_Z-HiIxHdnRfV94/s1600/Screen+Shot+2014-04-04+at+16.54.26.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-mHHk9-z74WTxsTiqHS-WScKPB0JxElL469dcPSHQftHBVx9KgEiJXkHor9t8_smnAERNuxSemTNKB3gehMmxzH-qiE2Mqt3TvAvXLjvS8omAX93W0x1TjbmpPV3I_Z-HiIxHdnRfV94/s1600/Screen+Shot+2014-04-04+at+16.54.26.png&quot; height=&quot;313&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&amp;nbsp;&lt;span style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px;&quot;&gt;This tells us that we can enter multiple search criteria as specified by the&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; line-height: 22px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;searchCriteria&lt;/code&gt;&lt;span style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px;&quot;&gt;&amp;nbsp;element:&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEii9Zqidj2dBjkCqyX9GjfB-Xbkn1gSzd19Mr37JJnSXa2FTDbNUb9aNWIK5Nfbxi1mSNJPNOrCsbAioU_eRF3aH0U-zfE5g2QcNqgfDXCN3kiYCqMYDq5a5X69SfDhsX_FhbFVgsyywPU/s1600/Screen+Shot+2014-04-04+at+16.56.35.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEii9Zqidj2dBjkCqyX9GjfB-Xbkn1gSzd19Mr37JJnSXa2FTDbNUb9aNWIK5Nfbxi1mSNJPNOrCsbAioU_eRF3aH0U-zfE5g2QcNqgfDXCN3kiYCqMYDq5a5X69SfDhsX_FhbFVgsyywPU/s1600/Screen+Shot+2014-04-04+at+16.56.35.png&quot; height=&quot;103&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
And return whatever information we need under the lines&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;returnedTags&lt;/code&gt;&amp;nbsp;element:&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghEO7Xb137nAFRX9nAnacd2noOO83wlVo_k-RJ25cx79LRCDg5Rvmz1ToGJgBL8etwC5PrbNCC8LvCw9ZHpBhqDUIKJXWDlwpEc5LZM5xsTAkLuJotgsG4ElizARuFzvHRBbY77HOQ5ME/s1600/Screen+Shot+2014-04-04+at+16.57.00.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghEO7Xb137nAFRX9nAnacd2noOO83wlVo_k-RJ25cx79LRCDg5Rvmz1ToGJgBL8etwC5PrbNCC8LvCw9ZHpBhqDUIKJXWDlwpEc5LZM5xsTAkLuJotgsG4ElizARuFzvHRBbY77HOQ5ME/s1600/Screen+Shot+2014-04-04+at+16.57.00.png&quot; height=&quot;320&quot; width=&quot;212&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
We’ve chosen to search for a&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;pattern&lt;/code&gt;&amp;nbsp;of 2001 and return the&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;description&lt;/code&gt;,&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;usage&lt;/code&gt;&amp;nbsp;and&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;routePartitionName&lt;/code&gt;&amp;nbsp;elements. The result is XML that looks like this:&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;xml&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;pi&quot; style=&quot;color: #999999; font-weight: bold;&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;soapenv:Envelope&lt;/span&gt; &lt;span class=&quot;attribute&quot; style=&quot;color: teal;&quot;&gt;xmlns:soapenv&lt;/span&gt;=&lt;span class=&quot;value&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;soapenv:Body&lt;/span&gt;&amp;gt;&lt;/span&gt;
   &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;ns:listLineResponse&lt;/span&gt; &lt;span class=&quot;attribute&quot; style=&quot;color: teal;&quot;&gt;xmlns:ns&lt;/span&gt;=&lt;span class=&quot;value&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;http://www.cisco.com/AXL/API/9.1&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;
     &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;return&lt;/span&gt;&amp;gt;&lt;/span&gt;
       &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;line&lt;/span&gt; &lt;span class=&quot;attribute&quot; style=&quot;color: teal;&quot;&gt;uuid&lt;/span&gt;=&lt;span class=&quot;value&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;{D0E3FEF4-6C4C-BFE8-C7BD-765989924CD4}&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;
         &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;pattern&lt;/span&gt;&amp;gt;&lt;/span&gt;2001&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;pattern&lt;/span&gt;&amp;gt;&lt;/span&gt;
         &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;description&lt;/span&gt;&amp;gt;&lt;/span&gt;Alice Anderson - 2001&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;description&lt;/span&gt;&amp;gt;&lt;/span&gt;
         &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;usage&lt;/span&gt;&amp;gt;&lt;/span&gt;Device&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;usage&lt;/span&gt;&amp;gt;&lt;/span&gt;
         &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;routePartitionName&lt;/span&gt; &lt;span class=&quot;attribute&quot; style=&quot;color: teal;&quot;&gt;uuid&lt;/span&gt;=&lt;span class=&quot;value&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;{021FA416-1725-4073-9BCE-745CD680BA93}&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;PT-Line&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;routePartitionName&lt;/span&gt;&amp;gt;&lt;/span&gt;
       &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;line&lt;/span&gt;&amp;gt;&lt;/span&gt;
     &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;return&lt;/span&gt;&amp;gt;&lt;/span&gt;
   &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;ns:listLineResponse&lt;/span&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;soapenv:Body&lt;/span&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;soapenv:Envelope&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
So, let’s get to it.&lt;/div&gt;
&lt;hr style=&quot;background-image: url(data:image/png; background-position: 0px 0px; background-repeat: repeat no-repeat; border: 0px none; color: #cccccc; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; height: 4px; line-height: 22px; padding: 0px;&quot; /&gt;
&lt;h2 id=&quot;scripting&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; cursor: text; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 24px; margin: 20px 0px 10px; padding: 0px; transition: background-color 0.2s ease-out;&quot;&gt;
Scripting AXL&lt;/h2&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px;&quot;&gt;
To access the AXL service on Communications Manager, we need to use HTTPS. Luckily for us, node provides an&amp;nbsp;&lt;a href=&quot;http://nodejs.org/api/https.html&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;HTTPS module&lt;/a&gt;&amp;nbsp;to simplify this task. It’s a built in module and so doesn’t require us to install anything extra.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
To use the HTTPS module, we add the following at the top of our script:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;js php&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;var&lt;/span&gt; https = &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;require&lt;/span&gt;(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;https&quot;&lt;/span&gt;);&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
We then need to set up various variables and our headers for the HTTPS request:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;js cs&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;var&lt;/span&gt; authentication = &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;username:password&#39;&lt;/span&gt;;

&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;var&lt;/span&gt; headers = {
  &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;Authorization&#39;&lt;/span&gt;: &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;Basic &#39;&lt;/span&gt; + &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;new&lt;/span&gt; Buffer(authentication).toString(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;base64&#39;&lt;/span&gt;), 
  &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;Content-Type&#39;&lt;/span&gt;: &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;text/xml; charset=utf-8&#39;&lt;/span&gt;,
  &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;SoapAction&#39;&lt;/span&gt;:&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;CUCM:DB ver=9.1&#39;&lt;/span&gt;
}&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Clearly this needs to be a username and password with access to the AXL API. There are permissions you can provide specifically for this, but using the standard admin account will work (although never recommended).&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
The headers are just specifying&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;Basic&lt;/code&gt;&amp;nbsp;authentication for connectivity to Communications Manager with base64 encoded credentials; and a content type for our request of&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;text/xml&lt;/code&gt;, for obvious reasons. The third header we are setting is the SoapAction header which is required for later versions of AXL as&amp;nbsp;&lt;a href=&quot;http://www.cisco.com/c/en/us/td/docs/voice_ip_comm/cucm/devguide/9_1_1/xmldev-911/axl.html#wp1054628&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;outlined in the documentation&lt;/a&gt;.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
We can then specify our xml:&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;js xml&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;var soapBody = new Buffer(&#39;&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;soapenv:Envelope&lt;/span&gt; &lt;span class=&quot;attribute&quot; style=&quot;color: teal;&quot;&gt;xmlns:soapenv&lt;/span&gt;=&lt;span class=&quot;value&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&lt;/span&gt; &lt;span class=&quot;attribute&quot; style=&quot;color: teal;&quot;&gt;xmlns:axl&lt;/span&gt;=&lt;span class=&quot;value&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;http://www.cisco.com/AXL/API/9.1&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;&#39; +
 &#39;&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;soapenv:Header&lt;/span&gt;/&amp;gt;&lt;/span&gt;&#39; +
 &#39;&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;soapenv:Body&lt;/span&gt;&amp;gt;&lt;/span&gt;&#39; +
    &#39;&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;axl:listLine&lt;/span&gt;&amp;gt;&lt;/span&gt;&#39; +
      &#39;&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;searchCriteria&lt;/span&gt;&amp;gt;&lt;/span&gt;&#39; +
        &#39;&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;pattern&lt;/span&gt;&amp;gt;&lt;/span&gt;2001&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;pattern&lt;/span&gt;&amp;gt;&lt;/span&gt;&#39; +
      &#39;&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;searchCriteria&lt;/span&gt;&amp;gt;&lt;/span&gt;&#39; +
      &#39;&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;returnedTags&lt;/span&gt;&amp;gt;&lt;/span&gt;&#39; +
        &#39;&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;pattern&lt;/span&gt;/&amp;gt;&lt;/span&gt;&#39; +
        &#39;&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;description&lt;/span&gt;/&amp;gt;&lt;/span&gt;&#39; +
        &#39;&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;usage&lt;/span&gt;/&amp;gt;&lt;/span&gt;&#39; +
        &#39;&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;routePartitionName&lt;/span&gt;/&amp;gt;&lt;/span&gt;&#39; +
      &#39;&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;returnedTags&lt;/span&gt;&amp;gt;&lt;/span&gt;&#39; +
  &#39;&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;axl:listLine&lt;/span&gt;&amp;gt;&lt;/span&gt;&#39; +
 &#39;&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;soapenv:Body&lt;/span&gt;&amp;gt;&lt;/span&gt;&#39; +
&#39;&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;soapenv:Envelope&lt;/span&gt;&amp;gt;&lt;/span&gt;&#39;);&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Set our options for the request:&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;js cs&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;var&lt;/span&gt; options = {
host: &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;192.168.7.41&#39;&lt;/span&gt;,       &lt;span class=&quot;comment&quot; style=&quot;color: #999988; font-style: italic;&quot;&gt;// The IP Address of the Communications Manager Server&lt;/span&gt;
port: &lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;443&lt;/span&gt;,                  &lt;span class=&quot;comment&quot; style=&quot;color: #999988; font-style: italic;&quot;&gt;// Clearly port 443 for SSL -- I think it&#39;s the default so could be removed&lt;/span&gt;
path: &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;/axl/&#39;&lt;/span&gt;,              &lt;span class=&quot;comment&quot; style=&quot;color: #999988; font-style: italic;&quot;&gt;// This is the URL for accessing axl on the server&lt;/span&gt;
method: &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;POST&#39;&lt;/span&gt;,             &lt;span class=&quot;comment&quot; style=&quot;color: #999988; font-style: italic;&quot;&gt;// AXL Requires POST messages&lt;/span&gt;
headers: headers,           &lt;span class=&quot;comment&quot; style=&quot;color: #999988; font-style: italic;&quot;&gt;// using the headers we specified earlier&lt;/span&gt;
rejectUnauthorized: &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;false&lt;/span&gt;   &lt;span class=&quot;comment&quot; style=&quot;color: #999988; font-style: italic;&quot;&gt;// required to accept self-signed certificates&lt;/span&gt;
};&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Then make the request and output the results when we get the response using an anonymous function:&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;js javascript&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;var&lt;/span&gt; req = https.request(options, &lt;span class=&quot;function&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;params&quot;&gt;(res)&lt;/span&gt; {&lt;/span&gt;
    console.log(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;status code = &quot;&lt;/span&gt;, res.statusCode);
    console.log(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;headers = &quot;&lt;/span&gt; , res.headers);
    res.setEncoding(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;utf8&#39;&lt;/span&gt;);
    res.on(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;data&#39;&lt;/span&gt;, &lt;span class=&quot;function&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;params&quot;&gt;(d)&lt;/span&gt; {&lt;/span&gt;
        console.log(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;Got Data: &quot;&lt;/span&gt; + d);
    });
});

&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;var&lt;/span&gt; result = req.write(soapBody);
req.end();

req.on(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;error&#39;&lt;/span&gt;, &lt;span class=&quot;function&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;params&quot;&gt;(e)&lt;/span&gt; {&lt;/span&gt;
console.error(e);
});&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
And that’s it. You can&amp;nbsp;&lt;a href=&quot;https://gist.github.com/darrenparkinson/9978397&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;get the full script&lt;/a&gt;&amp;nbsp;as a Gist from GitHub. You can also&amp;nbsp;&lt;a href=&quot;https://gist.github.com/darrenparkinson/9979639&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;download the perl script&lt;/a&gt;&amp;nbsp;if you’d prefer too.&lt;/div&gt;
&lt;hr style=&quot;background-image: url(data:image/png; background-position: 0px 0px; background-repeat: repeat no-repeat; border: 0px none; color: #cccccc; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; height: 4px; line-height: 22px; padding: 0px;&quot; /&gt;
&lt;h2 id=&quot;follow-up&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; cursor: text; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 24px; margin: 20px 0px 10px; padding: 0px; transition: background-color 0.2s ease-out;&quot;&gt;
Follow Up&lt;/h2&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px;&quot;&gt;
As a follow up to this, I’ll hopefully get around to posting more complex scripts to loop through users to change things on a larger scale etc., and also get into how to deploy scripts if you have additional module dependancies and so on.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;b id=&quot;firstdiff&quot; style=&quot;-webkit-transition: color 0.2s ease-in-out; border: none !important; display: block; left: 0px; position: absolute; transition: color 0.2s ease-in-out;&quot;&gt;&lt;/b&gt;As a final note, if you are thinking of doing larger scale scripts with AXL, you will need to cater for the throttling that AXL performs which is documented in&lt;br /&gt;
&lt;a href=&quot;http://www.cisco.com/c/en/us/td/docs/voice_ip_comm/cucm/devguide/9_1_1/xmldev-911/axl.html#wp1054955&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;Dynamic Throttling of Requests&lt;/a&gt;.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://blog.darrenparkinson.uk/feeds/8602771959366312751/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.darrenparkinson.uk/2014/04/accessing-cisco-administrative-xml-axl.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/8602771959366312751'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/8602771959366312751'/><link rel='alternate' type='text/html' href='http://blog.darrenparkinson.uk/2014/04/accessing-cisco-administrative-xml-axl.html' title='Accessing the Cisco Administrative XML (AXL) API with Node.js'/><author><name>Darren Parkinson</name><uri>http://www.blogger.com/profile/01084077294541066454</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-mHHk9-z74WTxsTiqHS-WScKPB0JxElL469dcPSHQftHBVx9KgEiJXkHor9t8_smnAERNuxSemTNKB3gehMmxzH-qiE2Mqt3TvAvXLjvS8omAX93W0x1TjbmpPV3I_Z-HiIxHdnRfV94/s72-c/Screen+Shot+2014-04-04+at+16.54.26.png" height="72" width="72"/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27381059098267211.post-8479041856306521673</id><published>2013-12-13T15:20:00.000+00:00</published><updated>2013-12-13T15:34:22.881+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".net"/><category scheme="http://www.blogger.com/atom/ns#" term="c#"/><category scheme="http://www.blogger.com/atom/ns#" term="cisco"/><category scheme="http://www.blogger.com/atom/ns#" term="jabber"/><category scheme="http://www.blogger.com/atom/ns#" term="powershell"/><title type='text'>Using the EWS Managed API to access Meeting Room availability</title><content type='html'>&lt;div id=&quot;wrapper&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; background-color: white; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; box-shadow: rgb(202, 202, 202) 0px 0px 0px 1px, rgb(238, 238, 238) 0px 0px 0px 4px; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 1.6; margin: 0px auto; max-width: 900px; outline: 0px; padding: 30px;&quot;&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: 14px; font-weight: normal; line-height: 1.6;&quot;&gt;I suppose it’s a common scenario for a lot of people: when I’m in the office, it’s always difficult to find an available meeting room for a quick meeting.&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
I’ve&amp;nbsp;&lt;a href=&quot;http://dparkinson.blogspot.co.uk/2012/12/room-availability-with-cisco-jabber.html&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;previously posted&lt;/a&gt;&amp;nbsp;about providing motion sensor data to&amp;nbsp;&lt;a href=&quot;http://www.cisco.com/go/jabber&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;Cisco Jabber&lt;/a&gt;&amp;nbsp;for ‘room presence’, and we’ve previously extended Cisco Jabber with CRM information, so we thought it might be nice to extend our Jabber Desktop application further with meeting room availability information from Microsoft Exchange too.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Clearly you can use Outlook directly to find meeting rooms and their availability so this is an extension of that to provide users with more choice about how they find that information.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
In addition to providing Cisco Jabber with this information, we can also extend this to&amp;nbsp;&lt;a href=&quot;http://www.cisco.com/go/ipphones&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;Cisco IP Phones&lt;/a&gt;&amp;nbsp;using&amp;nbsp;&lt;a href=&quot;http://developer.cisco.com/web/ipps/home&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;Cisco IP Phone Services&lt;/a&gt;.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
This first post takes an initial look at the Exchange Web Services (EWS) Managed API to connect to Exchange 2010, with subsequent posts looking at the integration into Cisco Jabber.&lt;/div&gt;
&lt;h2 id=&quot;gettingstarted&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; cursor: text; font-size: 24px; margin: 20px 0px 10px; padding: 0px; transition: background-color 0.2s ease-out;&quot;&gt;
Getting Started&lt;/h2&gt;
&lt;h3 id=&quot;firstthingsfirst-fixingourexchangeserver&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; color: #333333; cursor: text; font-size: 18px; margin: 20px 0px 10px; padding: 0px; transition: background-color 0.2s ease-out;&quot;&gt;
First things first - fixing our Exchange Server&lt;/h3&gt;
&lt;div style=&quot;margin-bottom: 15px;&quot;&gt;
Before I could do anything, it seemed our lab Exchange server needed a bit of TLC.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
To start with, I couldn’t load the management console until I had enabled Windows Remote Management, which I did by running the command&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;winrm quickconfig&lt;/code&gt;.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
The second problem was that the disk was full, so I enabled circular logging (thanks Adam), which automatically freed up about 20GB:&lt;/div&gt;
&lt;ul style=&quot;padding-left: 30px;&quot;&gt;
&lt;li&gt;Load up the Exchange PowerShell prompt by going to&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;Start -&amp;gt; All Programs -&amp;gt; Microsoft Exchange Server 2010 -&amp;gt; Exchange Management Console&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Find out the name (or Identity) of the Exchange Mailbox Database:&lt;/li&gt;
&lt;/ul&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;python&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;[PS] C:\Windows\system32&amp;gt;get-mailboxdatabase

Name                           Server          Recovery        ReplicationType
----                           ------          --------        ---------------
Mailbox Database &lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;1469248898&lt;/span&gt;    MAIL01    &lt;span class=&quot;built_in&quot; style=&quot;color: #0086b3;&quot;&gt;False&lt;/span&gt;           &lt;span class=&quot;built_in&quot; style=&quot;color: #0086b3;&quot;&gt;None&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul style=&quot;padding-left: 30px;&quot;&gt;
&lt;li&gt;Enable Circular Logging:&lt;/li&gt;
&lt;/ul&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;cs&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;[PS] C:\Windows\system32&amp;gt;&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;set&lt;/span&gt;-mailboxdatabase -circularloggingenabled:$&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;true&lt;/span&gt; -Identity &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;Mailbox Database 1469248898&quot;&lt;/span&gt;

WARNING: Circular logging parameter change will not be applied on &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;this&lt;/span&gt; database before it &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;is&lt;/span&gt; remounted. Dismount and
remount database &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;Mailbox Database 1469248898&quot;&lt;/span&gt; &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;in&lt;/span&gt; order to apply &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;this&lt;/span&gt; parameter change.&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
This was followed by a quick reboot which all seemed to do the trick. Now we can get going.&lt;/div&gt;
&lt;h3 id=&quot;preparingtheexchangeserverforewsuse&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; color: #333333; cursor: text; font-size: 18px; margin: 20px 0px 10px; padding: 0px; transition: background-color 0.2s ease-out;&quot;&gt;
Preparing the Exchange Server for EWS use&lt;/h3&gt;
&lt;div style=&quot;margin-bottom: 15px;&quot;&gt;
I checked the server version by using the following commands at the Exchange PowerShell prompt:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;ruby&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;[&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;PS&lt;/span&gt;] &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;C&lt;/span&gt;&lt;span class=&quot;symbol&quot; style=&quot;color: #0086b3;&quot;&gt;:&lt;/span&gt;\&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;Windows&lt;/span&gt;\&lt;span class=&quot;identifier&quot;&gt;system32&lt;/span&gt;&amp;gt;&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;Get&lt;/span&gt;-&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;PSSnapin&lt;/span&gt; -&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;Registered&lt;/span&gt; | &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;Add&lt;/span&gt;-&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;PSSnapin&lt;/span&gt;
[&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;PS&lt;/span&gt;] &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;C&lt;/span&gt;&lt;span class=&quot;symbol&quot; style=&quot;color: #0086b3;&quot;&gt;:&lt;/span&gt;\&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;Windows&lt;/span&gt;\&lt;span class=&quot;identifier&quot;&gt;system32&lt;/span&gt;&amp;gt;&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;Get&lt;/span&gt;-&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;ExchangeServer&lt;/span&gt; | &lt;span class=&quot;identifier&quot;&gt;fl&lt;/span&gt; &lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keymethods&quot; style=&quot;color: #0086b3;&quot;&gt;name&lt;/span&gt;&lt;/span&gt;,&lt;span class=&quot;identifier&quot;&gt;edition&lt;/span&gt;,&lt;span class=&quot;identifier&quot;&gt;admindisplayversion&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Which reported I was using AdminDisplayVersion 14.1 Build 218.15 which,&amp;nbsp;&lt;a href=&quot;http://technet.microsoft.com/library/hh135098(EXCHG.141).aspx&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;according to Microsoft&lt;/a&gt;&amp;nbsp;is Exchange Server 2010 Service Pack 1 (SP1) – (it might be time to update it…). This is important to know when we use the Managed Service API.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Then I browsed on the server to&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;https://localhost/EWS/Exchange.asmx&lt;/code&gt;&amp;nbsp;which redirected me to the Services.wsdl indicating that everything was good.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
You may need to configure access to the EWS Managed API by&amp;nbsp;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ff597941(v=exchg.80).aspx&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;following the instructions on MSDN&lt;/a&gt;.&lt;/div&gt;
&lt;h2 id=&quot;creatingatestconsoleapplication&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; cursor: text; font-size: 24px; margin: 20px 0px 10px; padding: 0px; transition: background-color 0.2s ease-out;&quot;&gt;
Creating a test console application&lt;/h2&gt;
&lt;div style=&quot;margin-bottom: 15px;&quot;&gt;
Firstly, I downloaded the Exchange Managed Service API from the&amp;nbsp;&lt;a href=&quot;http://www.microsoft.com/en-gb/download/details.aspx?id=35371&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;Microsoft site&lt;/a&gt;. Then I created a new test project in Visual Studio 2012 and added a reference to the&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;Microsoft.Exchange.WebServices.dll&lt;/code&gt;&amp;nbsp;file in the&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;C:\Program Files\Microsoft\Exchange\Web Services\2.0&lt;/code&gt;&amp;nbsp;directory.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
After that, it was simply a case of adding the following code to get some appointments from a users’ calendar:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;cs&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;
&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;using&lt;/span&gt; Microsoft.Exchange.WebServices.Data;
&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;using&lt;/span&gt; System.Net;
&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;using&lt;/span&gt; System.Net.Security;
&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;using&lt;/span&gt; System.Security.Cryptography.X509Certificates;

&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;namespace&lt;/span&gt; EWSConsoleTest
{
    &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;class&lt;/span&gt; Program
    {
        &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;void&lt;/span&gt; Main(&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;string&lt;/span&gt;[] args)
        {
         ServicePointManager.ServerCertificateValidationCallback = CertificateValidationCallBack;

            &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;try&lt;/span&gt;
            {
                ExchangeService service = &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;new&lt;/span&gt; ExchangeService(ExchangeVersion.Exchange2010_SP1);
                service.Credentials = &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;new&lt;/span&gt; WebCredentials(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;aa@mydomain.co.uk&quot;&lt;/span&gt;, &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;password&quot;&lt;/span&gt;);
                
                &lt;span class=&quot;comment&quot; style=&quot;color: #999988; font-style: italic;&quot;&gt;//service.AutodiscoverUrl(&quot;aa@mydomain.co.uk&quot;); #different domain, so not working for now.&lt;/span&gt;
                service.Url = &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;new&lt;/span&gt; Uri(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;https://172.16.7.12/EWS/Exchange.asmx&quot;&lt;/span&gt;);
                
                CalendarFolder calendar = CalendarFolder.Bind(service, WellKnownFolderName.Calendar, &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;new&lt;/span&gt; PropertySet());
                &lt;span class=&quot;comment&quot; style=&quot;color: #999988; font-style: italic;&quot;&gt;// Set start time, end time and number of appointments to fetch&lt;/span&gt;
                CalendarView calendarView = &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;new&lt;/span&gt; CalendarView(DateTime.Now, DateTime.Now.AddDays(&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;30&lt;/span&gt;), &lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;6&lt;/span&gt;);
                &lt;span class=&quot;comment&quot; style=&quot;color: #999988; font-style: italic;&quot;&gt;// Just fetch the subject, start and end times&lt;/span&gt;
                calendarView.PropertySet = &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;new&lt;/span&gt; PropertySet(AppointmentSchema.Subject, AppointmentSchema.Start, AppointmentSchema.End); 
 
 Console.WriteLine(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;\nThe first 6 appointments on your calendar for the next month are: \n&quot;&lt;/span&gt;);

                &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;foreach&lt;/span&gt; (Appointment a &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;in&lt;/span&gt; appointments)
                {
                    Console.WriteLine(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;Subject: &quot;&lt;/span&gt; + a.Subject.ToString());
                    Console.WriteLine(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;Start: &quot;&lt;/span&gt; + a.Start.ToString());
                    Console.WriteLine(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;End: &quot;&lt;/span&gt; + a.End.ToString());
                    Console.WriteLine();
                }
  }
            &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;catch&lt;/span&gt; (Exception ex)
            {
                Console.WriteLine(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;Error: &quot;&lt;/span&gt; + ex.Message);
                Console.ReadLine();
            }
        }
        &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;bool&lt;/span&gt; CertificateValidationCallBack(...)[...]
    }
}&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
The CertificateValidationCallBack method is used to accept the X.509 SSL Certificate from the server. The code is exactly the same as on the&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/dd633677(v=exchg.80).aspx&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;Microsoft documentation&lt;/a&gt;.&lt;/div&gt;
&lt;h3 id=&quot;identifyingrooms&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; color: #333333; cursor: text; font-size: 18px; margin: 20px 0px 10px; padding: 0px; transition: background-color 0.2s ease-out;&quot;&gt;
Identifying Rooms&lt;/h3&gt;
&lt;div style=&quot;margin-bottom: 15px;&quot;&gt;
Getting an individual users’ calendar is all well and good, but I need to get availability for all the meeting rooms. Fortunately, this is also taken care of by the Exchange Web Services using a feature that was new with Exchange 2010 called Room Finder. There’s a nice example of how to set this up on the&amp;nbsp;&lt;a href=&quot;http://blogs.technet.com/b/exchange/archive/2010/04/14/3409791.aspx&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;technet site&lt;/a&gt;.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Essentially, you set up a distribution group of rooms and mark the group as a room list, so in the Exchange PowerShell Prompt:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;ruby&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;[&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;PS&lt;/span&gt;] &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;C&lt;/span&gt;&lt;span class=&quot;symbol&quot; style=&quot;color: #0086b3;&quot;&gt;:&lt;/span&gt;\&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;Windows&lt;/span&gt;\&lt;span class=&quot;identifier&quot;&gt;system32&lt;/span&gt;&amp;gt;&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;New&lt;/span&gt;-&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;DistributionGroup&lt;/span&gt; -&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;Name&lt;/span&gt; &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;DSQ Rooms&quot;&lt;/span&gt; -&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;OrganizationalUnit&lt;/span&gt; &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;mydomain.co.uk/Rooms&quot;&lt;/span&gt; -&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;RoomList&lt;/span&gt;

&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;Name&lt;/span&gt;            &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;DisplayName&lt;/span&gt;         &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;GroupType&lt;/span&gt;           &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;PrimarySmtpAddress&lt;/span&gt;
----            -----------         ---------           ------------------
&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;DSQ&lt;/span&gt; &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;Rooms&lt;/span&gt;       &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;DSQ&lt;/span&gt; &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;Rooms&lt;/span&gt;           &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;Universal&lt;/span&gt;           &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;DSQRooms&lt;/span&gt;&lt;span class=&quot;variable&quot; style=&quot;color: teal;&quot;&gt;@mydomain&lt;/span&gt;.&lt;span class=&quot;identifier&quot;&gt;co&lt;/span&gt;.&lt;span class=&quot;identifier&quot;&gt;uk&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Of course, the OU “Rooms” already existed. Then I can add the rooms to this room list:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;ruby&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;Add&lt;/span&gt;-&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;DistributionGroupMember&lt;/span&gt; -&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;Identity&lt;/span&gt; &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;DSQ Rooms&quot;&lt;/span&gt; -&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;Member&lt;/span&gt; &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;BoardRoom&lt;/span&gt;&lt;span class=&quot;variable&quot; style=&quot;color: teal;&quot;&gt;@mydomain&lt;/span&gt;.&lt;span class=&quot;identifier&quot;&gt;co&lt;/span&gt;.&lt;span class=&quot;identifier&quot;&gt;uk&lt;/span&gt;
&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;Add&lt;/span&gt;-&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;DistributionGroupMember&lt;/span&gt; -&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;Identity&lt;/span&gt; &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;DSQ Rooms&quot;&lt;/span&gt; -&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;Member&lt;/span&gt; &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;CityScape&lt;/span&gt;&lt;span class=&quot;variable&quot; style=&quot;color: teal;&quot;&gt;@mydomain&lt;/span&gt;.&lt;span class=&quot;identifier&quot;&gt;co&lt;/span&gt;.&lt;span class=&quot;identifier&quot;&gt;uk&lt;/span&gt;
[...]&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
The rooms were previously set up as Room Mailboxes. There is a good overview of how to do that&amp;nbsp;&lt;a href=&quot;http://exchangeserverpro.com/exchange-server-2010-room-mailboxes-step-by-step-guide/&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;here&lt;/a&gt;.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Then we can access them via EWS as follows:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;cs&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;ExchangeService service = &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;new&lt;/span&gt; ExchangeService(ExchangeVersion.Exchange2010_SP1);
service.Credentials = &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;new&lt;/span&gt; WebCredentials(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;aa@mydomain.co.uk&quot;&lt;/span&gt;, &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;password&quot;&lt;/span&gt;);
service.Url = &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;new&lt;/span&gt; Uri(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;https://172.16.7.12/EWS/Exchange.asmx&quot;&lt;/span&gt;);
EmailAddressCollection myRoomLists = service.GetRoomLists();
&lt;span class=&quot;comment&quot; style=&quot;color: #999988; font-style: italic;&quot;&gt;// We only have one distribution list, but just in case...&lt;/span&gt;
&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;foreach&lt;/span&gt; (EmailAddress address &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;in&lt;/span&gt; myRoomLists)
{
 System.Collections.ObjectModel.Collection&lt;emailaddress&gt; roomAddresses = service.GetRooms(address);
 &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;foreach&lt;/span&gt; (EmailAddress roomAddress &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;in&lt;/span&gt; roomAddresses)
 {
  Console.WriteLine(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;List is {0}, Room is : {1}&quot;&lt;/span&gt;, address.Address, roomAddress.Address);
 }
}&lt;/emailaddress&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Returns output as follows:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;cs&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;List &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;is&lt;/span&gt; DSQRooms@mydomain.co.uk, Room &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;is&lt;/span&gt; : BoardRoom@mydomain.co.uk
List &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;is&lt;/span&gt; DSQRooms@mydomain.co.uk, Room &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;is&lt;/span&gt; : CityScape@mydomain.co.uk&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;roomavailability&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; color: #333333; cursor: text; font-size: 18px; margin: 20px 0px 10px; padding: 0px; transition: background-color 0.2s ease-out;&quot;&gt;
Room Availability&lt;/h3&gt;
&lt;div style=&quot;margin-bottom: 15px;&quot;&gt;
Now that we have access to the rooms, we just need to combine the two and get the room availability.&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;cs&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;ExchangeService service = &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;new&lt;/span&gt; ExchangeService(ExchangeVersion.Exchange2010_SP1);
service.Credentials = &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;new&lt;/span&gt; WebCredentials(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;aa@mydomain.co.uk&quot;&lt;/span&gt;, &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;password&quot;&lt;/span&gt;);
service.Url = &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;new&lt;/span&gt; Uri(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;https://172.16.7.12/EWS/Exchange.asmx&quot;&lt;/span&gt;);
EmailAddressCollection myRoomLists = service.GetRoomLists();
 &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;foreach&lt;/span&gt; (EmailAddress address &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;in&lt;/span&gt; myRoomLists)
 {
    System.Collections.ObjectModel.Collection&lt;emailaddress&gt; roomAddresses = service.GetRooms(address);
    &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;foreach&lt;/span&gt; (EmailAddress roomAddress &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;in&lt;/span&gt; roomAddresses)
    {
       CalendarView calendarView = &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;new&lt;/span&gt; CalendarView(DateTime.Now, DateTime.Now.AddHours(&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;8&lt;/span&gt;));
       FolderId folderID = &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;new&lt;/span&gt; FolderId(WellKnownFolderName.Calendar, roomAddress.Address);
       FindItemsResults&lt;appointment&gt; roomAppts = service.FindAppointments(folderID, calendarView);
       Console.WriteLine(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;Appointments for Room {0}&quot;&lt;/span&gt;, roomAddress.Address);
       &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;if&lt;/span&gt; (roomAppts.Items.Count &amp;gt; &lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;0&lt;/span&gt;)
          {
             &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;foreach&lt;/span&gt; (Appointment appt &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;in&lt;/span&gt; roomAppts)
             {
                Console.WriteLine(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;{0} - {1} : {2}&quot;&lt;/span&gt;, appt.Start, appt.End, appt.Subject);
             }
          }
       }
    }&lt;/appointment&gt;&lt;/emailaddress&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Gives me this:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;ruby&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;Appointments&lt;/span&gt; &lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;color: #0086b3;&quot;&gt;for&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;Room&lt;/span&gt; &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;BoardRoom&lt;/span&gt;&lt;span class=&quot;variable&quot; style=&quot;color: teal;&quot;&gt;@mydomain&lt;/span&gt;.&lt;span class=&quot;identifier&quot;&gt;co&lt;/span&gt;.&lt;span class=&quot;identifier&quot;&gt;uk&lt;/span&gt;
&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;13&lt;/span&gt;/&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;12&lt;/span&gt;/&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;2013&lt;/span&gt; &lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;14&lt;/span&gt;&lt;span class=&quot;symbol&quot; style=&quot;color: #0086b3;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;00&lt;/span&gt;&lt;span class=&quot;symbol&quot; style=&quot;color: #0086b3;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;00&lt;/span&gt; - &lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;13&lt;/span&gt;/&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;12&lt;/span&gt;/&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;2013&lt;/span&gt; &lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;symbol&quot; style=&quot;color: #0086b3;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;00&lt;/span&gt;&lt;span class=&quot;symbol&quot; style=&quot;color: #0086b3;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;symbol&quot; style=&quot;color: #0086b3;&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;Test&lt;/span&gt; &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;Appointment&lt;/span&gt;
&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;Appointments&lt;/span&gt; &lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;color: #0086b3;&quot;&gt;for&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;Room&lt;/span&gt; &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;CityScape&lt;/span&gt;&lt;span class=&quot;variable&quot; style=&quot;color: teal;&quot;&gt;@mydomain&lt;/span&gt;.&lt;span class=&quot;identifier&quot;&gt;co&lt;/span&gt;.&lt;span class=&quot;identifier&quot;&gt;uk&lt;/span&gt;
&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;13&lt;/span&gt;/&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;12&lt;/span&gt;/&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;2013&lt;/span&gt; &lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;symbol&quot; style=&quot;color: #0086b3;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;00&lt;/span&gt;&lt;span class=&quot;symbol&quot; style=&quot;color: #0086b3;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;00&lt;/span&gt; - &lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;13&lt;/span&gt;/&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;12&lt;/span&gt;/&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;2013&lt;/span&gt; &lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;symbol&quot; style=&quot;color: #0086b3;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;00&lt;/span&gt;&lt;span class=&quot;symbol&quot; style=&quot;color: #0086b3;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;symbol&quot; style=&quot;color: #0086b3;&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;Finance&lt;/span&gt; &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;Discussion&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;connectionerror&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; color: #333333; cursor: text; font-size: 18px; margin: 20px 0px 10px; padding: 0px; transition: background-color 0.2s ease-out;&quot;&gt;
Connection Error?&lt;/h3&gt;
&lt;div style=&quot;margin-bottom: 15px;&quot;&gt;
If you get an error&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;Error: Connection did not succeed. Try again later.&lt;/code&gt;, then it’s likely because you don’t have permissions to the mailbox. You can fix this at the Exchange Management Shell with this:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;python&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;[PS] C:\Windows\system32&amp;gt;Add-MailboxFolderPermission -Identity CityScape&lt;span class=&quot;decorator&quot;&gt;@mydomain.co.uk:\Calendar -AccessRights Reviewer -U&lt;/span&gt;
ser aa&lt;span class=&quot;decorator&quot;&gt;@mydomain.co.uk&lt;/span&gt;

RunspaceId   : &lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;2&lt;/span&gt;f1d74cf-&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;7&lt;/span&gt;aae-&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;4743&lt;/span&gt;-&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;85&lt;/span&gt;fc-&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;95450&lt;/span&gt;de2d5de
FolderName   : Calendar
User         : Alice Anderson
AccessRights : {Reviewer}
Identity     : Alice Anderson
IsValid      : &lt;span class=&quot;built_in&quot; style=&quot;color: #0086b3;&quot;&gt;True&lt;/span&gt;

[PS] C:\Windows\system32&amp;gt;Add-MailboxFolderPermission -Identity BoardRoom&lt;span class=&quot;decorator&quot;&gt;@mydomain.co.uk:\Calendar -AccessRights Reviewer -U&lt;/span&gt;
ser aa&lt;span class=&quot;decorator&quot;&gt;@mydomain.co.uk&lt;/span&gt;

RunspaceId   : &lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;2&lt;/span&gt;f1d74cf-&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;7&lt;/span&gt;aae-&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;4743&lt;/span&gt;-&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;85&lt;/span&gt;fc-&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;95450&lt;/span&gt;de2d5de
FolderName   : Calendar
User         : Alice Anderson
AccessRights : {Reviewer}
Identity     : Alice Anderson
IsValid      : &lt;span class=&quot;built_in&quot; style=&quot;color: #0086b3;&quot;&gt;True&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
This provides the user account&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;aa&lt;/code&gt;&amp;nbsp;(which we’re using for testing) “Reviewer” permissions to the room calendars which is enough.&lt;/div&gt;
&lt;h2 id=&quot;whatsnext&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; cursor: text; font-size: 24px; margin: 20px 0px 10px; padding: 0px; transition: background-color 0.2s ease-out;&quot;&gt;
What’s Next&lt;/h2&gt;
&lt;div style=&quot;margin-bottom: 15px;&quot;&gt;
So, as a follow up to this, the next steps I want to take are:&lt;/div&gt;
&lt;ul style=&quot;margin-bottom: 0px !important; padding-left: 30px;&quot;&gt;
&lt;li&gt;Create a web interface to present the results&lt;/li&gt;
&lt;li&gt;Embed the web interface into the Cisco Jabber desktop&lt;/li&gt;
&lt;li&gt;Update room presence status with calendar availability, this way I can see room availability immediately within my mobile Jabber client too.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class=&quot;generate_from_h1 generate_for_page&quot; id=&quot;generated-toc&quot; style=&quot;-webkit-transition: all 0.3s ease-out; background-color: rgba(0, 0, 0, 0.8); border-bottom-left-radius: 10px; border-bottom-right-radius: 10px; border-top-left-radius: 10px; border-top-right-radius: 10px; border: 0px; bottom: -882px; color: #c8c8c8; font-size: 1.1em; line-height: 1.2em; max-height: 90%; outline: 0px; overflow-x: hidden; overflow-y: auto; padding: 10px 30px 20px 20px; position: fixed; right: 20px; transition: all 0.3s ease-out; width: 250px; word-wrap: break-word; z-index: 101;&quot;&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;span class=&quot;hidden&quot;&gt;&lt;a href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/74ZAFF46HB~jp~informationarchitects~Writer/Documents/EWS%20Intro.md#aftertoc&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; text-decoration: none;&quot;&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div id=&quot;toggle-container&quot; style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;a href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/74ZAFF46HB~jp~informationarchitects~Writer/Documents/EWS%20Intro.md#&quot; id=&quot;generated_toc_d_toggle&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; text-decoration: none;&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;ul style=&quot;margin-left: 10px; padding-left: 0px;&quot;&gt;
&lt;li class=&quot;notmissing&quot; style=&quot;background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; display: block; list-style: none; margin: 10px 0px;&quot;&gt;&lt;a class=&quot;wiki-link&quot; href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/74ZAFF46HB~jp~informationarchitects~Writer/Documents/EWS%20Intro.md#usingtheewsmanagedapitoaccessmeetingroomavailability&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; margin-top: 0px; outline: 0px; text-decoration: none;&quot;&gt;Using the EWS Managed API to access Meeting Room availability.&lt;/a&gt;&lt;ul style=&quot;margin-left: 10px; padding-left: 0px;&quot;&gt;
&lt;li class=&quot;notmissing&quot; style=&quot;background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; display: block; list-style: none; margin: 10px 0px;&quot;&gt;&lt;a class=&quot;wiki-link&quot; href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/74ZAFF46HB~jp~informationarchitects~Writer/Documents/EWS%20Intro.md#gettingstarted&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; margin-top: 0px; outline: 0px; text-decoration: none;&quot;&gt;Getting Started&lt;/a&gt;&lt;ul style=&quot;margin-left: 10px; padding-left: 0px;&quot;&gt;
&lt;li class=&quot;notmissing&quot; style=&quot;background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; display: block; list-style: none; margin: 10px 0px;&quot;&gt;&lt;a class=&quot;wiki-link&quot; href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/74ZAFF46HB~jp~informationarchitects~Writer/Documents/EWS%20Intro.md#firstthingsfirst-fixingourexchangeserver&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; margin-top: 0px; outline: 0px; text-decoration: none;&quot;&gt;First things first - fixing our Exchange Server&lt;/a&gt;&lt;/li&gt;
&lt;li class=&quot;notmissing&quot; style=&quot;background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; display: block; list-style: none; margin: 10px 0px;&quot;&gt;&lt;a class=&quot;wiki-link&quot; href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/74ZAFF46HB~jp~informationarchitects~Writer/Documents/EWS%20Intro.md#preparingtheexchangeserverforewsuse&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; margin-top: 0px; outline: 0px; text-decoration: none;&quot;&gt;Preparing the Exchange Server for EWS use&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li class=&quot;notmissing&quot; style=&quot;background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; display: block; list-style: none; margin: 10px 0px;&quot;&gt;&lt;a class=&quot;wiki-link&quot; href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/74ZAFF46HB~jp~informationarchitects~Writer/Documents/EWS%20Intro.md#creatingatestconsoleapplication&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; margin-top: 0px; outline: 0px; text-decoration: none;&quot;&gt;Creating a test console application&lt;/a&gt;&lt;ul style=&quot;margin-left: 10px; padding-left: 0px;&quot;&gt;
&lt;li class=&quot;notmissing&quot; style=&quot;background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; display: block; list-style: none; margin: 10px 0px;&quot;&gt;&lt;a class=&quot;wiki-link&quot; href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/74ZAFF46HB~jp~informationarchitects~Writer/Documents/EWS%20Intro.md#identifyingrooms&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; margin-top: 0px; outline: 0px; text-decoration: none;&quot;&gt;Identifying Rooms&lt;/a&gt;&lt;/li&gt;
&lt;li class=&quot;notmissing&quot; style=&quot;background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; display: block; list-style: none; margin: 10px 0px;&quot;&gt;&lt;a class=&quot;wiki-link&quot; href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/74ZAFF46HB~jp~informationarchitects~Writer/Documents/EWS%20Intro.md#roomavailability&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; margin-top: 0px; outline: 0px; text-decoration: none;&quot;&gt;Room Availability&lt;/a&gt;&lt;/li&gt;
&lt;li class=&quot;notmissing&quot; style=&quot;background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; display: block; list-style: none; margin: 10px 0px;&quot;&gt;&lt;a class=&quot;wiki-link&quot; href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/74ZAFF46HB~jp~informationarchitects~Writer/Documents/EWS%20Intro.md#connectionerror&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; margin-top: 0px; outline: 0px; text-decoration: none;&quot;&gt;Connection Error?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li class=&quot;notmissing&quot; style=&quot;background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; display: block; list-style: none; margin: 10px 0px;&quot;&gt;&lt;a class=&quot;wiki-link&quot; href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/74ZAFF46HB~jp~informationarchitects~Writer/Documents/EWS%20Intro.md#whatsnext&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; margin-top: 0px; outline: 0px; text-decoration: none;&quot;&gt;What’s Next&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://blog.darrenparkinson.uk/feeds/8479041856306521673/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.darrenparkinson.uk/2013/12/using-ews-managed-api-to-access-meeting_13.html#comment-form' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/8479041856306521673'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/8479041856306521673'/><link rel='alternate' type='text/html' href='http://blog.darrenparkinson.uk/2013/12/using-ews-managed-api-to-access-meeting_13.html' title='Using the EWS Managed API to access Meeting Room availability'/><author><name>Darren Parkinson</name><uri>http://www.blogger.com/profile/01084077294541066454</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27381059098267211.post-87315836267921148</id><published>2013-12-11T12:34:00.000+00:00</published><updated>2013-12-13T15:31:05.604+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="powershell"/><category scheme="http://www.blogger.com/atom/ns#" term="scripting"/><title type='text'>Using PowerShell to extract Active Directory Photos.</title><content type='html'>&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px;&quot;&gt;
I was asked yesterday if I could help extract all the user photos from within Active Directory so that they could be used for another application (thanks Matt H ;) ).&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Initially, I assumed I’d extend a previously written .Net application to insert photos into AD, but then I thought that this is likely to be something that I could script easily with PowerShell, given that Microsoft seem to be writing a PowerShell interface for just about everything.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
As with most things, it seems there are multiple ways of achieving this, but the easiest seemed to be through the use of the existing Active Directory Administration PowerShell Module.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
If you are on a server, the likelihood is that it is already installed. If not, you can refer to the&amp;nbsp;&lt;a href=&quot;http://technet.microsoft.com/en-us/library/dd378937%28WS.10%29.aspx&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;Microsoft documentation&lt;/a&gt;&amp;nbsp;about the best way to install this for your platform.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
To use the module, select&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;Start -&amp;gt; Administrative Tools -&amp;gt; Active Directory Module for Windows Powershell&lt;/code&gt;. Or you can just use&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;Import-Module ActiveDirectory&lt;/code&gt;&amp;nbsp;in your normal PowerShell window.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
To get the details for a single user, I can run the command&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;get-ADUser aa&lt;/code&gt;&amp;nbsp;which returns the following output:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;python&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;PS C:\Photos&amp;gt; Get-ADUser aa


DistinguishedName : CN=Alice Anderson,OU=CCM-Users,DC=mydomain,DC=co,DC=uk
Enabled           : &lt;span class=&quot;built_in&quot; style=&quot;color: #0086b3;&quot;&gt;True&lt;/span&gt;
GivenName         : Alice
Name              : Alice Anderson
ObjectClass       : user
ObjectGUID        : &lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;257&lt;/span&gt;ed433-bae4-&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;4&lt;/span&gt;dff-b4e0-&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;2&lt;/span&gt;d8dd9ca6c30
SamAccountName    : aa
SID               : S-&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;1&lt;/span&gt;-&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;5&lt;/span&gt;-&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;21&lt;/span&gt;-&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;661201177&lt;/span&gt;-&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;40823111&lt;/span&gt;-&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;81145796&lt;/span&gt;-&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;1111&lt;/span&gt;
Surname           : Anderson
UserPrincipalName : aa&lt;span class=&quot;decorator&quot;&gt;@mydomain.co.uk&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Since I want to perform this operation on a number of users, I can get the list of users I want by using the command:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;cs&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;PS C:\Photos&amp;gt; &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;get&lt;/span&gt;-ADUser -Filter * -SearchBase &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;OU=CCM-Users,DC=mydomain,DC=co,DC=uk&quot;&lt;/span&gt;&lt;/code&gt;&lt;div&gt;
&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;/pre&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
To get a specific user and save their thumbnail photo to a file, I need to extract the thumbnailPhoto attribute and encode it to a sequence of bytes:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;bash&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;PS C:\Photos&amp;gt; &lt;span class=&quot;variable&quot; style=&quot;color: teal;&quot;&gt;$user&lt;/span&gt; = Get-ADUser aa -Properties thumbnailPhoto
PS C:\Photos&amp;gt; &lt;span class=&quot;variable&quot; style=&quot;color: teal;&quot;&gt;$user&lt;/span&gt;.thumbnailPhoto | Set-Content aa.jpg -Encoding byte&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Then, if I want to do that for all users within an OU, I can do the following:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;ruby&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;Import&lt;/span&gt;-&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;Module&lt;/span&gt; &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;ActiveDirectory&lt;/span&gt;  
&lt;span class=&quot;variable&quot; style=&quot;color: teal;&quot;&gt;$users&lt;/span&gt; = &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;Get&lt;/span&gt;-&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;ADUser&lt;/span&gt; -&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;Filter&lt;/span&gt; * -&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;SearchBase&lt;/span&gt; &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;OU=CCM-Users,DC=mydomain,DC=co,DC=uk&quot;&lt;/span&gt; -&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;Properties&lt;/span&gt; &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;thumbnailPhoto&lt;/span&gt;  

&lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keymethods&quot; style=&quot;color: #0086b3;&quot;&gt;foreach&lt;/span&gt;&lt;/span&gt; (&lt;span class=&quot;variable&quot; style=&quot;color: teal;&quot;&gt;$user&lt;/span&gt; &lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;color: #0086b3;&quot;&gt;in&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;variable&quot; style=&quot;color: teal;&quot;&gt;$users&lt;/span&gt;) {
    &lt;span class=&quot;variable&quot; style=&quot;color: teal;&quot;&gt;$name&lt;/span&gt; = &lt;span class=&quot;variable&quot; style=&quot;color: teal;&quot;&gt;$user&lt;/span&gt;.&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;SamAccountName&lt;/span&gt; + &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;.jpg&quot;&lt;/span&gt;  
    &lt;span class=&quot;variable&quot; style=&quot;color: teal;&quot;&gt;$user&lt;/span&gt;.&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;thumbnailPhoto&lt;/span&gt; | &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;Set&lt;/span&gt;-&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;Content&lt;/span&gt; &lt;span class=&quot;variable&quot; style=&quot;color: teal;&quot;&gt;$name&lt;/span&gt; -&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;Encoding&lt;/span&gt; &lt;span class=&quot;identifier&quot;&gt;byte&lt;/span&gt;
}  
&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-top: 15px;&quot;&gt;
That’s it. You can then wrap that up into a full script (i.e. get-ADPhotos.ps1) so that this can be performed on a regular scheduled basis.&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;br /&gt;To select only users that have photos, you can use the following:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;perl&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;variable&quot; style=&quot;color: teal;&quot;&gt;$users&lt;/span&gt; = Get-ADUser -Filter * -SearchBase &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;OU=CCM-Users,DC=mydomain,DC=co,DC=uk&quot;&lt;/span&gt; -Properties thumbnailPhoto | ? {&lt;span class=&quot;variable&quot; style=&quot;color: teal;&quot;&gt;$_&lt;/span&gt;.thumbnailPhoto} | &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;select&lt;/span&gt; Name&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.darrenparkinson.uk/feeds/87315836267921148/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.darrenparkinson.uk/2013/12/using-powershell-to-extract-active.html#comment-form' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/87315836267921148'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/87315836267921148'/><link rel='alternate' type='text/html' href='http://blog.darrenparkinson.uk/2013/12/using-powershell-to-extract-active.html' title='Using PowerShell to extract Active Directory Photos.'/><author><name>Darren Parkinson</name><uri>http://www.blogger.com/profile/01084077294541066454</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27381059098267211.post-1487981908511128358</id><published>2013-11-26T16:32:00.000+00:00</published><updated>2013-11-26T16:32:58.627+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="cisco"/><category scheme="http://www.blogger.com/atom/ns#" term="ruby"/><category scheme="http://www.blogger.com/atom/ns#" term="scripting"/><category scheme="http://www.blogger.com/atom/ns#" term="unityconnection"/><title type='text'>Scripting Cisco Unity Connection</title><content type='html'>&lt;div id=&quot;wrapper&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; background-color: white; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; box-shadow: rgb(202, 202, 202) 0px 0px 0px 1px, rgb(238, 238, 238) 0px 0px 0px 4px; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 1.6; margin: 0px auto; max-width: 900px; outline: 0px; padding: 30px;&quot;&gt;
&lt;div style=&quot;margin-bottom: 15px;&quot;&gt;
This post talks about how easy it is to script against the&amp;nbsp;&lt;a href=&quot;http://docwiki.cisco.com/wiki/Cisco_Unity_Connection_APIs&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;REST based Cisco Unity Connection APIs&lt;/a&gt;. In case you don’t know, Cisco Unity Connection is an advanced unified messaging platform that works alongside the Cisco Unified Communications Manager platform.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
There are various APIs available, all of which seem capable of returning both XML and JSON responses, ranging from:&lt;/div&gt;
&lt;ul style=&quot;padding-left: 30px;&quot;&gt;
&lt;li&gt;provisioning, which allows you to set up users, contacts, distribution lists and call handlers (CUPI);&lt;/li&gt;
&lt;li&gt;a telephony interface to enable you to play and record content by phone (CUTI);&lt;/li&gt;
&lt;li&gt;a notification interface for notifications in server to server applications (CUNI);&lt;/li&gt;
&lt;li&gt;an imaging inteface, for visually viewing message state and mailbox information (CUII);&lt;/li&gt;
&lt;li&gt;and finally, a messaging interface for providing access to your messages (CUMI).&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
This last one is the one I thought I’d take a look at. This is useful if you want to embed this functionality into an existing application and allows you to send, receive and reply to messages, as well as providing the ability to broadcast messages and receive notifications.&lt;/div&gt;
&lt;h2 id=&quot;choosingascriptinglanguage&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; cursor: text; font-size: 24px; margin: 20px 0px 10px; padding: 0px; transition: background-color 0.2s ease-out;&quot;&gt;
Choosing a scripting language&lt;/h2&gt;
&lt;div style=&quot;margin-bottom: 15px;&quot;&gt;
For this, I needed to select a scripting language, and since I’m also in the process of taking a look at&amp;nbsp;&lt;a href=&quot;https://www.ruby-lang.org/en/&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;Ruby&lt;/a&gt;&amp;nbsp;it made sense to try them out together. I know I said I wouldn’t learn Ruby, but curiosity has got the better of me (and it turns out I quite like it).&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Firstly I thought I’d see if there were any existing REST clients for Ruby. Obviously REST is essentially based on HTTP, so you don’t really need one, but it turns out Ruby has&amp;nbsp;&lt;a href=&quot;http://rubygems.org/gems/rest-client&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;“rest-client”&lt;/a&gt;&amp;nbsp;which handles all the hard work (like multipart messages etc.) for you.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
So assuming you already have Ruby set up, to install the rest-client, simply run&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;gem install rest-client&lt;/code&gt;.&lt;/div&gt;
&lt;h2 id=&quot;gettingstarted&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; cursor: text; font-size: 24px; margin: 20px 0px 10px; padding: 0px; transition: background-color 0.2s ease-out;&quot;&gt;
Getting Started&lt;/h2&gt;
&lt;div style=&quot;margin-bottom: 15px;&quot;&gt;
With ruby, you can use the interactive ruby shell to run commands by typing&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;irb&lt;/code&gt;&amp;nbsp;at the terminal prompt.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
The first thing we do is tell it that we want to use the rest-client by typing&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;require &#39;rest-client&#39;&lt;/code&gt;:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;ruby&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;2.0&lt;/span&gt;.&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;0&lt;/span&gt;-&lt;span class=&quot;identifier&quot;&gt;p247&lt;/span&gt; &lt;span class=&quot;symbol&quot; style=&quot;color: #0086b3;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;001&lt;/span&gt; &amp;gt; &lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;color: #0086b3;&quot;&gt;require&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;rest-client&#39;&lt;/span&gt;
 =&amp;gt; &lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;color: #0086b3;&quot;&gt;true&lt;/span&gt;&lt;/span&gt; &lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Then we can request the basic details of our mailbox by sending a GET request to the /vmrest/mailbox URI on the server:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;cs&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;2.0&lt;/span&gt;.&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;0&lt;/span&gt;-p247 :&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;002&lt;/span&gt; &amp;gt; RestClient.&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;http://username:password@unityconnectionserver/vmrest/mailbox&#39;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Which, by default, returns XML output as follows:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;xml&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;pi&quot; style=&quot;color: #999999; font-weight: bold;&quot;&gt;&lt;/span&gt;
    &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;Mailbox&lt;/span&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;DisplayName&lt;/span&gt;&amp;gt;&lt;/span&gt;Voice Mailbox&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;DisplayName&lt;/span&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;CurrentSizeInBytes&lt;/span&gt;&amp;gt;&lt;/span&gt;18118&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;CurrentSizeInBytes&lt;/span&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;IsPrimary&lt;/span&gt;&amp;gt;&lt;/span&gt;true&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;IsPrimary&lt;/span&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;IsStoreMounted&lt;/span&gt;&amp;gt;&lt;/span&gt;true&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;IsStoreMounted&lt;/span&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;IsStoreOverFlowed&lt;/span&gt;&amp;gt;&lt;/span&gt;false&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;IsStoreOverFlowed&lt;/span&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;IsMailboxMounted&lt;/span&gt;&amp;gt;&lt;/span&gt;true&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;IsMailboxMounted&lt;/span&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;IsWarningQuotaExceeded&lt;/span&gt;&amp;gt;&lt;/span&gt;false&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;IsWarningQuotaExceeded&lt;/span&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;IsReceiveQuotaExceeded&lt;/span&gt;&amp;gt;&lt;/span&gt;false&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;IsReceiveQuotaExceeded&lt;/span&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;IsSendQuotaExceeded&lt;/span&gt;&amp;gt;&lt;/span&gt;false&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;IsSendQuotaExceeded&lt;/span&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;WarningQuota&lt;/span&gt;&amp;gt;&lt;/span&gt;12000000&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;WarningQuota&lt;/span&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;ReceiveQuota&lt;/span&gt;&amp;gt;&lt;/span&gt;14745600&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;ReceiveQuota&lt;/span&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;SendQuota&lt;/span&gt;&amp;gt;&lt;/span&gt;13000000&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;SendQuota&lt;/span&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;IsDeletedFolderEnabled&lt;/span&gt;&amp;gt;&lt;/span&gt;true&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;IsDeletedFolderEnabled&lt;/span&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;FoldersURI&lt;/span&gt;&amp;gt;&lt;/span&gt;/vmrest/mailbox/folders&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;FoldersURI&lt;/span&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;Mailbox&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
If you want JSON output, you simply set the accept header in the request:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;cs&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;2.0&lt;/span&gt;.&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;0&lt;/span&gt;-p247 :&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;003&lt;/span&gt; &amp;gt; RestClient.&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;http://username:password@unityconnectionserver/vmrest/mailbox&#39;&lt;/span&gt;, {:accept =&amp;gt; :json}&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Which returns the following:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;undefined&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;{\&quot;DisplayName\&quot;:\&quot;Voice Mailbox\&quot;,\&quot;CurrentSizeInBytes\&quot;:\&quot;18118\&quot;,\&quot;IsPrimary\&quot;:\&quot;true\&quot;,\&quot;IsStoreMounted\&quot;:\&quot;true\&quot;,\&quot;IsStoreOverFlowed\&quot;:\&quot;false\&quot;,\&quot;IsMailboxMounted\&quot;:\&quot;true\&quot;,\&quot;IsWarningQuotaExceeded\&quot;:\&quot;false\&quot;,\&quot;IsReceiveQuotaExceeded\&quot;:\&quot;false\&quot;,\&quot;IsSendQuotaExceeded\&quot;:\&quot;false\&quot;,\&quot;WarningQuota\&quot;:\&quot;12000000\&quot;,\&quot;ReceiveQuota\&quot;:\&quot;14745600\&quot;,\&quot;SendQuota\&quot;:\&quot;13000000\&quot;,\&quot;IsDeletedFolderEnabled\&quot;:\&quot;true\&quot;,\&quot;FoldersURI\&quot;:\&quot;/vmrest/mailbox/folders\&quot;}&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;usingyourbrowser&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; cursor: text; font-size: 24px; margin: 20px 0px 10px; padding: 0px; transition: background-color 0.2s ease-out;&quot;&gt;
Using your browser&lt;/h2&gt;
&lt;div style=&quot;margin-bottom: 15px;&quot;&gt;
Of course, you can see this output by just using your web browser to point to the address of your Unity Connection server and appending&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;/vmrest/mailbox&lt;/code&gt;&amp;nbsp;– you’ll be prompted for your username and password and will then get the appropriate xml output.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtnhobpAzqdgcMaUYT6RIPBggfHMdt_XP5Gg1O11blEnpCsZQpHeqBICuMPLjDFGaELHLaebOeaajn4bk0WpDImqhRqSYVCAcv22ZMUG_TJbIPCkKN74sbaDiF9NZvJePukgZfKfR_DjE/s1600/Screen+Shot+2013-11-26+at+11.13.02.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtnhobpAzqdgcMaUYT6RIPBggfHMdt_XP5Gg1O11blEnpCsZQpHeqBICuMPLjDFGaELHLaebOeaajn4bk0WpDImqhRqSYVCAcv22ZMUG_TJbIPCkKN74sbaDiF9NZvJePukgZfKfR_DjE/s1600/Screen+Shot+2013-11-26+at+11.13.02.png&quot; height=&quot;155&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
You can then use&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;/vmrest/mailbox/folders/inbox/messages&lt;/code&gt;&amp;nbsp;to list the messages in your inbox.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Finally, you can play or save any of your messages by using the URI in the message output, such as this:&lt;br /&gt;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;/vmrest/messages/0:da7fb3b8-5c91-4b9f-9d88-18604363df03&lt;/code&gt;&lt;br /&gt;and then using the URI of a specific attachment such as this:&lt;br /&gt;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;/vmrest/messages/0:da7fb3b8-5c91-4b9f-9d88-18604363df03/attachments/0&lt;/code&gt;.&lt;/div&gt;
&lt;h2 id=&quot;sendingabroadcastmessage&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; cursor: text; font-size: 24px; margin: 20px 0px 10px; padding: 0px; transition: background-color 0.2s ease-out;&quot;&gt;
Sending a broadcast message&lt;/h2&gt;
&lt;div style=&quot;margin-bottom: 15px;&quot;&gt;
The ability to send a broadcast voice message to all users can be quite useful, especially if your email system is down. There is a&amp;nbsp;&lt;a href=&quot;http://www.ciscounitytools.com/TOI/BMT/BroadcastMessageTool/BroadcastMessageTool.html&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;utility&lt;/a&gt;&amp;nbsp;already available for Windows that lets you manage your broadcast messages (along with source code at the main&lt;a href=&quot;http://developer.cisco.com/web/cuc/documentation&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;Unity Connection site&lt;/a&gt;), but since I’m using a Mac, I thought it would be useful to see how easy it is to do.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Before you can send broadcast messages, your user account must be enabled for it. This requires an administrative user to find your user account, edit the Send Message Settings and enable the option “User Can Send Broadcast Messages to Users on This Server” and “User Can Update Broadcast Messages Stored on This Server”. If you don’t do this, you will receive a&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;403 - Forbidden&lt;/code&gt;&amp;nbsp;error when you attempt to send the message.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-NbGCkDHoFhB32YQAjdPoxnjpbMqk4S4_uo6t8fFEuPBIom4gJ6CFHHnJLl_LU1_iJZg708hPY1hUOfv6HlAXborTM4NPDMGakxsw0erk_YM9nfjLXQpKSlupNqUorqCJktOyc5Z7auE/s1600/Screen+Shot+2013-11-26+at+11.16.19.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-NbGCkDHoFhB32YQAjdPoxnjpbMqk4S4_uo6t8fFEuPBIom4gJ6CFHHnJLl_LU1_iJZg708hPY1hUOfv6HlAXborTM4NPDMGakxsw0erk_YM9nfjLXQpKSlupNqUorqCJktOyc5Z7auE/s1600/Screen+Shot+2013-11-26+at+11.16.19.png&quot; height=&quot;140&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Some caveats:&lt;/div&gt;
&lt;ul style=&quot;padding-left: 30px;&quot;&gt;
&lt;li&gt;Messages can only be sent to all users (otherwise use a distribution list message);&lt;/li&gt;
&lt;li&gt;Messages can only be sent to users on one server – you would have to perform the broadcast on all servers if you have more than one;&lt;/li&gt;
&lt;li&gt;Once a broadcast message has been heard, it is automatically deleted from the user’s mailbox;&lt;/li&gt;
&lt;li&gt;Broadcast messages do not trigger notifications, i.e. MWI etc.&lt;/li&gt;
&lt;li&gt;Once you’ve sent a message, it’s not so simple to remove it. See the “Broadcast Message Tool viewing and deleting pending broadcast messages” video at the&amp;nbsp;&lt;a href=&quot;http://www.ciscounitytools.com/Applications/CxN/BroadcastMessageManager/BroadcastMessageManager.html&quot; style=&quot;color: #4183c4; margin-top: 0px; text-decoration: none;&quot;&gt;Broadcast Message Manager tool site&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;recordingyourmessage&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; color: #333333; cursor: text; font-size: 18px; margin: 20px 0px 10px; padding: 0px; transition: background-color 0.2s ease-out;&quot;&gt;
Recording your message&lt;/h3&gt;
&lt;div style=&quot;margin-bottom: 15px;&quot;&gt;
Clearly you’ll need a message to broadcast, so you’ll need to record one. If you were writing a full app, you’d probably build that functionality in, but the for the purposes of this, we’ll record it manually as it will be a message that never changes and we can re-use.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Cisco Unity Connection is a bit fussy about the file formats for audio files, so you need to ensure you’ve recorded the audio as mu-law at 8kHz sample rate.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
There are various ways of achieving this, but the easiest is probably to use Unity Connection. You can either download a previously recorded message, using the REST API from the browser as I mentioned above, or alternatively, you can use the CUTI API.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
For simplicity, I’ll use a previously downloaded WAV file from Unity Connection.&lt;/div&gt;
&lt;h3 id=&quot;usingcutitorecordaudio&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; color: #333333; cursor: text; font-size: 18px; margin: 20px 0px 10px; padding: 0px; transition: background-color 0.2s ease-out;&quot;&gt;
&lt;span style=&quot;line-height: 1.6;&quot;&gt;Sending the Broadcast Message&lt;/span&gt;&lt;/h3&gt;
&lt;div style=&quot;margin-bottom: 15px;&quot;&gt;
In order to send a broadcast message, the&amp;nbsp;&lt;a href=&quot;http://docwiki.cisco.com/wiki/Cisco_Unity_Connection_Messaging_Interface_(CUMI)_API_--_Using_the_CUMI_API_for_Broadcast_Messages&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;documentation&lt;/a&gt;&amp;nbsp;suggests using a POST to&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;mailbox/broadcastmessages&lt;/code&gt;. Firstly, we can use GET to see what messages we already have.&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;ruby&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;color: #0086b3;&quot;&gt;require&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;rest-client&#39;&lt;/span&gt;
&lt;span class=&quot;identifier&quot;&gt;url&lt;/span&gt; = &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;https://username:password@unityconnectionserver/vmrest/mailbox/broadcastmessages&#39;&lt;/span&gt;
&lt;span class=&quot;identifier&quot;&gt;response&lt;/span&gt; = &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;RestClient&lt;/span&gt;.&lt;span class=&quot;identifier&quot;&gt;get&lt;/span&gt;( &lt;span class=&quot;identifier&quot;&gt;url&lt;/span&gt;)
&lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keymethods&quot; style=&quot;color: #0086b3;&quot;&gt;puts&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;Response is&quot;&lt;/span&gt;, &lt;span class=&quot;identifier&quot;&gt;response&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Returns the following indicating that we have no messages.&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;xml&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;pi&quot; style=&quot;color: #999999; font-weight: bold;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;BroadcastMessages&lt;/span&gt; &lt;span class=&quot;attribute&quot; style=&quot;color: teal;&quot;&gt;total&lt;/span&gt;=&lt;span class=&quot;value&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;0&quot;&lt;/span&gt;/&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
To send the message, we need to POST a request with “mutipart/form-data”. Fortunately for us,&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;rest-client&lt;/code&gt;&amp;nbsp;handles that for us, we just need the data. This consists of an xml file and the audio wav file.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
The xml file must contain a start date, an end date and the detail about the audio file – my message.xml file looks like this:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;xml&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;pi&quot; style=&quot;color: #999999; font-weight: bold;&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;BroadcastMessage&lt;/span&gt;&amp;gt;&lt;/span&gt;
   &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;StartDate&lt;/span&gt;&amp;gt;&lt;/span&gt;2013-11-26 09:50:00.000&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;StartDate&lt;/span&gt;&amp;gt;&lt;/span&gt;
   &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;EndDate&lt;/span&gt;&amp;gt;&lt;/span&gt;2013-11-27 17:00:00.000&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;EndDate&lt;/span&gt;&amp;gt;&lt;/span&gt;
   &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;StreamFile&lt;/span&gt;&amp;gt;&lt;/span&gt;broadcast.wav&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;StreamFile&lt;/span&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;BroadcastMessage&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
So to post these, we can simply use the following code:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;ruby&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;color: #0086b3;&quot;&gt;require&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;rest-client&#39;&lt;/span&gt;
&lt;span class=&quot;identifier&quot;&gt;url&lt;/span&gt; = &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;https://username:password@unityconnectionserver/vmrest/mailbox/broadcastmessages&#39;&lt;/span&gt;
&lt;span class=&quot;identifier&quot;&gt;message&lt;/span&gt; = &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;./message.xml&#39;&lt;/span&gt;
&lt;span class=&quot;identifier&quot;&gt;audiofile&lt;/span&gt; = &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;./broadcast2.wav&#39;&lt;/span&gt;
&lt;span class=&quot;identifier&quot;&gt;response&lt;/span&gt; = &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;RestClient&lt;/span&gt;.&lt;span class=&quot;identifier&quot;&gt;post&lt;/span&gt;( &lt;span class=&quot;identifier&quot;&gt;url&lt;/span&gt;,
  {
    &lt;span class=&quot;symbol&quot; style=&quot;color: #0086b3;&quot;&gt;:&lt;span class=&quot;identifier&quot;&gt;myfiles&lt;/span&gt;&lt;/span&gt; =&amp;gt; {
      &lt;span class=&quot;symbol&quot; style=&quot;color: #0086b3;&quot;&gt;:&lt;span class=&quot;identifier&quot;&gt;file1&lt;/span&gt;&lt;/span&gt; =&amp;gt; &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;File&lt;/span&gt;.&lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keymethods&quot; style=&quot;color: #0086b3;&quot;&gt;new&lt;/span&gt;&lt;/span&gt;(&lt;span class=&quot;identifier&quot;&gt;message&lt;/span&gt;,&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;r&#39;&lt;/span&gt;),
      &lt;span class=&quot;symbol&quot; style=&quot;color: #0086b3;&quot;&gt;:&lt;span class=&quot;identifier&quot;&gt;file2&lt;/span&gt;&lt;/span&gt; =&amp;gt; &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;File&lt;/span&gt;.&lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keymethods&quot; style=&quot;color: #0086b3;&quot;&gt;new&lt;/span&gt;&lt;/span&gt;(&lt;span class=&quot;identifier&quot;&gt;audiofile&lt;/span&gt;,&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;r&#39;&lt;/span&gt;)
     }
  })
&lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keymethods&quot; style=&quot;color: #0086b3;&quot;&gt;puts&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;Response is&quot;&lt;/span&gt;, &lt;span class=&quot;identifier&quot;&gt;response&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
This doesn’t provide a response, but if we re-issue the GET request now, we receive the following:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;xml&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;pi&quot; style=&quot;color: #999999; font-weight: bold;&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;BroadcastMessages&lt;/span&gt; &lt;span class=&quot;attribute&quot; style=&quot;color: teal;&quot;&gt;total&lt;/span&gt;=&lt;span class=&quot;value&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;1&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;BroadcastMessage&lt;/span&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;ObjectId&lt;/span&gt;&amp;gt;&lt;/span&gt;d18ef988-4fbe-4fde-bbcf-ec4256931c4c&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;ObjectId&lt;/span&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;StreamFileObjectId&lt;/span&gt;&amp;gt;&lt;/span&gt;a9dbd464-8dc2-4c9f-83ae-db5675894c1d&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;StreamFileObjectId&lt;/span&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;VoiceFileURI&lt;/span&gt;&amp;gt;&lt;/span&gt;/vmrest/mailbox/broadcastmessages/d18ef988-4fbe-4fde-bbcf-ec4256931c4c/voicefile&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;VoiceFileURI&lt;/span&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;SubscriberObjectId&lt;/span&gt;&amp;gt;&lt;/span&gt;14e3f303-bb80-4c48-a884-c224f24e8d49&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;SubscriberObjectId&lt;/span&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;CreationDate&lt;/span&gt;&amp;gt;&lt;/span&gt;2013-11-26 10:09:15.870&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;CreationDate&lt;/span&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;StartDate&lt;/span&gt;&amp;gt;&lt;/span&gt;2013-11-26 09:50:00.000&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;StartDate&lt;/span&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;EndDate&lt;/span&gt;&amp;gt;&lt;/span&gt;2013-11-27 17:00:00.000&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;EndDate&lt;/span&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;StreamFile&lt;/span&gt;&amp;gt;&lt;/span&gt;4ffc1368-8f04-42aa-be17-f41654c2c77c.wav&lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;StreamFile&lt;/span&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;BroadcastMessage&lt;/span&gt;&amp;gt;&lt;/span&gt;
 &lt;span class=&quot;tag&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;BroadcastMessages&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
If I now hit the messages button on my handset and enter my PIN, I’m prompted by the broadcast message before my normal messages.&lt;/div&gt;
&lt;h2 id=&quot;followup&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; cursor: text; font-size: 24px; margin: 20px 0px 10px; padding: 0px; transition: background-color 0.2s ease-out;&quot;&gt;
Follow Up&lt;/h2&gt;
&lt;div style=&quot;margin-bottom: 15px;&quot;&gt;
&lt;b id=&quot;firstdiff&quot; style=&quot;-webkit-transition: color 0.2s ease-in-out; border: none !important; display: block; left: 0px; position: absolute; transition: color 0.2s ease-in-out;&quot;&gt;&lt;/b&gt;There is quite a lot you can do with the Cisco Unity Connection REST based APIs and they are super simple to use too. It’s nice to Cisco moving to this approach instead using SOAP.&lt;/div&gt;
&lt;div style=&quot;margin-top: 15px;&quot;&gt;
As an extension to the capability shown here, I guess you’d add the ability to dynamically record the audio in addition to the ability to delete the broadcast messages etc. Some of this functinoality is available in the&amp;nbsp;&lt;a href=&quot;http://www.ciscounitytools.com/Applications/CxN/BroadcastMessageManager/BroadcastMessageManager.html&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;Broadcast Message Manager&lt;/a&gt;available from the&amp;nbsp;&lt;a href=&quot;http://www.ciscounitytools.com/&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;Cisco Unity Tools&lt;/a&gt;&amp;nbsp;website.&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;generate_from_h1 generate_for_page&quot; id=&quot;generated-toc&quot; style=&quot;-webkit-transition: all 0.3s ease-out; background-color: rgba(0, 0, 0, 0.8); border-bottom-left-radius: 10px; border-bottom-right-radius: 10px; border-top-left-radius: 10px; border-top-right-radius: 10px; border: 0px; bottom: -879px; color: #c8c8c8; font-size: 1.1em; line-height: 1.2em; max-height: 90%; outline: 0px; overflow-x: hidden; overflow-y: auto; padding: 10px 30px 20px 20px; position: fixed; right: 20px; transition: all 0.3s ease-out; width: 250px; word-wrap: break-word; z-index: 101;&quot;&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;span class=&quot;hidden&quot;&gt;&lt;a href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/N39PJFAFEV~com~metaclassy~byword/Documents/Scripting%20Cisco%20Unity%20Connection.txt#aftertoc&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; text-decoration: none;&quot;&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div id=&quot;toggle-container&quot; style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;a href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/N39PJFAFEV~com~metaclassy~byword/Documents/Scripting%20Cisco%20Unity%20Connection.txt#&quot; id=&quot;generated_toc_d_toggle&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; text-decoration: none;&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;ul style=&quot;margin-left: 10px; padding-left: 0px;&quot;&gt;
&lt;li class=&quot;missing&quot; style=&quot;background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; display: block; list-style: none; margin: 10px 0px;&quot;&gt;&lt;ul style=&quot;margin-left: 10px; margin-top: 0px; padding-left: 0px;&quot;&gt;
&lt;li class=&quot;notmissing&quot; style=&quot;background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; display: block; list-style: none; margin: 10px 0px;&quot;&gt;&lt;a class=&quot;wiki-link&quot; href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/N39PJFAFEV~com~metaclassy~byword/Documents/Scripting%20Cisco%20Unity%20Connection.txt#choosingascriptinglanguage&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; margin-top: 0px; outline: 0px; text-decoration: none;&quot;&gt;Choosing a scripting language&lt;/a&gt;&lt;/li&gt;
&lt;li class=&quot;notmissing&quot; style=&quot;background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; display: block; list-style: none; margin: 10px 0px;&quot;&gt;&lt;a class=&quot;wiki-link&quot; href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/N39PJFAFEV~com~metaclassy~byword/Documents/Scripting%20Cisco%20Unity%20Connection.txt#gettingstarted&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; margin-top: 0px; outline: 0px; text-decoration: none;&quot;&gt;Getting Started&lt;/a&gt;&lt;/li&gt;
&lt;li class=&quot;notmissing&quot; style=&quot;background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; display: block; list-style: none; margin: 10px 0px;&quot;&gt;&lt;a class=&quot;wiki-link&quot; href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/N39PJFAFEV~com~metaclassy~byword/Documents/Scripting%20Cisco%20Unity%20Connection.txt#usingyourbrowser&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; margin-top: 0px; outline: 0px; text-decoration: none;&quot;&gt;Using your browser&lt;/a&gt;&lt;/li&gt;
&lt;li class=&quot;notmissing&quot; style=&quot;background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; display: block; list-style: none; margin: 10px 0px;&quot;&gt;&lt;a class=&quot;wiki-link&quot; href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/N39PJFAFEV~com~metaclassy~byword/Documents/Scripting%20Cisco%20Unity%20Connection.txt#sendingabroadcastmessage&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; margin-top: 0px; outline: 0px; text-decoration: none;&quot;&gt;Sending a broadcast message&lt;/a&gt;&lt;ul style=&quot;margin-left: 10px; padding-left: 0px;&quot;&gt;
&lt;li class=&quot;notmissing&quot; style=&quot;background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; display: block; list-style: none; margin: 10px 0px;&quot;&gt;&lt;a class=&quot;wiki-link&quot; href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/N39PJFAFEV~com~metaclassy~byword/Documents/Scripting%20Cisco%20Unity%20Connection.txt#recordingyourmessage&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; margin-top: 0px; outline: 0px; text-decoration: none;&quot;&gt;Recording your message&lt;/a&gt;&lt;/li&gt;
&lt;li class=&quot;notmissing&quot; style=&quot;background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; display: block; list-style: none; margin: 10px 0px;&quot;&gt;&lt;a class=&quot;wiki-link&quot; href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/N39PJFAFEV~com~metaclassy~byword/Documents/Scripting%20Cisco%20Unity%20Connection.txt#usingcutitorecordaudio&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; margin-top: 0px; outline: 0px; text-decoration: none;&quot;&gt;Using CUTI to record audio&lt;/a&gt;&lt;/li&gt;
&lt;li class=&quot;notmissing&quot; style=&quot;background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; display: block; list-style: none; margin: 10px 0px;&quot;&gt;&lt;a class=&quot;wiki-link&quot; href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/N39PJFAFEV~com~metaclassy~byword/Documents/Scripting%20Cisco%20Unity%20Connection.txt#sendingthebroadcastmessage&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; margin-top: 0px; outline: 0px; text-decoration: none;&quot;&gt;Sending the Broadcast Message&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li class=&quot;notmissing&quot; style=&quot;background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; display: block; list-style: none; margin: 10px 0px;&quot;&gt;&lt;a class=&quot;wiki-link&quot; href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/N39PJFAFEV~com~metaclassy~byword/Documents/Scripting%20Cisco%20Unity%20Connection.txt#followup&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; margin-top: 0px; outline: 0px; text-decoration: none;&quot;&gt;Follow Up&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://blog.darrenparkinson.uk/feeds/1487981908511128358/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.darrenparkinson.uk/2013/11/scripting-cisco-unity-connection_26.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/1487981908511128358'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/1487981908511128358'/><link rel='alternate' type='text/html' href='http://blog.darrenparkinson.uk/2013/11/scripting-cisco-unity-connection_26.html' title='Scripting Cisco Unity Connection'/><author><name>Darren Parkinson</name><uri>http://www.blogger.com/profile/01084077294541066454</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtnhobpAzqdgcMaUYT6RIPBggfHMdt_XP5Gg1O11blEnpCsZQpHeqBICuMPLjDFGaELHLaebOeaajn4bk0WpDImqhRqSYVCAcv22ZMUG_TJbIPCkKN74sbaDiF9NZvJePukgZfKfR_DjE/s72-c/Screen+Shot+2013-11-26+at+11.13.02.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27381059098267211.post-3807386866534458905</id><published>2013-10-04T20:06:00.001+01:00</published><updated>2013-10-04T20:08:06.337+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="mac"/><category scheme="http://www.blogger.com/atom/ns#" term="raspberry pi"/><title type='text'>Accessing the Raspberry Pi filesystem from MacOS X</title><content type='html'>&lt;br /&gt;
I recently changed my wireless network and could no longer access my wireless connected raspberry pi. I also don’t have an HDMI capable screen nearby that I can easily connect up to log in and change the settings. &lt;br /&gt;
&lt;br /&gt;
So, I thought it would be easiest to just put the SD card into my Mac, mount the filesystem and edit the appropriate files – it’s just unix right? &lt;br /&gt;
&lt;br /&gt;
Wrong. Unfortunately, Mac doesn’t support the ext2/ext3 filesystem types by default. &lt;br /&gt;
&lt;br /&gt;
Fortunately, there are a couple of projects that enable you to do just that. Firstly, there is a platform allowing developers to create their own file system handling capabilities in user space (&lt;a href=&quot;http://osxfuse.github.io/&quot;&gt;Fuse for OS X&lt;/a&gt; (previously MacFUSE)), and then there is the ext2/ext3 (&lt;a href=&quot;http://sourceforge.net/projects/fuse-ext2/&quot;&gt;fuse-ext2&lt;/a&gt;) extension which sits on top of that. &lt;br /&gt;
&lt;br /&gt;
&lt;h2 id=&quot;installingthesoftware.&quot;&gt;
Installing the software.&lt;/h2&gt;
&lt;br /&gt;
Installing the software is simply a matter of downloading the latest releases and installing them in the appropriate order. &lt;br /&gt;
&lt;br /&gt;
Of note is that you must select the option in Fuse for the &lt;code&gt;MacFUSE Compatibility Layer&lt;/code&gt; since fuse-ext2 hasn’t been updated to support the newer Fuse for OS X project. &lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8PzK8rJ6TgtFZ7tDloncmtdK3AeLLBVD0dgY5BqdLQeP5JUVyCF5-8PY2bnUmmyY0HqxrDOnODSQlz3XrJSTKFMW0YZmPjlReTDWHoTXmfEiYa1HCo9QQEThuCpoDaWRKo0UcIZ_4tOs/s1600/Screen+Shot+2013-10-04+at+18.32.58.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;227&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8PzK8rJ6TgtFZ7tDloncmtdK3AeLLBVD0dgY5BqdLQeP5JUVyCF5-8PY2bnUmmyY0HqxrDOnODSQlz3XrJSTKFMW0YZmPjlReTDWHoTXmfEiYa1HCo9QQEThuCpoDaWRKo0UcIZ_4tOs/s320/Screen+Shot+2013-10-04+at+18.32.58.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;h2 id=&quot;accessingtheext2partition&quot;&gt;
Accessing the ext2 partition&lt;/h2&gt;
&lt;br /&gt;
Once the software is installed, it will immediately mount the filesystem for you when you insert the SD card, in the same way you’d typically expect with other devices on the Mac. &lt;br /&gt;
&lt;br /&gt;
&lt;h2 id=&quot;twors&quot;&gt;
Two Rs&lt;/h2&gt;
&lt;br /&gt;
In trying to edit the wireless configuration files however, the problem I experienced was that I was getting read-only access to the partition, so I couldn’t edit the configuration file.&lt;br /&gt;
&lt;br /&gt;
I wasn’t having any luck through the options (i.e. -o rw+), so I just followed &lt;a href=&quot;http://www.thewireframecommunity.com/node/174&quot;&gt;some instructions that someone else had posted&lt;/a&gt; to fix that. &lt;br /&gt;
&lt;br /&gt;
Essentially, I performed the following steps:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Edit &lt;code&gt;/System/Library/Filesystems/fuse-ext2.fs/fuse-ext2.util&lt;/code&gt; with your favourite editor (obviously vi)&lt;/li&gt;
&lt;li&gt;Find the “Mount” function&lt;/li&gt;
&lt;li&gt;Edit the line with &lt;code&gt;OPTIONS=&quot;auto_xattr,defer_permissions&quot;&lt;/code&gt; to read &lt;code&gt;OPTIONS=&quot;auto_xattr,defer_permissions,rw+&quot;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
This changes the default mount options, so when you plug the SD card in again, it will automatically be mounted read/write. &lt;br /&gt;
&lt;br /&gt;
Previously, mount was showing: &lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;/dev/disk1s2 on /Volumes/Untitled (osxfusefs_ext2, local, read-only, synchronous)&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
And now it shows &lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;/dev/disk1s2 on /Volumes/Untitled 1 (osxfusefs_ext2, local, synchronous)&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;h2 id=&quot;changingthewirelessconfiguration&quot;&gt;
Changing the wireless configuration&lt;/h2&gt;
&lt;br /&gt;
To change the wireless configuration, I looked in the &lt;code&gt;etc/network/interfaces&lt;/code&gt; file on the mounted SD card, which in turn pointed me to the &lt;code&gt;etc/wpa_supplicant/wpa_supplicant.conf&lt;/code&gt; file. &lt;br /&gt;
&lt;br /&gt;
Firstly, I made a backup and then simply edited the ssid and psk entries. &lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
        ssid=&quot;YourSSIDhere&quot;
        psk=&quot;YourSuperHardToGuessPasswordHere&quot;
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=CCMP
        auth_alg=OPEN
}&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;h2 id=&quot;testing&quot;&gt;
Testing&lt;/h2&gt;
&lt;br /&gt;
Ejecting the SD card and poking it back in the Raspberry Pi was all that was needed to get it back on the network. It is possible that it might have been less time consuming to have gone to the effort of moving a few things so I could get to an HDMI capable screen! &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.darrenparkinson.uk/feeds/3807386866534458905/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.darrenparkinson.uk/2013/10/accessing-raspberry-pi-filesystem-from.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/3807386866534458905'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/3807386866534458905'/><link rel='alternate' type='text/html' href='http://blog.darrenparkinson.uk/2013/10/accessing-raspberry-pi-filesystem-from.html' title='Accessing the Raspberry Pi filesystem from MacOS X'/><author><name>Darren Parkinson</name><uri>http://www.blogger.com/profile/01084077294541066454</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8PzK8rJ6TgtFZ7tDloncmtdK3AeLLBVD0dgY5BqdLQeP5JUVyCF5-8PY2bnUmmyY0HqxrDOnODSQlz3XrJSTKFMW0YZmPjlReTDWHoTXmfEiYa1HCo9QQEThuCpoDaWRKo0UcIZ_4tOs/s72-c/Screen+Shot+2013-10-04+at+18.32.58.png" height="72" width="72"/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27381059098267211.post-7962536974976683014</id><published>2013-05-29T21:17:00.000+01:00</published><updated>2013-05-29T21:17:26.028+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="ifttt"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><category scheme="http://www.blogger.com/atom/ns#" term="raspberry pi"/><title type='text'>Using @Raspberry_Pi @Arduino and @ifttt to monitor the flood in my garage </title><content type='html'>&lt;br /&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px;&quot;&gt;
With the particularly wet weather we’re having this summer, my garage has developed a flood.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMLW3txWDNHCZwnx0Kepwdmb1cQoHhxZveTCc0SxLYhyphenhyphengXyxkNy7XcPbG2-73fHfFk28SeDpL9tiUYLkx36kcm6DOfuVieRyPtHbRRp1PH2CJ3TlvkU_TUwDiYt8TUO2jvnpv4sYuHhB0/s1600/Screenshot_29_05_2013_20_43.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMLW3txWDNHCZwnx0Kepwdmb1cQoHhxZveTCc0SxLYhyphenhyphengXyxkNy7XcPbG2-73fHfFk28SeDpL9tiUYLkx36kcm6DOfuVieRyPtHbRRp1PH2CJ3TlvkU_TUwDiYt8TUO2jvnpv4sYuHhB0/s320/Screenshot_29_05_2013_20_43.png&quot; width=&quot;211&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
There is what I believe to be a&amp;nbsp;&lt;a href=&quot;http://en.wikipedia.org/wiki/Dry_well&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;soakaway drain&lt;/a&gt;&amp;nbsp;which is used to drain the water from the garage roof when it’s raining.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Over the last few weeks, I’ve walked into the garage to see quite a flood around the drain without any indication of how it it is happening, even whilst it’s still raining and water is going into the drain, it’s not clear how it is flooding.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
I have therefore decided to set up the Arduino as a water sensor and hooked that up to the Raspberry Pi to provide the notifications, since I don’t have a wireless shield for my Arduino. This way, I can hopefully get an early warning of the flood without having to keep checking every few minutes.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
This post just outlines how I’ve achieved that. Most of this is quite convoluted and probably overkill for the requirement, but I have these items around and it&#39;s all pretty simple to do.&lt;/div&gt;
&lt;h2 id=&quot;overallarchitecture&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; cursor: text; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 24px; margin: 20px 0px 10px; padding: 0px;&quot;&gt;
Overall Architecture&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNu-J6VeDEB29Y1x8hzdJ_bDZcCxeyEM_5pqSRAF3tAg6sBvYk8kRjEHoLY365rNaFKWmiJURXj-Q4JWTgNQ52Oeu-OgcrJTKgFM5gOZltQIDt9xCRBowQ0wXUvEuIid2wFlx95NWJacQ/s1600/Drawing1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;161&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNu-J6VeDEB29Y1x8hzdJ_bDZcCxeyEM_5pqSRAF3tAg6sBvYk8kRjEHoLY365rNaFKWmiJURXj-Q4JWTgNQ52Oeu-OgcrJTKgFM5gOZltQIDt9xCRBowQ0wXUvEuIid2wFlx95NWJacQ/s640/Drawing1.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px;&quot;&gt;
At a high level, the Arduino senses the flood and the raspberry pi sends me a tweet. In addition, since I wouldn’t necessarily see the tweet immediately, I’ve also set it up to email&amp;nbsp;&lt;a href=&quot;http://www.ifttt.com/&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;“If This Then That”&lt;/a&gt;&amp;nbsp;which will in turn send me a text message (sms) that I’ll get immediately.&lt;/div&gt;
&lt;h2 id=&quot;arduinoasawatersensor&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; cursor: text; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 24px; margin: 20px 0px 10px; padding: 0px;&quot;&gt;
Arduino as a Water Sensor&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgj3Hw11kq77QdZ9g_H_ElgkmUfbSO19qd9UO_zpSI1Khk4vYl2xPYeHosguzFNWm_u7PXbTZxDW-whjF06Lr9v1d2r6wvsDthNVQzYR7XbdDytpPOxZOnibbXkuNOBx94kf2cBMMotwDY/s1600/Nails.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;212&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgj3Hw11kq77QdZ9g_H_ElgkmUfbSO19qd9UO_zpSI1Khk4vYl2xPYeHosguzFNWm_u7PXbTZxDW-whjF06Lr9v1d2r6wvsDthNVQzYR7XbdDytpPOxZOnibbXkuNOBx94kf2cBMMotwDY/s320/Nails.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Strictly speaking, this isn’t really a sensor. I’m essentially using the water to complete a circuit between a couple of nails and when I get a circuit, I’m reading the analog input to determine whether there is a flood or not.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
The analog input will give me a value of 1023 for a direct connection between the two nails and a value of 0 when no circuit is made. When water completes the circuit, it will provide a value of between 400 and 700 depending on how far apart the nails are.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
The circuit and the code for this is therefore very simple, as outlined below.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkPI5ID1BvoPNcHp2QAD-mcUmIK5iX_uuVOVbXgL2c9foFISxuZbfZY7yLCF2LNIxnOxKgYMw4E79cnlbLewuE8P2-OjzUcG43BHJZbqwPAJcV6Uefwt8nSoB-Jzxg6wv9LHDUloo6Pk0/s1600/circuit.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;197&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkPI5ID1BvoPNcHp2QAD-mcUmIK5iX_uuVOVbXgL2c9foFISxuZbfZY7yLCF2LNIxnOxKgYMw4E79cnlbLewuE8P2-OjzUcG43BHJZbqwPAJcV6Uefwt8nSoB-Jzxg6wv9LHDUloo6Pk0/s400/circuit.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;sketch cs&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;int&lt;/span&gt; moistureSensor = &lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;0&lt;/span&gt;; &lt;span class=&quot;comment&quot; style=&quot;color: #999988; font-style: italic;&quot;&gt;//analog 0&lt;/span&gt;
&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;int&lt;/span&gt; ledPin = &lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;9&lt;/span&gt;;
&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;int&lt;/span&gt; moistureValue;

&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;void&lt;/span&gt; setup() {
  pinMode(ledPin, OUTPUT);
  Serial.begin(&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;9600&lt;/span&gt;);
}

&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;void&lt;/span&gt; loop() {
  moistureValue = analogRead(moistureSensor);
  &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;if&lt;/span&gt; ((moistureValue &amp;lt; &lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;700&lt;/span&gt;) &amp;amp;&amp;amp; (moistureValue &amp;gt; &lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;400&lt;/span&gt;)) {
    analogWrite(ledPin, &lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;255&lt;/span&gt;); 
    Serial.println(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;Moisture Detected&quot;&lt;/span&gt;);
  } &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;else&lt;/span&gt; {
    analogWrite(ledPin, &lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;0&lt;/span&gt;);
  }
  delay(&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;500&lt;/span&gt;);
 
}&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
This will also light an LED on pin 9 as a visual indication too.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2 id=&quot;settingupatwitterfornotifications&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; cursor: text; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 24px; margin: 20px 0px 10px; padding: 0px;&quot;&gt;
Setting up a Twitter for notifications&lt;/h2&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px;&quot;&gt;
To get the notifications, I’ve set up a twitter account for the house which can then tweet that a flood has occurred.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
You could just use any twitter account, the important thing is to set up an “application” in twitter so that you can use Python on the Raspberry Pi to tweet.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Go to&amp;nbsp;&lt;a href=&quot;http://dev.twitter.com/apps&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;dev.twitter.com/apps&lt;/a&gt;&amp;nbsp;and log in with your account. Once logged in, you can click the “Create a new application” button and follow the steps.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiw42XM2rbFU21tfkPqYwAbLYeCpUngvrHYyZeV6ziFpqDfueyHRA16WRafnqlVcbSWqXhCSSfqto57TlaCEj06wm7vL4Y9R5sKTQblN8j9o8416CSC5npmtJN7pfh5NTHEnl1GjCAkBOA/s1600/Screen+Shot+2013-05-29+at+18.00.03.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;260&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiw42XM2rbFU21tfkPqYwAbLYeCpUngvrHYyZeV6ziFpqDfueyHRA16WRafnqlVcbSWqXhCSSfqto57TlaCEj06wm7vL4Y9R5sKTQblN8j9o8416CSC5npmtJN7pfh5NTHEnl1GjCAkBOA/s400/Screen+Shot+2013-05-29+at+18.00.03.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Once you’ve created an application, you then need to get the consumer key, the consumer secret and an access token secret from the application details tab which you’ll need for the Python script coming up next. You create the access token by clicking the “Create my access token” button.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
They have lots of rules too, so please make sure you follow them!&lt;/div&gt;
&lt;h2 id=&quot;settinguptheraspberrypi&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; cursor: text; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 24px; margin: 20px 0px 10px; padding: 0px;&quot;&gt;
Setting up the Raspberry Pi&lt;/h2&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px;&quot;&gt;
At this point, I’m assuming you already have a working Raspberry Pi, so I’ll just outline the main steps I performed to get up and running.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
So that I could load the arduino sketches on from the Raspberry Pi, I installed the arduino package and added the pi user to the tty and dial out groups for access to the serial port:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;sh cs&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;sudo apt-&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;get&lt;/span&gt; update
sudo apt-&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;get&lt;/span&gt; install arduino
sudo usermod -a -G tty pi
sudo usermod -a -G dialout pi&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Then I added the serial package for accessing the Arduino via serial port in the script:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;sh cs&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;sudo apt-&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;get&lt;/span&gt; install python-serial python3-serial&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
To enable the twitter integration, I’m using the&amp;nbsp;&lt;a href=&quot;http://code.google.com/p/python-twitter/&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;python-twitter&lt;/a&gt;&amp;nbsp;wrapper. To get this running I installed pip for the python package management:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;sh cs&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;sudo apt-&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;get&lt;/span&gt; install python-setuptools 
sudo easy_install pip&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Then installed the appropriate components:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;sh undefined&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;sudo pip install simplejson
sudo pip install OAuth2
sudo pip install HTTPLib2
sudo pip install python-twitter&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Then I created a short python script to read the serial port and detect the “Moisture Detected” string I’m outputting from the Arduino script. It probably isn’t that robust, but should serve the purpose for this.&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;py python&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;function&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;title&quot; style=&quot;color: #990000; font-weight: bold;&quot;&gt;SendTweet&lt;/span&gt;&lt;span class=&quot;params&quot;&gt;()&lt;/span&gt;:&lt;/span&gt;
    &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;&#39;&#39;
    Method to send a tweet
    &#39;&#39;&#39;&lt;/span&gt;
    &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;Water has been detected -- sending tweet&quot;&lt;/span&gt;
    api = twitter.Api(consumer_key=my_consumer_key,
        consumer_secret=my_consumer_secret,
        access_token_key=my_access_token_key,
        access_token_secret=my_access_token_secret)
    statustext = &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;Test Tweet : Water Detected on %s&#39;&lt;/span&gt; % time.asctime()
    status = api.PostUpdate(statustext)
    &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;print&lt;/span&gt; status.text

&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;import&lt;/span&gt; serial
&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;import&lt;/span&gt; time
&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;import&lt;/span&gt; twitter

my_consumer_key = &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;YOUR_CONSUMER_KEY&#39;&lt;/span&gt;
my_consumer_secret = &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;YOUR_CONSUMER_SECRET&#39;&lt;/span&gt;
my_access_token_key = &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;YOUR_ACCESS_TOKEN_KEY&#39;&lt;/span&gt;
my_access_token_secret = &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;YOUR_ACCESS_TOKEN_SECRET&#39;&lt;/span&gt;

port = &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;/dev/ttyACM0&quot;&lt;/span&gt;
ser = serial.Serial(port, &lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;9600&lt;/span&gt;)
ser.flushInput()

&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;Listening to arduino, waiting for detection...&quot;&lt;/span&gt;
timer = time.time()
tweetdelay = &lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;120&lt;/span&gt; &lt;span class=&quot;comment&quot; style=&quot;color: #999988; font-style: italic;&quot;&gt;# in seconds&lt;/span&gt;

&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;built_in&quot; style=&quot;color: #0086b3;&quot;&gt;True&lt;/span&gt;:
    &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;if&lt;/span&gt; (ser.inWaiting() &amp;gt; &lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;0&lt;/span&gt;):
        input = ser.readline()
        &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;Moisture Detected&quot;&lt;/span&gt; &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;in&lt;/span&gt; input:
            &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;if&lt;/span&gt; ((time.time() - timer) &amp;gt; tweetdelay):
               timer = time.time() &lt;span class=&quot;comment&quot; style=&quot;color: #999988; font-style: italic;&quot;&gt;#reset timer ready for next loop&lt;/span&gt;
               SendTweet()
        &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;elif&lt;/span&gt; ((time.time() - timer) &amp;gt; tweetdelay):
            timer = time.time()&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;addingsmsnotifications&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; cursor: text; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 24px; margin: 20px 0px 10px; padding: 0px;&quot;&gt;
Adding SMS notifications&lt;/h2&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px;&quot;&gt;
At the moment, IFTTT doesn’t have any triggers for Twitter, so in order to get an SMS notification, I can send an email from my google account to IFTTT which in turn will send me a text message.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
To do this, I just added the following to the SendTweet method:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;py undefined&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;server = smtplib.SMTP(&#39;smtp.gmail.com:587&#39;)
server.starttls()
server.login(username, password)
server.sendmail(fromaddr, toaddr, msg)
server.quit()&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;b id=&quot;firstdiff&quot; style=&quot;-webkit-transition: color 0.2s ease-in-out; border: none !important; display: block; left: 0px; position: absolute;&quot;&gt;&lt;/b&gt;And the following to the main script:&amp;nbsp;&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;py ini&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;setting&quot;&gt;fromaddr = &lt;span class=&quot;value&quot;&gt;&#39;YOUR_GMAIL_ADDRESS_HERE&#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;setting&quot;&gt;toaddr = &lt;span class=&quot;value&quot;&gt;&#39;trigger@ifttt.com&#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;setting&quot;&gt;header = &lt;span class=&quot;value&quot;&gt;&#39;To:&#39; + toaddr + &#39;\n&#39; + &#39;From: fromaddr&#39; + &#39;\n&#39; + &#39;Subject:Garage is flooded. \n&#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;setting&quot;&gt;msg = &lt;span class=&quot;value&quot;&gt;header + &#39;Garage is flooded&#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;setting&quot;&gt;username = &lt;span class=&quot;value&quot;&gt;&#39;YOUR_GMAIL_ACCOUNT@gmail.com&#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;setting&quot;&gt;password = &lt;span class=&quot;value&quot;&gt;&#39;YOUR_GMAIL_PASSWORD&#39;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; text-align: -webkit-auto;&quot;&gt;Of note is that the email wasn&#39;t accepted without the &quot;From:&quot; in the header, which makes sense I guess as this is what IFTTT is checking for I suppose.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; text-align: -webkit-auto;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqWNn0nKwejf3EGStvLFtodFfT2nMr8F8nsULDwlPVhG_w5KjrKuSJPbGGX1q9FqI2h1olgzpUSq1rZIKwGAHUpT1X4Exvu2YoSP-HoSda8eYTa5N8HLfxz1fJwmMHx537o9Xz31EFpOk/s1600/Screen+Shot+2013-05-29+at+20.26.12.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;87&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqWNn0nKwejf3EGStvLFtodFfT2nMr8F8nsULDwlPVhG_w5KjrKuSJPbGGX1q9FqI2h1olgzpUSq1rZIKwGAHUpT1X4Exvu2YoSP-HoSda8eYTa5N8HLfxz1fJwmMHx537o9Xz31EFpOk/s400/Screen+Shot+2013-05-29+at+20.26.12.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-top: 15px;&quot;&gt;
That&#39;s it.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-top: 15px;&quot;&gt;
Now, if the garage floods, I&#39;ll be able to get there immediately to see how on earth it&#39;s happening. &amp;nbsp;As a follow up, I could also incorporate the motion sensor that I&#39;ve posted about before, along with a web cam in case I&#39;m not in the house somewhere.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://blog.darrenparkinson.uk/feeds/7962536974976683014/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.darrenparkinson.uk/2013/05/using-raspberrypi-arduino-and-ifttt-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/7962536974976683014'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/7962536974976683014'/><link rel='alternate' type='text/html' href='http://blog.darrenparkinson.uk/2013/05/using-raspberrypi-arduino-and-ifttt-to.html' title='Using @Raspberry_Pi @Arduino and @ifttt to monitor the flood in my garage '/><author><name>Darren Parkinson</name><uri>http://www.blogger.com/profile/01084077294541066454</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMLW3txWDNHCZwnx0Kepwdmb1cQoHhxZveTCc0SxLYhyphenhyphengXyxkNy7XcPbG2-73fHfFk28SeDpL9tiUYLkx36kcm6DOfuVieRyPtHbRRp1PH2CJ3TlvkU_TUwDiYt8TUO2jvnpv4sYuHhB0/s72-c/Screenshot_29_05_2013_20_43.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27381059098267211.post-8266874042055400242</id><published>2013-05-16T22:23:00.000+01:00</published><updated>2013-05-16T22:23:10.636+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="iOS"/><title type='text'>Messing around with custom UICollectionViewLayouts</title><content type='html'>&lt;div id=&quot;wrapper&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; background-color: white; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; box-shadow: rgb(202, 202, 202) 0px 0px 0px 1px, rgb(238, 238, 238) 0px 0px 0px 4px; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 1.6; margin: 0px auto; max-width: 900px; outline: 0px; padding: 30px;&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;margin-bottom: 15px;&quot;&gt;
I’ve had some success implementing an enterprise application project with a UICollectionView using UICollectionViewFlowLayout objects to lay out the information in a fairly standard way.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
In preparation for the next version of the app I’ve been experimenting with custom UICollectionViewLayouts by using and modifying sample code from various locations.&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://skeuo.com/uicollectionview-custom-layout-tutorial&quot; target=&quot;_blank&quot;&gt;Bryan Hansen&#39;s UICollectionView Custom Layout Tutorial&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/mpospese/IntroducingCollectionViews&quot; target=&quot;_blank&quot;&gt;Mark Pospesel&#39;s Introducing Collection Views&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
The problem was, I didn’t really have a full grasp of what was going on in the custom layouts, so I set about starting a new project from scratch in order to gain a better understanding.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
In this post, I’m going to look at the basic implementation of a custom UICollectionViewLayout, with maybe some follow-up posts on implementing supplementary views and decoration views etc. at a later date.&lt;/div&gt;
&lt;h2 id=&quot;gettingstarted&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; cursor: text; font-size: 24px; margin: 20px 0px 10px; padding: 0px;&quot;&gt;
Getting Started&lt;/h2&gt;
&lt;div style=&quot;margin-bottom: 15px;&quot;&gt;
I set up a new project with a Single View and added a Collection View object to it. I set the View Controller as the datasource and delegate, gave the Cell a cell identifier of “Cell” and ran it, and it looks as follows (after changing the background colours of the UICollectionView and Cell to white and grey respectively):&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjR-jOfyUdDh6-WMAcD2D40CNhm0jGvhaYjx2shbnB0CB33RB8R6V6VNdEb17ky3opGPWcyCjY7_AK16AQcGPivZ8UY05H3HRTaJ0DbHGvQED7KMPEAqxBlZgpjcy-NAIlCz3pj6g9eUwk/s1600/Default+Flow+Layout.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;239&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjR-jOfyUdDh6-WMAcD2D40CNhm0jGvhaYjx2shbnB0CB33RB8R6V6VNdEb17ky3opGPWcyCjY7_AK16AQcGPivZ8UY05H3HRTaJ0DbHGvQED7KMPEAqxBlZgpjcy-NAIlCz3pj6g9eUwk/s320/Default+Flow+Layout.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
Implementing a basic datasource to achieve this looks as follows:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;m cs&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;- (&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;void&lt;/span&gt;)viewDidLoad
{
    [super viewDidLoad];
	&lt;span class=&quot;comment&quot; style=&quot;color: #999988; font-style: italic;&quot;&gt;// Do any additional setup after loading the view, typically from a nib.&lt;/span&gt;
    _mySection1 = @[&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;@&quot;item1&quot;&lt;/span&gt;, &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;@&quot;item2&quot;&lt;/span&gt;, &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;@&quot;item3&quot;&lt;/span&gt;, &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;@&quot;item4&quot;&lt;/span&gt;, &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;@&quot;item5&quot;&lt;/span&gt;, &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;@&quot;item6&quot;&lt;/span&gt;, &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;@&quot;item7&quot;&lt;/span&gt;, &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;@&quot;item8&quot;&lt;/span&gt;, &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;@&quot;item9&quot;&lt;/span&gt;, &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;@&quot;item10&quot;&lt;/span&gt;];
    _mySection2 = @[&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;@&quot;item1&quot;&lt;/span&gt;, &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;@&quot;item2&quot;&lt;/span&gt;, &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;@&quot;item3&quot;&lt;/span&gt;, &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;@&quot;item4&quot;&lt;/span&gt;, &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;@&quot;item5&quot;&lt;/span&gt;, &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;@&quot;item6&quot;&lt;/span&gt;, &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;@&quot;item7&quot;&lt;/span&gt;, &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;@&quot;item8&quot;&lt;/span&gt;, &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;@&quot;item9&quot;&lt;/span&gt;, &lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;@&quot;item10&quot;&lt;/span&gt;];
    _mySections = [[NSArray alloc] initWithObjects:_mySection1, _mySection2, nil];
}

#pragma mark - UICollectionViewDataSource
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;return&lt;/span&gt; [[_mySections objectAtIndex:section] count];
}

- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
    &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;return&lt;/span&gt; [_mySections count];
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;@&quot;Cell&quot;&lt;/span&gt; forIndexPath:indexPath];
    &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;return&lt;/span&gt; cell;
}&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;em&gt;ViewController.m&lt;/em&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
It doesn’t look that great, but the intention isn’t to produce a graphically pleasing display at this point, just to learn about the layout.&lt;/div&gt;
&lt;h2 id=&quot;whatdowewantittolooklike&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; cursor: text; font-size: 24px; margin: 20px 0px 10px; padding: 0px;&quot;&gt;
What do we want it to look like?&lt;/h2&gt;
&lt;div style=&quot;margin-bottom: 15px;&quot;&gt;
To learn about the custom layout, I thought I’d set a goal of recreating some of the functionality that was available in the Microsoft Silverlight PivotViewer control&amp;nbsp;&lt;a href=&quot;http://www.itwriting.com/blog/6924-microsoft-silverlight-shattered-into-a-million-broken-urls.html&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;(before they decided to drop Silverlight)&lt;/a&gt;.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
For those that don’t know, the PivotViewer control enabled you to create a graphical data set and then manipulate it in ways to see trends etc. It’s probably easier to see an example (you’ll need to have Silverlight installed).&lt;/div&gt;
&lt;ul style=&quot;padding-left: 30px;&quot;&gt;
&lt;li&gt;&lt;a href=&quot;http://netflixpivot.cloudapp.net/&quot; style=&quot;color: #4183c4; margin-top: 0px; text-decoration: none;&quot;&gt;NetFlix Movies&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://netflixpivot.cloudapp.net/&quot; style=&quot;color: #4183c4; margin-top: 0px; text-decoration: none;&quot;&gt;Caravans and Camping&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.microsoft.com/silverlight/pivotviewer/&quot; style=&quot;color: #4183c4; margin-top: 0px; text-decoration: none;&quot;&gt;Microsoft Page for Pivot Viewer&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
And in case you don’t have Silverlight, here’s a couple of screen shots from NetFlix:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhi4cgu6XshQ1Ud2Bkjd8-_v8q_gRPyppoUMMTR6epmIVxhIwi0P8uY2DoNEAoXwB73L7eu-mhSqKG3o4evo0rc7gt6b993LGwBcDSSoqUV8ka_Ge2QzG6UHn3DyTDUYMLr7PqY47LXnU0/s1600/PivotViewer+Example+1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;173&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhi4cgu6XshQ1Ud2Bkjd8-_v8q_gRPyppoUMMTR6epmIVxhIwi0P8uY2DoNEAoXwB73L7eu-mhSqKG3o4evo0rc7gt6b993LGwBcDSSoqUV8ka_Ge2QzG6UHn3DyTDUYMLr7PqY47LXnU0/s400/PivotViewer+Example+1.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQgc8wWXE7Du79vT447YD1v8E-tGaw56TzeTx_1_qVG4ZfwfSLGuVYjG9bC_-d5mf_uqOaro7yNDDiMEMV58ynbLrOyFbyP-wS6ZPwmwBLT7e-LcG82nLO2WoLIDCfyryOgev6e2O7wKk/s1600/PivotViewer+Example+2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;173&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQgc8wWXE7Du79vT447YD1v8E-tGaw56TzeTx_1_qVG4ZfwfSLGuVYjG9bC_-d5mf_uqOaro7yNDDiMEMV58ynbLrOyFbyP-wS6ZPwmwBLT7e-LcG82nLO2WoLIDCfyryOgev6e2O7wKk/s400/PivotViewer+Example+2.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;br /&gt;
Clearly it’s quite a big goal to create all of that functionality, so we’ll start extremely basic by first creating a custom layout that can display items as a bar graph.&lt;/div&gt;
&lt;h2 id=&quot;creatingthecustomlayout&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; cursor: text; font-size: 24px; margin: 20px 0px 10px; padding: 0px;&quot;&gt;
Creating the custom layout&lt;/h2&gt;
&lt;div style=&quot;margin-bottom: 15px;&quot;&gt;
The default layout given to the UICollectionView is “Flow”, but I want to mess around with Custom Layout, so I have set it to custom and added an empty class as a subclass of UICollectionViewLayout.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLJqoG0DYN5lvPvFAWwaaQVFyR9XnUXHNVye92rIdHIh-_R1mhyj2UiUeGzESLMirzJHufWDE5s5PeR6eb0YwBBom73LtlWPgNhLfsa0OyWLwyVM5cw2AXqKNWF-I4Yjy5RF8oyeyaisk/s1600/Collection+View+Flow+Setting.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLJqoG0DYN5lvPvFAWwaaQVFyR9XnUXHNVye92rIdHIh-_R1mhyj2UiUeGzESLMirzJHufWDE5s5PeR6eb0YwBBom73LtlWPgNhLfsa0OyWLwyVM5cw2AXqKNWF-I4Yjy5RF8oyeyaisk/s1600/Collection+View+Flow+Setting.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKy_tXzc8oUs5iOm1t5hs1jSPn-KFt62FotEgqP4Zr_c5lH-Ay3JfACd2Zwbpxm9KTxEDbEzMzNmpKTTPIUv8ddXWgBEExmp1Ix8xfxl6o2c6SP78XOTrR58LbPK8M2KEUwH1pkgz_kpY/s1600/CollectionView+Custom+Setting.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKy_tXzc8oUs5iOm1t5hs1jSPn-KFt62FotEgqP4Zr_c5lH-Ay3JfACd2Zwbpxm9KTxEDbEzMzNmpKTTPIUv8ddXWgBEExmp1Ix8xfxl6o2c6SP78XOTrR58LbPK8M2KEUwH1pkgz_kpY/s1600/CollectionView+Custom+Setting.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Running the app now gives me a blank screen as I haven’t provided any layout information. To do that, I have to override various methods, including at least the following:&lt;/div&gt;
&lt;ul style=&quot;padding-left: 30px;&quot;&gt;
&lt;li&gt;collectionViewContentSize: to specify how large your entire content is&lt;/li&gt;
&lt;li&gt;prepareLayout: to perform up-front layout calculations ready for the next method&lt;/li&gt;
&lt;li&gt;layoutAttributesForElementsInRect: to provide the information for the cells etc. in the current display.&lt;/li&gt;
&lt;li&gt;layoutAttributesForItemAtIndexPath:&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
There are many more methods to override when we start looking at inserting or removing items and adding supplementary or decoration views, but that’s for another time.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
For collectionViewContentSize: we would usually return a property that we can change as our collection view changes, since this size is essentially the size of our entire collection once we’ve laid everything out so that it knows how much scrolling to do. For the purposes of my test, I’m creating a bar graph and so I don’t want any scrolling, I just want to fit everything to one page (screen), so I’ll return the following:&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;return self.collectionView.bounds.size;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
The prepareLayout: method is next, and we’ll use that to create an array that contains another array for each section, each containing the locations of the items within that section.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Here is a rough sketch that I created to help visualise what the code needed to look like.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiti1yIKBI3G8o77z2razMU1jnTtvjqTm2liye4dV9lSS_TkvTeEwuKBXo0BF4KVarzAUm7THuZOYqf6Dqx6Q8QyWHqBfNSHJOtVbZg1Wo6NYjB_cAph3kac6dhRWEKu32Bv-gWl5lMRf4/s1600/BarGraphLayout.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;271&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiti1yIKBI3G8o77z2razMU1jnTtvjqTm2liye4dV9lSS_TkvTeEwuKBXo0BF4KVarzAUm7THuZOYqf6Dqx6Q8QyWHqBfNSHJOtVbZg1Wo6NYjB_cAph3kac6dhRWEKu32Bv-gWl5lMRf4/s400/BarGraphLayout.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Firstly, we’ll create the property that will store the arrays, along with some constants that we can use in the code:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;m perl&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;comment&quot; style=&quot;color: #999988; font-style: italic;&quot;&gt;#define kCellHeight 25.0f&lt;/span&gt;
&lt;span class=&quot;comment&quot; style=&quot;color: #999988; font-style: italic;&quot;&gt;#define kCellWidth 25.0f&lt;/span&gt;
&lt;span class=&quot;comment&quot; style=&quot;color: #999988; font-style: italic;&quot;&gt;#define kCellSpace 5.0f&lt;/span&gt;
&lt;span class=&quot;comment&quot; style=&quot;color: #999988; font-style: italic;&quot;&gt;#define kBarWidth 85.0f&lt;/span&gt;
&lt;span class=&quot;comment&quot; style=&quot;color: #999988; font-style: italic;&quot;&gt;#define kBarSpace 50.0f&lt;/span&gt;

&lt;span class=&quot;variable&quot; style=&quot;color: teal;&quot;&gt;@interface&lt;/span&gt; TBBarGraphLayout()
&lt;span class=&quot;variable&quot; style=&quot;color: teal;&quot;&gt;@property&lt;/span&gt; (strong, nonatomic) NSMutableArray &lt;span class=&quot;variable&quot; style=&quot;color: teal;&quot;&gt;*barGraphFrames&lt;/span&gt;;
&lt;span class=&quot;variable&quot; style=&quot;color: teal;&quot;&gt;@end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Then we’ll implement the prepareLayout: method:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;m ruby&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;- (&lt;span class=&quot;identifier&quot;&gt;void&lt;/span&gt;)&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;prepareLayout&lt;/span&gt; {

    [&lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;color: #0086b3;&quot;&gt;super&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;prepareLayout&lt;/span&gt;];

    &lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;color: #0086b3;&quot;&gt;if&lt;/span&gt;&lt;/span&gt; (!&lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;color: #0086b3;&quot;&gt;self&lt;/span&gt;&lt;/span&gt;.&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;barGraphFrames&lt;/span&gt;) {
        &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;_barGraphFrames&lt;/span&gt; = [[&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;NSMutableArray&lt;/span&gt; &lt;span class=&quot;identifier&quot;&gt;alloc&lt;/span&gt;] &lt;span class=&quot;identifier&quot;&gt;init&lt;/span&gt;];
    }

    &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;CGFloat&lt;/span&gt; &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;columnLeft&lt;/span&gt; = &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;kBarSpace&lt;/span&gt;;
    &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;CGFloat&lt;/span&gt; &lt;span class=&quot;identifier&quot;&gt;left&lt;/span&gt; = &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;columnLeft&lt;/span&gt;;
    &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;CGFloat&lt;/span&gt; &lt;span class=&quot;identifier&quot;&gt;top&lt;/span&gt; = &lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;color: #0086b3;&quot;&gt;self&lt;/span&gt;&lt;/span&gt;.&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;collectionViewContentSize&lt;/span&gt;.&lt;span class=&quot;identifier&quot;&gt;height&lt;/span&gt; - &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;kCellHeight&lt;/span&gt;;
    
    &lt;span class=&quot;identifier&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;barColumn&lt;/span&gt; = &lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;0&lt;/span&gt;;
    &lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;color: #0086b3;&quot;&gt;for&lt;/span&gt;&lt;/span&gt; (&lt;span class=&quot;identifier&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;identifier&quot;&gt;section&lt;/span&gt; = &lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;0&lt;/span&gt;; &lt;span class=&quot;identifier&quot;&gt;section&lt;/span&gt; &amp;lt; &lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;color: #0086b3;&quot;&gt;self&lt;/span&gt;&lt;/span&gt;.&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;collectionView&lt;/span&gt;.&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;numberOfSections&lt;/span&gt;; &lt;span class=&quot;identifier&quot;&gt;section&lt;/span&gt;++) {
        &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;NSMutableArray&lt;/span&gt; *&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;tempArray&lt;/span&gt; = [[&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;NSMutableArray&lt;/span&gt; &lt;span class=&quot;identifier&quot;&gt;alloc&lt;/span&gt;] &lt;span class=&quot;identifier&quot;&gt;init&lt;/span&gt;];
        &lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;color: #0086b3;&quot;&gt;for&lt;/span&gt;&lt;/span&gt; (&lt;span class=&quot;identifier&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;identifier&quot;&gt;item&lt;/span&gt; = &lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;0&lt;/span&gt;; &lt;span class=&quot;identifier&quot;&gt;item&lt;/span&gt; &amp;lt; [&lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;color: #0086b3;&quot;&gt;self&lt;/span&gt;&lt;/span&gt;.&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;collectionView&lt;/span&gt; &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;numberOfItemsInSection&lt;/span&gt;&lt;span class=&quot;symbol&quot; style=&quot;color: #0086b3;&quot;&gt;:&lt;span class=&quot;identifier&quot;&gt;section&lt;/span&gt;&lt;/span&gt;]; &lt;span class=&quot;identifier&quot;&gt;item&lt;/span&gt;++) {
            &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;CGRect&lt;/span&gt; &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;itemFrame&lt;/span&gt; = (&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;CGRect&lt;/span&gt;){{&lt;span class=&quot;identifier&quot;&gt;left&lt;/span&gt;, &lt;span class=&quot;identifier&quot;&gt;top&lt;/span&gt;}, &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;CGSizeMake&lt;/span&gt;(&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;kCellWidth&lt;/span&gt;, &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;kCellHeight&lt;/span&gt;)};
            [&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;tempArray&lt;/span&gt; &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;addObject&lt;/span&gt;&lt;span class=&quot;symbol&quot; style=&quot;color: #0086b3;&quot;&gt;:&lt;/span&gt;[&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;NSValue&lt;/span&gt; &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;valueWithCGRect&lt;/span&gt;&lt;span class=&quot;symbol&quot; style=&quot;color: #0086b3;&quot;&gt;:&lt;span class=&quot;identifier&quot;&gt;itemFrame&lt;/span&gt;&lt;/span&gt;]];
            &lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;color: #0086b3;&quot;&gt;if&lt;/span&gt;&lt;/span&gt; (&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;barColumn&lt;/span&gt; &amp;lt; &lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;2&lt;/span&gt;) {
                &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;barColumn&lt;/span&gt; += &lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;1&lt;/span&gt;;
                &lt;span class=&quot;identifier&quot;&gt;left&lt;/span&gt; += &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;kCellWidth&lt;/span&gt; + &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;kCellSpace&lt;/span&gt;;
            } &lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;color: #0086b3;&quot;&gt;else&lt;/span&gt;&lt;/span&gt; { &lt;span class=&quot;regexp&quot; style=&quot;color: #009926;&quot;&gt;//&lt;/span&gt; &lt;span class=&quot;identifier&quot;&gt;must&lt;/span&gt; &lt;span class=&quot;identifier&quot;&gt;be&lt;/span&gt; &lt;span class=&quot;identifier&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;identifier&quot;&gt;start&lt;/span&gt; &lt;span class=&quot;identifier&quot;&gt;of&lt;/span&gt; &lt;span class=&quot;identifier&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keymethods&quot; style=&quot;color: #0086b3;&quot;&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;identifier&quot;&gt;row&lt;/span&gt;.
                &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;barColumn&lt;/span&gt; = &lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;0&lt;/span&gt;;
                &lt;span class=&quot;identifier&quot;&gt;top&lt;/span&gt; -= &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;kCellHeight&lt;/span&gt; + &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;kCellSpace&lt;/span&gt;;
                &lt;span class=&quot;identifier&quot;&gt;left&lt;/span&gt; = &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;columnLeft&lt;/span&gt;;
            }
        }
        [&lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;color: #0086b3;&quot;&gt;self&lt;/span&gt;&lt;/span&gt;.&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;barGraphFrames&lt;/span&gt; &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;addObject&lt;/span&gt;&lt;span class=&quot;symbol&quot; style=&quot;color: #0086b3;&quot;&gt;:&lt;span class=&quot;identifier&quot;&gt;tempArray&lt;/span&gt;&lt;/span&gt;];
        &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;columnLeft&lt;/span&gt; = ((&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;kBarSpace&lt;/span&gt; + &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;kBarWidth&lt;/span&gt;) * (&lt;span class=&quot;identifier&quot;&gt;section&lt;/span&gt; + &lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;1&lt;/span&gt;) + &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;kBarSpace&lt;/span&gt;);
        &lt;span class=&quot;identifier&quot;&gt;left&lt;/span&gt; = &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;columnLeft&lt;/span&gt;;
        &lt;span class=&quot;identifier&quot;&gt;top&lt;/span&gt; = &lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;color: #0086b3;&quot;&gt;self&lt;/span&gt;&lt;/span&gt;.&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;collectionViewContentSize&lt;/span&gt;.&lt;span class=&quot;identifier&quot;&gt;height&lt;/span&gt; - &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;kCellHeight&lt;/span&gt;;
        &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;barColumn&lt;/span&gt; = &lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;0&lt;/span&gt;;   
    }
}&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
This essentially provides us with co-ordinates for each item by laying out each section as a bar, three items wide&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Now we have prepared the layout, the layoutAttributesForElementsInRect: method is called to identify what items should be displayed at this time. You can use&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;CGRectIntersectsRect&lt;/code&gt;&amp;nbsp;to determine whether something is in the given&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(234, 234, 234); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px; white-space: nowrap;&quot;&gt;(CGRect)rect&lt;/code&gt;&amp;nbsp;and should be displayed, but given that I want all items displayed with no scrolling, I can just return everything.&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;m perl&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;- (NSArray &lt;span class=&quot;variable&quot; style=&quot;color: teal;&quot;&gt;*)&lt;/span&gt;layoutAttributesForElementsInRect:(CGRect)rect
{
    NSMutableArray &lt;span class=&quot;variable&quot; style=&quot;color: teal;&quot;&gt;*attributes&lt;/span&gt; = [NSMutableArray array];
    &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;for&lt;/span&gt; (&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;int&lt;/span&gt; section = &lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;0&lt;/span&gt;; section &amp;lt; self.collectionView.numberOfSections; section++) {
        NSInteger itemCount = [self.collectionView numberOfItemsInSection:section];
        &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;for&lt;/span&gt; (&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;int&lt;/span&gt; item = &lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;0&lt;/span&gt;; item &amp;lt; itemCount; item++) {
            NSIndexPath &lt;span class=&quot;variable&quot; style=&quot;color: teal;&quot;&gt;*indexPath&lt;/span&gt; = [NSIndexPath indexPathForItem:item inSection:section];
            [attributes addObject:[self layoutAttributesForItemAtIndexPath:indexPath]];
        }
    }  
    &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;return&lt;/span&gt; attributes;
}&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
This in turn calls the layoutAttributesForItemAtIndexPath: method which looks as follows:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;m ruby&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;- (&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;UICollectionViewLayoutAttributes&lt;/span&gt; *)&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;layoutAttributesForItemAtIndexPath&lt;/span&gt;&lt;span class=&quot;symbol&quot; style=&quot;color: #0086b3;&quot;&gt;:&lt;/span&gt;(&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;NSIndexPath&lt;/span&gt; *)&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;indexPath&lt;/span&gt;
{
    &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;UICollectionViewLayoutAttributes&lt;/span&gt; *&lt;span class=&quot;identifier&quot;&gt;attributes&lt;/span&gt; = [&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;UICollectionViewLayoutAttributes&lt;/span&gt; &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;layoutAttributesForCellWithIndexPath&lt;/span&gt;&lt;span class=&quot;symbol&quot; style=&quot;color: #0086b3;&quot;&gt;:&lt;span class=&quot;identifier&quot;&gt;indexPath&lt;/span&gt;&lt;/span&gt;];
    
    &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;CGRect&lt;/span&gt; &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;itemFrame&lt;/span&gt; = [[[&lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;color: #0086b3;&quot;&gt;self&lt;/span&gt;&lt;/span&gt;.&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;barGraphFrames&lt;/span&gt; &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;objectAtIndex&lt;/span&gt;&lt;span class=&quot;symbol&quot; style=&quot;color: #0086b3;&quot;&gt;:&lt;span class=&quot;identifier&quot;&gt;indexPath&lt;/span&gt;&lt;/span&gt;.&lt;span class=&quot;identifier&quot;&gt;section&lt;/span&gt;] &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;objectAtIndex&lt;/span&gt;&lt;span class=&quot;symbol&quot; style=&quot;color: #0086b3;&quot;&gt;:&lt;span class=&quot;identifier&quot;&gt;indexPath&lt;/span&gt;&lt;/span&gt;.&lt;span class=&quot;identifier&quot;&gt;row&lt;/span&gt;] &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;CGRectValue&lt;/span&gt;];
    &lt;span class=&quot;identifier&quot;&gt;attributes&lt;/span&gt;.&lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keymethods&quot; style=&quot;color: #0086b3;&quot;&gt;size&lt;/span&gt;&lt;/span&gt; = &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;CGSizeMake&lt;/span&gt;(&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;kCellHeight&lt;/span&gt;, &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;kCellWidth&lt;/span&gt;);
    &lt;span class=&quot;identifier&quot;&gt;attributes&lt;/span&gt;.&lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keymethods&quot; style=&quot;color: #0086b3;&quot;&gt;center&lt;/span&gt;&lt;/span&gt; = &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;CGPointMake&lt;/span&gt;(&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;CGRectGetMidX&lt;/span&gt;(&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;itemFrame&lt;/span&gt;), &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;CGRectGetMidY&lt;/span&gt;(&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;itemFrame&lt;/span&gt;));

    &lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;color: #0086b3;&quot;&gt;return&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;identifier&quot;&gt;attributes&lt;/span&gt;;   
}&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
As you can see, all I’m doing it setting the cell size to the height and width of the constants defined earlier, in addition to setting the centre position of the item. I could also use this method to set the zIndex or 3D rotation etc.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
So, after that, the bar graph now looks like this after adding some more sections:&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSlO_71ZuqdbiM4RJS2nfagt6WpI4vnUSrjp_ty0lkSbRsopovsBqrk42rFVfu5E07RNml1Iejo_CQWXiemV9IcWMo6wBzM_j7lWKSHfTwgDQbBE-j-YPw8NQIfnZ196tRsPvu9mLNwZg/s1600/Bar+Graph.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;253&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSlO_71ZuqdbiM4RJS2nfagt6WpI4vnUSrjp_ty0lkSbRsopovsBqrk42rFVfu5E07RNml1Iejo_CQWXiemV9IcWMo6wBzM_j7lWKSHfTwgDQbBE-j-YPw8NQIfnZ196tRsPvu9mLNwZg/s320/Bar+Graph.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
And like this after changing the size of the cell and spacing:&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUE5oOY8wUXlkUqNwVj6mshf_1tjoLEy4gQMp_lmNWx-uv7Rojnrf6KtUT_hMQiYGkTZgbgAA3LebHCbgXQpvZowJeh3C2zNQioHkKIDVZMl_Acx8enRiMr-Ks8mAbtf9Q8xN1Glc7GgE/s1600/Bar+Graph+Smaller+Cells.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;252&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUE5oOY8wUXlkUqNwVj6mshf_1tjoLEy4gQMp_lmNWx-uv7Rojnrf6KtUT_hMQiYGkTZgbgAA3LebHCbgXQpvZowJeh3C2zNQioHkKIDVZMl_Acx8enRiMr-Ks8mAbtf9Q8xN1Glc7GgE/s320/Bar+Graph+Smaller+Cells.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
Again, not very exciting I know, but it&#39;s progress.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2 id=&quot;follow-up&quot; style=&quot;-webkit-font-smoothing: subpixel-antialiased; -webkit-transition: background-color 0.2s ease-out; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; cursor: text; font-size: 24px; margin: 20px 0px 10px; padding: 0px;&quot;&gt;
Follow-Up&lt;/h2&gt;
&lt;div style=&quot;margin-bottom: 15px;&quot;&gt;
There is plenty of work to do before it’s useable, but I’ve got a much better idea of how the custom view controller works now.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Some of the things I’ll have to work on now include:&lt;/div&gt;
&lt;ul style=&quot;padding-left: 30px;&quot;&gt;
&lt;li&gt;Ensuring that all the content fits within the height and width of the display. So, calculating how many items I’ve got and dynamically sizing the height/width/spacing of items and sections;&lt;/li&gt;
&lt;li&gt;Maybe enabling the use of flexible column widths;&lt;/li&gt;
&lt;li&gt;Handling orientation changes;&lt;/li&gt;
&lt;li&gt;Adding Supplementary Views as section titles;&lt;/li&gt;
&lt;li&gt;Adding some content instead of using the grey boxes;&lt;/li&gt;
&lt;li&gt;Generally making it much prettier.&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;b id=&quot;firstdiff&quot; style=&quot;-webkit-transition: color 0.2s ease-in-out; border: none !important; display: block; left: 0px; position: absolute;&quot;&gt;&lt;/b&gt;Then we can get into the real functionality of enabling the filtering of content and performing custom animations etc.&lt;/div&gt;
&lt;div style=&quot;margin-top: 15px;&quot;&gt;
Until next time.&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;generate_from_h1 generate_for_page&quot; id=&quot;generated-toc&quot; style=&quot;-webkit-transition: all 0.3s ease-out; background-color: rgba(0, 0, 0, 0.792969); border-bottom-left-radius: 10px; border-bottom-right-radius: 10px; border-top-left-radius: 10px; border-top-right-radius: 10px; border: 0px; bottom: -960px; color: #c8c8c8; font-size: 1.1em; line-height: 1.2em; max-height: 90%; outline: 0px; overflow-x: hidden; overflow-y: auto; padding: 10px 30px 20px 20px; position: fixed; right: 20px; text-align: left; width: 250px; word-wrap: break-word; z-index: 101;&quot;&gt;
&lt;div style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;span class=&quot;hidden&quot;&gt;&lt;a href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/74ZAFF46HB~jp~informationarchitects~Writer/Documents/Messing%20about%20with%20collection%20view.md#aftertoc&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; text-decoration: none;&quot;&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div id=&quot;toggle-container&quot; style=&quot;margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;a href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/74ZAFF46HB~jp~informationarchitects~Writer/Documents/Messing%20about%20with%20collection%20view.md#&quot; id=&quot;generated_toc_d_toggle&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; text-decoration: none;&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;ul style=&quot;margin-left: 10px; padding-left: 0px;&quot;&gt;
&lt;li class=&quot;notmissing&quot; style=&quot;background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; display: block; list-style: none; margin: 10px 0px;&quot;&gt;&lt;a class=&quot;wiki-link&quot; href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/74ZAFF46HB~jp~informationarchitects~Writer/Documents/Messing%20about%20with%20collection%20view.md#messingaroundwithcustomuicollectionviewlayouts&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; margin-top: 0px; outline: 0px; text-decoration: none;&quot;&gt;Messing around with custom UICollectionViewLayouts&lt;/a&gt;&lt;ul style=&quot;margin-left: 10px; padding-left: 0px;&quot;&gt;
&lt;li class=&quot;notmissing&quot; style=&quot;background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; display: block; list-style: none; margin: 10px 0px;&quot;&gt;&lt;a class=&quot;wiki-link&quot; href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/74ZAFF46HB~jp~informationarchitects~Writer/Documents/Messing%20about%20with%20collection%20view.md#gettingstarted&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; margin-top: 0px; outline: 0px; text-decoration: none;&quot;&gt;Getting Started&lt;/a&gt;&lt;/li&gt;
&lt;li class=&quot;notmissing&quot; style=&quot;background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; display: block; list-style: none; margin: 10px 0px;&quot;&gt;&lt;a class=&quot;wiki-link&quot; href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/74ZAFF46HB~jp~informationarchitects~Writer/Documents/Messing%20about%20with%20collection%20view.md#whatdowewantittolooklike&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; margin-top: 0px; outline: 0px; text-decoration: none;&quot;&gt;What do we want it to look like?&lt;/a&gt;&lt;/li&gt;
&lt;li class=&quot;notmissing&quot; style=&quot;background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; display: block; list-style: none; margin: 10px 0px;&quot;&gt;&lt;a class=&quot;wiki-link&quot; href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/74ZAFF46HB~jp~informationarchitects~Writer/Documents/Messing%20about%20with%20collection%20view.md#creatingthecustomlayout&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; margin-top: 0px; outline: 0px; text-decoration: none;&quot;&gt;Creating the custom layout&lt;/a&gt;&lt;/li&gt;
&lt;li class=&quot;notmissing&quot; style=&quot;background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; display: block; list-style: none; margin: 10px 0px;&quot;&gt;&lt;a class=&quot;wiki-link&quot; href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/74ZAFF46HB~jp~informationarchitects~Writer/Documents/Messing%20about%20with%20collection%20view.md#follow-up&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; margin-top: 0px; outline: 0px; text-decoration: none;&quot;&gt;Follow-Up&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.darrenparkinson.uk/feeds/8266874042055400242/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.darrenparkinson.uk/2013/05/messing-around-with-custom.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/8266874042055400242'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/8266874042055400242'/><link rel='alternate' type='text/html' href='http://blog.darrenparkinson.uk/2013/05/messing-around-with-custom.html' title='Messing around with custom UICollectionViewLayouts'/><author><name>Darren Parkinson</name><uri>http://www.blogger.com/profile/01084077294541066454</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjR-jOfyUdDh6-WMAcD2D40CNhm0jGvhaYjx2shbnB0CB33RB8R6V6VNdEb17ky3opGPWcyCjY7_AK16AQcGPivZ8UY05H3HRTaJ0DbHGvQED7KMPEAqxBlZgpjcy-NAIlCz3pj6g9eUwk/s72-c/Default+Flow+Layout.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27381059098267211.post-1815806302352075480</id><published>2013-04-26T22:01:00.001+01:00</published><updated>2013-04-26T22:01:48.585+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="iOS"/><title type='text'>Quickly adding JSON test data to an iOS app.</title><content type='html'>&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px;&quot;&gt;
When I create a new iOS app, I like getting a quick proof of concept working first. Then, once I’m happy with the data and layout etc., I can start work on getting any web services working and making the app look nicer.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
For the data, typically the web services I create will deliver their content in JSON format, so I figured if I created my test data as a JSON file, any work I do on processing that wouldn’t be wasted.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
In this particular instance, the output from my CRM application is in CSV (or Excel) format. I will eventually create a web service to deliver that report information as JSON data, but to get up and running quickly, I can convert it into JSON using a&amp;nbsp;&lt;a href=&quot;http://www.cparker15.com/code/utilities/csv-to-json/&quot; style=&quot;color: #4183c4; text-decoration: none;&quot;&gt;great web utility by a chap called Christopher Parker&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
So from CSV input like this:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;csv undefined&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;Customer, Address, Telephone
Customer1, Address1, Telephone1
Customer2, Address2, Telephone2
Customer3, Address3, Telephone3&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
I get JSON output like this:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;json ini&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;title&quot; style=&quot;color: #990000; font-weight: bold;&quot;&gt;[
 {
  &quot;Customer&quot;: &quot;Customer1&quot;,
  &quot;Address&quot;: &quot;Address1&quot;,
  &quot;Telephone&quot;: &quot;Telephone1&quot;
 },
 {
  &quot;Customer&quot;: &quot;Customer2&quot;,
  &quot;Address&quot;: &quot;Address2&quot;,
  &quot;Telephone&quot;: &quot;Telephone2&quot;
 },
 {
  &quot;Customer&quot;: &quot;Customer3&quot;,
  &quot;Address&quot;: &quot;Address3&quot;,
  &quot;Telephone&quot;: &quot;Telephone3&quot;
 }
]&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnpadRSUhdTgVGtcFLk442yuyk_ZsXkO-QA0UNUEpMX6EaZH8RI2Y9bC8qjYTwmcm6ygLiCUwOlaDTC3UbMFpvO0Shzl1hef-RYqd5d_b56OdzLFfGhcC25bgBh0ZPfDZTnbDonIwPtgY/s1600/Screen+Shot+2013-04-26+at+21.24.49.png&quot; imageanchor=&quot;1&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;306&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnpadRSUhdTgVGtcFLk442yuyk_ZsXkO-QA0UNUEpMX6EaZH8RI2Y9bC8qjYTwmcm6ygLiCUwOlaDTC3UbMFpvO0Shzl1hef-RYqd5d_b56OdzLFfGhcC25bgBh0ZPfDZTnbDonIwPtgY/s400/Screen+Shot+2013-04-26+at+21.24.49.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
Then, in Xcode, I can load the data from a customers.json file as follows:&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;m cs&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;_customers = [[NSMutableArray alloc] init];
NSString *customerDataPath = [[NSBundle mainBundle] pathForResource:&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;@&quot;customers&quot;&lt;/span&gt; ofType:&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;@&quot;json&quot;&lt;/span&gt;];
NSData *customerData = [NSData dataWithContentsOfFile:customerDataPath];
NSArray *customerJSONArray = [NSJSONSerialization JSONObjectWithData:customerData options:&lt;span class=&quot;number&quot; style=&quot;color: #40a070;&quot;&gt;0&lt;/span&gt; error:nil];

&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;for&lt;/span&gt; (NSDictionary *customer &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold;&quot;&gt;in&lt;/span&gt; customerJSONArray) {
        [_customers addObject:
            [[TBCustomer alloc]initWithCustomerName:[customer objectForKey:&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;@&quot;Customer&quot;&lt;/span&gt;]
                customerAddress:[customer objectForKey:&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;@&quot;Address&quot;&lt;/span&gt;]
                customerTelephone:[customer objectForKey:&lt;span class=&quot;string&quot; style=&quot;color: #dd1144;&quot;&gt;@&quot;Telephone&quot;&lt;/span&gt;]
            ]];
}&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;b id=&quot;firstdiff&quot; style=&quot;-webkit-transition: color 0.2s ease-in-out; border: none !important; display: block; left: 0px; position: absolute;&quot;&gt;&lt;/b&gt;This creates an NSArray holding objects of a type called TBCustomer that I created which looks like this:&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;strong&gt;TBCustomer.h&lt;/strong&gt;&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;h perl&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;comment&quot; style=&quot;color: #999988; font-style: italic;&quot;&gt;#import &lt;foundation oundation.h=&quot;&quot;&gt;&lt;/foundation&gt;&lt;/span&gt;

&lt;span class=&quot;variable&quot; style=&quot;color: teal;&quot;&gt;@interface&lt;/span&gt; TBCustomer : NSObject

&lt;span class=&quot;variable&quot; style=&quot;color: teal;&quot;&gt;@property&lt;/span&gt; (strong, nonatomic) NSString &lt;span class=&quot;variable&quot; style=&quot;color: teal;&quot;&gt;*customerName&lt;/span&gt;;
&lt;span class=&quot;variable&quot; style=&quot;color: teal;&quot;&gt;@property&lt;/span&gt; (strong, nonatomic) NSString &lt;span class=&quot;variable&quot; style=&quot;color: teal;&quot;&gt;*customerAddress&lt;/span&gt;;
&lt;span class=&quot;variable&quot; style=&quot;color: teal;&quot;&gt;@property&lt;/span&gt; (strong, nonatomic) NSString &lt;span class=&quot;variable&quot; style=&quot;color: teal;&quot;&gt;*customerTelephone&lt;/span&gt;;

- (id) initWithCustomerName:(NSString&lt;span class=&quot;variable&quot; style=&quot;color: teal;&quot;&gt;*)&lt;/span&gt;name customerAddress:(NSString&lt;span class=&quot;variable&quot; style=&quot;color: teal;&quot;&gt;*)&lt;/span&gt;address customerTelephone:(NSString&lt;span class=&quot;variable&quot; style=&quot;color: teal;&quot;&gt;*)&lt;/span&gt;telephone;

&lt;span class=&quot;variable&quot; style=&quot;color: teal;&quot;&gt;@end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;strong&gt;TBCustomer.m&lt;/strong&gt;&lt;/div&gt;
&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;m ruby&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;comment&quot; style=&quot;color: #999988; font-style: italic;&quot;&gt;#import &quot;TBCustomer.h&quot;&lt;/span&gt;

&lt;span class=&quot;variable&quot; style=&quot;color: teal;&quot;&gt;@implementation&lt;/span&gt; &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;TBCustomer&lt;/span&gt;

- (&lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keymethods&quot; style=&quot;color: #0086b3;&quot;&gt;id&lt;/span&gt;&lt;/span&gt;) &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;initWithCustomerName&lt;/span&gt;&lt;span class=&quot;symbol&quot; style=&quot;color: #0086b3;&quot;&gt;:&lt;/span&gt;(&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;NSString&lt;/span&gt; *)&lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keymethods&quot; style=&quot;color: #0086b3;&quot;&gt;name&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;customerAddress&lt;/span&gt;&lt;span class=&quot;symbol&quot; style=&quot;color: #0086b3;&quot;&gt;:&lt;/span&gt;(&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;NSString&lt;/span&gt; *)&lt;span class=&quot;identifier&quot;&gt;address&lt;/span&gt; &lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;customerTelephone&lt;/span&gt;&lt;span class=&quot;symbol&quot; style=&quot;color: #0086b3;&quot;&gt;:&lt;/span&gt;(&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;NSString&lt;/span&gt; *)&lt;span class=&quot;identifier&quot;&gt;telephone&lt;/span&gt;
{
    &lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;color: #0086b3;&quot;&gt;if&lt;/span&gt;&lt;/span&gt; (&lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;color: #0086b3;&quot;&gt;self&lt;/span&gt;&lt;/span&gt; = [&lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;color: #0086b3;&quot;&gt;super&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;identifier&quot;&gt;init&lt;/span&gt;]) {
        &lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;color: #0086b3;&quot;&gt;self&lt;/span&gt;&lt;/span&gt;.&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;customerName&lt;/span&gt; = &lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keymethods&quot; style=&quot;color: #0086b3;&quot;&gt;name&lt;/span&gt;&lt;/span&gt;;
        &lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;color: #0086b3;&quot;&gt;self&lt;/span&gt;&lt;/span&gt;.&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;customerAddress&lt;/span&gt; = &lt;span class=&quot;identifier&quot;&gt;address&lt;/span&gt;;
        &lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;color: #0086b3;&quot;&gt;self&lt;/span&gt;&lt;/span&gt;.&lt;span class=&quot;constant&quot; style=&quot;color: teal;&quot;&gt;customerTelephone&lt;/span&gt; = &lt;span class=&quot;identifier&quot;&gt;telephone&lt;/span&gt;;
    }
    &lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;color: #0086b3;&quot;&gt;return&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;identifier&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;color: #0086b3;&quot;&gt;self&lt;/span&gt;&lt;/span&gt;;
}

&lt;span class=&quot;variable&quot; style=&quot;color: teal;&quot;&gt;@end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-top: 15px;&quot;&gt;
And that’s it. I’m now ready to crack on with the functionality I want to spend the time on rather than preparing test data. This way I’m using real data too which helps when showing people the proof of concept.&lt;/div&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.darrenparkinson.uk/feeds/1815806302352075480/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.darrenparkinson.uk/2013/04/quickly-adding-json-test-data-to-ios-app.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/1815806302352075480'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/1815806302352075480'/><link rel='alternate' type='text/html' href='http://blog.darrenparkinson.uk/2013/04/quickly-adding-json-test-data-to-ios-app.html' title='Quickly adding JSON test data to an iOS app.'/><author><name>Darren Parkinson</name><uri>http://www.blogger.com/profile/01084077294541066454</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnpadRSUhdTgVGtcFLk442yuyk_ZsXkO-QA0UNUEpMX6EaZH8RI2Y9bC8qjYTwmcm6ygLiCUwOlaDTC3UbMFpvO0Shzl1hef-RYqd5d_b56OdzLFfGhcC25bgBh0ZPfDZTnbDonIwPtgY/s72-c/Screen+Shot+2013-04-26+at+21.24.49.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27381059098267211.post-6431197279515077067</id><published>2013-02-20T18:35:00.001+00:00</published><updated>2013-02-20T18:35:24.495+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="powershell"/><category scheme="http://www.blogger.com/atom/ns#" term="scripting"/><title type='text'>Automating IE with PowerShell</title><content type='html'>&lt;br /&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
Someone asked yesterday if it was possible to get an Internet Explorer window to the exact dimensions they wanted, without all the extra menu bars, status bars etc. and easily navigate to a specific web page.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;b id=&quot;firstdiff&quot; style=&quot;-webkit-transition: color 0.2s ease-in-out; border: none !important; display: block; left: 0px; margin: 0px; padding: 0px; position: absolute;&quot;&gt;&lt;/b&gt;So, given they will be Windows users, they will all have access to PowerShell and be able to run PowerShell scripts, I suggested the following script after referring to the&amp;nbsp;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms970456.aspx&quot; style=&quot;color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;&quot;&gt;Internet Explorer Object Model&lt;/a&gt;&lt;/div&gt;
&lt;pre markdown=&quot;0&quot; style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-top: 10px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;ps1 ruby&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;variable&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;$ie&lt;/span&gt; = &lt;span class=&quot;identifier&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;span class=&quot;keymethods&quot; style=&quot;color: #0086b3; margin: 0px; padding: 0px;&quot;&gt;new&lt;/span&gt;&lt;/span&gt;-&lt;span class=&quot;identifier&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;object&lt;/span&gt; -&lt;span class=&quot;identifier&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;com&lt;/span&gt; &lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&quot;InternetExplorer.Application&quot;&lt;/span&gt;  
&lt;span class=&quot;variable&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;$ie&lt;/span&gt;.&lt;span class=&quot;identifier&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;navigate&lt;/span&gt;(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&quot;http://google.com&quot;&lt;/span&gt;)  
&lt;span class=&quot;variable&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;$ie&lt;/span&gt;.&lt;span class=&quot;identifier&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;height&lt;/span&gt; = &lt;span class=&quot;number&quot; style=&quot;color: #40a070; margin: 0px; padding: 0px;&quot;&gt;200&lt;/span&gt;  
&lt;span class=&quot;variable&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;$ie&lt;/span&gt;.&lt;span class=&quot;identifier&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;width&lt;/span&gt; = &lt;span class=&quot;number&quot; style=&quot;color: #40a070; margin: 0px; padding: 0px;&quot;&gt;500&lt;/span&gt;  
&lt;span class=&quot;variable&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;$ie&lt;/span&gt;.&lt;span class=&quot;identifier&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;top&lt;/span&gt; = &lt;span class=&quot;number&quot; style=&quot;color: #40a070; margin: 0px; padding: 0px;&quot;&gt;0&lt;/span&gt;  
&lt;span class=&quot;variable&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;$ie&lt;/span&gt;.&lt;span class=&quot;identifier&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;left&lt;/span&gt; = &lt;span class=&quot;number&quot; style=&quot;color: #40a070; margin: 0px; padding: 0px;&quot;&gt;800&lt;/span&gt;  
&lt;span class=&quot;variable&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;$ie&lt;/span&gt;.&lt;span class=&quot;identifier&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;statusbar&lt;/span&gt; = &lt;span class=&quot;variable&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;$false&lt;/span&gt;  
&lt;span class=&quot;variable&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;$ie&lt;/span&gt;.&lt;span class=&quot;identifier&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;toolbar&lt;/span&gt; = &lt;span class=&quot;number&quot; style=&quot;color: #40a070; margin: 0px; padding: 0px;&quot;&gt;0&lt;/span&gt;  
&lt;span class=&quot;variable&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;$ie&lt;/span&gt;.&lt;span class=&quot;identifier&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;visible&lt;/span&gt; = &lt;span class=&quot;variable&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;$true&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
Unfortunately it doesn’t seem possible to run the PowerShell script just by double-clicking it on the desktop. To get around this there are a couple of solutions:&lt;/div&gt;
&lt;ul style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 0px !important; margin-left: 36px; margin-right: 0px; margin-top: 21px; padding: 0px;&quot;&gt;
&lt;li style=&quot;margin: 7px 0px; padding: 0px;&quot;&gt;&lt;a href=&quot;http://www.faqforge.com/windows/how-to-execute-powershell-scripts-without-pop-up-window/&quot; style=&quot;color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;&quot;&gt;create a small VB Script to launch it&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;margin: 7px 0px; padding: 0px;&quot;&gt;&lt;a href=&quot;http://learningpcs.blogspot.co.uk/2010/08/powershell-run-script-from-shortcut.html&quot; style=&quot;color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;&quot;&gt;create a shortcut file to launch it&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content><link rel='replies' type='application/atom+xml' href='http://blog.darrenparkinson.uk/feeds/6431197279515077067/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.darrenparkinson.uk/2013/02/automating-ie-with-powershell.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/6431197279515077067'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/6431197279515077067'/><link rel='alternate' type='text/html' href='http://blog.darrenparkinson.uk/2013/02/automating-ie-with-powershell.html' title='Automating IE with PowerShell'/><author><name>Darren Parkinson</name><uri>http://www.blogger.com/profile/01084077294541066454</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27381059098267211.post-9125885200909951590</id><published>2013-02-16T01:00:00.002+00:00</published><updated>2013-02-16T01:02:04.074+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".net"/><category scheme="http://www.blogger.com/atom/ns#" term="c#"/><category scheme="http://www.blogger.com/atom/ns#" term="scripting"/><title type='text'>Reporting on Outlook Categories</title><content type='html'>&lt;div id=&quot;wrapper&quot; style=&quot;background-color: white; border: 0px; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 1.6; margin: 0px auto; max-width: 900px; outline: 0px; padding: 30px;&quot;&gt;
&lt;span style=&quot;font-size: 14px; font-weight: normal; line-height: 1.6;&quot;&gt;I use Outlook categories quite a lot for colour coding entries in Outlook for certain tasks, just to make it easy for a quick glance. Recently, as a team, we’ve agreed on a set of standard categories/colours that we use so that when viewing each others calendars, we can see at a glance what everyone is up to.&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
We’ve also decided that it would be useful to report on these categories on a monthly basis. Someone in the team (thanks Rich) pointed me to&amp;nbsp;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/office/hh144973.aspx&quot; style=&quot;color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;&quot;&gt;this link&lt;/a&gt;&amp;nbsp;which is a pretty good starting point for doing exactly this.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
I made a few amendments to get it exactly how we want for the output, but otherwise, this is a pretty good solution. Below are a couple of areas where I added/amended things.&lt;/div&gt;
&lt;h2 id=&quot;addingacustomicontotheribbon&quot; style=&quot;-webkit-transition: all 0.2s ease-out; font-size: 18px; margin: 20px 0px 10px; padding: 0px;&quot;&gt;
Adding a custom icon to the ribbon&lt;/h2&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
Firstly, things have got to look nice, so I thought I’d start by adding an icon to the ribbon. I already have an icon from the iPhone version of a reporting app that I created.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
To add the icon to the Visual Studio project, I simply dragged the icon onto the project. I then opened up the properties of the project and selected the resources tab, and again, simply dragged the icon from the Solution Explorer to the resources window.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEhNSqJyf0iyAjIdLQXq0dJbyJ7yIMyj9JpVYcw4zbTO4NF2hiQTzV0dCqTsLa2-h87DbzH9q10tEGsEKMYhMBV_deNwSywVyNX_zgROxIyc_0Rb24SYvxH2kIULx-AtyDbl5sopfCTTk/s1600/Screen+Shot+2013-02-16+at+00.48.40.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEhNSqJyf0iyAjIdLQXq0dJbyJ7yIMyj9JpVYcw4zbTO4NF2hiQTzV0dCqTsLa2-h87DbzH9q10tEGsEKMYhMBV_deNwSywVyNX_zgROxIyc_0Rb24SYvxH2kIULx-AtyDbl5sopfCTTk/s1600/Screen+Shot+2013-02-16+at+00.48.40.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
To use the icon required more effort than I thought it would, and I’m sure there’s a simpler solution, but the way I’ve got it to work includes editing the ribbon xml file and adding a bit of code to the ribbon code file as follows.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
Firstly, the xml file requires the&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 12px; margin: 0px 2px; padding: 2px 5px; white-space: nowrap;&quot;&gt;size=&quot;large&quot;&lt;/code&gt;,&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 12px; margin: 0px 2px; padding: 2px 5px; white-space: nowrap;&quot;&gt;tag=&quot;Report&quot;&lt;/code&gt;&amp;nbsp;and&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 12px; margin: 0px 2px; padding: 2px 5px; white-space: nowrap;&quot;&gt;getImage=&quot;GetImage&quot;&lt;/code&gt;&amp;nbsp;entries adding:&lt;/div&gt;
&lt;pre markdown=&quot;0&quot; style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-top: 10px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;(xml) xml&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;tag&quot; style=&quot;color: navy; margin: 0px; padding: 0px;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;tab&lt;/span&gt; &lt;span class=&quot;attribute&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;idMso&lt;/span&gt;=&lt;span class=&quot;value&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&quot;TabAddIns&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;tag&quot; style=&quot;color: navy; margin: 0px; padding: 0px;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;group&lt;/span&gt; &lt;span class=&quot;attribute&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;id&lt;/span&gt;=&lt;span class=&quot;value&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&quot;MyNewGroup&quot;&lt;/span&gt;
    &lt;span class=&quot;attribute&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;label&lt;/span&gt;=&lt;span class=&quot;value&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&quot;My Buttons&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;tag&quot; style=&quot;color: navy; margin: 0px; padding: 0px;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;button&lt;/span&gt; &lt;span class=&quot;attribute&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;id&lt;/span&gt;=&lt;span class=&quot;value&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&quot;generateReportButton&quot;&lt;/span&gt; 
        &lt;span class=&quot;attribute&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;label&lt;/span&gt;=&lt;span class=&quot;value&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&quot;Report&quot;&lt;/span&gt;
          &lt;span class=&quot;attribute&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;size&lt;/span&gt;=&lt;span class=&quot;value&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&quot;large&quot;&lt;/span&gt;
     &lt;span class=&quot;attribute&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;onAction&lt;/span&gt;=&lt;span class=&quot;value&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&quot;GenerateReportButton_Clicked&quot;&lt;/span&gt;
           &lt;span class=&quot;attribute&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;tag&lt;/span&gt;=&lt;span class=&quot;value&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&quot;Report&quot;&lt;/span&gt;
        &lt;span class=&quot;attribute&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;getImage&lt;/span&gt;=&lt;span class=&quot;value&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&quot;GetImage&quot;&lt;/span&gt;/&amp;gt;&lt;/span&gt; 
    &lt;span class=&quot;tag&quot; style=&quot;color: navy; margin: 0px; padding: 0px;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;group&lt;/span&gt;&amp;gt;&lt;/span&gt;  
&lt;span class=&quot;tag&quot; style=&quot;color: navy; margin: 0px; padding: 0px;&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;tab&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
then, the GetImage method needs adding to the Ribbon code file:&lt;/div&gt;
&lt;pre markdown=&quot;0&quot; style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-top: 10px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;cs&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;public&lt;/span&gt; Bitmap GetImage(Office.IRibbonControl control)
{  
    Bitmap returnImage;  
    &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;switch&lt;/span&gt; (control.Tag)
    {  
        &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&quot;Report&quot;&lt;/span&gt;:  
            returnImage = &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;new&lt;/span&gt; Bitmap(Properties.Resources.icon);  
            &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;break&lt;/span&gt;;  
        &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;default&lt;/span&gt;:  
            returnImage = &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;null&lt;/span&gt;;  
            &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;break&lt;/span&gt;;
    }  
    &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;return&lt;/span&gt; returnImage;
}&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
Where&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 12px; margin: 0px 2px; padding: 2px 5px; white-space: nowrap;&quot;&gt;Properties.Resources.icon&lt;/code&gt;&amp;nbsp;refers to the image we copied to resources earlier and has the name icon.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
A&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 12px; margin: 0px 2px; padding: 2px 5px; white-space: nowrap;&quot;&gt;switch&lt;/code&gt;&amp;nbsp;might seem overkill, but it allows me to easily add more buttons later.&lt;/div&gt;
&lt;h2 id=&quot;addingacountofcategory&quot; style=&quot;-webkit-transition: all 0.2s ease-out; font-size: 18px; margin: 20px 0px 10px; padding: 0px;&quot;&gt;
Adding a Count of Category&lt;/h2&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
As well as getting the output from the sample code, such as the hours for each category, I also wanted to add a count of items for each category too.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
This was essentially just adding a few lines to the report generator to put the counts of each category at the top of the csv file. I’ve borrowed and emulated the existing structure that was in place.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
In the&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 12px; margin: 0px 2px; padding: 2px 5px; white-space: nowrap;&quot;&gt;GenerateReport&lt;/code&gt;&amp;nbsp;method, I initialised a new Dictionary:&lt;/div&gt;
&lt;pre markdown=&quot;0&quot; style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-top: 10px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;cs&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; margin: 0px; padding: 0.5em;&quot;&gt;Dictionary&amp;lt;&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;string&lt;/span&gt;, &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;int&amp;gt;&lt;/span&gt; categoryCount =
       &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;new&lt;/span&gt; Dictionary&amp;lt;&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;string&lt;/span&gt;, &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;int&amp;gt;&lt;/span&gt;();
&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;foreach&lt;/span&gt; (&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;string&lt;/span&gt; category &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;in&lt;/span&gt; reportingCategories)
{
    categoryCount[category] = &lt;span class=&quot;number&quot; style=&quot;color: #40a070; margin: 0px; padding: 0px;&quot;&gt;0&lt;/span&gt;;
}&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
And then in the&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 12px; margin: 0px 2px; padding: 2px 5px; white-space: nowrap;&quot;&gt;foreach (ScheduleItem item in items)&lt;/code&gt;&amp;nbsp;I added:&lt;/div&gt;
&lt;pre markdown=&quot;0&quot; style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-top: 10px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;cs&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; margin: 0px; padding: 0.5em;&quot;&gt;AddItemToCategoryCount(categoryCount, item);&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
Which calls the newly created method:&lt;/div&gt;
&lt;pre markdown=&quot;0&quot; style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-top: 10px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;cs&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;void&lt;/span&gt; AddItemToCategoryCount(
        Dictionary&amp;lt;&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;string&lt;/span&gt;, &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;int&lt;/span&gt;&amp;gt; categoryCount,
       ScheduleItem item)
{  
    &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;foreach&lt;/span&gt; (&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;string&lt;/span&gt; category &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;in&lt;/span&gt; item.RelevantCategories)
    {  
        categoryCount[category]++;
    }  
}  &lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
In the WriteReportData method, I added the following line at the beginning, which is what puts my new count data at the start of the output file:&lt;/div&gt;
&lt;pre markdown=&quot;0&quot; style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-top: 10px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;cs&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; margin: 0px; padding: 0.5em;&quot;&gt;WriteCountsPerPeriod(writer, categoryCount);&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
Which calls this new method:&lt;/div&gt;
&lt;pre markdown=&quot;0&quot; style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-top: 10px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;cs&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;void&lt;/span&gt; WriteCountsPerPeriod(TextWriter writer,  
        Dictionary&amp;lt;&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;string&lt;/span&gt;, &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;int&lt;/span&gt;&amp;gt; categoryCount)
{  
    &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;int&lt;/span&gt; totalEntries = &lt;span class=&quot;number&quot; style=&quot;color: #40a070; margin: 0px; padding: 0px;&quot;&gt;0&lt;/span&gt;;  
    writer.Write(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&quot;Counts per Period&quot;&lt;/span&gt;);  
    &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;foreach&lt;/span&gt; (&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;string&lt;/span&gt; category &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;in&lt;/span&gt; reportingCategories)
    {  
        totalEntries += categoryCount[category];  
        writer.Write(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&quot;,{0}&quot;&lt;/span&gt;, categoryCount[category].ToString());
    }  
    writer.WriteLine(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&quot;,,{0}&quot;&lt;/span&gt;, totalEntries);  
}&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;deployment&quot; style=&quot;-webkit-transition: all 0.2s ease-out; font-size: 18px; margin: 20px 0px 10px; padding: 0px;&quot;&gt;
Deployment&lt;/h2&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
Wow, what a nightmare. Firstly, it seems Microsoft have totally broken the deployment capabilities of Visual Studio 2012, but I won’t talk about that for now.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;(*Edit The web site linked by VS to install the InstallShield Limited Edition seems to be up again now, but having googled for a while, I can tell you it&#39;s not the first time it&#39;s disappeared -- and they want registration for a version which probably isn&#39;t going to deliver the functionality I need anyway. &amp;nbsp;I still think it&#39;s generally a bad decision by Microsoft to rely on an external party for this.)&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
So, I thought I’d try One Click Publishing, since they still have this in VS. Of course, this is also a bit of a problem because of the security involved.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
To get the add-in deployed, it was necessary to do three things:&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
– Publish the application;&lt;br /&gt;
– Add the location to the Trusted Sites List for every user;&lt;br /&gt;
– Configure the Inclusion List Security for every user.&lt;/div&gt;
&lt;ol style=&quot;margin: 21px 0px 15px 36px; padding: 0px;&quot;&gt;
&lt;li style=&quot;margin: 7px 0px; padding: 0px;&quot;&gt;&lt;div style=&quot;padding: 0px;&quot;&gt;
Publish the Application to a UNC location to give everyone access:&lt;br /&gt;
1.1. In VS, go to Build–&amp;gt;Publish and follow the instructions&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin: 7px 0px; padding: 0px;&quot;&gt;&lt;div style=&quot;padding: 0px;&quot;&gt;
Add the folder location of the Trusted Sites list : This is because I was using a shared drive for installation:&lt;br /&gt;
2.1. Open Internet Explorer&lt;br /&gt;
2.2. Go to Tools–&amp;gt;Internet Options&lt;br /&gt;
2.3. Select the Security tab&lt;br /&gt;
2.4. Click on Trusted Sites in the top “Select a Zone to View or Change Security Settings” box&lt;br /&gt;
2.5. Click Sites&lt;br /&gt;
2.6. In the “Add this website to the zone”, enter file://&lt;em style=&quot;margin: 0px; padding: 0px;&quot;&gt;your_server_name_here&lt;/em&gt;&amp;nbsp;and click “Add”&lt;br /&gt;
2.7. Click OK and exit out.&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;margin: 7px 0px; padding: 0px;&quot;&gt;&lt;div style=&quot;padding: 0px;&quot;&gt;
Configure the Inclusion List Security&lt;br /&gt;
3.1. This required a registry addition as per this&amp;nbsp;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/bb772070.aspx&quot; style=&quot;color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;&quot;&gt;Microsoft note&lt;/a&gt;&amp;nbsp;which I found out about&amp;nbsp;&lt;a href=&quot;http://blogs.msdn.com/b/vsod/archive/2012/10/08/troubleshooting-common-vsto-issues-part-2.aspx&quot; style=&quot;color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;
3.2. I essentially created the entries in my registry and exported that selected branch to a&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 12px; margin: 0px 2px; padding: 2px 5px; white-space: nowrap;&quot;&gt;.reg&lt;/code&gt;&amp;nbsp;file that everyone could simply double-click. &amp;nbsp;Trusted sites is what we&#39;re using because of the previous step, which is set to Enabled.&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;oneotherissue&quot; style=&quot;-webkit-transition: all 0.2s ease-out; font-size: 18px; margin: 20px 0px 10px; padding: 0px;&quot;&gt;
One other issue&lt;/h2&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
After deployment, one other problem that someone had was that he unknowingly seemed to be using a different calendar than the default calendar which the add-in runs the report against.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
In the&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 12px; margin: 0px 2px; padding: 2px 5px; white-space: nowrap;&quot;&gt;GetCalendarItemsInTimeFrame&lt;/code&gt;&amp;nbsp;method, there is a reference to&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 12px; margin: 0px 2px; padding: 2px 5px; white-space: nowrap;&quot;&gt;Outlook.OlDefaultFolders.olFolderCalendar&lt;/code&gt;. To fix this issue, I’ll need to ask the user to specify the calendar to use.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
To do this, I changed the form to contain a list of available calendars and then passed this through to the report generator and the&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 12px; margin: 0px 2px; padding: 2px 5px; white-space: nowrap;&quot;&gt;GetCalendarItemsInTimeFrame&lt;/code&gt;&amp;nbsp;method.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
Here is the form with the calendar selection box added:&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh59WynLuJCPVq4gaomstYP8j9coAJV1F5a1xT5lsD2i0tLlj3BqVNjSeCpka6SnV3P7LwnvXv6fZDD-G_o9v16a9JjURjELi9M8jMD_d_S3Us7GcdIeio-T4MVGCugdR_usdONjM6Aj38/s1600/Screen+Shot+2013-02-16+at+00.46.38.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh59WynLuJCPVq4gaomstYP8j9coAJV1F5a1xT5lsD2i0tLlj3BqVNjSeCpka6SnV3P7LwnvXv6fZDD-G_o9v16a9JjURjELi9M8jMD_d_S3Us7GcdIeio-T4MVGCugdR_usdONjM6Aj38/s320/Screen+Shot+2013-02-16+at+00.46.38.png&quot; width=&quot;214&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
In the form, I added a new private variable:&lt;/div&gt;
&lt;pre markdown=&quot;0&quot; style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-top: 10px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;cs&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;private&lt;/span&gt; Outlook.Folder selectedCalendar;&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
In the Form_Load method, I added:&lt;/div&gt;
&lt;pre markdown=&quot;0&quot; style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-top: 10px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;cs&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; margin: 0px; padding: 0.5em;&quot;&gt;calendarsListBox.Items.AddRange(GetCalendarList().ToArray());  
calendarsListBox.SetSelected(&lt;span class=&quot;number&quot; style=&quot;color: #40a070; margin: 0px; padding: 0px;&quot;&gt;0&lt;/span&gt;, &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;true&lt;/span&gt;);&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
Which uses the following helper method to enumerate the calendar list box:&lt;/div&gt;
&lt;pre markdown=&quot;0&quot; style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-top: 10px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;cs&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;private&lt;/span&gt; List&amp;lt;&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;string&lt;/span&gt;&amp;gt; GetCalendarList()
{  
    List&amp;lt;&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;string&amp;gt;&lt;/span&gt; calendarfolders = &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;new&lt;/span&gt; List&amp;lt;&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;string&lt;/span&gt;&amp;gt;();  
    Outlook.NameSpace session =           
            Globals.ThisAddIn.Application.Session;  
    selectedCalendar = session.GetDefaultFolder(  
            Outlook.OlDefaultFolders.olFolderCalendar)  
            &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;as&lt;/span&gt; Outlook.Folder;

    Outlook.Folder calendar = session.GetDefaultFolder(  
            Outlook.OlDefaultFolders.olFolderCalendar)  
            &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;as&lt;/span&gt; Outlook.Folder;  
    calendarfolders.Add(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&quot;Default&quot;&lt;/span&gt;);  
    &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;if&lt;/span&gt; (calendar != &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;null&lt;/span&gt;)
    {  
        &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;if&lt;/span&gt; (calendar.Folders.Count &amp;gt; &lt;span class=&quot;number&quot; style=&quot;color: #40a070; margin: 0px; padding: 0px;&quot;&gt;0&lt;/span&gt;)
        {  
            &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;foreach&lt;/span&gt; (Outlook.Folder subfolder &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;in&lt;/span&gt; calendar.Folders)
            {
                &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;string&lt;/span&gt; trimmedcal = subfolder.Name.Trim();
                calendarfolders.Add(trimmedcal);
            }
        }
    }  
    &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;return&lt;/span&gt; calendarfolders;  
}&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
Finally, there’s the&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 12px; margin: 0px 2px; padding: 2px 5px; white-space: nowrap;&quot;&gt;calendarsListBox_SelectedIndexChanged&lt;/code&gt;&amp;nbsp;method to set the calendar, before passing it to the report generator.&lt;/div&gt;
&lt;pre markdown=&quot;0&quot; style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-top: 10px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;cs&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;void&lt;/span&gt; calendarsListBox_SelectedIndexChanged(&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;object&lt;/span&gt; sender, EventArgs e)
{  
    Outlook.NameSpace session =  
            Globals.ThisAddIn.Application.Session;  
    Outlook.Folder calendar = session.GetDefaultFolder(  
            Outlook.OlDefaultFolders.olFolderCalendar)  
            &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;as&lt;/span&gt; Outlook.Folder;

    &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;if&lt;/span&gt; (calendarsListBox.SelectedItem.Equals(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&quot;Default&quot;&lt;/span&gt;))
    {  
        selectedCalendar = calendar;
    }  
    &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;else&lt;/span&gt;
    {  
        &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;foreach&lt;/span&gt; (Outlook.Folder subfolder &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;in&lt;/span&gt; calendar.Folders)
        {  
            &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;string&lt;/span&gt; trimmedcal = subfolder.Name.Trim();  
            &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;if&lt;/span&gt; (trimmedcal.Equals(calendarsListBox.SelectedItem))
            {
                selectedCalendar = subfolder;
            }
        }
    }  
}&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
In the&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 12px; margin: 0px 2px; padding: 2px 5px; white-space: nowrap;&quot;&gt;btnGenerateReport_Click&lt;/code&gt;&amp;nbsp;method, we can then just pass the selectedCalendar along with all the other items:&lt;/div&gt;
&lt;pre markdown=&quot;0&quot; style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-top: 10px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;cs&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; margin: 0px; padding: 0.5em;&quot;&gt; ScheduleReportGenerator.GenerateReport(fromDate, toDate, Categories,  dailySubtotalsCheckBox.Checked, saveFileDialog1.FileName,  
    selectedCalendar);&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
So we can now switch to the report generator and make a couple of small changes there.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
Firstly, update the method signature to reflect the previous change:&lt;/div&gt;
&lt;pre markdown=&quot;0&quot; style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-top: 10px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;cs&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;internal&lt;/span&gt; &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;void&lt;/span&gt; GenerateReport(  
        DateTime reportStart, DateTime reportEnd,  
        HashSet&amp;lt;&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;string&lt;/span&gt;&amp;gt; categories,   
        &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;bool&lt;/span&gt; includeDailySubtotals,  
        &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;string&lt;/span&gt; filepath,  
        Outlook.Folder selectedCalendar)&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;b id=&quot;firstdiff&quot; style=&quot;-webkit-transition: color 0.2s ease-in-out; border: none !important; display: block; left: 0px; margin: 0px; padding: 0px; position: absolute;&quot;&gt;&lt;/b&gt;And then passing to&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 12px; margin: 0px 2px; padding: 2px 5px; white-space: nowrap;&quot;&gt;GetCalendarItemsInTimeFrame&lt;/code&gt;&lt;/div&gt;
&lt;pre markdown=&quot;0&quot; style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-top: 10px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;cs&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; margin: 0px; padding: 0.5em;&quot;&gt;Outlook.Items calendarItems =   
    GetCalendarItemsInTimeFrame(reportStart,  
    reportEnd,selectedCalendar);&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
Where we can then specify which calendar to use:&lt;/div&gt;
&lt;pre markdown=&quot;0&quot; style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-top: 10px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;cs&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;static&lt;/span&gt; Outlook.Items GetCalendarItemsInTimeFrame(
DateTime reportStart, DateTime reportEnd, Outlook.Folder  
selectedCalendar)
{
    Outlook.Folder calendar = selectedCalendar;  
    &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;string&lt;/span&gt; filter = &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;string&lt;/span&gt;.Format(  
        &lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&quot;[Start] &amp;lt; &#39;{0}&#39; AND [End] &amp;gt; &#39;{1}&#39;&quot;&lt;/span&gt;,  
            reportEnd.ToString(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&quot;MM/dd/yyyy hh:mm tt&quot;&lt;/span&gt;),  
            reportStart.ToString(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&quot;MM/dd/yyyy hh:mm tt&quot;&lt;/span&gt;));  

    &lt;span class=&quot;comment&quot; style=&quot;color: #999988; font-style: italic; margin: 0px; padding: 0px;&quot;&gt;//Include recurring calendar items.  &lt;/span&gt;
    Outlook.Items calendarItems = calendar.Items;  
    calendarItems.Sort(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&quot;[Start]&quot;&lt;/span&gt;, Type.Missing);  
    calendarItems.IncludeRecurrences = &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;true&lt;/span&gt;;  
    calendarItems = calendarItems.Restrict(filter);  
    &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;return&lt;/span&gt; calendarItems;  
}&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-top: 1em; padding: 0px;&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
That&#39;s it. &amp;nbsp;Took slightly longer than I might have hoped, but hopefully it’ll save the whole team some time collating stats on a monthly basis.&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;generate_from_h1 generate_for_page&quot; id=&quot;generated-toc&quot; style=&quot;-webkit-transition: all 0.3s ease-out; background-color: rgba(0, 0, 0, 0.792969); border-bottom-left-radius: 10px; border-bottom-right-radius: 10px; border-top-left-radius: 10px; border-top-right-radius: 10px; border: 0px; bottom: -870px; color: #c8c8c8; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 1.1em; line-height: 1.2em; margin: 0px; max-height: 90%; outline: 0px; overflow-x: hidden; overflow-y: auto; padding: 10px 30px 20px 20px; position: fixed; right: 20px; text-align: left; width: 250px; word-wrap: break-word; z-index: 101;&quot;&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;span class=&quot;hidden&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;a href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/74ZAFF46HB~jp~informationarchitects~Writer/Documents/Reporting%20on%20Outlook%20Categories.md#aftertoc&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px; text-decoration: none;&quot;&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div id=&quot;toggle-container&quot; style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;a href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/74ZAFF46HB~jp~informationarchitects~Writer/Documents/Reporting%20on%20Outlook%20Categories.md#&quot; id=&quot;generated_toc_d_toggle&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px; text-decoration: none;&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;ul style=&quot;margin: 15px 0px 15px 10px; padding: 0px;&quot;&gt;
&lt;li class=&quot;notmissing&quot; style=&quot;background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; display: block; list-style: none; margin: 10px 0px; padding: 0px;&quot;&gt;&lt;a class=&quot;wiki-link&quot; href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/74ZAFF46HB~jp~informationarchitects~Writer/Documents/Reporting%20on%20Outlook%20Categories.md#reportingonoutlookcategories&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; margin: 0px; outline: 0px; padding: 0px; text-decoration: none;&quot;&gt;Reporting on Outlook Categories&lt;/a&gt;&lt;ul style=&quot;margin: 15px 0px 0px 10px; padding: 0px;&quot;&gt;
&lt;li class=&quot;notmissing&quot; style=&quot;background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; display: block; list-style: none; margin: 10px 0px; padding: 0px;&quot;&gt;&lt;a class=&quot;wiki-link&quot; href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/74ZAFF46HB~jp~informationarchitects~Writer/Documents/Reporting%20on%20Outlook%20Categories.md#addingacustomicontotheribbon&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; margin: 0px; outline: 0px; padding: 0px; text-decoration: none;&quot;&gt;Adding a custom icon to the ribbon&lt;/a&gt;&lt;/li&gt;
&lt;li class=&quot;notmissing&quot; style=&quot;background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; display: block; list-style: none; margin: 10px 0px; padding: 0px;&quot;&gt;&lt;a class=&quot;wiki-link&quot; href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/74ZAFF46HB~jp~informationarchitects~Writer/Documents/Reporting%20on%20Outlook%20Categories.md#addingacountofcategory&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; margin: 0px; outline: 0px; padding: 0px; text-decoration: none;&quot;&gt;Adding a Count of Category&lt;/a&gt;&lt;/li&gt;
&lt;li class=&quot;notmissing&quot; style=&quot;background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; display: block; list-style: none; margin: 10px 0px; padding: 0px;&quot;&gt;&lt;a class=&quot;wiki-link&quot; href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/74ZAFF46HB~jp~informationarchitects~Writer/Documents/Reporting%20on%20Outlook%20Categories.md#deployment&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; margin: 0px; outline: 0px; padding: 0px; text-decoration: none;&quot;&gt;Deployment&lt;/a&gt;&lt;/li&gt;
&lt;li class=&quot;notmissing&quot; style=&quot;background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; display: block; list-style: none; margin: 10px 0px; padding: 0px;&quot;&gt;&lt;a class=&quot;wiki-link&quot; href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/74ZAFF46HB~jp~informationarchitects~Writer/Documents/Reporting%20on%20Outlook%20Categories.md#oneotherissue&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; margin: 0px; outline: 0px; padding: 0px; text-decoration: none;&quot;&gt;One other issue&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.darrenparkinson.uk/feeds/9125885200909951590/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.darrenparkinson.uk/2013/02/reporting-on-outlook-categories.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/9125885200909951590'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/9125885200909951590'/><link rel='alternate' type='text/html' href='http://blog.darrenparkinson.uk/2013/02/reporting-on-outlook-categories.html' title='Reporting on Outlook Categories'/><author><name>Darren Parkinson</name><uri>http://www.blogger.com/profile/01084077294541066454</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEhNSqJyf0iyAjIdLQXq0dJbyJ7yIMyj9JpVYcw4zbTO4NF2hiQTzV0dCqTsLa2-h87DbzH9q10tEGsEKMYhMBV_deNwSywVyNX_zgROxIyc_0Rb24SYvxH2kIULx-AtyDbl5sopfCTTk/s72-c/Screen+Shot+2013-02-16+at+00.48.40.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27381059098267211.post-6355627105390230319</id><published>2013-01-28T13:12:00.000+00:00</published><updated>2013-01-28T13:17:56.128+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Apple"/><category scheme="http://www.blogger.com/atom/ns#" term="iOS"/><title type='text'>Snooping iPhone traffic with Fiddler2</title><content type='html'>&lt;br /&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
I’m using a Windows VM under Parallels on the Mac. This VM has&amp;nbsp;&lt;a href=&quot;http://www.fiddler2.com/fiddler2/&quot; style=&quot;color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;&quot;&gt;Fiddler2&lt;/a&gt;&amp;nbsp;running which is a Web Debugging Proxy.&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
In order to use this to debug iOS applications I have to change my network settings in Parallels. It is normally set to use a “Shared” network, and I just have set it to “Bridged” on “Wi-Fi”. This allows me to have an IP Address on my wireless network of course, which can then be used by the iPhone.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwBjfj3qLFljj7Ax7WbROZngVOLXjvAAy-w4R9kQpbcY3ImbKrW-w1T84EtWqMR5_31u_7uQ2Pwj15dWfJJdhA62LVIZ_vLNiZtypOxCo9xH6UU3WfCzwWecVXX2wp0Fz9n7ARKIY2Bdw/s1600/Screen+Shot+2013-01-28+at+12.49.10.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;181&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwBjfj3qLFljj7Ax7WbROZngVOLXjvAAy-w4R9kQpbcY3ImbKrW-w1T84EtWqMR5_31u_7uQ2Pwj15dWfJJdhA62LVIZ_vLNiZtypOxCo9xH6UU3WfCzwWecVXX2wp0Fz9n7ARKIY2Bdw/s320/Screen+Shot+2013-01-28+at+12.49.10.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
Next, I basically followed&amp;nbsp;&lt;a href=&quot;http://www.diaryofaninja.com/blog/2010/11/09/using-fiddler-to-sniff-mobile-device-application-traffic&quot; style=&quot;color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;&quot;&gt;these instructions&lt;/a&gt;&amp;nbsp;where you set the proxy address on the iPhone to point to the IP Address of the windows VM. Simple.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2498hyphenhyphenFtLqeKjjjfZ1QkkKTwYDNsFyqf0h1XHxDbi4zdhg4Xaem4ey8xjpW2lKPJhnNQcngBCfolxY8fqCZ0YKzyVYm7tdUOWT1mK_2jGrxzA70yL-BKA8zo_4nN1ry9YExoxx606xVI/s1600/IMG_1323+-+Version+2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;249&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2498hyphenhyphenFtLqeKjjjfZ1QkkKTwYDNsFyqf0h1XHxDbi4zdhg4Xaem4ey8xjpW2lKPJhnNQcngBCfolxY8fqCZ0YKzyVYm7tdUOWT1mK_2jGrxzA70yL-BKA8zo_4nN1ry9YExoxx606xVI/s320/IMG_1323+-+Version+2.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-top: 1em; padding: 0px;&quot;&gt;
As well as debugging my applications, it’s quite interesting to see what other traffic gets sent back and forth too.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 22px; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIAxMX1C3g2AXs5Ldf8Vv69xhqwd_QYkshDMF4eMH0zPJug02fKuO6UpR2v3Gv0Z9QHRD9doMFZSoFx723R5neGa1CgWZQTbesiR4sIAuZAD4DqaRydpjL9tHFcPyQO1fCJEz0KFsODsk/s1600/Screen+Shot+2013-01-28+at+13.16.18.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIAxMX1C3g2AXs5Ldf8Vv69xhqwd_QYkshDMF4eMH0zPJug02fKuO6UpR2v3Gv0Z9QHRD9doMFZSoFx723R5neGa1CgWZQTbesiR4sIAuZAD4DqaRydpjL9tHFcPyQO1fCJEz0KFsODsk/s320/Screen+Shot+2013-01-28+at+13.16.18.png&quot; width=&quot;204&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://blog.darrenparkinson.uk/feeds/6355627105390230319/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.darrenparkinson.uk/2013/01/snooping-iphone-traffic-with-fiddler2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/6355627105390230319'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/6355627105390230319'/><link rel='alternate' type='text/html' href='http://blog.darrenparkinson.uk/2013/01/snooping-iphone-traffic-with-fiddler2.html' title='Snooping iPhone traffic with Fiddler2'/><author><name>Darren Parkinson</name><uri>http://www.blogger.com/profile/01084077294541066454</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwBjfj3qLFljj7Ax7WbROZngVOLXjvAAy-w4R9kQpbcY3ImbKrW-w1T84EtWqMR5_31u_7uQ2Pwj15dWfJJdhA62LVIZ_vLNiZtypOxCo9xH6UU3WfCzwWecVXX2wp0Fz9n7ARKIY2Bdw/s72-c/Screen+Shot+2013-01-28+at+12.49.10.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27381059098267211.post-3139803137367388325</id><published>2013-01-28T12:41:00.000+00:00</published><updated>2013-01-28T12:42:07.719+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Apple"/><category scheme="http://www.blogger.com/atom/ns#" term="iOS"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><category scheme="http://www.blogger.com/atom/ns#" term="scripting"/><title type='text'>Speed writing an iPhone Application</title><content type='html'>&lt;br /&gt;
&lt;div&gt;
&lt;div id=&quot;wrapper&quot; style=&quot;background-color: white; border: 0px; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 1.6; margin: 15px; outline: 0px; padding: 30px;&quot;&gt;
&lt;h1 id=&quot;speedwritinganiphoneapplication&quot; style=&quot;-webkit-transition: all 0.2s ease-out; border: 0px; font-size: 24px; margin: 0px; padding: 0px;&quot;&gt;
&lt;span style=&quot;font-size: 14px; font-weight: normal; line-height: 1.6;&quot;&gt;So someone comes over to me and says: ‘I’ve got a demo in a couple of days, do you think you could put together an iPhone app as part of the demonstration?’.&lt;/span&gt;&lt;/h1&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
I’m always up for the challenge and it turns out that the app requirement isn’t too complicated: simply perform an HTTP POST request with certain information and when you get the response, initiate a telephone call.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
Someone else has already done all the complicated logic behind the scenes, like what happens when the POST is made and the call received etc. This was just the final piece to complete the puzzle.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
First things first, I wanted to ensure the web service was working and accepting requests with the required parameters and then returning the appropriate response.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
Naturally, I turned to Python for this – might as well learn something new in the process.&lt;/div&gt;
&lt;h2 id=&quot;testingtheservicewithpython&quot; style=&quot;-webkit-transition: all 0.2s ease-out; font-size: 18px; margin: 20px 0px 10px; padding: 0px;&quot;&gt;
Testing the service with Python&lt;/h2&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
It seems there are, as usual, various libraries available to achieve this, but urllib/urllib2 is commonly thought to be the best. (Note: my understanding is that urllib in Python 3 is equivalent to urllib and urllib2 in Python 2.7).&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
A great resource for getting to grips with this is available here:&lt;a href=&quot;http://www.voidspace.org.uk/python/articles/urllib2.shtml&quot; style=&quot;color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;&quot;&gt;http://www.voidspace.org.uk/python/articles/urllib2.shtml&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
The code to test the web service is as outlined below which should be fairly self explanatory:&lt;/div&gt;
&lt;ol style=&quot;margin: 21px 0px 15px 36px; padding: 0px;&quot;&gt;
&lt;li style=&quot;margin: 7px 0px; padding: 0px;&quot;&gt;Set up the Query Parameters&lt;/li&gt;
&lt;li style=&quot;margin: 7px 0px; padding: 0px;&quot;&gt;Set up the Request Headers&lt;/li&gt;
&lt;li style=&quot;margin: 7px 0px; padding: 0px;&quot;&gt;URL Encode the Parameters&lt;/li&gt;
&lt;li style=&quot;margin: 7px 0px; padding: 0px;&quot;&gt;Make the request (passing data makes it a POST)&lt;/li&gt;
&lt;li style=&quot;margin: 7px 0px; padding: 0px;&quot;&gt;Get the response and print it out&lt;/li&gt;
&lt;/ol&gt;
&lt;pre markdown=&quot;0&quot; style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-top: 10px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;python&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; margin: 0px; padding: 0.5em;&quot;&gt;!/usr/bin/env python

&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;import&lt;/span&gt; urllib
&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;import&lt;/span&gt; urllib2
&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;from&lt;/span&gt; urllib2 &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;import&lt;/span&gt; URLError

url = &lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;http://mysite:8080/urltoservice&#39;&lt;/span&gt;

params = {
    &lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;param1&#39;&lt;/span&gt; : &lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;01234567890&#39;&lt;/span&gt;,
    &lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;param2&#39;&lt;/span&gt; : &lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;thisthattheother&#39;&lt;/span&gt;
}

headers = {&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&quot;Content-type&quot;&lt;/span&gt;: &lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&quot;application/x-www-form-urlencoded&quot;&lt;/span&gt;, &lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&quot;Accept&quot;&lt;/span&gt;: &lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&quot;text/plain&quot;&lt;/span&gt;}

data = urllib.urlencode(params)
request = urllib2.Request(url, data, headers)
&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;try&lt;/span&gt;:
    response = urllib2.urlopen(request)
&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;except&lt;/span&gt; URLError, e:
    &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;print&lt;/span&gt; e.reason
&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;else&lt;/span&gt;:
    result = response.read()
    &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;print&lt;/span&gt; result&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
Now I know that works and what response to expect, I can get on with the iPhone application.&lt;/div&gt;
&lt;h2 id=&quot;settinguptheiphoneui&quot; style=&quot;-webkit-transition: all 0.2s ease-out; font-size: 18px; margin: 20px 0px 10px; padding: 0px;&quot;&gt;
Setting up the iPhone UI&lt;/h2&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
This is a simple bullet list of the main steps involved in creating the iPhone application:&lt;/div&gt;
&lt;ul style=&quot;margin: 21px 0px 15px 36px; padding: 0px;&quot;&gt;
&lt;li style=&quot;margin: 7px 0px; padding: 0px;&quot;&gt;Create a new application using the Tab Bar template;&lt;/li&gt;
&lt;li style=&quot;margin: 7px 0px; padding: 0px;&quot;&gt;Open the Storyboard and drag on a Table View Controller;&lt;/li&gt;
&lt;li style=&quot;margin: 7px 0px; padding: 0px;&quot;&gt;Set the Table View to use Static Cells with as many as required;&lt;/li&gt;
&lt;li style=&quot;margin: 7px 0px; padding: 0px;&quot;&gt;Add Labels, Text Fields and Buttons as appropriate;&lt;/li&gt;
&lt;li style=&quot;margin: 7px 0px; padding: 0px;&quot;&gt;Create a new UITableViewController class and in the Storyboard, set the new Table View Controller to use that class;&lt;/li&gt;
&lt;li style=&quot;margin: 7px 0px; padding: 0px;&quot;&gt;The following two steps automatically create the references and stub methods for the UI:&lt;ul style=&quot;margin: 0px 0px 0px 25px; padding: 0px;&quot;&gt;
&lt;li style=&quot;margin: 7px 0px; padding: 0px;&quot;&gt;Using Assistant Editor, ctrl+drag from the text fields to create Outlets automatically;&lt;/li&gt;
&lt;li style=&quot;margin: 7px 0px; padding: 0px;&quot;&gt;And then ctrl+drag from buttons and create Action connections;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre markdown=&quot;0&quot; style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-top: 10px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;perl&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;variable&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;@property&lt;/span&gt; (weak, nonatomic) IBOutlet UITextField &lt;span class=&quot;variable&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;*param1TextField&lt;/span&gt;;
&lt;span class=&quot;variable&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;@property&lt;/span&gt; (weak, nonatomic) IBOutlet UITextField &lt;span class=&quot;variable&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;*param2TextField&lt;/span&gt;;

- (IBAction)makeCall:(id)sender;&lt;/code&gt;&lt;/pre&gt;
&lt;ul style=&quot;margin: 21px 0px 15px 36px; padding: 0px;&quot;&gt;
&lt;li style=&quot;margin: 7px 0px; padding: 0px;&quot;&gt;Drag from Text Field delegate outlets to the view controller so the events get to it;&lt;/li&gt;
&lt;li style=&quot;margin: 7px 0px; padding: 0px;&quot;&gt;Create the arrays for hard coding (for now) any Picker View values:&lt;/li&gt;
&lt;/ul&gt;
&lt;pre markdown=&quot;0&quot; style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-top: 10px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;php&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;comment&quot; style=&quot;color: #999988; font-style: italic; margin: 0px; padding: 0px;&quot;&gt;// Set up the array for the picker view:&lt;/span&gt;
&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;self&lt;/span&gt;.arrayTypes = [[NSMutableArray alloc] init];
[&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;self&lt;/span&gt;.arrayTypes addObject:@&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&quot;Item 1&quot;&lt;/span&gt;];
[&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;self&lt;/span&gt;.arrayTypes addObject:@&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&quot;Item 2&quot;&lt;/span&gt;];
[&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;self&lt;/span&gt;.arrayTypes addObject:@&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&quot;Item 3&quot;&lt;/span&gt;];&lt;/code&gt;&lt;/pre&gt;
&lt;ul style=&quot;margin: 21px 0px 15px 36px; padding: 0px;&quot;&gt;
&lt;li style=&quot;margin: 7px 0px; padding: 0px;&quot;&gt;Assign the View Controller as the datasource and delegate&lt;/li&gt;
&lt;/ul&gt;
&lt;pre markdown=&quot;0&quot; style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-top: 10px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;ruby&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;constant&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;_typePickerView&lt;/span&gt; = [[&lt;span class=&quot;constant&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;UIPickerView&lt;/span&gt; &lt;span class=&quot;identifier&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;alloc&lt;/span&gt;] &lt;span class=&quot;identifier&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;init&lt;/span&gt;];
&lt;span class=&quot;constant&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;_typePickerView&lt;/span&gt;.&lt;span class=&quot;identifier&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;delegate&lt;/span&gt; = &lt;span class=&quot;identifier&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;color: #0086b3; margin: 0px; padding: 0px;&quot;&gt;self&lt;/span&gt;&lt;/span&gt;;
&lt;span class=&quot;constant&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;_typePickerView&lt;/span&gt;.&lt;span class=&quot;constant&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;dataSource&lt;/span&gt; = &lt;span class=&quot;identifier&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;color: #0086b3; margin: 0px; padding: 0px;&quot;&gt;self&lt;/span&gt;&lt;/span&gt;;&lt;/code&gt;&lt;/pre&gt;
&lt;ul style=&quot;margin: 21px 0px 15px 36px; padding: 0px;&quot;&gt;
&lt;li style=&quot;margin: 7px 0px; padding: 0px;&quot;&gt;Make sure you have added the picker view data source and delegate protocols to the header; along with the UITextField and any other delegates you might need.&lt;/li&gt;
&lt;/ul&gt;
&lt;pre markdown=&quot;0&quot; style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-top: 10px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;xml&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; margin: 0px; padding: 0.5em;&quot;&gt;@interface MyWellNamedViewController : UITableViewController &lt;span class=&quot;tag&quot; style=&quot;color: navy; margin: 0px; padding: 0px;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;UITextFieldDelegate,&lt;/span&gt; &lt;span class=&quot;attribute&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;UIPickerViewDataSource&lt;/span&gt;, &lt;span class=&quot;attribute&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;UIPickerViewDelegate&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul style=&quot;margin: 21px 0px 15px 36px; padding: 0px;&quot;&gt;
&lt;li style=&quot;margin: 7px 0px; padding: 0px;&quot;&gt;Implement those protocols:&lt;/li&gt;
&lt;/ul&gt;
&lt;pre markdown=&quot;0&quot; style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-top: 10px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;cs&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;comment&quot; style=&quot;color: #999988; font-style: italic; margin: 0px; padding: 0px;&quot;&gt;// UITextFieldDelegate&lt;/span&gt;
textFieldShouldReturn:
textFieldDidBeginEditing:
&lt;span class=&quot;comment&quot; style=&quot;color: #999988; font-style: italic; margin: 0px; padding: 0px;&quot;&gt;// UIPickerViewDataSource&lt;/span&gt;
numberOfComponentsInPickerView:
&lt;span class=&quot;comment&quot; style=&quot;color: #999988; font-style: italic; margin: 0px; padding: 0px;&quot;&gt;// UIPickerViewDelegate&lt;/span&gt;
pickerView:numberOfRowsInComponent:&lt;/code&gt;&lt;/pre&gt;
&lt;ul style=&quot;margin: 21px 0px 15px 36px; padding: 0px;&quot;&gt;
&lt;li style=&quot;margin: 7px 0px; padding: 0px;&quot;&gt;Add the Picker View as the Input View for a text field&lt;/li&gt;
&lt;/ul&gt;
&lt;pre markdown=&quot;0&quot; style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-top: 10px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;ini&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;title&quot; style=&quot;color: #990000; font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;[_typeTextField setInputView:_typePickerView]&lt;/span&gt;&lt;span class=&quot;comment&quot; style=&quot;color: #999988; font-style: italic; margin: 0px; padding: 0px;&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;addtherequiredfunctionality&quot; style=&quot;-webkit-transition: all 0.2s ease-out; font-size: 18px; margin: 20px 0px 10px; padding: 0px;&quot;&gt;
Add the required functionality&lt;/h2&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
In this instance, I just need to perform an HTTP POST to a URL with the parameters using the values from the text fields on the UI and then make a call.&lt;/div&gt;
&lt;h3 id=&quot;postingthedata&quot; style=&quot;-webkit-transition: all 0.2s ease-out; border-bottom-color: rgb(221, 221, 221); border-bottom-style: solid; border-bottom-width: 1px; font-size: 14px; margin: 20px 0px 10px; padding: 0px 0px 2px;&quot;&gt;
Posting the data&lt;/h3&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
To post the data, it’s simply a case of using NSURLConnection and implementing the appropriate delegate:&lt;/div&gt;
&lt;pre markdown=&quot;0&quot; style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-top: 10px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;cs&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; margin: 0px; padding: 0.5em;&quot;&gt;NSString *requestString = &lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;@&quot;http://mysite:8080/urltoservice&quot;&lt;/span&gt;;    NSString *post = [NSString stringWithFormat:&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;@&quot;param1=%@&amp;amp;param2=%@&quot;&lt;/span&gt;,[self.param1TextField text],[self.param2TextField text]];
NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
NSString *postLength = [NSString stringWithFormat:&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;@&quot;%d&quot;&lt;/span&gt;, [postData length]];
    
NSMutableURLRequest *theRequest = [NSMutableURLRequest
    requestWithURL:[NSURL URLWithString:requestString]
    cachePolicy:NSURLRequestReloadIgnoringCacheData
    timeoutInterval:&lt;span class=&quot;number&quot; style=&quot;color: #40a070; margin: 0px; padding: 0px;&quot;&gt;20.0&lt;/span&gt;];
[theRequest setHTTPMethod:&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;@&quot;POST&quot;&lt;/span&gt;];
[theRequest setValue:postLength forHTTPHeaderField:&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;@&quot;Content-Length&quot;&lt;/span&gt;];
[theRequest setValue:&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;@&quot;application/x-www-form-urlencoded&quot;&lt;/span&gt; forHTTPHeaderField:&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;@&quot;Content-Type&quot;&lt;/span&gt;];
[theRequest setHTTPBody:postData];
    
NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;delegate&lt;/span&gt;:self];
   
&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;if&lt;/span&gt; (theConnection) {
    NSLog(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;@&quot;Connection is good&quot;&lt;/span&gt;);
} &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;else&lt;/span&gt; {
    NSLog(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;@&quot;Connection is bad&quot;&lt;/span&gt;);
}&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
To use NSURLConnection, you must implement the&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 12px; margin: 0px 2px; padding: 2px 5px; white-space: nowrap;&quot;&gt;NSURLConnectionDataDelegate&lt;/code&gt;&amp;nbsp;delegate and the relevant methods:&lt;/div&gt;
&lt;pre markdown=&quot;0&quot; style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-top: 10px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;connection:didReceiveResponse: css&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;tag&quot; style=&quot;color: navy; margin: 0px; padding: 0px;&quot;&gt;connection&lt;/span&gt;&lt;span class=&quot;pseudo&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;:didReceiveData&lt;/span&gt;:
&lt;span class=&quot;tag&quot; style=&quot;color: navy; margin: 0px; padding: 0px;&quot;&gt;connection&lt;/span&gt;&lt;span class=&quot;pseudo&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;:didFailWithError&lt;/span&gt;:
&lt;span class=&quot;tag&quot; style=&quot;color: navy; margin: 0px; padding: 0px;&quot;&gt;connectionDidFinishLoading&lt;/span&gt;:&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;makingthecall&quot; style=&quot;-webkit-transition: all 0.2s ease-out; border-bottom-color: rgb(221, 221, 221); border-bottom-style: solid; border-bottom-width: 1px; font-size: 14px; margin: 20px 0px 10px; padding: 0px 0px 2px;&quot;&gt;
Making the call&lt;/h3&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
I then needed to make a call to a specified number (taken from another field in the UI in this instance).&lt;/div&gt;
&lt;pre markdown=&quot;0&quot; style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-top: 10px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;perl&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; margin: 0px; padding: 0.5em;&quot;&gt;UIApplication &lt;span class=&quot;variable&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;*myApp&lt;/span&gt; = [UIApplication sharedApplication];
NSString &lt;span class=&quot;variable&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;*theCall&lt;/span&gt; = [NSString stringWithFormat:&lt;span class=&quot;variable&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;@&quot;&lt;/span&gt;tel:&lt;span class=&quot;variable&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;%@&lt;/span&gt;&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&quot;,[self.numberToCallTextField text]]; 
NSLog(&lt;span class=&quot;variable&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;@&quot;&lt;/span&gt;Making call with &lt;span class=&quot;variable&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;%@&lt;/span&gt;&quot;&lt;/span&gt;, theCall);
[myApp openURL:[NSURL URLWithString:theCall]];&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;addingsomeartwork&quot; style=&quot;-webkit-transition: all 0.2s ease-out; font-size: 18px; margin: 20px 0px 10px; padding: 0px;&quot;&gt;
Adding some art work&lt;/h2&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
Finally, we just need to add an icon and startup images to the App Icons and Launch Images section of the project properties, in addition to creating some custom tab bar icons. This is just a case of creating images at the right size:&lt;/div&gt;
&lt;ul style=&quot;margin: 21px 0px 15px 36px; padding: 0px;&quot;&gt;
&lt;li style=&quot;margin: 7px 0px; padding: 0px;&quot;&gt;Create the tab bar icons: 60x60 (baricon@2x.png) and one at 30x30 (baricon.png).&lt;/li&gt;
&lt;li style=&quot;margin: 7px 0px; padding: 0px;&quot;&gt;Create an icon with two sizes: 114x114 (icon@2x.png) and one at 57x57 (icon.png)&lt;/li&gt;
&lt;li style=&quot;margin: 7px 0px; padding: 0px;&quot;&gt;Create the launch images in three sizes 320x480 (default.png), 640x960 (Default@2x.png) and 640x1136 (Default–568h@2x.png)&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
Drag them into the project and assign to the application / tab bars respectively.&lt;/div&gt;
&lt;div style=&quot;margin-top: 1em; padding: 0px;&quot;&gt;
And that’s it. A couple of hours work which will hopefully add something extra to the demonstration.&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;generate_from_h1 generate_for_page&quot; id=&quot;generated-toc&quot; style=&quot;-webkit-transition: all 0.3s ease-out; background-color: rgba(0, 0, 0, 0.792969); border-bottom-left-radius: 10px; border-bottom-right-radius: 10px; border-top-left-radius: 10px; border-top-right-radius: 10px; border: 0px; bottom: -870px; color: #c8c8c8; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 1.1em; line-height: 1.2em; margin: 0px; max-height: 90%; outline: 0px; overflow-x: hidden; overflow-y: auto; padding: 10px 30px 20px 20px; position: fixed; right: 20px; text-align: left; width: 250px; word-wrap: break-word; z-index: 101;&quot;&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;span class=&quot;hidden&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;a href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/74ZAFF46HB~jp~informationarchitects~Writer/Documents/iPhone%20App%20in%20two%20days.md#aftertoc&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px; text-decoration: none;&quot;&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div id=&quot;toggle-container&quot; style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;a href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/74ZAFF46HB~jp~informationarchitects~Writer/Documents/iPhone%20App%20in%20two%20days.md#&quot; id=&quot;generated_toc_d_toggle&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; margin: 0px; padding: 0px; text-decoration: none;&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;ul style=&quot;margin: 15px 0px 15px 10px; padding: 0px;&quot;&gt;
&lt;li class=&quot;notmissing&quot; style=&quot;background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; display: block; list-style: none; margin: 10px 0px; padding: 0px;&quot;&gt;&lt;a class=&quot;wiki-link&quot; href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/74ZAFF46HB~jp~informationarchitects~Writer/Documents/iPhone%20App%20in%20two%20days.md#speedwritinganiphoneapplication&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; margin: 0px; outline: 0px; padding: 0px; text-decoration: none;&quot;&gt;Speed writing an iPhone Application&lt;/a&gt;&lt;ul style=&quot;margin: 15px 0px 0px 10px; padding: 0px;&quot;&gt;
&lt;li class=&quot;notmissing&quot; style=&quot;background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; display: block; list-style: none; margin: 10px 0px; padding: 0px;&quot;&gt;&lt;a class=&quot;wiki-link&quot; href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/74ZAFF46HB~jp~informationarchitects~Writer/Documents/iPhone%20App%20in%20two%20days.md#testingtheservicewithpython&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; margin: 0px; outline: 0px; padding: 0px; text-decoration: none;&quot;&gt;Testing the service with Python&lt;/a&gt;&lt;/li&gt;
&lt;li class=&quot;notmissing&quot; style=&quot;background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; display: block; list-style: none; margin: 10px 0px; padding: 0px;&quot;&gt;&lt;a class=&quot;wiki-link&quot; href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/74ZAFF46HB~jp~informationarchitects~Writer/Documents/iPhone%20App%20in%20two%20days.md#settinguptheiphoneui&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; margin: 0px; outline: 0px; padding: 0px; text-decoration: none;&quot;&gt;Setting up the iPhone UI&lt;/a&gt;&lt;/li&gt;
&lt;li class=&quot;notmissing&quot; style=&quot;background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; display: block; list-style: none; margin: 10px 0px; padding: 0px;&quot;&gt;&lt;a class=&quot;wiki-link&quot; href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/74ZAFF46HB~jp~informationarchitects~Writer/Documents/iPhone%20App%20in%20two%20days.md#addtherequiredfunctionality&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; margin: 0px; outline: 0px; padding: 0px; text-decoration: none;&quot;&gt;Add the required functionality&lt;/a&gt;&lt;ul style=&quot;margin: 15px 0px 0px 10px; padding: 0px;&quot;&gt;
&lt;li class=&quot;notmissing&quot; style=&quot;background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; display: block; list-style: none; margin: 10px 0px; padding: 0px;&quot;&gt;&lt;a class=&quot;wiki-link&quot; href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/74ZAFF46HB~jp~informationarchitects~Writer/Documents/iPhone%20App%20in%20two%20days.md#postingthedata&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; margin: 0px; outline: 0px; padding: 0px; text-decoration: none;&quot;&gt;Posting the data&lt;/a&gt;&lt;/li&gt;
&lt;li class=&quot;notmissing&quot; style=&quot;background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; display: block; list-style: none; margin: 10px 0px; padding: 0px;&quot;&gt;&lt;a class=&quot;wiki-link&quot; href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/74ZAFF46HB~jp~informationarchitects~Writer/Documents/iPhone%20App%20in%20two%20days.md#makingthecall&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; margin: 0px; outline: 0px; padding: 0px; text-decoration: none;&quot;&gt;Making the call&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li class=&quot;notmissing&quot; style=&quot;background-color: transparent !important; background-position: initial initial !important; background-repeat: initial initial !important; display: block; list-style: none; margin: 10px 0px; padding: 0px;&quot;&gt;&lt;a class=&quot;wiki-link&quot; href=&quot;file:///Users/dparkinson/Library/Mobile%20Documents/74ZAFF46HB~jp~informationarchitects~Writer/Documents/iPhone%20App%20in%20two%20days.md#addingsomeartwork&quot; style=&quot;background-image: none !important; background-position: initial initial !important; background-repeat: initial initial !important; border: none !important; color: rgb(255, 255, 255) !important; display: block; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; margin: 0px; outline: 0px; padding: 0px; text-decoration: none;&quot;&gt;Adding some art work&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://blog.darrenparkinson.uk/feeds/3139803137367388325/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.darrenparkinson.uk/2013/01/speed-writing-iphone-application.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/3139803137367388325'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/3139803137367388325'/><link rel='alternate' type='text/html' href='http://blog.darrenparkinson.uk/2013/01/speed-writing-iphone-application.html' title='Speed writing an iPhone Application'/><author><name>Darren Parkinson</name><uri>http://www.blogger.com/profile/01084077294541066454</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27381059098267211.post-2971465056365233224</id><published>2013-01-18T18:02:00.000+00:00</published><updated>2013-01-18T18:02:56.366+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><title type='text'>Using ‘UpStart’ to manage jobs on Ubuntu</title><content type='html'>&lt;br /&gt;
&lt;div id=&quot;wrapper&quot; style=&quot;background-color: white; border: 0px; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 1.6; margin: 15px; outline: 0px; padding: 30px;&quot;&gt;
&lt;div style=&quot;margin-bottom: 1em; padding: 0px;&quot;&gt;
&lt;span style=&quot;line-height: 1.6;&quot;&gt;In the past, I’ve always used SysVinit to manage the loading and running of persistent processes/services on *nix servers. Whilst refreshing my memory in order to get a process loaded at boot time, I came across&lt;/span&gt;&lt;span style=&quot;line-height: 1.6;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;http://upstart.ubuntu.com/cookbook/#what-is-upstart&quot; style=&quot;color: #4183c4; line-height: 1.6; margin: 0px; padding: 0px; text-decoration: none;&quot;&gt;UpStart&lt;/a&gt;&lt;span style=&quot;line-height: 1.6;&quot;&gt;, which is intended as a replacement for the SysVinit system. So I thought I’d give it a go.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
I’m using a headless Ubuntu server 12.04 LTS and I have a python script that I want to keep running. It was pretty straight forward. All I had to do was create a file in&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 12px; margin: 0px 2px; padding: 2px 5px; white-space: nowrap;&quot;&gt;/etc/init&lt;/code&gt;&amp;nbsp;called&lt;em style=&quot;margin: 0px; padding: 0px;&quot;&gt;myjobname&lt;/em&gt;.conf and the service then has the name&amp;nbsp;&lt;em style=&quot;margin: 0px; padding: 0px;&quot;&gt;myjobname&lt;/em&gt;. The file in /etc/init looks like this:&lt;/div&gt;
&lt;pre markdown=&quot;0&quot; style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-top: 10px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;xml&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; margin: 0px; padding: 0.5em;&quot;&gt;description     &quot;My Python Script etc..&quot;
author          &quot;My Name Here &lt;span class=&quot;tag&quot; style=&quot;color: navy; margin: 0px; padding: 0px;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;me@myplace.com&lt;/span&gt;&amp;gt;&lt;/span&gt;&quot;

start on runlevel [2345]
stop on runlevel [!2345]

respawn

exec /usr/local/bin/my_script.py&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
Which essentially says, start on run levels 2, 3, 4 and 5 and stop on any run-level that is&amp;nbsp;&lt;em style=&quot;margin: 0px; padding: 0px;&quot;&gt;not&lt;/em&gt;&amp;nbsp;2, 3, 4 or 5. If the process dies, restart it (respawn) and the command to run follows the exec.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
Clearly the contents of the file can be a lot more detailed and have many options, including pre and post start scripts etc. More detail of which can be found&amp;nbsp;&lt;a href=&quot;http://upstart.ubuntu.com/cookbook/#configuration&quot; style=&quot;color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;&quot;&gt;here&lt;/a&gt;.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
You then have to reload the upstart configuration to get it to recognise the file and start it running (initially I had a problem with my script which I saw through&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 12px; margin: 0px 2px; padding: 2px 5px; white-space: nowrap;&quot;&gt;dmesg&lt;/code&gt;). To reload the configuration, run&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 12px; margin: 0px 2px; padding: 2px 5px; white-space: nowrap;&quot;&gt;sudo initctl reload-configuration&lt;/code&gt;.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
To list jobs and their statuses, use&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 12px; margin: 0px 2px; padding: 2px 5px; white-space: nowrap;&quot;&gt;initctl list&lt;/code&gt;&amp;nbsp;and to start/stop jobs, use&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 12px; margin: 0px 2px; padding: 2px 5px; white-space: nowrap;&quot;&gt;sudo initctl start myjobname&lt;/code&gt;&amp;nbsp;and&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 12px; margin: 0px 2px; padding: 2px 5px; white-space: nowrap;&quot;&gt;sudo initctl stop myjobname&lt;/code&gt;&amp;nbsp;respectively.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
Finally, if I want to see any output from my script, there is also a log file under /var/log/upstart, so I can just use:&lt;/div&gt;
&lt;pre markdown=&quot;0&quot; style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-top: 10px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;cs&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; margin: 0px; padding: 0.5em;&quot;&gt;sudo tail -f /&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;var&lt;/span&gt;/log/upstart/myjobname.log&lt;/code&gt;&lt;div&gt;
&lt;/div&gt;
&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://blog.darrenparkinson.uk/feeds/2971465056365233224/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.darrenparkinson.uk/2013/01/using-upstart-to-manage-jobs-on-ubuntu.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/2971465056365233224'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/2971465056365233224'/><link rel='alternate' type='text/html' href='http://blog.darrenparkinson.uk/2013/01/using-upstart-to-manage-jobs-on-ubuntu.html' title='Using ‘UpStart’ to manage jobs on Ubuntu'/><author><name>Darren Parkinson</name><uri>http://www.blogger.com/profile/01084077294541066454</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27381059098267211.post-4265994191272838221</id><published>2013-01-16T17:09:00.001+00:00</published><updated>2013-01-18T18:03:42.212+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="cisco"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><category scheme="http://www.blogger.com/atom/ns#" term="scripting"/><title type='text'>Using Python to call Cisco Communications Manager Serviceability SOAP API</title><content type='html'>&lt;br /&gt;
&lt;div id=&quot;wrapper&quot; style=&quot;background-color: white; border: 0px; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 1.6; margin: 15px; outline: 0px; padding: 30px;&quot;&gt;
&lt;div style=&quot;margin-bottom: 1em; padding: 0px;&quot;&gt;
If Python is to be&amp;nbsp;&lt;a href=&quot;http://dparkinson.blogspot.co.uk/2012/12/python-one-scripting-language-to-rule.html&quot; style=&quot;color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;&quot;&gt;my new&amp;nbsp;&lt;em style=&quot;margin: 0px; padding: 0px;&quot;&gt;‘go to’&lt;/em&gt;&amp;nbsp;scripting language&lt;/a&gt;, I am, sooner or later, going to have to access Cisco SOAP services with it, so I thought it wise to investigate up front before I actually need to use it.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
With this in mind, I turned to a&amp;nbsp;&lt;a href=&quot;http://dparkinson.blogspot.co.uk/2012/07/calling-cisco-communications-manager.html&quot; style=&quot;color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;&quot;&gt;previous post&lt;/a&gt;&amp;nbsp;where I accessed the Cisco Communications Manager Real Time Information SOAP service using PHP. Time to convert it to Python.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
It seems there are various SOAP libraries for Python, the most popular of which appears to be&lt;a href=&quot;https://fedorahosted.org/suds/&quot; style=&quot;color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;&quot;&gt;suds&lt;/a&gt;, which I have used here.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
Initially, I experienced what appears to be a well documented issue with suds concerning WSDL schemas, getting a ‘Type Not Found’ error:&lt;/div&gt;
&lt;pre markdown=&quot;0&quot; style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-top: 10px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;ruby&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;constant&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;TypeNotFound&lt;/span&gt;&lt;span class=&quot;symbol&quot; style=&quot;color: #0086b3; margin: 0px; padding: 0px;&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;constant&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;Type&lt;/span&gt; &lt;span class=&quot;identifier&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;color: #0086b3; margin: 0px; padding: 0px;&quot;&gt;not&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;identifier&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;found&lt;/span&gt;&lt;span class=&quot;symbol&quot; style=&quot;color: #0086b3; margin: 0px; padding: 0px;&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;(Array, http://schemas.xmlsoap.org/soap/encoding/, )&#39;&lt;/span&gt;   &lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
I’ve often had trouble with Cisco SOAP schemas and namespaces etc, so I suspected this was my problem. Fortunately,&amp;nbsp;&lt;a href=&quot;http://stackoverflow.com/questions/12239103/python-soap-client-library&quot; style=&quot;color: #4183c4; margin: 0px; padding: 0px; text-decoration: none;&quot;&gt;stack overflow came to the rescue again&lt;/a&gt;&amp;nbsp;enabling me to fix the issue in no time by adding&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 12px; margin: 0px 2px; padding: 2px 5px; white-space: nowrap;&quot;&gt;Import&lt;/code&gt;&amp;nbsp;and&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 12px; margin: 0px 2px; padding: 2px 5px; white-space: nowrap;&quot;&gt;ImportDoctor&lt;/code&gt;&amp;nbsp;to import the referenced namespace:&lt;/div&gt;
&lt;pre markdown=&quot;0&quot; style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-top: 10px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;python&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; margin: 0px; padding: 0.5em;&quot;&gt;tns = &lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;http://schemas.cisco.com/ast/soap/&#39;&lt;/span&gt;
imp = Import(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;http://schemas.xmlsoap.org/soap/encoding/&#39;&lt;/span&gt;, &lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;http://schemas.xmlsoap.org/soap/encoding/&#39;&lt;/span&gt;)
imp.filter.add(tns)&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
The&amp;nbsp;&lt;em style=&quot;margin: 0px; padding: 0px;&quot;&gt;tns&lt;/em&gt;&amp;nbsp;part I got directly from looking at the WSDL file, where right at the top, it had this:&lt;/div&gt;
&lt;pre markdown=&quot;0&quot; style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-top: 10px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;xml&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;tag&quot; style=&quot;color: navy; margin: 0px; padding: 0px;&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;definitions&lt;/span&gt; &lt;span class=&quot;attribute&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;xmlns&lt;/span&gt;=&lt;span class=&quot;value&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&quot;http://schemas.xmlsoap.org/wsdl/&quot;&lt;/span&gt; &lt;span class=&quot;attribute&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;xmlns:soap&lt;/span&gt;=&lt;span class=&quot;value&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&quot;http://schemas.xmlsoap.org/wsdl/soap/&quot;&lt;/span&gt; &lt;span class=&quot;attribute&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;xmlns:soapenc&lt;/span&gt;=&lt;span class=&quot;value&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&quot;http://schemas.xmlsoap.org/soap/encoding/&quot;&lt;/span&gt; &lt;span class=&quot;attribute&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;xmlns:tns&lt;/span&gt;=&lt;span class=&quot;value&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&quot;http://schemas.cisco.com/ast/soap/&quot;&lt;/span&gt; &lt;span class=&quot;attribute&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;xmlns:xsd&lt;/span&gt;=&lt;span class=&quot;value&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&quot;http://www.w3.org/2001/XMLSchema&quot;&lt;/span&gt; &lt;span class=&quot;attribute&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;value&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&quot;RISService&quot;&lt;/span&gt; &lt;span class=&quot;attribute&quot; style=&quot;color: teal; margin: 0px; padding: 0px;&quot;&gt;targetNamespace&lt;/span&gt;=&lt;span class=&quot;value&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&quot;http://schemas.cisco.com/ast/soap/&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
After this, it was just a case of connecting with&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 12px; margin: 0px 2px; padding: 2px 5px; white-space: nowrap;&quot;&gt;suds.client.Client&lt;/code&gt;&amp;nbsp;using the appropriate location, username and password, along with the added Import:&lt;/div&gt;
&lt;pre markdown=&quot;0&quot; style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-top: 10px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;python&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; margin: 0px; padding: 0.5em;&quot;&gt;client = Client(wsdl,location=location, username=username, password=password, plugins=[ImportDoctor(imp)])&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
&lt;b id=&quot;firstdiff&quot; style=&quot;-webkit-transition: color 0.2s ease-in-out; border: none !important; display: block; left: 0px; margin: 0px; padding: 0px; position: absolute;&quot;&gt;&lt;/b&gt;Then, it was as easy as calling the methods listed with a&amp;nbsp;&lt;code style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 12px; margin: 0px 2px; padding: 2px 5px; white-space: nowrap;&quot;&gt;print client&lt;/code&gt;&amp;nbsp;which showed the five methods available:&lt;/div&gt;
&lt;pre markdown=&quot;0&quot; style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-top: 10px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;cs&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; margin: 0px; padding: 0.5em;&quot;&gt;    Methods (&lt;span class=&quot;number&quot; style=&quot;color: #40a070; margin: 0px; padding: 0px;&quot;&gt;5&lt;/span&gt;):
        ExecuteCCMSQLStatement(xs:&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;string&lt;/span&gt; ExecuteSQLInputData, ArrayOfGetColumns GetColumns, )
        GetServerInfo(ArrayOfHosts Hosts, )
        SelectCmDevice(xs:&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;string&lt;/span&gt; StateInfo, CmSelectionCriteria CmSelectionCriteria, )
        SelectCmDeviceSIP(xs:&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;string&lt;/span&gt; StateInfo, CmSelectionCriteriaSIP CmSelectionCriteriaSIP, )
        SelectCtiItem(xs:&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;string&lt;/span&gt; StateInfo, CtiSelectionCriteria CtiSelectionCriteria, )&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
So I could then use the SelectCmDevice as before with the PHP script using the following:&lt;/div&gt;
&lt;pre markdown=&quot;0&quot; style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-top: 10px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;python&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; margin: 0px; padding: 0.5em;&quot;&gt;result = client.service.SelectCmDevice(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;&#39;&lt;/span&gt;,{&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;SelectBy&#39;&lt;/span&gt;:&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;Name&#39;&lt;/span&gt;, &lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;Status&#39;&lt;/span&gt;:&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;Registered&#39;&lt;/span&gt;, &lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;Class&#39;&lt;/span&gt;:&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;Phone&#39;&lt;/span&gt;})&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
and print out the results like this:&lt;/div&gt;
&lt;pre markdown=&quot;0&quot; style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-top: 10px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;python&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;print&lt;/span&gt; result&lt;span class=&quot;malformed&quot; style=&quot;color: #98323f; margin: 0px; padding: 0px;&quot;&gt;[&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;SelectCmDeviceResult&#39;&lt;/span&gt;][&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;TotalDevicesFound&#39;&lt;/span&gt;]&lt;/span&gt;

&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;for&lt;/span&gt; node &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;in&lt;/span&gt; result&lt;span class=&quot;malformed&quot; style=&quot;color: #98323f; margin: 0px; padding: 0px;&quot;&gt;[&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;SelectCmDeviceResult&#39;&lt;/span&gt;][&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;CmNodes&#39;&lt;/span&gt;]&lt;/span&gt;:
    &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;for&lt;/span&gt; device &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;in&lt;/span&gt; node[&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;CmDevices&#39;&lt;/span&gt;]:
        &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;print&lt;/span&gt; device[&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;Name&#39;&lt;/span&gt;], device[&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;IpAddress&#39;&lt;/span&gt;], device[&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;DirNumber&#39;&lt;/span&gt;], device[&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;Description&#39;&lt;/span&gt;]
&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
Not too bad. Looks less verbose than the php version I think. Full script below:&lt;/div&gt;
&lt;pre markdown=&quot;0&quot; style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; margin-top: 10px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;code class=&quot;python&quot; style=&quot;background-color: ghostwhite; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; display: block; margin: 0px; padding: 0.5em;&quot;&gt;&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;from&lt;/span&gt; suds.xsd.doctor &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;import&lt;/span&gt; Import
&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;from&lt;/span&gt; suds.xsd.doctor &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;import&lt;/span&gt; ImportDoctor
&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;from&lt;/span&gt; suds.client &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;import&lt;/span&gt; Client

cmserver = &lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;172.16.4.11&#39;&lt;/span&gt;
cmport = &lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;8443&#39;&lt;/span&gt;
wsdl = &lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;https://172.16.4.11:8443/realtimeservice/services/RisPort?wsdl&#39;&lt;/span&gt;
location = &lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;https://&#39;&lt;/span&gt; + cmserver + &lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;:&#39;&lt;/span&gt; + cmport + &lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;/realtimeservice/services/RisPort&#39;&lt;/span&gt;
username = &lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;administrator&#39;&lt;/span&gt;
password = &lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;mypassword&#39;&lt;/span&gt;

tns = &lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;http://schemas.cisco.com/ast/soap/&#39;&lt;/span&gt;
imp = Import(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;http://schemas.xmlsoap.org/soap/encoding/&#39;&lt;/span&gt;, &lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;http://schemas.xmlsoap.org/soap/encoding/&#39;&lt;/span&gt;)
imp.filter.add(tns)

client = Client(wsdl,location=location, username=username, password=password, plugins=[ImportDoctor(imp)])

result = client.service.SelectCmDevice(&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;&#39;&lt;/span&gt;,{&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;SelectBy&#39;&lt;/span&gt;:&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;Name&#39;&lt;/span&gt;, &lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;Status&#39;&lt;/span&gt;:&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;Registered&#39;&lt;/span&gt;, &lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;Class&#39;&lt;/span&gt;:&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;Phone&#39;&lt;/span&gt;})

&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;print&lt;/span&gt; result&lt;span class=&quot;malformed&quot; style=&quot;color: #98323f; margin: 0px; padding: 0px;&quot;&gt;[&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;SelectCmDeviceResult&#39;&lt;/span&gt;][&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;TotalDevicesFound&#39;&lt;/span&gt;]&lt;/span&gt;

&lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;for&lt;/span&gt; node &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;in&lt;/span&gt; result&lt;span class=&quot;malformed&quot; style=&quot;color: #98323f; margin: 0px; padding: 0px;&quot;&gt;[&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;SelectCmDeviceResult&#39;&lt;/span&gt;][&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;CmNodes&#39;&lt;/span&gt;]&lt;/span&gt;:
    &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;for&lt;/span&gt; device &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;in&lt;/span&gt; node[&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;CmDevices&#39;&lt;/span&gt;]:
        &lt;span class=&quot;keyword&quot; style=&quot;font-weight: bold; margin: 0px; padding: 0px;&quot;&gt;print&lt;/span&gt; device[&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;Name&#39;&lt;/span&gt;], device[&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;IpAddress&#39;&lt;/span&gt;], device[&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;DirNumber&#39;&lt;/span&gt;], device[&lt;span class=&quot;string&quot; style=&quot;color: #dd1144; margin: 0px; padding: 0px;&quot;&gt;&#39;Description&#39;&lt;/span&gt;]&lt;/code&gt;&lt;div&gt;
&lt;/div&gt;
&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://blog.darrenparkinson.uk/feeds/4265994191272838221/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.darrenparkinson.uk/2013/01/using-python-to-call-cisco.html#comment-form' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/4265994191272838221'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/4265994191272838221'/><link rel='alternate' type='text/html' href='http://blog.darrenparkinson.uk/2013/01/using-python-to-call-cisco.html' title='Using Python to call Cisco Communications Manager Serviceability SOAP API'/><author><name>Darren Parkinson</name><uri>http://www.blogger.com/profile/01084077294541066454</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27381059098267211.post-4360353517391314652</id><published>2012-12-20T12:31:00.000+00:00</published><updated>2012-12-20T12:31:24.186+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Apple"/><category scheme="http://www.blogger.com/atom/ns#" term="cisco"/><category scheme="http://www.blogger.com/atom/ns#" term="jabber"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><category scheme="http://www.blogger.com/atom/ns#" term="scripting"/><category scheme="http://www.blogger.com/atom/ns#" term="siri"/><title type='text'>Using Siri to set Cisco Jabber Room Availability</title><content type='html'>Once I had &lt;a href=&quot;http://dparkinson.blogspot.co.uk/2012/12/installing-siri-proxy-ubuntu-1110-fresh.html&quot;&gt;Siri Proxy working&lt;/a&gt;, clearly the simplest thing to try was to extend one of my &lt;a href=&quot;http://dparkinson.blogspot.co.uk/2012/12/room-availability-with-cisco-jabber.html&quot;&gt;previous posts&lt;/a&gt; which uses a motion sensor to set Cisco Jabber room availability.&lt;br /&gt;
&lt;br /&gt;
In this example, I’m using Siri to change the availability status of the room instead. To do this, it’s very simple since I’ve done a lot of the leg work in the previous example. Essentially, on receiving the command from Siri, I can just publish a message to the &lt;a href=&quot;http://mosquitto.org/&quot;&gt;Mosquitto&lt;/a&gt; MQTT server that I set up. Since the room is already subscribing to messages, there is nothing else to do.&lt;br /&gt;
&lt;br /&gt;
Here is a very short video of that working. I’m not sure why there is a delay with the second status setting, probably just the usual Siri delays I expect.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;iframe allowfullscreen=&#39;allowfullscreen&#39; webkitallowfullscreen=&#39;webkitallowfullscreen&#39; mozallowfullscreen=&#39;mozallowfullscreen&#39; width=&#39;320&#39; height=&#39;266&#39; src=&#39;https://www.youtube.com/embed/5P9P0klgXcA?feature=player_embedded&#39; frameborder=&#39;0&#39;&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
On the Siri Proxy Ubuntu server, I simply added mosquitto and the mosquitto clients as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;    sudo apt-get install mosquitto
    sudo apt-get install mosquitto-clients
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Then I can use the appropriate mqtt publish command in Siri Proxy by using the &lt;code&gt;system&lt;/code&gt; command:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;listen_for /Meeting Room One Available/i do
  say &quot;Changing the status of Meeting Room One to Available...&quot;
  request_completed
  system(&quot;mosquitto_pub -h 192.168.1.105 -t &#39;room/presence&#39; -m &#39;Available&#39;&quot;)
end

listen_for /Meeting Room One Occupied/i do
  say &quot;Changing the status of Meeting Room One to Occupied...&quot;
  request_completed
  system(&quot;mosquitto_pub -h 192.168.1.105 -t &#39;room/presence&#39; -m &#39;Occupied&#39;&quot;)
end  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
And that’s it!</content><link rel='replies' type='application/atom+xml' href='http://blog.darrenparkinson.uk/feeds/4360353517391314652/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.darrenparkinson.uk/2012/12/using-siri-to-set-cisco-jabber-room.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/4360353517391314652'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/4360353517391314652'/><link rel='alternate' type='text/html' href='http://blog.darrenparkinson.uk/2012/12/using-siri-to-set-cisco-jabber-room.html' title='Using Siri to set Cisco Jabber Room Availability'/><author><name>Darren Parkinson</name><uri>http://www.blogger.com/profile/01084077294541066454</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27381059098267211.post-2172504253056955107</id><published>2012-12-20T12:11:00.001+00:00</published><updated>2012-12-20T12:13:16.341+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Apple"/><category scheme="http://www.blogger.com/atom/ns#" term="iOS"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><category scheme="http://www.blogger.com/atom/ns#" term="siri"/><title type='text'>Installing Siri Proxy - Ubuntu 11.10 Fresh Install</title><content type='html'>&lt;br /&gt;
&lt;br /&gt;
For my next blog post, I needed to get &lt;a href=&quot;https://github.com/plamoni/SiriProxy&quot;&gt;Siri Proxy&lt;/a&gt; working. Siri Proxy is an application that enables you to create your own commands for Siri. It doesn’t require a jailbreak, but clearly it’s not supported by Apple either.&lt;br /&gt;
&lt;br /&gt;
Initially I had some challenges and I spent quite some time trying to get a different version of Ubuntu running, but the instructions I was following are specifically based on Ubuntu 11.10, so to avoid any more wasted time, I performed a fresh install specifically for this use.&lt;br /&gt;
&lt;br /&gt;
The following just outlines my notes to get things up and running for me to refer to if I need to do it again. There are various resources that I used at the end of this post that are more comprehensive.&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Fresh 11.10 installation. I downloaded the &lt;a href=&quot;http://releases.ubuntu.com/11.10/&quot;&gt;PC (Intel x86) desktop version&lt;/a&gt;. &lt;/li&gt;
&lt;li&gt;Install Updates &lt;/li&gt;
&lt;li&gt;Parallels - Take Snapshot &lt;/li&gt;
&lt;li&gt;Network in Bridged Mode (Note IP Address) &lt;/li&gt;
&lt;li&gt;Paste in commands as per the tutorial: &lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;sudo apt-get install dnsmasq ruby build-essential openssl libreadline6 
libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev 
libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf 
libc6-dev ncurses-dev automake libtool bison subversion
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Edit /etc/dnsmasq.conf&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;sudo vi /etc/dnsmasq.conf  
    address=/guzzoni.apple.com/*my ip address*  
sudo /etc/init.d/dnsmasq restart
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Download RVM (ruby version manager): &lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;bash &amp;lt; &amp;lt;(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)  
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Set up the environment: &lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;[[ -s &quot;$HOME/.rvm/scripts/rvm&quot; ]] &amp;amp;&amp;amp; . &quot;$HOME/.rvm/scripts/rvm&quot;
echo &#39;[[ -s &quot;$HOME/.rvm/scripts/rvm&quot; ]] &amp;amp;&amp;amp; . &quot;$HOME/.rvm/scripts/rvm&quot; # Load RVM function&#39; &amp;gt;&amp;gt; ~/.bash_profile  
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Install RVM (takes ~14 mins) &lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;rvm install 1.9.3  
rvm use 1.9.3 --default  
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Install Siri Proxy (finally!!) &lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;git clone git://github.com/plamoni/SiriProxy.git
cd SiriProxy
Answer y if asked to trust .rvmrc file
mkdir ~/.siriproxy
cp ./config.example.yml ~/.siriproxy/config.yml
rake install
siriproxy gencerts
siriproxy bundle
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Run Siri Proxy (if all that worked of course)&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;rvmsudo siriproxy server&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Set up the iPhone by emailing yourself the certificate file you created earlier and installing it to the iPhone &lt;code&gt;~/.siriproxy/ca.pem&lt;/code&gt; (maybe move it up a level out of the .siriproxy directory so you don’t have to mess about viewing “hidden” files)&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;Then change the wifi dns server to be the IP Address of the Ubuntu machine on the same wireless network &lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;h2 id=&quot;fixingthingsup&quot;&gt;
Fixing things up&lt;/h2&gt;
&lt;br /&gt;
After doing all that, it still didn’t work, with a pretty similar error to the one I was getting with the other version of Ubuntu. So I went through the same things I did then, but this time with more success, as outlined below.&lt;br /&gt;
&lt;br /&gt;
Edit the &lt;code&gt;siriproxy.gemspec&lt;/code&gt; file so that the line with CFPropertyList reads: &lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;s.add_runtime_dependency(&#39;CFPropertyList&#39;, &#39;2.1.2&#39;)  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Install the correct version of CFPropertList and update things: &lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;rvmsudo gem install --version &#39;=2.1.2&#39; CFPropertyList  
rvmsudo rake install
rvmsudo siriproxy bundle
rvmsudo siriproxy server
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
(Note: Before the the rake install etc., I did also try a &lt;code&gt;rvmsudo siriproxy update&lt;/code&gt; which didn’t seem to fix things).&lt;br /&gt;
&lt;br /&gt;
&lt;h2 id=&quot;testingsiriproxy&quot;&gt;
Testing Siri Proxy&lt;/h2&gt;
&lt;br /&gt;
The example script has the following commands you can try: &lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&quot;Test Siri Proxy&quot;
&quot;Where am i?&quot;
&quot;Siri Proxy Test Question&quot;
&quot;Siri Proxy Number 426&quot;
&quot;Test Map&quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;h2 id=&quot;addingyourownquickcommand&quot;&gt;
Adding your own quick command&lt;/h2&gt;
&lt;br /&gt;
Edit the example plugin file in &lt;code&gt;~/SiriProxy/plugins/siriproxy-example/lib&lt;/code&gt; to add an extra phrase:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;listen_for /how is everyone at work/i do
    say &quot;They are all working hard whilst you enjoy your day off&quot;
    request_completed
end
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Then I had to perform the following commands. I’m not sure it should be this difficult, but if I perform the update command as instructed elsewhere, I get the same issue as before with the CFPropertyList version. &lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;rvmsudo rake install
rvmsudo siriproxy bundle
rvmsudo siriproxy server
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;h2 id=&quot;furtherreading&quot;&gt;
Further Reading&lt;/h2&gt;
&lt;br /&gt;
Most of this information is taken straight from &lt;a href=&quot;http://www.idownloadblog.com/2011/12/09/how-to-install-siri-proxy-tutorial-video/&quot;&gt;idownloadblog&lt;/a&gt;, but I’ve summarised it into quick steps for me, so it’s not as detailed.&lt;br /&gt;
&lt;br /&gt;
Outside of that, a couple of other useful/interesting links are as follows: &lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/plamoni/SiriProxy/blob/master/README.md&quot;&gt;The Readme from the source&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/plamoni/SiriProxy/wiki/Installation-How-Tos&quot;&gt;Installation Instructions for other distributions/form factors&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/plamoni/SiriProxy/issues/389&quot;&gt;The link that led me to the CFPropertyList issue&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.idownloadblog.com/2011/12/11/how-to-install-siri-proxy-plugins-video/&quot;&gt;Installing Siri Proxy Plugins&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.raspberrypi.org/phpBB3/viewtopic.php?f=63&amp;amp;t=25118&quot;&gt;Someone using Raspberry Pi for Siri Proxy to open their Garage Door&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://labs.laan.com/wp/2011/10/unlock-your-door-with-siri-sms-or-a-secret-knock/&quot;&gt;Combining Siri with Arduino for to control a door lock&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://blog.darrenparkinson.uk/feeds/2172504253056955107/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.darrenparkinson.uk/2012/12/installing-siri-proxy-ubuntu-1110-fresh.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/2172504253056955107'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/2172504253056955107'/><link rel='alternate' type='text/html' href='http://blog.darrenparkinson.uk/2012/12/installing-siri-proxy-ubuntu-1110-fresh.html' title='Installing Siri Proxy - Ubuntu 11.10 Fresh Install'/><author><name>Darren Parkinson</name><uri>http://www.blogger.com/profile/01084077294541066454</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27381059098267211.post-120452798886668738</id><published>2012-12-17T11:10:00.000+00:00</published><updated>2012-12-17T11:24:26.664+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="cisco"/><category scheme="http://www.blogger.com/atom/ns#" term="jabber"/><category scheme="http://www.blogger.com/atom/ns#" term="mqtt"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><category scheme="http://www.blogger.com/atom/ns#" term="scripting"/><title type='text'>Room Availability with Cisco Jabber</title><content type='html'>&lt;em&gt;&lt;br /&gt;&lt;/em&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=27381059098267211&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=27381059098267211&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=27381059098267211&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=27381059098267211&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;/a&gt;&lt;em&gt;You know what it&#39;s like -- you need a meeting room for an ad-hoc meeting, there are calendars for all the meeting rooms and some are showing availability, yet every room you try is occupied.&lt;/em&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=27381059098267211&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=27381059098267211&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
As with video calling, ad-hoc meetings seem to be at least as popular as scheduled meetings these days. So wouldn&#39;t it be nice to get a live view of meeting room availability straight from your IM &amp;amp; Presence client.&lt;br /&gt;
&lt;br /&gt;
For me, this seems to be the most logical place to have availability status, not just for meeting rooms, but for a whole range of devices and applications. This then means that the information is available in all integrated applications along with having it available on my mobile device too.&lt;br /&gt;
&lt;br /&gt;
&lt;h2 id=&quot;bringing-it-all-together&quot;&gt;
Bringing it all together&lt;/h2&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=27381059098267211&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=27381059098267211&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;/a&gt;With the announcement of Cisco&#39;s &lt;a href=&quot;http://blogs.cisco.com/news/internet-of-everything-2/&quot;&gt;Internet of Everything&lt;/a&gt; strategy I thought it would be a great opportunity to bring together some of the things that I&#39;ve been experimenting with lately to create a simple example.&lt;br /&gt;
&lt;br /&gt;
The main components in this case include:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://arduino.cc/&quot;&gt;Arduino&lt;/a&gt; - An electronics prototyping platform which is super easy to use and program and provides the basis for the motion sensing in this example. I&#39;ve had the Arduino platform for a while now and have been using it to expand my knowledge of electronics;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.cisco.com/go/jabber&quot;&gt;Cisco Jabber&lt;/a&gt; - The Enterprise Instant Messaging, Presence and Collaboration platform we use. Cisco Jabber is also a very open platform supporting various standards, including XMPP, which enables great opportunities for CEBP and extensibility. This is used to indicate the availability status. &lt;/li&gt;
&lt;/ul&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4eeRGRCcP0yd9s_CgDrjnxcev3tD5Bc43Gifo8mrRsmKF3N9gtYk4XL5Hx10_PXdd0PvCForURIgnW6E1-xf1uAFxPABeNTMHqCBmVqtARQJk62OzS4PTyzNVLFXUp12PuTerEhNKyRU/s1600/PIRS-01_MED.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;213&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4eeRGRCcP0yd9s_CgDrjnxcev3tD5Bc43Gifo8mrRsmKF3N9gtYk4XL5Hx10_PXdd0PvCForURIgnW6E1-xf1uAFxPABeNTMHqCBmVqtARQJk62OzS4PTyzNVLFXUp12PuTerEhNKyRU/s320/PIRS-01_MED.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;PIR Motion Sensor&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=27381059098267211&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=27381059098267211&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;/a&gt;&lt;/div&gt;
For the glue, I&#39;m using the following:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.python.org/&quot;&gt;Python&lt;/a&gt; - The scripting language I&#39;m using for joining these things together.  Clearly other languages could be used too;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://mosquitto.org/&quot;&gt;Mosquitto&lt;/a&gt; - The MQTT Message Broker I&#39;m using. A message broker isn&#39;t essential, I could just link the components directly, but using a broker provides many benefits -- more specifically for me, it would work directly with the arduino once I hook it up to the wireless network.&lt;/li&gt;
&lt;/ul&gt;
The following diagram shows how simple the architecture of this is:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUwXyK_WBegR2sElrGeznuLDreBVIjIETgDaCAu8LMH5LhOdJdRKRR0doFTVTQF0F3MbTpj4_Qh3hXhRYiVfKgjpx5Onal6A1Z4lp7bsjiDeDokYWvXWrKxXZYFJ_ILtYtnik75F-8ob8/s1600/RoomAvailability.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;50&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUwXyK_WBegR2sElrGeznuLDreBVIjIETgDaCAu8LMH5LhOdJdRKRR0doFTVTQF0F3MbTpj4_Qh3hXhRYiVfKgjpx5Onal6A1Z4lp7bsjiDeDokYWvXWrKxXZYFJ_ILtYtnik75F-8ob8/s400/RoomAvailability.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And once it&#39;s all together, I can view the room status on any of my devices:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEif47zw0WCJY5MdcfZRFxGXsB8MuxZvFurwght3LRcW9PhybPGjbqVqdTZnj4xeLV7Tb3b9-h3skF0LyTcl1bi_71gwo3qnExNb37bAW7Mr9BDlMQnijRkFHJL3YJNhErtrIHLESd5xJtw/s1600/Screen+Shot+2012-12-17+at+10.04.05.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEif47zw0WCJY5MdcfZRFxGXsB8MuxZvFurwght3LRcW9PhybPGjbqVqdTZnj4xeLV7Tb3b9-h3skF0LyTcl1bi_71gwo3qnExNb37bAW7Mr9BDlMQnijRkFHJL3YJNhErtrIHLESd5xJtw/s1600/Screen+Shot+2012-12-17+at+10.04.05.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEif47zw0WCJY5MdcfZRFxGXsB8MuxZvFurwght3LRcW9PhybPGjbqVqdTZnj4xeLV7Tb3b9-h3skF0LyTcl1bi_71gwo3qnExNb37bAW7Mr9BDlMQnijRkFHJL3YJNhErtrIHLESd5xJtw/s1600/Screen+Shot+2012-12-17+at+10.04.05.png&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Mac - Available&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiz2rF_LSZOLKegN6TDKVHO5MRtvbDefgryAGoikn8gpXqQd7b7JXnAKnnp5N4iIyIyttR0aNmrXHEkc5TXVd8n-ExPr4_d_U3hbO7JKAvYpuCo8EmWatnvbmDUAD0b_rTETwVkY6r-INo/s1600/Screen+Shot+2012-12-17+at+10.07.22.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiz2rF_LSZOLKegN6TDKVHO5MRtvbDefgryAGoikn8gpXqQd7b7JXnAKnnp5N4iIyIyttR0aNmrXHEkc5TXVd8n-ExPr4_d_U3hbO7JKAvYpuCo8EmWatnvbmDUAD0b_rTETwVkY6r-INo/s1600/Screen+Shot+2012-12-17+at+10.07.22.png&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Mac - Occupied&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgaCz75Nd74wYZVE6wXQfx_mXwcsGNufgmmdxWRGqcrfh2GFiSWmgo1PEdRxbrOGfTidvioiHrgO3TfXohsbESP8pEMpkJA8NbZxqlN0JnYFkEoHd09IkmPGGl5EQKSaRoIe-yVbWDqWdo/s1600/Screen+Shot+2012-12-17+at+10.09.47.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgaCz75Nd74wYZVE6wXQfx_mXwcsGNufgmmdxWRGqcrfh2GFiSWmgo1PEdRxbrOGfTidvioiHrgO3TfXohsbESP8pEMpkJA8NbZxqlN0JnYFkEoHd09IkmPGGl5EQKSaRoIe-yVbWDqWdo/s1600/Screen+Shot+2012-12-17+at+10.09.47.png&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;iPhone - Occupied&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7v3dm_tda7BrCVUXaGeFb4FEwulY0uR970gEXnuV7uo8yyocRshuv9wKLVvoFMefAhh0Jzm3ZFdjG5YIT82t_xTnxWfryGPN49iVoFnlUiOeik8Zrp3JQamE6ZOH4Jdzop6betYfhYlk/s1600/Screen+Shot+2012-12-17+at+10.11.02.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7v3dm_tda7BrCVUXaGeFb4FEwulY0uR970gEXnuV7uo8yyocRshuv9wKLVvoFMefAhh0Jzm3ZFdjG5YIT82t_xTnxWfryGPN49iVoFnlUiOeik8Zrp3JQamE6ZOH4Jdzop6betYfhYlk/s1600/Screen+Shot+2012-12-17+at+10.11.02.png&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;iPhone - Available&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=27381059098267211&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=27381059098267211&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h2 id=&quot;future-enhancements&quot;&gt;
Future enhancements&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Wireless Connectivity : At the moment, I have the Arduino connected directly to my laptop via serial link, but because I&#39;m using a message broker I can essentially make this even simpler by having the Arduino talk directly to the broker and removing my laptop and one of the helper scripts from the equation -- that&#39;s as soon as I get my hands on a &lt;a href=&quot;http://www.oomlout.co.uk/wifi-shield-for-arduino-p-290.html&quot;&gt;wireless shield&lt;/a&gt; for the Arduino.&lt;/li&gt;
&lt;li&gt;Upcoming Meetings : As well as providing real time status information, it would also be useful to show when the next scheduled meeting is too, without having to use another application. Of course, Cisco Jabber can already provide calendar status by identifying users as being &quot;In a Meeting&quot;, but doesn&#39;t necessarily show what upcoming meetings there are. To do this, it would simply be a case of reading the calendar for the room and then either: listing the information in the status (which may be too much information since this is a short field); or enabling someone to &#39;chat&#39; to the room to ask for details.&lt;/li&gt;
&lt;li&gt;Message Broker Options : I&#39;m currently using a separate message broker for this, mainly because of the Arduino support, but Cisco Jabber, and more specifically &lt;a href=&quot;http://xmpp.org/extensions/xep-0060.html&quot;&gt;XMPP, supports a publish/subscribe model&lt;/a&gt; too, so I&#39;d like to investigate the possibility of using that as the publish/subscribe platform allowing me to simplify things further and remove an extra component.&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
If you can think of any others, I&#39;d be glad to hear them.&lt;/div&gt;
&lt;h2 id=&quot;additional-detail&quot;&gt;
Additional Detail&lt;/h2&gt;
&lt;div&gt;
If anyone would like additional detail on exactly how this fits together, let me know in the comments and I&#39;ll add a separate post.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Essentially though, it was a case of slightly modifying the example scripts on each of the respective sites for the various elements:&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://mosquitto.org/documentation/python/&quot; target=&quot;_blank&quot;&gt;Mosquitto&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://sleekxmpp.com/getting_started/echobot.html&quot; target=&quot;_blank&quot;&gt;XMPP&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.oomlout.com/PIRS-01/PIRS-01-code.txt&quot; target=&quot;_blank&quot;&gt;Arduino Motion Sensor&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://blog.darrenparkinson.uk/feeds/120452798886668738/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.darrenparkinson.uk/2012/12/room-availability-with-cisco-jabber.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/120452798886668738'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/120452798886668738'/><link rel='alternate' type='text/html' href='http://blog.darrenparkinson.uk/2012/12/room-availability-with-cisco-jabber.html' title='Room Availability with Cisco Jabber'/><author><name>Darren Parkinson</name><uri>http://www.blogger.com/profile/01084077294541066454</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4eeRGRCcP0yd9s_CgDrjnxcev3tD5Bc43Gifo8mrRsmKF3N9gtYk4XL5Hx10_PXdd0PvCForURIgnW6E1-xf1uAFxPABeNTMHqCBmVqtARQJk62OzS4PTyzNVLFXUp12PuTerEhNKyRU/s72-c/PIRS-01_MED.jpg" height="72" width="72"/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27381059098267211.post-2600009151077915029</id><published>2012-12-13T14:37:00.000+00:00</published><updated>2012-12-14T09:11:09.667+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="python"/><category scheme="http://www.blogger.com/atom/ns#" term="scripting"/><category scheme="http://www.blogger.com/atom/ns#" term="visio"/><title type='text'>Using Python to export multiple Visio pages to .png files</title><content type='html'>&lt;p&gt;So, following &lt;a href=&quot;http://dparkinson.blogspot.co.uk/2012/12/python-one-scripting-language-to-rule.html&quot;&gt;my post&lt;/a&gt; about using Python for as much as possible, this is the first attempt. It&#39;s a simple script but is also an area where I thought Python would struggle the most -- automating Visio. This is based on the &lt;a href=&quot;http://dparkinson.blogspot.co.uk/2012/07/using-powershell-to-export-multiple.html&quot;&gt;previous post&lt;/a&gt; that used PowerShell.&lt;/p&gt;&lt;p&gt;For Windows scripting, you will need to install PyWin32. After installing PyWin32 by following the &lt;a href=&quot;http://sourceforge.net/projects/pywin32/files/?source=navbar&quot;&gt;instructions&lt;/a&gt;, I needed to set my PATH so that the win32api module was found. Prior to doing this, I was getting an error when performing an &lt;code&gt;import win32com.client&lt;/code&gt; that the win32api module was not found. This was because the &lt;code&gt;C:\Python27\lib\site-packages\win32&lt;/code&gt; directory was not in my PATH. To do this I used PowerShell as follows:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;[Environment]::SetEnvironmentVariable(&amp;quot;Path&amp;quot;, &amp;quot;$env:Path;C:\Python27\lib\site-packages\win32&amp;quot;, &amp;quot;User&amp;quot;)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You could also do this directly in Python like this:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;import sys
sys.path.append(r&#39;C:\Python27\Lib\site-packages\win32&#39;)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;For Visio automation, it seems there are two options. You can either use Com with pywin32, or use the IronPython .Net integration using the CLR. This is highlighted in &lt;a href=&quot;http://mil-oss.org/resources/mil-oss-wg4-automating-microsoft-office-with-python.pdf&quot;&gt;this presentation&lt;/a&gt; from Georgia Tech Research Institute (which is a great read).&lt;/p&gt;&lt;pre&gt;&lt;code&gt;
import win32com.client
from win32com.client import constants

directory = &#39;c:\\path_to_file\\&#39;
filename = &#39;filename_without_extension&#39;

win32com.client.gencache.EnsureDispatch(&amp;quot;Visio.Application&amp;quot;)

application = win32com.client.Dispatch(&amp;quot;Visio.Application&amp;quot;)
application.Visible = False
document = document = application.Documents.Open(&#39;%s%s.vsd&#39; % (directory,filename))

pages = application.ActiveDocument.Pages

for page in pages:
    pagename = &#39;%s%s.png&#39; % (directory, page)
    page.Export(pagename)
application.Quit()
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Looks pretty similar to the PowerShell version right...&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.darrenparkinson.uk/feeds/2600009151077915029/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.darrenparkinson.uk/2012/12/so-following-my-post-about-using-python.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/2600009151077915029'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/2600009151077915029'/><link rel='alternate' type='text/html' href='http://blog.darrenparkinson.uk/2012/12/so-following-my-post-about-using-python.html' title='Using Python to export multiple Visio pages to .png files'/><author><name>Darren Parkinson</name><uri>http://www.blogger.com/profile/01084077294541066454</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27381059098267211.post-383360200964783386</id><published>2012-12-12T22:00:00.005+00:00</published><updated>2012-12-14T09:10:52.108+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="python"/><category scheme="http://www.blogger.com/atom/ns#" term="scripting"/><title type='text'>Python -- one scripting language to rule them all?</title><content type='html'>&lt;h1 id=&quot;python-one-scripting-language-to-rule-them-all&quot;&gt;&lt;/h1&gt;Over the years, it&#39;s been necessary to learn various scripting languages in order to address the task at hand. For example: wsh/powershell for scripting the windows desktop and Microsoft applications; php for scripting the web; perl for text processing (among other things); ksh/bash for unix shell scripting etc.. You get the idea. &lt;br /&gt;
&lt;br /&gt;
Just recently I&#39;d been looking at a couple of &#39;projects&#39; where it seemed learning python would make the task easier, purely because various libraries had already been written for the task, and python seemed to be the language of choice. (These &#39;projects&#39; are just something that I&#39;m messing around with in my spare time relating to arduino/raspberry pi and IoT that I&#39;ll maybe blog about in the future if they become interesting).&lt;br /&gt;
&lt;br /&gt;
Previously I had always put off learning python for various reasons, including: the odd formatting it uses didn&#39;t really appeal; did I really need to learn yet another scripting language?; and could it really do anything I couldn&#39;t do with another language? &lt;br /&gt;
&lt;br /&gt;
So, when this opportunity came along, I thought I&#39;d take another look. &lt;br /&gt;
&lt;br /&gt;
The first thing I did was to check the &lt;a href=&quot;http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html&quot;&gt;TIOBE index&lt;/a&gt; to see where the language was in the &#39;charts&#39; -- the last thing I want to do is invest too much time in something on its way down, or near the bottom. Fortunately it&#39;s in the top 10 and seems to be doing well. Also of interest on that site is the headline that &lt;em&gt;Objective-C is on its way to become &quot;language of the year&quot; again&lt;/em&gt; -- fortunately I&#39;ve been learning that all year too.&lt;br /&gt;
&lt;br /&gt;
On closer inspection, it also seems there is nothing that can&#39;t be done with python and it got me thinking that perhaps by investing more than the minimum amount of time in this, it could replace all those other scripting languages and be the one language to rule them all.&lt;br /&gt;
&lt;br /&gt;
As an example, there is a &lt;a href=&quot;https://www.djangoproject.com/&quot;&gt;web framework&lt;/a&gt;, there is a module for &lt;a href=&quot;http://sourceforge.net/projects/pywin32/&quot;&gt;windows scripting&lt;/a&gt;, it&#39;s installed by default on the mac for all my text processing and data manipulation needs, I can use it for home automation on a Linux server, and I can even use &lt;a href=&quot;http://ironpython.net/&quot;&gt;Iron Python&lt;/a&gt; for .Net programming if I really want to replace C#. &lt;br /&gt;
&lt;br /&gt;
To prove this theory, I&#39;ll be rewriting various scripts that I&#39;ve written recently to see if I can really use one scripting language, even if it’s not for everything, but just for most things. Clearly &lt;a href=&quot;http://dparkinson.blogspot.co.uk/2012/11/extracting-xml-with-python.html&quot;&gt;my last blog post&lt;/a&gt; was my first foray into python, and there will be follow up posts on this topic to come. &lt;br /&gt;
&lt;br /&gt;
</content><link rel='replies' type='application/atom+xml' href='http://blog.darrenparkinson.uk/feeds/383360200964783386/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.darrenparkinson.uk/2012/12/python-one-scripting-language-to-rule.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/383360200964783386'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27381059098267211/posts/default/383360200964783386'/><link rel='alternate' type='text/html' href='http://blog.darrenparkinson.uk/2012/12/python-one-scripting-language-to-rule.html' title='Python -- one scripting language to rule them all?'/><author><name>Darren Parkinson</name><uri>http://www.blogger.com/profile/01084077294541066454</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry></feed>