A Clockwork Engineer

Fetch Azure Function Settings for Local Development

Fetch Azure Function Settings for Local Development

To run Azure Functions locally on your development machine, you need to use a local development environment such as Visual Studio Code or the Azure Functions Core Tools. This local development environment allows you to simulate the Azure Functions runtime on your machine.

The local.settings.json file is used to store configuration settings for your Azure Functions when running locally. These settings include things like connection strings, app settings, and other configuration values that are used by your function code.

When you create an Azure Function project in Visual Studio Code or with the Azure Functions Core Tools, a default local.settings.json file is created for you. You can edit this file to add or modify configuration settings as needed.

Race Condition

Race Condition

A Race Condition can be metaphorically compared to a scenario where two people are trying to use the same bathroom at the same time. Imagine two roommates who need to get ready for work in the morning and share one bathroom. If both roommates try to enter the bathroom at the same time, a race condition occurs, and it’s unclear who will finish first.

Similarly, in programming, a race condition occurs when two or more processes or threads try to access the same shared resource, such as a variable or a file, at the same time. Just like the roommates, the processes or threads are in a race to finish their task, and if they don’t coordinate properly, they may end up interfering with each other’s progress or producing unexpected results.

The Star Wars API

The Star Wars API

Paul Hallett developed a web api called SWAPI which consists of the data from the universe of Star Wars.

You can find all the planets, spaceships, vehicles, characters from the six original movies. This is a nice dataset to practice coding or for an assessment. I wrote an api client SharpTrooper with C# to support this project in 2015. You know Storm Troopers are famous with their lack of targeting skills.

Automate Microsoft Login

Selenium Webdriver With Javascript

If you have a protected website by Azure Active Directory, you need to pass Microsoft login first to run your functional UI tests.

I used both id and name locators for the elements and they have some weird naming. I am not sure but maybe the purpose is to prevent any bot attacks. We need to use driver.wait() method of the webdriver to wait until the element is found but with a timeout limit in milliseconds.

It is not a good practice to have animations on web but Microsoft Online login has some sliding animations. This causes another bad practice like sleeping the driver for the animation to be completed. Please, keep in mind never let the driver sleep(), but let her wait(). We do not have anything to wait for at this step, so I used driver.sleep() for 1 second. It is not preferred because it will add that duration to your test run no matter what.

