Skip to content

Quick Dev Notes Posts

Using the Python interpreter for interactive help

Whether we want some help for a module or want to quickly test a piece of code, Python interpreter is of great help. And in this article we are going to cover different ways where Python interpreter comes handy. In previous articles we have: setup Python environment on Linux based systems setup Python environment on Windows run our first Python script So, what are you waiting…

Running your first Python script

Since you are here, I would assume that you have a working Python setup along with a working Python interpreter, and are ready to run your first Python script. If not, check out my previous  articles, where I walk you through each step to setup your Python environment. Here are the links to those articles: setup Python environment on Linux based systems setup Python environment…

Setup a virtual environment for Python Development on Windows

Introduction Earlier, I wrote an article on how to set up a virtual environment for Python development on Ubuntu. This article, as the title suggests, focuses on setting up a virtual environment on Windows. I’m using Windows 8, and everything we will do here should work on other versions of Windows as well.   Installing and Running Python Installing Python, or any other software, for…

Setup a virtual environment for Python Development on Ubuntu

Introduction In this article, we will start off by installing Python 3.6 and later, we will set up various virtual environments to work on different projects that require different versions of Python (say 2.7 and 3.6). Just for a change (honestly, I’m bored working on Windows), I will be doing everything on a system running Ubuntu 16.04. If you are interested to install Ubuntu alongside…

A better approach to use HttpContext outside a Controller in .Net Core 2.1

Introduction In my previous post we discussed an approach to access the HttpContext.Session in RequestHandler. However, there was a problem. For every single component where we need to access the session, we have to inject a dependency of IHttpContextAccessor. While for one or two components it’s not a problem, it can be very daunting if we have to do the same over and over again. In this article, we will use a different…

Using HttpContext outside a Controller in .Net Core 2.1

  Introduction Last Friday, while working on a web application based on ASP.Net Core 2.1, I came across a scenario where I had to put some data into memory. While that’s not a problem, the catch is that the data has to be unique for each Http Session. Consider it as keeping a key that is to be used across different views to display some…

Breaking Circular Dependency between Components

Introduction Couple of days ago, I came across a piece of code that was not just tightly coupled but also formed a circular dependency among the components. In the following code, I’ve tried to give you a gist of it (may not be the best though). The below code has two key components, DataProvider and DataValidator. The DataProvider “new” DataValidator and passes in its own instance, which is then used…

Introduction to Software Design Patterns

Ever since software engineering has come to life, software engineers have repeatedly faced situations wherein they have to solve similar problems over and over again. And being a software engineer I can tell you that it is very annoying. So, what can we do about it? How do we solve our similar software problems? Well, the answer to these questions is, by using Software Design…

Composed Relationship Types Func<Owned<T>>

We often end up in situations where injecting a service using simple relationship types like Func<T>, Lazy<T>, Owned<T> and others, doesn’t serve the purpose. For instance, there can be a scenario where we want to control the lifetime of a component and yet the initialization of the component takes place at run time. Now, for such a scenario, injecting the service as either Func<T> or…