tomcat Multiple Tomcat instances in Fedora Have you ever wondered why there's a folder /var/lib/tomcats/ adjacent to /var/lib/tomcat ? Just empty, nothing inside it? Well the extra s is super helpful when you want to run
typeorm Catching Unique Constraint Errors in TypeORM and PostgreSQL IntroTypeORM is a really nice ORM layer that utilizes TypeScript features to provide a superior development experience. Coming from Djangoland where Django ORM is a bliss to work with, TypeORM seems like the
graphql Metafield awesomeness with Shopify GraphQL API The GraphQL revolution in Shopify has made working with Metafields whole lot easier. The equivalent of "a picture speaks thousand words" in programming is a code sample. So here it goes: Create Product
Firefox NS_ERROR_NET_INADEQUATE_SECURITY after Firefox upgrade To fix the issue, update nss package when you update Firefox.
React GraphQL: Remove __typename in mutations Apollo Client adds typename field for its InMemoryCache. Data from query, thus, cannot be used as-is for mutations. This article shows how to use Apollo Link to remove it automatically.
Devanagari Devanagari/Nepali numerals in HTML lists CSS list-style-property supports Devanagari as an experimental feature. We use this to show an enumerated list in Devanagari script.
Django Django and Create-React-App together on Heroku React is awesome. Django is great. And together, they can provide a clean separation of frontend and backend concerns. An ideal way to host React app is to serve it over a CDN
Django Extract new rows in updated CSV file: Simple Tricks with Pandas Problem Let's describe the problem visually. Say, I have a file with the following contents: Year Code Price 1995 X1 20 1996 X2 30 1997 X4 20 2000 X4 69 Then, we get
Django Use JSONField with Django Rest Framework There are multiple implementations of JSONField that can be used for storing arbitary JSON data in Django models: PostgreSQL specific model fields Third-party implementations The one I am using is jsonfield2 which is
Python Comparing Floats in Python unit tests When you are comparing floats in an unit test, a common notion is to round off the numbers being compared to some places. self.assertEquals(obj.change(), round(decimal.Decimal(0.471404524888533), 8)
Xpath Negative indexing and slicing in Xpath In Python, you could do list[-1] to get the last element. So, how do you do it inXPATH? Say, I want to get the last link in the navigation that is made
Django Auto migrate Django in Heroku on push In your Procfile, add the following: release: python manage.py migrate --noinput Heroku will run this command everytime you deploy the app. This command is run after all other commands so you can
Nginx Remove specific cookie with Nginx Snippet This snippet should remove some_cookie cookie from the request before passing it to the backend: set $new_cookie $http_cookie; if ($http_cookie ~ "(.*)(?:^|;)\s*some_cookie=[^;]+(.*)") { set $new_cookie
Angular Fixing Angular infinite digest loops with Underscore's memoize A quote I created for this scenario: When stranded in a place without a mechanic, you will learn to repair the bike on your own. I was getting errors like this: Error: $rootScope:
Django Send HTML emails with Django Below is a quick snippet on how to send HTML emails with Django. If you have email.html in your templates folder (either app or project-wide), you can do: from django.core.mail
Flask Getting around Heroku's 30 seconds timeout limit with Flask Heroku has this 30s request timeout window in which if your app doesn't send anything within 30 seconds, the request is cancelled and Application Error is returned. With Flask, there's an easy way
Linux Deploying Django with Gunicorn and Nginx on Debian/Ubuntu This tutorial will setup a Django environment running with nginx as a reverse proxy for the app. A gunicorn server will run our Django app i.e. gunicorn will act as a WSGI
Linux Repairing broken downloads with Rsync If you can download a file with size in GBs in a single session, you should feel a great sense of accomplishment, specially in Nepal where internet connection follows Heisenberg's uncertainty principle. Yesterday,
Android Using LIKE constructs in Android SQLite Queries I was using SQLite Database to cache things around in an Android application. I had to implement a search interface for cache's title column. I was using CursorLoader. So, how do we filter
Linux Using SSH config for fun and benefit If you have multiple servers to manage, you find yourself connecting to each of them a tedious task. Different private keys, different ports to connect, different hostnames and so many things to remember.
SRTM Reading SRTM data with Python Digital Elevation Model (DEM) provides elevation data for use in programs and analysis. These models have varied practical uses like line-of-sight and viewshed analysis. Shuttle Radar Topography Mission (SRTM), as the name suggests,
Linux Writing Git Hooks in Python Git hooks are a great way to execute something whenever a specified event happen in a Git repository. No wonder this website also uses Git hooks, mostly abusing post-receive. This post is not