module.exports = {

    elements: {
        usernameInput: by.id('i0116'),
        passwordInput: by.name('passwd'),
        submitButton: by.id('idSIButton9')

     * Sign in to Azure AD with the given credentials
     * @param {string} username
     * @param {string} password
    signin: function (username, password) {
        var locateTimeout = 1000; //in milliseconds

        var usernameElement = driver.wait(until.elementLocated(elements.usernameInput), locateTimeout);

        var passwordElement = driver.wait(until.elementLocated(elements.passwordInput), locateTimeout);

        driver.sleep(1000); //bad bad bad

        var submitButtonElement = driver.wait(until.elementLocated(elements.submitButton), locateTimeout);

        var staySignedInButtonElement = driver.wait(until.elementLocated(elements.submitButton), locateTimeout);

A personal summary of 2020

A personal summary of 2020

We experienced a year like never before. I tried to do what I could and stayed at home as much as possible while keeping my health and sanity well. I focused on self development and sharing the knowledge with others. Thanks to all healthcare and essential workers, they made it possible to do the stuff in the list below;

  • Finished an awesome course Harvard Introduction to Computer Science. It was mostly back to basics for me but a lot of fun and a few nice little details in programming. There are some updates in the course so I think I will do it again.

  • Wrote 6 new blog posts as you can see below. It is not much but still better than previous years.

  • Organized an online meetup Hacktoberfest Istanbul. I always wanted to do it but I was far from the community. I did not miss the chance to make it online.

Follow A Link To A New Tab

Selenium Webdriver With Javascript

This will tell about my age but back then we did not have tabs on an internet browser. We only had windows. When you click a link on a webpage with the target attribute set as _blank, it was openning a new window. Now, it opens a new tab. Even folders on a file explorer were openning a new window on Windows 95.

Moving formard, we had a test scenario to check contents of a webpage that opens on a new tab. We had to follow a link from our parent website, to the target but Selenium Webdriver was not doing it by default. So the code below helped us to track new tabs on the browser. If there is a new tab, just switch the driver to continue on that one.

//Get all the tab handles first
var windowHandles = await driver.getAllWindowHandles()

//Click that anchor with target=_blank
await driver.findElement(By.id('externalLink')).click()

//Never ever let the driver sleep, because they may crash
//But there is not any change on the parent page to wait for
await driver.sleep(20000) //in milliseconds

//Keep the previous handles
const handlesThen = windowHandles

//Get the current handles
const handlesNow = await driver.getAllWindowHandles()

//If there are new handles in our list, that must be our target
var newWindow
if (handlesNow.length > handlesThen.length) {
    newWindow = handlesNow.find(handle => (!handlesThen.includes(handle)))

//Switch the driver, the previous one was already sleepy
await driver.switchTo().window(newWindow)



Yet another request bin

Yet another request bin but made with Blazor this time. When you build serverless apps or functions, your system depends on webhooks a lot. There are request bin tools on web which provides you unique endpoints so you can send requests from your system and see what is coming in the payload.

When I saw Blazor WebAssembly 3.2.0 Preview 1 release now available article on ASP.NET Blog, I decided to give it a try to work with Azure SignalR Service.

BlazorBin is on Azure and can be accessed by blazorbin.azurewebsites.net/. This service does not continue because of a billing issue. A new endpoint to an Azure Function, will be created when you visit the website. When a request comes to the endpoint, it will be listed on the left-hand-side menu as the method name. You can see the details of that request by clicking on the menu item.

Azure Durable Functions

Azure Durable Functions

Architect serverless solutions in Azure

Durable Functions is an extension of Azure Functions that enables you to perform long-lasting, stateful operations in Azure. Azure provides the infrastructure for maintaining state information. You can use Durable Functions to orchestrate a long-running workflow. Using this approach, you get all the benefits of a serverless hosting model, while letting the Durable Functions framework take care of activity monitoring, synchronization, and runtime concerns.

Suppose your e-commerce company has a warehouse and there is a staff to ship products. We want to automate the process, but still involve humans. We can implement human interaction pattern by using an orchestrator function. The orchestrator uses a durable timer to request approval. The orchestrator escalates if timeout occurs. The orchestrator waits for an external event, such as a notification that’s generated by a human interaction.

Azure Functions

Azure Functions

Architect serverless solutions in Azure

Serverless, as the name suggests, is computing without managing a server. You would not care about any server specification to process your data. The server should already be provided by a cloud platform as a PaaS (platform as a service) or as a FaaS (function as a service). The two common approaches on Azure are Logic Apps and Functions.

Is serverless computing right for my business needs?

No, it is not. You need to create clear requirements for your business needs then develop your application. You can answer this question only by analyzing your telemetry results from production. The serverless computing is a technical solution for a better infrastructure allocation and event driven design. There is not any engineer who can calculate necessacities without any data.

For example, functions have a timeout of 10 minutes maximum. If it is triggered by an HTTP request then it lowers to 2.5 minutes. Even if it responds in seconds, there is still a probability that it is executed continuously. In this case, it would be more expensive than having an app service or a VM.

How serverless can help me?

You will be working only on your business logic code in the technology stack of your choice (.NET Core, Node.js, Python, Java and PowerShell Core). No more hassle about infrastucture, scaling up or down. Most importantly, you are charged based on what is used.

Wildcard For Azure Devops Branch Policies

Wildcard For Azure Devops Branch Policies

We use GitFlow as our branching model on Azure Devops. When we create a new Release branch, we want it to be protected by default. By protection I mean, preventing unreviewed code changes.

This is not like setting a branch policy for an existing branch, it would be a wildcard for future branches. You need to do one extra step to access the correct page for a wildcard and this is not documented yet.