programming

Three Tier Architecture in Docker

In this article I am going to talk about how to do a classic 3-tier architecture using docker containers. The 3-tiers will be: Frontend tier: This will host the web application. Middle tier: This will host the api, in our case the REST api. Database tier: This will host the database. We want to expose the web application to the outside world. Simultaneously, we want this layer to be able to talk with the middle tier only not the database tier.

Upgrading Postgresql to V11

I run two instances of postgres servers - one on my local machine and the other one on my do virtual machine. Both of them are on debian. One of them was running 10.x and the other one 9.x version of postgres. I wanted to upgrade them to the latest version - that is version 11. I was pleasantly surprised to see how simple it was. This is what I did:

Creating an OTP Screen in Flutter

Nowadays, one time password (OTP) is used a lot as an authentication mechanism. Sometimes the OTP is sent using SMS and sometimes its sent through email. A screen for users to input the OTP has to be created. In this article we will talk about creating a simple screen in flutter to allow users to enter the OTP. Suggested laptop for programming Lenovo IdeaPad S145 AMD Ryzen 5 15.6" FHD Thin and Light Laptop (8GB/512GB SSD/Windows10/Office/Platinum Grey/1.

Writing a Postgresql Stored Procedure Returning a Single Value

Say we have a table called person with the following structure --------------------------- column| datatype --------------------------- _id | autonumber name | text age | integer --------------------------- We want to write a stored procedure to return the highest age that we have in the table. We will use OUT param here. CREATE OR REPLACE FUNCTION get_max_age(OUT max_age int) RETURNS int LANGUAGE 'plpgsql' AS $BODY$ BEGIN SELECT MAX(age) INTO max_age FROM person; END $BODY$; That’s it.

Writing a Postgresql Stored Procedure Returning Resultset

Coming from Microsoft SQL Server, I keep on forgetting how to return a resultset from a stored procedure in postgresql. Here is a small sample of how to do it. Needs a bit more code than SQL Server. Note that postgresql does not have stored procedure, they have function. They are equivalent. Say we have a table called person with the following structure --------------------------- column| datatype --------------------------- _id | autonumber name | text age | integer --------------------------- We want to write a stored procedure to return records with age greater than a specified age.

Login Flow in Flutter

In this article, I will be showing a simple flutter app that will demonstrate a typical mobile login flow. This article is not an introductory tutorial on flutter or programming. I am assuming that the reader knows programming and has basic understanding of how flutter works. You can find more from flutter.io. Suggested laptop for programming Lenovo IdeaPad S145 AMD Ryzen 5 15.6" FHD Thin and Light Laptop (8GB/512GB SSD/Windows10/Office/Platinum Grey/1.