Skip to content
This repository has been archived by the owner on Aug 31, 2024. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinmoris committed Apr 12, 2021
2 parents 177cde8 + 62ac6b0 commit 279851e
Show file tree
Hide file tree
Showing 42 changed files with 474 additions and 488 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -337,4 +337,7 @@ ASALocalRun/

# DotEnv
.env
.env.ini
.env.ini

# VS Code
.devcontainer
1 change: 1 addition & 0 deletions src/DustedCodes/BlogPosts.fs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ module BlogPosts =
let private getAllBlogPostsFromDisk (blogPostsPath : string) =
blogPostsPath
|> Directory.GetFiles
|> Array.filter (fun f -> f.EndsWith ".md")
|> Array.map parseBlogPost
|> Array.fold (fun (blogPosts, errors) result ->
match result with
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

<p>Last week was my first time at the <a href="http://phpconference.co.uk/">PHP UK Conference</a> in London. As a .NET developer who is very new to the PHP community I didn't have any particular expectations, but I think this year was a great time to be there!</p>
<h2>The Venue</h2>
<img src="https://storage.googleapis.com/dusted-codes/images/blog-posts/2015-02-26/16626982306_ed7994ed96_o.jpg" alt="PHP UK Conference 2015 - The Venue, Image by Dustin Moris Gorski" class="half-width"><img src="https://storage.googleapis.com/dusted-codes/images/blog-posts/2015-02-26/16445626857_00f842eb7e_o.jpg" alt="PHP UK Conference 2015 - Open Bar, Image by Dustin Moris Gorski" class="half-width">
<img src="https://cdn.dusted.codes/images/blog-posts/2015-02-26/16626982306_ed7994ed96_o.jpg" alt="PHP UK Conference 2015 - The Venue, Image by Dustin Moris Gorski" class="half-width"><img src="https://cdn.dusted.codes/images/blog-posts/2015-02-26/16445626857_00f842eb7e_o.jpg" alt="PHP UK Conference 2015 - Open Bar, Image by Dustin Moris Gorski" class="half-width">
<p>The conference took place on Thursday and Friday (apparently for the first time, because in previous years it was Friday and Saturday) at <a href="http://www.thebrewery.co.uk/">The Brewery</a>, which is a great venue at a very central location in the city of London.</p>
<p>Also worth noting is that this year was the 10<sup>th</sup> anniversary of the event with a record high of more than 700 attendees coming from many different countries around the world. The hosting was excellent, food and drinks were available throughout the entire day and in the evenings they had many hundreds of free beer up for grab to celebrate this occasion.</p>
<p>As if this was not enough, the organisers even rented out the <a href="http://www.allstarlanes.co.uk/venues/brick-lane/karaoke/">All Star Lanes in Brick lane</a> to continue the celebration with some free bowling, free karaoke, more beer, more food and a cake on Thursday night.</p>
<p>I have to admit that due to a light cold I didn't make the most out of it, but I still had a fantastic time!</p>
<h2>The Tracks</h2>
<img src="https://storage.googleapis.com/dusted-codes/images/blog-posts/2015-02-26/16651908382_77919e91e6_o.jpg" alt="PHP UK Conference 2015 - Closing Keynote, Image by Dustin Moris Gorski" class="half-width"><img src="https://storage.googleapis.com/dusted-codes/images/blog-posts/2015-02-26/16651888422_9c337e1d3f_o.jpg" alt="PHP UK Conference 2015 - Opening Keynote, Image by Dustin Moris Gorski" class="half-width">
<img src="https://cdn.dusted.codes/images/blog-posts/2015-02-26/16651908382_77919e91e6_o.jpg" alt="PHP UK Conference 2015 - Closing Keynote, Image by Dustin Moris Gorski" class="half-width"><img src="https://cdn.dusted.codes/images/blog-posts/2015-02-26/16651888422_9c337e1d3f_o.jpg" alt="PHP UK Conference 2015 - Opening Keynote, Image by Dustin Moris Gorski" class="half-width">
<p>Both days started off with two great key notes. The first keynote was by <a href="https://twitter.com/coderabbi">coderabbi</a>, who walked us through some of his own experiences, spoke about code reviews and peer coding and eventually spread his wisdom over a packed room.</p>
<p>On Friday <a href="https://twitter.com/miss_jwo">Jenny Wong</a>, a developer and (according to her own words) a "community junkie" kicked off the second day with a very light hearted and extremely inspirational speech about bringing developer communities together.</p>
<h3>Integrating Communities</h3>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@
<pre><code>&lt;a class=&quot;fa-car&quot; href=&quot;#&quot;&gt;This is a link&lt;/a&gt;</code></pre>
<p>Result:<br /><a class="fa-car" href="#">This is a link</a></p>
<p>The icon isn't what we want, but at least the tag's original font remains as is. Using the Google Chrome developer tools I can quickly confirm that the icon-specific class is not doing any harm to the original tag:</p>
<img src="https://storage.googleapis.com/dusted-codes/images/blog-posts/2015-03-04/16710024065_9226643bf3_o.png" alt="CSS source code of the Font Awesome car icon, Image by Dustin Moris Gorski">
<img src="https://cdn.dusted.codes/images/blog-posts/2015-03-04/16710024065_9226643bf3_o.png" alt="CSS source code of the Font Awesome car icon, Image by Dustin Moris Gorski">
<p>Evidently this class only adds the content to the ::before attribute of the target element. The conclusion is that the actual styling gets applied via the &quot;fa&quot; class:</p>
<img src="https://storage.googleapis.com/dusted-codes/images/blog-posts/2015-03-04/16523945879_3588abcda2_o.png" alt="CSS source code of the Font Awesome fa class, Image by Dustin Moris Gorski">
<img src="https://cdn.dusted.codes/images/blog-posts/2015-03-04/16523945879_3588abcda2_o.png" alt="CSS source code of the Font Awesome fa class, Image by Dustin Moris Gorski">
<p>Now this makes sense. The content from the ::before attribute gets rendered inside the original tag and therefore also picks up the styling from the fa class.</p>
<p>Everything from the fa class could equally go into the icon class as part of the ::before attribute, but I can see why the Font Awesome team has extracted it into a shared class, because it is the same for every icon and would be otherwise a maintenance nightmare.</p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<p>ASP.NET itself is a larger framework to process incoming requests. Even though it could handle incoming requests from different sources, it is almost exclusively used with <abbr title="Internet Information Services">IIS</abbr>. It can be extended with <a href="https://msdn.microsoft.com/en-us/library/bb398986%28v=vs.140%29.aspx">HttpModules and HttpHandlers</a>.</p>
<p>HttpModules are plugged into the pipeline to process a request at any point of the <a href="https://msdn.microsoft.com/en-us/library/ms178473(v=vs.85).aspx">ASP.NET life cycle</a>. A HttpHandler is responsible for producing a response/output for a request.</p>
<p><a href="https://www.iis.net/">IIS</a> (Microsoft's web server technology) will create an incoming request for ASP.NET, which subsequently will start processing the request and eventually initialize the HttpApplication (which is the default handler) and create a response:</p>
<img src="https://storage.googleapis.com/dusted-codes/images/blog-posts/2015-04-06/16862010839_64d17c3268_o.gif" alt="IIS, ASP.NET and MVC architecture, Image by Dustin Moris Gorski">
<img src="https://cdn.dusted.codes/images/blog-posts/2015-04-06/16862010839_64d17c3268_o.gif" alt="IIS, ASP.NET and MVC architecture, Image by Dustin Moris Gorski">
<p>The key thing to know is that ASP.NET can only handle requests which IIS forwards to it. This is determined by the registered HttpHandlers (e.g. by default a request to a .htm file is not handled by ASP.NET).</p>
<p>And finally, MVC is only one of potentially many registered handlers in the ASP.NET pipeline.</p>
<p>This is crucial to understand the impact of different error handling methods.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,26 @@

<p>Last week I noticed a charge of ~ &pound;20 by MSFT AZURE on my bank statement and initially struggled to work out why I was charged this much.</p>
<p>I knew I'd have to pay something for this website, which is hosted on the shared tier in Microsoft Azure, but according to <a href="http://azure.microsoft.com/en-us/pricing/calculator/">Microsoft Azure's pricing calculator</a> it should have only come to &pound;5.91 per month:</p>
<img src="https://storage.googleapis.com/dusted-codes/images/blog-posts/2015-06-14/18821999662_b71b95637e_o.png" alt="Windows Azure Shared Pricing Tier, Image by Dustin Moris Gorski">
<img src="https://cdn.dusted.codes/images/blog-posts/2015-06-14/18821999662_b71b95637e_o.png" alt="Windows Azure Shared Pricing Tier, Image by Dustin Moris Gorski">

<p>After a little investigation I quickly found the issue, it was due to a few on and off test web apps which were running on the shared tier as well.</p>
<p>This was clearly a mistake, because I was confident that I created all my test apps on the free tier, but as it turned out, after I upgraded my production website to the shared tier all my other newly created apps were running on the shared tier as well.</p>

<p>I simply didn't pay close attention during the creation process:</p>
<img src="https://storage.googleapis.com/dusted-codes/images/blog-posts/2015-06-14/18829751471_b072e0ceaa_o.png" alt="Windows Azure Create new Web App, Image by Dustin Moris Gorski">
<img src="https://cdn.dusted.codes/images/blog-posts/2015-06-14/18829751471_b072e0ceaa_o.png" alt="Windows Azure Create new Web App, Image by Dustin Moris Gorski">

<p>Evidentially every new web app gets automatically assigned to my existing app service plan, which I upgraded to the shared tier.</p>
<p>Luckily I learned my lesson after the first bill. However my initial attempt to switch my test apps back to the free tier was not as simple as I thought it would be. I cannot scale one app individually without affecting all other apps on the same plan:</p>
<img src="https://storage.googleapis.com/dusted-codes/images/blog-posts/2015-06-14/18640926409_dbf2790205_o.png" alt="Windows Azure change pricing tier, Image by Dustin Moris Gorski">
<img src="https://cdn.dusted.codes/images/blog-posts/2015-06-14/18640926409_dbf2790205_o.png" alt="Windows Azure change pricing tier, Image by Dustin Moris Gorski">

<p>The solution is to create a new app service plan and assign it to the free tier.</p>

<p>You can do this either when creating a new web app, by picking "Create new App Service plan" from the drop down:</p>
<img src="https://storage.googleapis.com/dusted-codes/images/blog-posts/2015-06-14/18204493134_e04eba21dd_o.png" alt="Windows Azure Create new App Service plan, Image by Dustin Moris Gorski">
<img src="https://cdn.dusted.codes/images/blog-posts/2015-06-14/18204493134_e04eba21dd_o.png" alt="Windows Azure Create new App Service plan, Image by Dustin Moris Gorski">

<p>Or when navigating to the new Portal, where you have the possibility to manage your app service plans:</p>
<img src="https://storage.googleapis.com/dusted-codes/images/blog-posts/2015-06-14/18821999642_d779125c72_o.png" class="half-width" alt="Windows Azure switch to Azure Preview Portal, Image by Dustin Moris Gorski">
<img src="https://storage.googleapis.com/dusted-codes/images/blog-posts/2015-06-14/18640926369_1f679d0f4f_o.png" class="half-width" alt="Windows Azure New Portal App Service Plans Menu, Image by Dustin Moris Gorski">
<img src="https://cdn.dusted.codes/images/blog-posts/2015-06-14/18821999642_d779125c72_o.png" class="half-width" alt="Windows Azure switch to Azure Preview Portal, Image by Dustin Moris Gorski">
<img src="https://cdn.dusted.codes/images/blog-posts/2015-06-14/18640926369_1f679d0f4f_o.png" class="half-width" alt="Windows Azure New Portal App Service Plans Menu, Image by Dustin Moris Gorski">

<p>This wasn't difficult at all, but certainly a mistake which can easily happen to anyone who is new to Microsoft Azure.</p>
<p>Another very useful thing to know is that if you choose the same data centre location for all your app service plans, then you can easily move a web app from one plan to another. This could be very handy when having different test and/or production stages (Dev/Staging/Production).</p>
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<h4>Alice, Bob and Eve</h4>
<p>Alice and Bob want to communicate privately and Eve wants to eavesdrop. Both, Alice and Bob have their individual public and private key pair.</p>
<p>Alice uses Bob's public key to encrypt a private message before sending it to Bob. Bob can use his private key to decrypt the message. Now Bob can use Alice's public key to reply to Alice without Eve being able to understand any of the transmitted data. Finally Alice decrypts Bob's message with her own private key.</p>
<img src="https://storage.googleapis.com/dusted-codes/images/blog-posts/2015-06-28/18626777534_fc5524c031_o.gif" alt="Public Key Encryption, Image by Dustin Moris Gorski">
<img src="https://cdn.dusted.codes/images/blog-posts/2015-06-28/18626777534_fc5524c031_o.gif" alt="Public Key Encryption, Image by Dustin Moris Gorski">
<p>The public key is available to everyone, while the private key is only known to the key holder. There is never the requirement to share a secret key via an insecure channel.</p>

<h4>Integrity and Authenticity</h4>
Expand All @@ -54,13 +54,13 @@
<h4>A simple example of a one-way function</h4>
<p>Let's say the initial value is 264. The one-way function reads as following:</p>
<p><em>You start from the centre of a map. Now take your value and divide it by it's last digit. The result is a new value x. Now draw a line x centimetres north east and mark a new point on the map. Next take your original value and subtract it by x. The result is y. Draw another line, starting from the last point, y centimetres south west. The final point is the end result.</em></p>
<img src="https://storage.googleapis.com/dusted-codes/images/blog-posts/2015-06-28/19247927141_e7b4b378a8_o.gif" alt="Example of a one way function, Image by Dustin Moris Gorski">
<img src="https://cdn.dusted.codes/images/blog-posts/2015-06-28/19247927141_e7b4b378a8_o.gif" alt="Example of a one way function, Image by Dustin Moris Gorski">
<p>In this example we would divide 264 by 4 and retrieve 66 for x. Additionally we subtract 66 from 264 and retrieve y = 198. We draw both lines and determine the final point on the map, which represents the end result of the one-way function.</p>
<p>Now just from knowing the final point on the map and the definition of the function it is not possible to easily deduce the original value.</p>

<h3>Modular arithmetic</h3>
<p>Modular arithmetic is full of one-way functions. It is also known as clock arithmetic, because it can be illustrated by a finite amount of numbers arranged in a loop, like on a clock:</p>
<img src="https://storage.googleapis.com/dusted-codes/images/blog-posts/2015-06-28/19051127700_2dd7074ef4_o.gif" alt="Clock Arithmetic, Image by Dustin Moris Gorski">
<img src="https://cdn.dusted.codes/images/blog-posts/2015-06-28/19051127700_2dd7074ef4_o.gif" alt="Clock Arithmetic, Image by Dustin Moris Gorski">
<p>The dark circle represents the clock. The blue numbers represent the value 17. If you arrange all numbers from 1 to 17 clockwise in a loop, then the end value results in 5. In other words 17 mod 12 equals 5.</p>
<p>The short-cut and common way of calculating the modulus is by dividing the original value by x. The reminder equals the modulus.</p>
<p>The modulus operation is a great one-way function, because it is fairly simple and has an infinite amount of possible values giving the same result.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<li><code>public virtual byte[] Decrypt(byte[] data, RSAEncryptionPadding padding)</code></li>
</ul>
<p>Interestingly they are not mentioned in <a href="https://msdn.microsoft.com/en-us/library/system.security.cryptography.rsa(v=vs.100).aspx">the official MSDN documentation</a> on the web, however when I decompile .NET 4.0's mscorlib I can see the two virtual methods:</p>
<img src="https://storage.googleapis.com/dusted-codes/images/blog-posts/2015-08-13/20377339999_8cd6511ee9_o.png" alt="Encrypt and Decrypt methods in .NET C# RSA Class, Image by Dustin Moris Gorski">
<img src="https://cdn.dusted.codes/images/blog-posts/2015-08-13/20377339999_8cd6511ee9_o.png" alt="Encrypt and Decrypt methods in .NET C# RSA Class, Image by Dustin Moris Gorski">

<p>This was a great addition for two reasons in particular:</p>
<ol>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<p>Recently I upgraded my IDE to Visual Studio 2015 and made instant use of many new C# 6 features like the <a href="https://msdn.microsoft.com/en-us/library/dn986596.aspx">nameof keyword</a> or <a href="https://msdn.microsoft.com/en-us/library/dn961160.aspx">interpolated strings</a>.
</p>
<p>It worked (and compiled) perfectly fine until I started using C# 6 features in ASP.NET MVC 5 razor views:</p>
<img src="https://storage.googleapis.com/dusted-codes/images/blog-posts/2015-08-21/20768813781_9d305e366b_o.png" alt="Feature not available in C# 5 message, Image by Dustin Moris Gorski">
<img src="https://cdn.dusted.codes/images/blog-posts/2015-08-21/20768813781_9d305e366b_o.png" alt="Feature not available in C# 5 message, Image by Dustin Moris Gorski">

<blockquote>
<p>Feature 'interpolated strings' is not available in C# 5. Please use language version 6 or greater.</p>
Expand All @@ -21,7 +21,7 @@

<p>However, saying that I don't get any errors at compilation time even though I made a lot of use of C# 6 features all over my project.</p>
<p>Maybe it is an intellisense bug in Visual Studio 2015? Not really, because when I start my project I get a yellow screen of death which matches the intellisense error:</p>
<img src="https://storage.googleapis.com/dusted-codes/images/blog-posts/2015-08-21/20575504479_95b11bae10_o.png" alt="Interpolated String Runtime Error in ASP.NET MVC 5, Image by Dustin Moris Gorski">
<img src="https://cdn.dusted.codes/images/blog-posts/2015-08-21/20575504479_95b11bae10_o.png" alt="Interpolated String Runtime Error in ASP.NET MVC 5, Image by Dustin Moris Gorski">

<h3>ASP.NET Runtime compiler</h3>
<p>The problem is at runtime when ASP.NET tries to compile the razor view. ASP.NET MVC 5 uses the <a href="https://msdn.microsoft.com/en-us/library/system.codedom.compiler.codedomprovider(v=vs.110).aspx">CodeDOM Provider</a> which doesn't support C# 6 language features.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
<p>If you ever browsed a popular GitHub repository (like <a href="https://github.com/nunit/nunit">NUnit</a> or <a href="https://github.com/twbs/bootstrap">Bootstrap</a>) then you must have seen many of the available SVG badges which can be used to decorate a repository's README file.
</p>
<p>While some repositories keep it very simple:</p>
<img src="https://storage.googleapis.com/dusted-codes/images/blog-posts/2015-08-30/20384154514_4e48fdc582_o.png" alt="NUnit Project Badges, Image by Dustin Moris Gorski">
<img src="https://cdn.dusted.codes/images/blog-posts/2015-08-30/20384154514_4e48fdc582_o.png" alt="NUnit Project Badges, Image by Dustin Moris Gorski">

<p>Others can be quite fancy:</p>
<img src="https://storage.googleapis.com/dusted-codes/images/blog-posts/2015-08-30/20996898652_6205e41d46_o.png" alt="Bootstrap Project Badges, Image by Dustin Moris Gorski">
<img src="https://cdn.dusted.codes/images/blog-posts/2015-08-30/20996898652_6205e41d46_o.png" alt="Bootstrap Project Badges, Image by Dustin Moris Gorski">

<p>These little widgets (or often called badges) are more of a gimmick rather than anything useful, but we love them because they give us an opportunity to visually highlight statistics or achievements which we are proud of.</p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

<p>What was happening is that a user story got divided into several work tasks and each task was worked on by a different person in the team. It felt a lot like a production line:</p>

<img src="https://storage.googleapis.com/dusted-codes/images/blog-posts/2015-09-28/21794643692_d42d0f0d78_o.png" alt="Scrum User Story Production Line, Image by Dustin Moris Gorski">
<img src="https://cdn.dusted.codes/images/blog-posts/2015-09-28/21794643692_d42d0f0d78_o.png" alt="Scrum User Story Production Line, Image by Dustin Moris Gorski">

<p>While it was possible to do some parallel work on the development and QA task at the same time, it was not possible to close one before the other. We had inter team dependencies.</p>

Expand Down
Loading

0 comments on commit 279851e

Please sign in to comment.