<?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-12 on Funky Si's Test</title><link>https://blog-test.funkysi1701.com/2017/12/</link><description>Recent content in 2017-12 on Funky Si's Test</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>Thu, 28 Dec 2017 20:00:45 +0000</lastBuildDate><atom:link href="https://blog-test.funkysi1701.com/2017/12/index.xml" rel="self" type="application/rss+xml"/><item><title>Looking back at 2017</title><link>https://blog-test.funkysi1701.com/posts/2017/looking-back-at-2017/</link><author>funkysi1701@gmail.com (funkysi1701)</author><pubDate>Thu, 28 Dec 2017 20:00:45 +0000</pubDate><guid>https://blog-test.funkysi1701.com/posts/2017/looking-back-at-2017/</guid><category term="StarTrek">StarTrek</category><category term="Goals">Goals</category><category term="Azure">Azure</category><category term="Baby">Baby</category><category term="C-Sharp">C-Sharp</category><description>&lt;p&gt;As 2017 starts to draw to a close let’s look at some of the highlights from the past year.&lt;/p&gt;
&lt;p&gt;
&lt;img class="img-fluid" alt="Edward" src="https://blog-test.funkysi1701.com/images/2017/DSC_0376-e1510563039193-225x300.jpg" loading="lazy"
width="225" height="300"
/&gt;
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Edward&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In November I became a father again and celebrated the arrival of Edward into the world. Before the birth I was worried how well my first son James would adapt to the new arrival but I am happy to say I didn’t need to, he mostly ignores the new arrival.&lt;/p&gt;
&lt;ol start="2"&gt;
&lt;li&gt;Star Trek&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In September the latest Star Trek TV series Discovery arrived on Netflix. I have been very positive so far about the show, I am still positive however there are things that annoy me about the new show, however I am keen to see the next episode each week so they are definitely doing something right.&lt;/p&gt;
&lt;ol start="3"&gt;
&lt;li&gt;Office move&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In May I helped my employer move to brand new &lt;a href="https://www.funkysi1701.com/posts/2017/office-move/" target="_blank" rel="noopener noreferrer"&gt;offices&lt;/a&gt;
. This was a lot of hard work, but everything went as planned and our new home is great.&lt;/p&gt;
&lt;ol start="4"&gt;
&lt;li&gt;Side projects
&lt;img class="img-fluid" alt="Google Play" src="https://blog-test.funkysi1701.com/images/2017/googleplay.jpg" loading="lazy"
width="512" height="512"
/&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I blogged in February about having a side project but it wasn’t until later in the year that this solidified into what I am working on now. It started as a way to understand &lt;a href="https://www.funkysi1701.com/posts/2017/interfaces/" target="_blank" rel="noopener noreferrer"&gt;interfaces&lt;/a&gt;
this then led to learning Xamarin and creating an android app to help promote this blog. Troy Hunt expanded his HIBP API to include passwords that have been in data breaches, I then started working on pwned passwords which is a simple android frontend for this.&lt;/p&gt;
&lt;ol start="5"&gt;
&lt;li&gt;Learning R&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In Feb I also experimented with a new programming language &lt;a href="https://www.funkysi1701.com/posts/2017/learning-r/" target="_blank" rel="noopener noreferrer"&gt;R&lt;/a&gt;
. It started with a problem about converting exchange rates and ended with a SQL stored procedure that executed some R code, I still want to learn lots more but it was a good example of the sorts of thing you can build with R.&lt;/p&gt;
&lt;ol start="6"&gt;
&lt;li&gt;DNS programmatically&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;One of my most successful blogs was about how you can create &lt;a href="https://www.funkysi1701.com/posts/2017/creating-dns-records-programmatically/" target="_blank" rel="noopener noreferrer"&gt;dns&lt;/a&gt;
records within your application eg sites that have yourname.domain in the url. It was a great chance to look at how dns works and learn more about what azure can do to manage this. I want to expand on this and build something.&lt;/p&gt;
&lt;p&gt;So that was 2017, for some ideas about what 2018 might have in store for me look out for my next blog post.&lt;/p&gt;</description></item><item><title>Getting started with Azure Tables</title><link>https://blog-test.funkysi1701.com/posts/2017/azure-table-storage/</link><author>funkysi1701@gmail.com (funkysi1701)</author><pubDate>Sun, 17 Dec 2017 20:00:45 +0000</pubDate><guid>https://blog-test.funkysi1701.com/posts/2017/azure-table-storage/</guid><category term="Azure">Azure</category><category term="SQL">SQL</category><category term="TableStorage">TableStorage</category><category term="Database">Database</category><description>&lt;p&gt;Azure Table storage is cheap way to store data, however it has some drawbacks that you should be aware of.&lt;/p&gt;
&lt;p&gt;Azure Table storage is a simple way to store NoSQL data with key/attribute pairs. I am very familiar with storing data in SQL databases and would still choose SQL over Table storage, however Table storage is significantly cheaper so could be worth investigating depending on your project.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.troyhunt.com/working-with-154-million-records-on/" target="_blank" rel="noopener noreferrer"&gt;Troy Hunt&lt;/a&gt;
makes use of Table storage for his Have I been pwned? website so there are projects out there that make use of it to great affect.&lt;/p&gt;
&lt;p&gt;To work with Table storage you need to use a nuget package &lt;strong&gt;WindowsAzure.Storage&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Install-Package WindowsAzure.Storage&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;To load data from a Table in Azure Table storage I use the following code&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;CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;CloudTable table = tableClient.GetTableReference(&lt;span style="color:#e6db74"&gt;&amp;#34;tablename&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;TableOperation retrieveOperation = TableOperation.Retrieve&amp;lt;Entity&amp;gt;(PartitionKey, Rowkey);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;table.CreateIfNotExists();
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;TableResult retrievedResult = table.Execute(retrieveOperation);
&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;Example eg = &lt;span style="color:#66d9ef"&gt;new&lt;/span&gt; Example();
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;if&lt;/span&gt; (retrievedResult.Result != &lt;span style="color:#66d9ef"&gt;null&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; eg.ID = ((Entity)retrievedResult.Result).Id;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; eg.Date = ((Entity)retrievedResult.Result).Date;
&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;return&lt;/span&gt; eg;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You need to create a class (called Entity in the example above) derived from TableEntity which defines the Partitionkey and Rowkey, plus and other columns you want to store in table storage. The row key and partition key uniquely identify the data in the table, think of this as the primary key of the table if you are used to SQL. This class must also contain a parameterless constructor.&lt;/p&gt;
&lt;p&gt;This is the only way to retrieve data, using the partitionkey and rowkey. If you want to retrieve a specific piece of data you would need to retrieve all rows and then search them for what you need. For me this is not a big problem as I only have 150 rows but if you have millions of rows you may need to think carefully how to use this.&lt;/p&gt;
&lt;p&gt;To save data I use a very similar piece of code&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;CloudStorageAccount storageAccount = CloudStorageAccount.Parse(path);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;CloudTable table = tableClient.GetTableReference(&lt;span style="color:#e6db74"&gt;&amp;#34;tablename&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Entity post = &lt;span style="color:#66d9ef"&gt;new&lt;/span&gt; Entity(ID, DateTime.Now);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;TableOperation insertOperation = TableOperation.InsertOrReplace(post);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;table.CreateIfNotExists();
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;table.Execute(insertOperation);
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I create a Entity object and then pass this as a parameter into the InsertOrReplace method.&lt;/p&gt;
&lt;p&gt;To delete data it is also very similar, you create an entity object and pass this as a parameter to the Delete method.&lt;/p&gt;
&lt;p&gt;When debugging my table storage code I found the &lt;a href="https://azure.microsoft.com/en-gb/features/storage-explorer/" target="_blank" rel="noopener noreferrer"&gt;Azure Storage Explorer&lt;/a&gt;
very useful for seeing what data actually existed in the table and what might be throwing an error, usually something wrong with my Entity.&lt;/p&gt;
&lt;p&gt;I mentioned earlier that Table Storage was cheaper than SQL Azure. Well for my simple playing about with things I have found my monthly charge of £10+ has been reduced to £1+ If I were to build anything that is more than just me learning about how it works I would probably continue to use SQL but for the cost of learning new tech it is well worth giving table storage a try.&lt;/p&gt;</description></item></channel></rss>