New Octopus Deploy Step

My new pull request was recently merged to the Octopus Deploy Library.

Content Delivery Network (CDN) cache needs to be refreshed after deploying a Web UI project. I developed a custom step which runs a PowerShell script on Octopus, a well-known deployment tool in .NET eco-system, to trigger purge method of the CDN server which is Medianova CDN and added it to community step library.

Now, you can see the details of Medianova - Purge Step on Octopus Deploy Library and install it from the community step templates page of the Octopus dashboard.

MedianovaStepTemplate

PS: We should add the version parameter to the static files. This process will not renew the browser cache.


Tinycards

Tinycards is a new mobile application from the creators of Duolingo which is led by Luis von Ahn

The app helps to memorize anything with its simple UX. It has the same simplicty while creating a deck of flashcards. We have published some decks as A Clockwork Engineer which you can find on https://tiny.cards/users/olcaybayram. First, you should download the app to commence and it is free but it is only for iOS right now.

Decks;

  • HTTP Verbs & Status Codes
  • Git Commands


Run ASP.NET Core Websites with Command Line Arguments

The DLL file that contains ASP.NET Core application can run on KestrelHttpServer without the need to IIS. When you run it with dotnet cli, it works like a console application.

So we want to deploy it to Heroku cloud platform to see its cross-platform capabilites.

Heroku app engine runs the dotnet cli with the parameters below.

cd /app/heroku_output && dotnet ./Libton.dll --server.urls http://+:54372

The server.urls parameter sets the port variable which can be different everytime. The default value is 5000 in ASP.NET Core and our application doesn’t have the capability to read the command line arguments so it won’t set and listen the specified port.

In order to give this capability to our application, we could add the reference of Microsoft.Extensions.Configuration.CommandLine via NuGet Package Manager.

Now, we could convert the command line arguments to configuration settings and use them on the web host builder on Main method of the Program class.

Finally, the Program.cs file will look like this;


Attributes and Annotations of Testing Frameworks

It is called attributes in the .NET environment and annotations in Java. We use them to declare information about methods, types, properties and so on.

We will discuss about frequently used ones to run test scenarious properly. You would find comparisons of NUnit, MSTest, xUnit.net and JUnit testing frameworks down below.

You could find very comprehensive tutorials on Guru99 website.

NUnit MSTest xUnit.net JUnit Description
[TestFixture] [TestClass] - - Indicates that the class has test methods.
[Test] [TestMethod] [Fact] @Test Marks a test case.
[OneTimeSetUp] [ClassInitialize] IClassFixture @BeforeClass The one time triggered method before test cases start.
[OneTimeTearDown] [ClassCleanup] IClassFixture @AfterClass The one time triggered method after test cases end.
[SetUp] [TestInitialize] Constructor @Before Triggered before every test case.
[TearDown] [TestCleanup] IDisposable.Dispose @After Triggered after every test case.
[Ignore] [Ignore] [Fact(Skip=”reason”)] @Ignore Ignores the test case.
[Category(“”)] [TestCategory(“”)] [Trait(“Category”, “”)] @Category(*.class) Categorizes the test cases or classes.


Copy Database with Backup on SQL Management Studio

We can get a copy of any database with Backup and Restore commands in SQL Server Management Studio but there are a few tricks which makes our life easier.

First of all, it must be a full backup because a differential backup would be useless.

We can not restore a database to another one. If you just want to change the name of the database, you can easily give a new name at the restore process.