Tags

PostgreSQL template0 vs template1 Database

In PostgreSQL, we have two default databases, template0 and template1. Sometimes users are confused about why there are two default databases. In this post, we will learn why these two databases are important and what their uses are in PostgreSQL. template1 database Whenever we create a new database in PostgreSQL, the system needs to find a default database from which all the default tables, ...

Continue Reading

PostgreSQL Bigserial datatype Guide

PostgreSQL is the most advanced open source database. PostgreSQL supports many data types and one of the special datatype is bigserial data type. Bigserial data type is used for creating autoincrement columns. PostgreSQL supports 3 datatypes for creating autoincrement columns. smallserial serial bigserial All three datatypes are used for autoincrement fields. All three datatypes have diffe...

Continue Reading

NodeJS Get HostName from request ExpressJS

Sometimes we need hostname to do various log activities. We can get the hostname from the request property in ExpressJS NodeJS. We have two options to get the hostname: hostname property of request header method of request Request HostName Property Below code is shown to get hostname from request object. app.get('/',(req, res) => { hostName = req.hostname; //dotnetpattern.com...

Continue Reading

NodeJS UUID Validate

To validate UUID (GUID) in NodeJS, we can use below options: UUID NPM Package We can write our own custom regular expressions to validate. 1. UUID NPM Package To use UUID package, we can use below command to include in our project. To validate UUID in NodeJS, we can use validate method of UUID package. Below is the sample code. const uuid = require('uuid'); const uniqueId = "3112b3db...

Continue Reading

Go Variables

Variables in Go refer to the names associated with values like numbers, or strings. When we declare a go variable, we specify the type and optionally the default value. If we don't specify the default value, go automatically assigns the default value to a go variable. Go is a statically-type language that means when we declare a variable, we also specify a data type. From the data type, Go com...

Continue Reading

chmod 755 - Change Access Permissions

chmod 755 linux command is used for changing permissions for the files and directories. Only the file's owner or superuser can change the file access permissions. chmod 755 command does following work: It gives read, write and execute (RWX) file permissions to file owner, It gives read and execute (R_X) file permissions to file's group owner and other system users. It removes write p...

Continue Reading

Python Script to Optimise Images and upload to FTP server

Below is the python script to optimize PNG images files using OPTIPNG library and upload compressed images in FTP folder. If you don't have OPTIPNG library, download from this url: http://optipng.sourceforge.net/ import ftplib import os username = 'username1' pwd = 'pwd1' localdirpath = "/home/username/Documents/screenshots/" files = os.listdir(localdirpath) ftp = ftplib.FTP...

Continue Reading

ASP.NET Core Introduction

ASP.NET Core is a open source framework to develop web applications on Windows, Linux, and Mac operating systems. It provides framwork to build cloud-enabled web applications and web API services. It is a lighweight framework that provides high-performance. In Techempower Benchmark, asp.net core comes in 36 position. It comes before NodeJS framework which comes in 172 position. https://...

Continue Reading

ASP.NET Core MVC Linux Hello World Program

In this tutorial, we will create a simple hello world web mvc application in .NET Core. .NET Core Installation on Linux To install .NET on linux, we need to first add Microsoft package signing key to your trusted keys and add the package repository. We have different commands for different linux distributions. Run below commands in terminal window according to your distribution. ...

Continue Reading

NodeJS MySQL Tutorial

One of the main advantages of using the NodeJS framework is the easy integration with the Database libraries. MySQL is one of the most popular database. NPM MySQL library provides easy integration with NodeJS application. In this tutorial, we'll learn following operations from NodeJS application: Installing MySQL NPM module Connect to MySQL database Execute select quer...

Continue Reading