<?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>2017-10 on Funky Si's Blog (Dev)</title><link>https://blog-dev.funkysi1701.com/2017/10/</link><description>Recent content in 2017-10 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>Tue, 31 Oct 2017 20:00:45 +0000</lastBuildDate><atom:link href="https://blog-dev.funkysi1701.com/2017/10/index.xml" rel="self" type="application/rss+xml"/><item><title>Interfaces are cool!</title><link>https://blog-dev.funkysi1701.com/posts/2017/interfaces-are-cool/</link><author>funkysi1701@gmail.com (funkysi1701)</author><pubDate>Tue, 31 Oct 2017 20:00:45 +0000</pubDate><guid>https://blog-dev.funkysi1701.com/posts/2017/interfaces-are-cool/</guid><category term="BadDesign">BadDesign</category><category term="Interface">Interface</category><description>&lt;p&gt;A while back I &lt;a href="https://www.funkysi1701.com/posts/2017/interfaces/" target="_blank" rel="noopener noreferrer"&gt;blogged&lt;/a&gt;
about learning about interfaces as I didn’t really understand the value of them. I do now.&lt;/p&gt;
&lt;p&gt;I created an application that used interfaces so I could learn how it worked. I created a Logger Interface and created multiple classes that implemented that interface so I could swap out the different implementations easily. I created a SQL Logger and a File Logger and my code could be written and be completely unaware of which implementation it was using.&lt;/p&gt;
&lt;p&gt;This application uses SQL Azure and so I have a monthly bill to pay. Wouldn’t it be cool if I could reduce this bill? How about using the cheaper table storage instead?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Easy!&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Create a new class that implements my interface and all I need to do is write the three methods defined in my interface and I can swap from SQL Azure to table storage.&lt;/p&gt;
&lt;p&gt;Another benefit to interfaces is testing. Say I have an interface called inotification for sending notifications, I can have several implementations of this email, twitter, slack etc&lt;/p&gt;
&lt;p&gt;None of these implementations should be used in unit tests, as you don’t want a tweet being sent every time you run your tests. Why not create an implementation that simply returns something for each method call and doesn’t actually do anything. I can then run my tests with my fake implementation which tests my code logic but not the implementation I have chosen (this can be tested later on with integration tests or user testing if required).&lt;/p&gt;
&lt;p&gt;This is pretty much all I have to say about interfaces. I just like how I can swap different implementations.&lt;/p&gt;
&lt;p&gt;It does take a bit of work to get the interface setup. I found that when writing the second implementation the interface would need to change slightly, mostly as it was badly designed to begin with. I think for beginners there may be some value to writing multiple implementations of an interface so you can be sure your interface is good, however I am sure with experience this will not be required.&lt;/p&gt;</description></item><item><title>Create DNS records programmatically</title><link>https://blog-dev.funkysi1701.com/posts/2017/creating-dns-records-programmatically/</link><author>funkysi1701@gmail.com (funkysi1701)</author><pubDate>Mon, 16 Oct 2017 20:00:45 +0000</pubDate><guid>https://blog-dev.funkysi1701.com/posts/2017/creating-dns-records-programmatically/</guid><category term="Azure">Azure</category><category term="DNS">DNS</category><description>&lt;p&gt;DNS is the backbone of the internet. It converts domain names into IP addresses. But how can we do clever things with it?&lt;/p&gt;
&lt;p&gt;Making DNS changes has always been a pain. You have to remember what company you registered your domain name with, then locate the login details for their website, login and fill in some web form and wait for the changes to replicate across the internet.&lt;/p&gt;
&lt;p&gt;There are various websites that assign you a custom subdomain name like name.domain.com, obviously they must do this programmatically, they don’t have a guy following the above process.&lt;/p&gt;
&lt;p&gt;Lets see how we could do this.&lt;/p&gt;
&lt;p&gt;My first thought was to make use of the DNSimple API. &lt;a href="https://developer.dnsimple.com/v2/" target="_blank" rel="noopener noreferrer"&gt;https://developer.dnsimple.com/v2/&lt;/a&gt;
The API allows all sort of DNS changes to be made, however this is a paid service so let’s look at other options.&lt;/p&gt;
&lt;p&gt;Azure now has a DNS section. You can go to the portal, add a DNS zone, and then add as many A, CNAME and MX records as you need. This is of course no better than doing it manually.&lt;/p&gt;
&lt;p&gt;Azure offers a &lt;a href="https://learn.microsoft.com/en-us/azure/dns/dns-sdk" target="_blank" rel="noopener noreferrer"&gt;SDK&lt;/a&gt;
and an example Visual Studio project. Let&amp;rsquo;s look at how it works.&lt;/p&gt;
&lt;p&gt;First you need to setup some credentials to use your Azure subscription. The easiest way to do this is with powershell.&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-powershell" data-lang="powershell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Login&lt;span style="color:#960050;background-color:#1e0010"&gt;–&lt;/span&gt;AzureRmAccount
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$sp = New-AzureRmADServicePrincipal &lt;span style="color:#960050;background-color:#1e0010"&gt;–&lt;/span&gt;DisplayName exampleapp &lt;span style="color:#960050;background-color:#1e0010"&gt;–&lt;/span&gt;Password &lt;span style="color:#e6db74"&gt;&amp;#34;{provide-password}&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Sleep &lt;span style="color:#ae81ff"&gt;20&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;New-AzureRmRoleAssignment &lt;span style="color:#960050;background-color:#1e0010"&gt;–&lt;/span&gt;RoleDefinitionName Contributor &lt;span style="color:#960050;background-color:#1e0010"&gt;–&lt;/span&gt;ServicePrincipalName $sp.ApplicationId
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This will create a AD Service Principal which has access to your Azure subscription.&lt;/p&gt;
&lt;p&gt;You need to get the following IDs from the Azure portal.&lt;/p&gt;
&lt;p&gt;subscriptionId for your subscription&lt;br&gt;
tenantId or the Azure AD Directory ID&lt;br&gt;
applicationId of the service principal created above&lt;br&gt;
password you entered into the powershell script above&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-csharp" data-lang="csharp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;var&lt;/span&gt; serviceCreds = &lt;span style="color:#66d9ef"&gt;await&lt;/span&gt; ApplicationTokenProvider.LoginSilentAsync(tenantId, clientId, secret);
&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; dnsClient = &lt;span style="color:#66d9ef"&gt;new&lt;/span&gt; DnsManagementClient(serviceCreds);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;dnsClient.SubscriptionId = subscriptionId;
&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;&lt;span style="color:#66d9ef"&gt;var&lt;/span&gt; recordSetParams = &lt;span style="color:#66d9ef"&gt;new&lt;/span&gt; RecordSet();
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;recordSetParams.TTL = &lt;span style="color:#ae81ff"&gt;3600&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;recordSetParams.ARecords = &lt;span style="color:#66d9ef"&gt;new&lt;/span&gt; List&amp;lt;ARecord&amp;gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;recordSetParams.ARecords.Add(&lt;span style="color:#66d9ef"&gt;new&lt;/span&gt; ARecord(&lt;span style="color:#e6db74"&gt;&amp;#34;1.2.3.4&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; recordSet = &lt;span style="color:#66d9ef"&gt;await&lt;/span&gt; dnsClient.RecordSets.CreateOrUpdateAsync(resourceGroupName, &lt;span style="color:#e6db74"&gt;&amp;#34;funkysi1701.com&amp;#34;&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#34;test&amp;#34;&lt;/span&gt;, RecordType.A, recordSetParams);
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The above code connects to Azure and creates an A record for test.funkysi1701.com that points at the ip address 1.2.3.4.&lt;/p&gt;
&lt;p&gt;Other DNS records can be created in a similar way.&lt;/p&gt;
&lt;p&gt;The above example creates a new RecordSet but you can use the following to delete or get existing records.&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-csharp" data-lang="csharp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;var&lt;/span&gt; recordSet = dnsClient.RecordSets.Get(resourceGroupName, &lt;span style="color:#e6db74"&gt;&amp;#34;funkysi1701.com&amp;#34;&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#34;test&amp;#34;&lt;/span&gt;, RecordType.A);
&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;dnsClient.RecordSets.Delete(resourceGroupName, &lt;span style="color:#e6db74"&gt;&amp;#34;funkysi1701.com&amp;#34;&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#34;test&amp;#34;&lt;/span&gt;, RecordType.A);
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now I have found out that I can write a console app to edit my DNS records I need to change the nameservers for all my domains so I can take advantage of this new feature.&lt;/p&gt;</description></item><item><title>Discovery – My thoughts so far</title><link>https://blog-dev.funkysi1701.com/posts/2017/discovery-my-thoughts-so-far/</link><author>funkysi1701@gmail.com (funkysi1701)</author><pubDate>Tue, 10 Oct 2017 20:00:45 +0000</pubDate><guid>https://blog-dev.funkysi1701.com/posts/2017/discovery-my-thoughts-so-far/</guid><category term="StarTrek">StarTrek</category><category term="Discovery">Discovery</category><media:content medium="image" type="image/jpeg" url="https://blog-dev.funkysi1701.com/images/2017/DAD0hTKUAAAUkTP.jpg"/><description>&lt;p&gt;I tried to resist but I am going to have to write about the new Star Trek series Discovery. Warning this post is going to include SPOILERS. If you read on you have been warned.&lt;/p&gt;
&lt;p&gt;I watched the first two episodes of the brand new Star Trek TV show. As I am an international viewer I used Netflix, if you are from the US you need to use CBS All Access.
&lt;img class="img-fluid" alt="Promotional image from Star Trek Discovery" src="https://blog-dev.funkysi1701.com/images/2017/DAD0hTKUAAAUkTP.jpg" loading="lazy"
width="1199" height="663"
/&gt;
&lt;/p&gt;
&lt;p&gt;I have heard a lot of complaining that the show is not free to watch. CBS is making Star Trek Discovery to make money, if they don’t make money they will stop making it. Its as simple as that.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.netflix.com" target="_blank" rel="noopener noreferrer"&gt;Netflix&lt;/a&gt;
costs £5.99 per month and &lt;a href="https://www.paramountplus.com/home/" target="_blank" rel="noopener noreferrer"&gt;CBS All Access&lt;/a&gt;
costs $5.99 per month. I don’t believe this is a lot of money. The 5.99 above allows you to watch any of the 726 Star Trek episodes at any time of day whenever you want as many times as you want, plus you have access to all the other movies or TV shows available. I don’t think this is too much to ask.&lt;/p&gt;
&lt;p&gt;Back to Discovery. I loved it! It felt like Star Trek. I had feared it might only share the name and would be an action filled TV show that had little in common with what he had seen before. I was wrong this is definitely a show that can proudly call itself Star Trek.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The Klingons&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;When it was first announced that the Klingons would feature in the new show I was a bit “meh”. We had done lots with the Klingons before and they had never been my favourite alien race.
&lt;img class="img-fluid" alt="Redesigned Klingons from Star Trek Discovery" src="https://blog-dev.funkysi1701.com/images/2017/star-trek-discovery-klingons-1002567-1280x0.jpg" loading="lazy"
width="1280" height="704"
/&gt;
&lt;/p&gt;
&lt;p&gt;The look of the Klingons was also going to be changed, I have to admit this didn’t bother me. Klingons have had their look updated before. In 1966 Klingons had dark faces and smooth foreheads, in 1979 the forehead ridges were added as the first Star Trek movie was made, and now Discovery has removed all hair from Klingons. I can explain it away as productional changes, I don’t need an on screen explanation like we had on Enterprise (or even DS9).&lt;/p&gt;
&lt;p&gt;What I have seen so far is a menacing alien race that fits with what we have seen before with lots of references to honor, Kahless and speaking Klingon. I must admit reading all the subtitles is getting a bit tiresome, but that is a minor issue.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Conflict&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Historically Star Trek has not featured conflict between the main starfleet characters due to the idea that humanity has evolved beyond this. DS9 got round this by having Odo and Kira who are not starfleet characters so can have a little bit of conflict. Discovery has completely abandoned this idea.&lt;/p&gt;
&lt;p&gt;In the pilot episode, the Michael Burnham commits mutiny on her captain, even attacking her with a vulcan nerve pinch. In the third episode we finally meet the discovery crew. Gone are the TNG days where the ships crew are like a family, I am not sure I can think of a single character that would call another character “friend”. We are in a time of war so this would be expected, however I do hope we see deepening friendships form between characters.&lt;/p&gt;
&lt;p&gt;I am OK with the change to feature more conflict. I must admit the darkness of the third episode, did stop to make me think a bit, however by the fourth episode I was won over.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Cast&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The story is concentrated around Michael Burnham, so I do worry that other characters won’t get a look in. However from what I have seen Michael Burnham is a great character. She is a strong female character, with a intriguing back story relating to Sarek and possibly also Spock.&lt;/p&gt;
&lt;p&gt;Saru the alien character on the show, played by the very tall Doug Jones is great. From the trailers he was all about sensing death, but there is far more to him than that. I am looking forward to learn more about him and his threat ganglia.&lt;/p&gt;
&lt;p&gt;As the show has gone on we have started to learn about the other characters like Captain Lorca, Tilly and Paul Stamets.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Title Sequence&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I don’t like the opening title sequence, it feels very cheap like a draft version which hasn’t been finished yet. I was looking forward to a title sequence that would show off the USS Discovery, maybe like TNG where it warps around our own solar system. What we see is some of the tech that features in Star Trek which is nice but I want more. The theme tune while great that it features parts from the classic theme doesn’t stand on its own. I can hum all the other TV shows themes, and now after 4 episodes would struggle to do that.&lt;/p&gt;
&lt;p&gt;However I expect that after a while I will grow to like this more.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Overall&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I like Discovery and I will keep watching it. I want to find out what happens to the characters. There are no annoying characters like other shows have had. There is character development, none of the characters are going to finish where they started. I want more friendship between characters, but I expect that will come, I want more exploring and doing Star Trek stuff, but most of all I want more episodes, roll on next weeks show.&lt;/p&gt;
&lt;p&gt;Other things I noticed&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Sound effects on the bridge are awesome, it makes me feel at home&lt;/li&gt;
&lt;li&gt;The USS Discovery doesn’t feature in the first two episodes despite being the title of the show.&lt;/li&gt;
&lt;li&gt;Others have noted that Captain Georgiou has books on her shelf which feature classic episode titles&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Did you know you can track episodes from Star Trek Discovery in &lt;a href="https://www.episodeatlas.com/" target="_blank" rel="noopener noreferrer"&gt;Episode Atlas&lt;/a&gt;
.&lt;/p&gt;</description></item></channel></rss>