I adopted a REST API project today which had no exception handling or logging, making it really hard to investigate issues. So I spent an hour adding a centralized exception handler and structured logging using Serilog. In this article, I’d like to discuss how exception handling and logging can be setup at the beginning phase of a project following a best and easy concept.
Once the business-level entities are defined, common exceptions and business-specific exceptions should be defined so that they can be shared among projects like API, Function App, Console App, etc..
Once the exceptions are defined, we need…
This article describes the GitHub project that can be used as a starting point to work with:
Popular features also supported in the project include:
According to Wikipedia, “In data analysis, anomaly detection (also outlier detection) is the identification of rare items, events or observations which raise suspicions by differing significantly from the majority of the data.”
In plain English, anomaly detection identifies weird behaviors or data points, such as power outages, email fraud, viral tweets, or BIG stock price movements. There are two common types of time series anomalies: spikes and change points.
What is Spike Detection? Spikes are literally what it says, “spikes”… Spikes detection identifies temporary bursts of weird behavior. For example, if the Tesla stock price sky-rockets after they release their…
If you have a pure Data Scientist role, you probably care more about studying the data, going through feature engineering, choosing the correct statistical or machine learning model, and training the model to perform well on both the training dataset and validation dataset. And that’s it!
However, in most cases, a trained machine learning model does not just stop there and sit in a Jupyter Notebook, but it needs to be deployed as a service so it can be actually used in production applications. …
In the last couple of articles, we discussed how to design a barebones working solution for TinyURL, and also how to improve 90% of the estimated workload by introducing cache.
The system diagram below shows what we currently have. The single web server handles all the HTTP requests from the clients, and the single database stores all the data and handles all the read and write requests. Let’s trace the workflow and see how we can scale each component in the diagram, starting from the web server.
OAuth 2.0 is quite popular and is in-fact adopted almost everywhere now. Even if you haven’t developed any OAuth workflows, I am fairly certain that you have used it. Every time you provide consent to allow a specific application to access data on your behalf from Google, Facebook, or GitHub etc., you are using the OAuth 2.0 for authorization. You likely have used OpenID Connect for authentication as well if you have ever looked closer and noticed any id token. But do all authentication and authorization workflows have to use OAuth 2.0 and OpenID Connect? Not really.
Even though many…
The goal is to share some concise notes on Binary Search, and its implementation using both recursion and two pointers algorithm. Hopefully, the high-level summary notes allow you to add Binary Search to your tool bag without getting swamped by detailed textbook explanations. The following items are covered:
Binary Search is an algorithm to search a sorted array for a target value. Important notes on Binary Search:
The goal is to share some concise notes on the Two Pointers algorithm at the high-level and its typical use cases or relevant interview questions. Hopefully, this allows you to add it to your tool bag without getting swamped by detailed textbook explanations. The following items are covered:
Depending on the starting point of the two pointers, left (L) and right (R):
Below are some typical use cases and frequently asked interview questions on Two Pointers with facing direction.
Does this sound familiar? “XXX works perfectly locally, but does not work at all in production”. The same mystery applies to structured logging using Serilog!
This is a very short article aiming to discuss how to setup Serilog in an ASP.NET Core Web API project so that it works flawlessly both in development locally and also in production on Azure App Service.
Not to waste any time, so let’s get straight into it!
Step 1 — Add…
It is straightforward to create an Azure database and containers in Azure Portal. But if you are developing a new application using Cosmos DB Emulator, it will be nice to be able to delete the whole database and have it automatically re-created on the application start to get a clean slate. Also, if a new developer joins the team, he/she can just run the application and be all set to go, instead of having to manually create a database and containers (annoying!).
Software Engineer, Machine Learning Engineer. When I am not dived into data and code, I am hanging out with my young daughter or outside rock climbing!