Software engineering facts, information, and skills from February, 2018

Install specific git commit with pip

Varghese Chacko 1 year ago

To install specific git commit with pip,  You can specify commit hash, branch name, tag.

Categories:
Python

What is @permalink and get_absolute_url in Django?

Varghese Chacko 1 year ago

What is @permalink and get_absolute_url in Django? When and why to use it?

Categories:
Django Python

How to install Python package from GitHub?

Varghese Chacko 1 year ago

How to install Python package from GitHub?

Categories:
Python

Get the previous months name

Varghese Chacko 1 year ago

Often we need to get previous months name in python, especially, when we have to save report from previous month's name. In python its is pretty simple. 

Categories:
Python

Get month name from month number

Varghese Chacko 1 year ago

How can we get the month name from the month number? For instance, if I have 3, I want to return march? Most simple method is to define a function that checks for the number and return name.

Categories:
Python

What's a good way to check if a cookie exist in JavaScript?

Varghese Chacko 1 year ago

What's a good way to check if a cookie exist using Javascript? The cookieisavailable to Javascript via document.cookie So the easiest method is to write a function that checks with document.cookie and return

Categories:
JavaScript

Clone a sqlalchemy db object with new primary key

Varghese Chacko 1 year ago

At many points, a developer may want to clone a row of data for multiple reason. TheSQL Alchemy makeit easy to do in 5 steps. For example we have a table products and clone the product with id 25.

Introduction to Angular JS

Varghese Chacko 1 year ago

Angular JS logoAngular JS is a framework in JavaScript. It is distributed as a JavaScript file and could be included in any HTML page with script tag. <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.7.2/angular.min.js"></script> The angular JS extends the HTMLwith directives. The key directives are ng-app which defines the AngularJS application, the ng-model directive which bids value of HTML controls like input widgets to the app and ng-bind binds application data to the HTML.

Python - Delete item from array by its value

Varghese Chacko 1 year ago

Python logoOften we encounter the situation where we need to remove item from array by value. For example, if we have an array [23, 1, 54, 32, 34, 8, 23]. We don't know or we are not sure about the index of the value 32, but we need to delete it. Python array has the built in function remove. For example