<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/"><channel><title>2015-03 on Funky Si's Blog (Dev)</title><link>https://blog-dev.funkysi1701.com/2015/03/</link><description>Recent content in 2015-03 on Funky Si's Blog (Dev)</description><generator>Hugo -- gohugo.io</generator><language>en-gb</language><managingEditor>funkysi1701@gmail.com (Simon Foster)</managingEditor><webMaster>funkysi1701@gmail.com (Simon Foster)</webMaster><lastBuildDate>Wed, 25 Mar 2015 20:00:45 +0000</lastBuildDate><atom:link href="https://blog-dev.funkysi1701.com/2015/03/index.xml" rel="self" type="application/rss+xml"/><item><title>Monitoring Screens</title><link>https://blog-dev.funkysi1701.com/posts/2015/monitoring-screens/</link><author>funkysi1701@gmail.com (funkysi1701)</author><pubDate>Wed, 25 Mar 2015 20:00:45 +0000</pubDate><guid>https://blog-dev.funkysi1701.com/posts/2015/monitoring-screens/</guid><category term="BigScreen">BigScreen</category><category term="Azure">Azure</category><category term="jQuery">jQuery</category><category term="JavaScript">JavaScript</category><category term="Nagios">Nagios</category><category term="Monitoring">Monitoring</category><media:content medium="image" type="image/jpeg" url="https://blog-dev.funkysi1701.com/images/2015/03/perf.jpg"/><description>&lt;p&gt;We all know that it is important to monitor your servers and services, so you can spot issues before they become problems. I personally have spent a lot of time configuring &lt;a href="https://www.funkysi1701.com/posts/2014/i-love-nagios/" target="_blank" rel="noopener noreferrer"&gt;nagios&lt;/a&gt;
to email me about issues and I have recently been configuring various different alerts in Azure.&lt;/p&gt;
&lt;p&gt;My old boss has this idea that I should have a big monitor screen displaying all the vital stats of my servers and services, I personally disagree with this idea and think that notifications on my phone and email alerts are sufficient. He will no doubt correct my thinking when he reads this, but I believe part of his thinking is to make the monitoring of your infrastructure move visible and make it obvious to anyone that walks past that you have your eye on everything.&lt;/p&gt;
&lt;p&gt;For the purpose of this blog post lets assume he has convinced me and I have convinced my actual boss to spend money on the required technology to do this (No easy feat). What exactly would I display on this screen?&lt;/p&gt;
&lt;p&gt;I have Google Chromecast that I use for streaming various things to my TV, this is a relatively cheap bit of technology that could allow a TV or monitor to display a web page with the required stats displayed.
&lt;img class="img-fluid" alt="Server performance graphs on a monitoring dashboard" src="https://blog-dev.funkysi1701.com/images/2015/03/perf.jpg" loading="lazy"
width="980" height="349"
/&gt;
&lt;/p&gt;
&lt;p&gt;The two main sources of information that I want to display are New Relic for monitoring my azure websites and Nagios for monitoring my internal servers. New Relic allows you to easily export live performance data as iframes so I quickly threw together a web page full of these graphs. However if you have a static screen on the wall you don’t want to have to scroll to see different information so I needed to come up with another way to display this information.&lt;/p&gt;
&lt;p&gt;My first thought was a slide show. There are lots of javascript scripts that cycle through a series of images like a slideshow, this could be adapted to cycle through a series of iframes and display everything I want.&lt;/p&gt;
&lt;p&gt;My script goes something like this and requires jquery as well as javascript. First of all the script waits for the page to load completely with the ready function, it then defines the urls which will be put into the iframe one at a time. It than counts the number of urls you have. It then loops through changing the contents of the src attribute in the iframe every few seconds, in my example it changes every 9 seconds but once this is used in production you may want to increase this.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-html" data-lang="html"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;&lt;span style="color:#f92672"&gt;script&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;type&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;text/javascript&amp;#34;&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;$&lt;/span&gt;(document).&lt;span style="color:#a6e22e"&gt;ready&lt;/span&gt;(&lt;span style="color:#66d9ef"&gt;function&lt;/span&gt;(){
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;var&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;locations&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; [&lt;span style="color:#e6db74"&gt;&amp;#34;URL1&amp;#34;&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#34;URL2&amp;#34;&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#34;etc&amp;#34;&lt;/span&gt;];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;var&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;len&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;locations&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;length&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;var&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;iframe&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;$&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#39;#frame&amp;#39;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;var&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;i&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;setInterval&lt;/span&gt;(&lt;span style="color:#66d9ef"&gt;function&lt;/span&gt; () {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;iframe&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;attr&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#39;src&amp;#39;&lt;/span&gt;, &lt;span style="color:#a6e22e"&gt;locations&lt;/span&gt;[&lt;span style="color:#f92672"&gt;++&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;i&lt;/span&gt; &lt;span style="color:#f92672"&gt;%&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;len&lt;/span&gt;]);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }, &lt;span style="color:#ae81ff"&gt;9000&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;});
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;/&lt;span style="color:#f92672"&gt;script&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now what information wants to be included in a script like this? Showing too much performance data can almost be as bad as not doing it at all as problems gets drowned out in the noise. For me I have performance of my websites, followed by Nagios problems, followed by the azure status page, followed by memory usage of all my servers and lastly showing number of connections to my databases. Another question to consider is what time scales do you want to graph over, too long and you don’t see what is happening now, but too short and you may only worry about an intermittent issue?&lt;/p&gt;</description></item><item><title>Networking Event</title><link>https://blog-dev.funkysi1701.com/posts/2015/networking-event/</link><author>funkysi1701@gmail.com (funkysi1701)</author><pubDate>Sun, 22 Mar 2015 20:00:45 +0000</pubDate><guid>https://blog-dev.funkysi1701.com/posts/2015/networking-event/</guid><category term="ITManagers">ITManagers</category><category term="Change">Change</category><category term="Networking">Networking</category><category term="ITBoss">ITBoss</category><category term="Strategy">Strategy</category><description>&lt;p&gt;I recently went to an event called ITBoss organised by &lt;a href="https://www.corecomconsulting.co.uk/" target="_blank" rel="noopener noreferrer"&gt;Core Com Consulting&lt;/a&gt;
. It was really good, helped partly by a free bar and great food.&lt;/p&gt;
&lt;p&gt;The event was hosted in a pub in central Leeds, so I rushed to the train station from work to get there. And yes I was the first to arrive (Why do I always do that?). The event was targeted at IT Leaders and Managers and was limited to about 20 people.&lt;/p&gt;
&lt;p&gt;To begin with I just chatted to the hosts and other people as we waited for everyone to arrive. Once we got going we had a short presentation about the need for Strategy. Interestingly the next day I suggested a strategy meeting with my director, so something must have sunk in from this.&lt;/p&gt;
&lt;p&gt;The main gist of the talk was that IT leaders need to pop there head up from day to day work to look at where they are going, and this should be matched with the overall direction of the company. I agree with this, recently I have been thinking of what direction our infrastructure needs to go in, it is currently just in my head, but at least that is a start. However our company directors are poor at sharing their long term vision, so it is hard for me to know where the company is going. I need to step up and challenge this behavior, so I can deliver the changes that are needed. Not easy but that is what the best IT leaders are doing.&lt;/p&gt;
&lt;p&gt;After this we broke for food, which was very nice. I had a chat with a couple of people. I found it interesting that one gentleman was surprised that I wanted to get into development. I think I understand why, most of the people in the room where senior managers, while I share their job titles, I don’t share their salaries. He saw development as a demotion, I see it as a promotion.&lt;/p&gt;
&lt;p&gt;After food we had some discussion questions. Mine was the first, How to convince others of the need for change? Some interesting ideas where presented, but it is the need to work closely with others, find out their requirements which is the difficult part not anything technical. The other topics of discussion where relating to recruiting people with skills that you have no knowledge of and around the topic of security and privacy in this modern age. Both were very interesting with lots of viewpoints expressed.&lt;/p&gt;
&lt;p&gt;I enjoyed the evening and hope to go to another at some point. Previous events I have been to have been technical, but lacked the networking that this one had. While I am not very good at networking, at this event it was easy to have a conversation or two with people.&lt;/p&gt;</description></item><item><title>Source Control Fail</title><link>https://blog-dev.funkysi1701.com/posts/2015/source-control-fail/</link><author>funkysi1701@gmail.com (funkysi1701)</author><pubDate>Mon, 16 Mar 2015 00:00:00 +0000</pubDate><guid>https://blog-dev.funkysi1701.com/posts/2015/source-control-fail/</guid><category term="Git">Git</category><description>&lt;p&gt;Every developer uses source control, it is a great tool for keeping track of changes to your code, seeing who has done what.&lt;/p&gt;
&lt;p&gt;However I keep messing up, my use of it. I am fairly disciplined when creating new features, all my changes will get committed to source control and when I am happy I will deploy these changes to the live system. But as soon as there is a bug, especially one where the client is chasing for a fix, I will deploy a fix as soon as humanly possible on to the live system.&lt;/p&gt;
&lt;p&gt;At first glance there is nothing wrong with what I have described but what happens the next time I deploy a new feature. Yes the bug the client was complaining about gets deployed with the new feature as the fix was never committed into source control. The client gets angry as the bug he was screaming about is back again.&lt;/p&gt;
&lt;p&gt;Every change you make to the system &lt;strong&gt;MUST&lt;/strong&gt; be committed to source control. If it isn’t that change will look like it never existed. I have worked with source control for over 5 years why do I keep making this rookie mistake over and over.&lt;/p&gt;
&lt;p&gt;Troy Hunt has a &lt;a href="https://www.troyhunt.com/10-commandments-of-good-source-control/" target="_blank" rel="noopener noreferrer"&gt;blog post&lt;/a&gt;
about the 10 commandments of using source control. His number two commandment is “If it’s not in source control, it doesn’t exist” He talks more about code you have written being not saved into source control, but the principal is the same for my example as his.&lt;/p&gt;
&lt;p&gt;There are ways to automatically deploy from source control, however most of the time you don’t want your live database being rebuilt because you fixed a typo. Additional steps will need to be implemented and there is still the chance that you might want to bypass these steps to fix the urgent problem. The only way past this problem is for you and everyone on your team to be disciplined and only ever commit to source control first, and only after that deploy live (either automatically or manually)&lt;/p&gt;</description></item><item><title>Azure Traffic Manager</title><link>https://blog-dev.funkysi1701.com/posts/2015/azure-traffic-manager/</link><author>funkysi1701@gmail.com (funkysi1701)</author><pubDate>Thu, 12 Mar 2015 20:00:45 +0000</pubDate><guid>https://blog-dev.funkysi1701.com/posts/2015/azure-traffic-manager/</guid><category term="Azure">Azure</category><category term="DevOps">DevOps</category><category term="ITAdmin">ITAdmin</category><description>&lt;p&gt;I have spent most of the day tweaking my Azure websites. Lots of fun!&lt;/p&gt;
&lt;p&gt;Last week unfortunately Azure had some problems and many websites that were running in the North Europe data centre were unavailable for several hours. And you guessed it my websites were hosted here.&lt;/p&gt;
&lt;p&gt;All hosting providers are going to have downtime from time to time and this is just something you have to take on the chin. The important thing to do in times like these is communicate with your customers about what is going on and that you are doing everything you can to restore service.&lt;/p&gt;
&lt;p&gt;However Azure has some amazing features that you can configure to help manage when downtime occurs.&lt;/p&gt;
&lt;p&gt;Azure is Microsoft’s global cloud platform. And it really is global, there are data centres in North Europe, West Europe, Brazil, Japan, two more in Asia and five in the US. In the event of problems it is highly unlikely that more than one of these would go down at once. If all of these are unavailable, I expect the planet earth is facing some kind of cataclysmic event and the fact that my website is down is not a priority.&lt;/p&gt;
&lt;p&gt;
&lt;img class="img-fluid" alt="Azure Traffic Manager" src="https://blog-dev.funkysi1701.com/images/2015/IC750592.jpg" loading="lazy"
width="856" height="449"
/&gt;
To take advantage of these multiple data centres, Azure has something called a Traffic Manager.&lt;/p&gt;
&lt;p&gt;Traffic Manager has various settings but I am using it in failover mode. This means that if one website goes down, the next one is used.&lt;/p&gt;
&lt;p&gt;All you need to do is create a traffic manager, add two or more websites to it (called endpoints) and choose a page that needs to be monitored so Azure knows which websites are up and which are down.&lt;/p&gt;
&lt;p&gt;If you are using SSL or custom domain names, there are a few extra steps you need to do. Your custom domain name needs pointing at the traffic manager, not the individual websites. The websites themselves have three domain names, the traffic manager address, the azure address and the custom domain name. The SSL certificate can then be assigned to each website that you have added to the traffic manager.&lt;/p&gt;
&lt;p&gt;That was easy wasn’t it, and now if a website goes down traffic manager will use the next one. While testing this, the transition to the next website was almost immediate. I did notice that if you had a browser showing the website open during a problem you sometimes got an error page, I think this was probably due to browser caching, reopening a tab or browser fixed this issue.&lt;/p&gt;</description></item><item><title>Tidying my desktop</title><link>https://blog-dev.funkysi1701.com/posts/2015/tidying-my-desktop/</link><author>funkysi1701@gmail.com (funkysi1701)</author><pubDate>Wed, 11 Mar 2015 20:00:45 +0000</pubDate><guid>https://blog-dev.funkysi1701.com/posts/2015/tidying-my-desktop/</guid><category term="PowerShell">PowerShell</category><category term="Desktop">Desktop</category><category term="ITAdmin">ITAdmin</category><description>&lt;p&gt;My desktop is always a mess. I constantly download files there and forget all about them.&lt;/p&gt;
&lt;p&gt;Every now and then I copy files into sub directories, so my desktop looks sane for a day or two before it gets out of control again.&lt;/p&gt;
&lt;p&gt;Why don’t I write a script that I can schedule to do this for me. Then my desktop will always be tidy.&lt;/p&gt;
&lt;p&gt;I have written a few simple batch scripts, but of course the best scripting language out there at the moment is PowerShell. Lets use that.&lt;/p&gt;
&lt;p&gt;Windows provides a nice little utility for writing scripts called the Windows PowerShell ISE, so let&amp;rsquo;s start by loading that up.&lt;/p&gt;
&lt;p&gt;PS has lots of help included to help you, just run &lt;strong&gt;Get-Help [name of ps command]&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;To move files you can use &lt;strong&gt;Move-Item&lt;/strong&gt; which works very similar to copy, specify source and destination. In my case I moved files based on their file extension.&lt;/p&gt;
&lt;p&gt;Move-Item *.pdf folder&lt;/p&gt;
&lt;p&gt;Now all I need to do is schedule this script to run either every day or so, or maybe every time I login or switch my computer on.&lt;/p&gt;
&lt;p&gt;PowerShell can do lots more interesting things which hopefully I will blog about soon.&lt;/p&gt;</description></item><item><title>Database Deployment</title><link>https://blog-dev.funkysi1701.com/posts/2015/database-deployment/</link><author>funkysi1701@gmail.com (funkysi1701)</author><pubDate>Thu, 05 Mar 2015 20:00:45 +0000</pubDate><guid>https://blog-dev.funkysi1701.com/posts/2015/database-deployment/</guid><category term="Deployment">Deployment</category><category term="Database">Database</category><category term="SQL">SQL</category><description>&lt;p&gt;One of my jobs is adding extra features to our internal databases. There is a fair amount of risk in doing this. I could make a change to one of the queries in the database that stops the rest of the company using it as they need to. This could be a costly mistake, almost as bad as the database server being inaccessible.&lt;/p&gt;
&lt;p&gt;One way to reduce this risk is to test, test and test the database. First I take a backup of the database and make my changes to that. I can do anything I like to my backup database without worrying that it will affect anyone else. Once I have finished making my changes and I have tested that everything is working exactly as I want, I need to apply my changes to the production database.&lt;/p&gt;
&lt;p&gt;Until recently I made a note of every change that I have made and then made the same change to the production database. But what if I forget to apply one of my changes to production, I have a broken database on my hands, disaster!&lt;/p&gt;
&lt;p&gt;But there is a better way to track database changes. SSDT or SQL Server Data Tools.&lt;/p&gt;
&lt;p&gt;Create a Database project with Visual Studio, you can then point this at your live database. This will scan the database and save scripts for all the Tables, Views, Stored Procedures, Triggers and any other object in the database. This doesn’t import the data, just the structures that contain the data. So no data protection issues or problems because your database is terabytes in size.&lt;/p&gt;
&lt;p&gt;Now comes the really cool part, Visual Studio allows you to build a copy of the database from these scripts. All you need to do is edit the scripts and test like you did before. Once you are happy with your changes and everything is working as you want, you can point your visual studio project back at your production database and it will magically deploy all your changes, or if you are as paranoid as me about breaking things, it will create a script that you can thoroughly analyse before running on your production database.&lt;/p&gt;
&lt;p&gt;I do not know why I never thought of setting this up until recently, it will reduce the number of times I roll out my changes but forget to setup permissions, (these can be scripted) or forget that tiny change I did weeks ago but never rolled out.&lt;/p&gt;
&lt;p&gt;And of course all the changes that you make can be saved in source control, so easy to see what changes have been made and by whom.&lt;/p&gt;
&lt;p&gt;This process even works with complicated database structures, in my case I needed to setup three database projects that depend on each other. Dependencies can be setup, and the test databases can even be built with different names for testing on the production server, (although I wouldn’t recommend it!)&lt;/p&gt;</description></item></channel></rss>