Software Engineering vs Software Development

Varghese Chacko 1 year, 3 months ago

Software Engineering and Software development does not mean the same thing. Software engineering is the establishment and use of sound engineering principles in order to economically obtain software that is reliable and works efficiently on real machines. Software development is, of course, part of software engineering. You may find few software engineers are involved in software development, but not all developers are engineers.

Python magic method __del__

Varghese Chacko 1 year, 3 months ago

One of the useful magic method is __del__, which is the python destructor. It doesn't implement the behavior of del(x) instead, it defines the behavior for when an object is garbage collected. It is useful for objects that require extra cleanup like close files. The only required property of Python garbage collection is that it happens after all references have been deleted, so this might not necessary happen right after and might not happen at all.

Python magic method __new__

Varghese Chacko 1 year, 3 months ago

Many developers believe that __init__ is the first method invoked in the life-cycle of an object. When we create an object or instantiate a class, the first method that gets called __new__, which actually creates an objects and then passed the arguments to to __init__, the initializer. __new__ gets invoked before __init__.

Python magic method __init__

Varghese Chacko 1 year, 3 months ago

Python comes with magic methods that starts its name with __ . The most common one is __init__. What is so magical about __init__? The __init__ method need not be called or invoked. It get invoked/called whenever a class is instantiated. This method is used to initialize the instance. For example, when we run x = A(), the __init__ is invoked. Let us look at the example.

Export results of SQLs from Heroku using Data Clips

Varghese Chacko 1 year, 3 months ago

Heroku comes with nice database backup tools, both commandline and web based. But how to export results of an SQL query?

Building a form - HTML Vs Django

Priya Philip 1 year, 3 months ago

While creating a simple form in HTML we needs more works to be done in our templates like this:

Concatenate two columns in results of SQL query in PostgreSQL

Varghese Chacko 1 year, 3 months ago

Very often, you will have the requirement to concatenate two columns in a table, on the fly in SELECT SQL. For example, first name and last name needed to be combined at username. The + operator is available in MicroSoft's database servers, but it is not part of PostgreSQL or SQL standard. PostgreSQL very well support string concatenation in SQL results. Let us assume that we have a table like

Find if two date ranges overlap around the year

Varghese Chacko 1 year, 3 months ago

Finding two date range is easy in straight line. ie to find if two ranges range_1_from to range_1_to and range_2_from to range_2_to. It is enough to check if

PG::Error (FATAL: too many connections for role "xxxxxxx")

Varghese Chacko 1 year, 3 months ago

PostgreSQL could be configured to limit number of simultaneous connections to the database. The heroku comes with plans having connection limits. The 'Hopby' plans comes with 20 connections where as standard plans comes startings with 120 conection. When we start developing and testing, especially automated testings, the hobby plans raise error PG::Error (FATAL: too many connections for role "xxxxxxx"). If we check the connections with heroku cli, we get