.NET

When To Use FirstOrDefault with Linq Expression

FirstOrDefault is a Linq expression that returns the first element of a sequence or a default value (which is usually null) when no element is found. First is similar, but throws an error when no element is found. FirstOrDefault is usually preferred to First because it does not throw an …

Front-End

What is ‘this’ referencing to in JavaScript?

The JavaScript this keyword refers to all the objects that exist in the function’s call-site.   A call-site of a function is the location where the function is called. When a function’s call-site is inside an object, this refers to the object where the function belongs to. When a function’s call-site …

Front-End

Getting started with Selenium with Python

There are a few automation testing tools for web applications out there. Selenium is one of them and is probably most widely-used. It is the most famous and the oldest, but still relevant, automation testing tool. It is open-source and supports many different major programming languages, such as Java, C#, …

Front-End

SVG Attributes for Sizing Doesn’t Work on iPhone

I created a website that uses SVG files imported in img tags. It looked fine. When I tested the mobile version with iPhone, the SVG was bloated. It worked fine with Android with Chrome, Windows with Chrome and Mac with both Safari and Chrome. For some reason, the sizing attributes, …

Front-End

Why Istanbul Is Not Working After Cloning A Repo

I got a new laptop. I installed the latest Node.js and cloned a repo to keep continuing with my React project. I ran npm i to install all dependencies. The app started fine and built fine. However, when I ran npm test, the test was not running. My test script …

.NET

Hosting ASP.NET Core Website with InterServer

Ok, you developed a cool APS.NET Core website. Now, it’s time to get it out to the world. There are many hosting options out there. You can take a more hands-on approach like deploying to AWS or Azure. Or, you can use the hosting service provider without any hustle of …

.NET

Implementing Dependency Injection in ASP.NET Core

Dependency Injection is the heart of clean architecture for an ASP.NET Core application. It is supported out of the box when you create an ASP.NET Core application with the Microsoft.Extensions.DependencyInjection module. In the start up file, you can add the mapping between interface and actual implementation. IServiceCollection has methods to …

.NET

How to Deploy ASP.NET Core Application to Windows with IIS

An ASP.NET Core application is hosted on Kestrel on both Windows and Linux. Kestrel is a web application server (just like Tomcat or NodeJS). It is included by default in ASP.NET Core project templates. Although ASP.NET Core application can run solely run on Kestrel, it is recommended to use it …

Front-End

Releasing Multiple PWAs to GooglePlay By Using a Single GitHub Page Root

PWA is pretty exciting. As long as you have a static web hosting service, you can create a mobile app with a web site. I’ve written a few posts about packaging and releasing an Android app to GooglePlay in the past. – Tips on Creating Android App from PWA – …

Front-End

Better Way to Attach Event Listener with Vanilla JS

Let’s discuss a better way to attach event listeners to a bunch of HTML elements selected by a class name with vanilla JavaScript. With jQuery, this is super easy. You just select the elements by a class name and use .on(). jQuery will handle event listener attachments to multiple elements. …