RSSAmplifier

Blog

Chandra Sekar's Blog

Recent content on Chandra Sekar's Blog

blog.cskr.devRSS feed ↗25 posts

Latest posts

Birds of My Neighbourhood Lakes

Over the past few months, I’ve been exploring the lakes around my home in North
Bengaluru. They have blown me away with the diversity of birdlife they host. In
a rapidly expanding city, these water bodies serve as vital sanctuaries. While
well-known hotspots like the Jakkur lake are predictably teeming with avian
activity, even smaller, unassuming spots like the Chokkanahalli lake…

Making pylsp Work in Vim

Language servers enable IDE-like features in text editors that support the
 Language Server Protocol . pylsp is a language server for
Python. I use vim-lsp to integrate language servers into Vim.
Configuring a language server in vim-lsp is straightforward for most
languages , but not for Python. 
 Any non-trivial Python codebase uses a virtual environment (venv) to store…

FIRE and Personal Finance Inspirations

There are two key problems to solve on the journey to attaining Financial
Independence and Retiring Early (FIRE): 1) ensuring you have enough money for
the rest of your life and 2) figuring out what to do after retiring. While the
latter is critical for a fulfilling retirement, it is also highly personal.
However, the path to achieving the former is quite common to most people.…

Productivity as an Employed Software Engineer

There has been a lot of talk about employee productivity in recent days, with
some Indian tech entrepreneurs asking people to work 70 hours a week.
Productivity is not the sole purpose of life. Health and relationships that we
value are more important and productivity must never come at the cost of these.
With that out of the way, here is my view of productivity and ways to improve…

The Tale of a Corrupt Backup

As I mentioned in the post about my backup system , I run restic check 
regularly, to test the integrity of my backup. It has never reported any error
in my repository. It performs a quick, shallow check, and does not verify that
all the data is intact. I also restore a random file, whenever I run restic check , to test recoverability. 
 Shortly after I wrote the previous post , I…

My Personal Backup System

Computing devices and online services can fail catastrophically and take our
data with them. It is crucial that we have a robust system to backup and
restore our data, to protect against such events. This post details what I
wanted from the backup system for my personal data and the tools I use to
achieve them. This system has served me well over the last 5 years,…

Connection Leak in PgBouncer Behind AWS NLB

At a previous job, we had several instances of Ruby on Rails applications
connecting to PostgreSQL through PgBouncer . The services and databases
were deployed on bare-metal servers and chugged along fine. We then decided to
migrate to AWS. Upon migration, we noticed that PgBouncer started leaking
connections to PostgreSQL like a sieve, leading to exhaustion of the…

Using Command-Line Tools on Vim Buffers

Vim offers many ways to use the command-line tools available on your system when editing. You can: 
 
 insert the output of a command into the current buffer - e.g., insert the current date. 
 process lines of the current buffer through a command - e.g., sum up a list of numbers in the file. 
 manipulate lines of the current buffer using a command - e.g., sort a list of names in…

GnuCash for Personal Finance: Online Quotes

This is third in the series of posts describing how I use
 GnuCash to manage my finances. In
 previous 
 posts , I had discussed
how I organize my accounts, record transactions and handle taxation in GnuCash.
In this post I’ll show how GnuCash can be configured to fetch the current NAV
of mutual funds from the Internet.

GnuCash for Personal Finance: Transactions and Taxes

This is second in the series of posts describing how I use
 GnuCash to manage my finances. In the previous
post I had discussed how I
organize my accounts in GnuCash. In this post I’ll describe how I record
transactions and use GnuCash to help with computation of taxes and filing of
tax returns.

GnuCash for Personal Finance: Chart of Accounts

GnuCash is an open-source double-entry bookkeeping
software. In a series of posts this week, I will describe how I use GnuCash to
manage my finances. The series will be biased towards a portfolio composed
primarily of Indian mutual funds. This post describes the chart of
accounts involved and the
purpose of each account.

Safe and Convenient Password Management

For better or worse, passwords are central to the safety of almost all our
online accounts. 2-factor authentication systems are meant to protect users
from compromise of their passwords. However, not all services support it. Also,
several online services (including banks), use OTP sent over SMS as the second
factor. This has several vulnerabilities and has been deprecated…

Prepared Statements Without Additional Round-Trip

Prepared statements are the best way to avoid SQL injections in applications
accepting user input. However they require an additional round-trip to
prepare the query, which increases latency when your queries are dynamic and
the statements are not re-used. PostgreSQL allows execution of such queries
without the additional cost!

Java's CompletableFuture and Threads

Quiz time. How many threads (other than main ) will this program create on a&#xA;dual-core machine? &#xA; public class App {&#xA; public static void main (String [] args) {&#xA; for ( int i = 0; i < 10; i ++ ) {&#xA; CompletableFuture. runAsync (() -> {&#xA; System. out . println (currentThread(). getName ());&#xA; }). join ();&#xA; }&#xA; }&#xA; }&#xA;

Timing Equity MFs with PE

The rule of thumb for equity investments is to not time the market, but&#xA;there are also several analyses correlating investing at high index PE levels&#xA;with lower returns. So can we use the PE levels of indices to generate better&#xA;returns than SIP and reduce volatility of the portfolio?

Arena Allocation in Go

One of the weaknesses of Go&rsquo;s runtime today is the relatively naive GC&#xA;implementation. This is evident from go performing consistently worse than most&#xA;other languages in the binary trees&#xA;benchmark .&#xA;However, the language can make designing programs that reduce GC cost fairly&#xA;straightforward.

Go Does Delegates Beautifully!

When working with object-oriented languages, there are many instances when one&#xA;would want to implement an interface re-using code from another implementation&#xA;of the interface. While inheritance will work, it couples the new&#xA;implementation to the specific other implementation. Composition with&#xA;delegation will be a better way of doing this.

How Git Outshines Subversion at Merging

I&rsquo;ve recently started getting my head around Git having been a Subversion&#xA;(sadly even CVS) user all along. While I liked the fact that it was distributed&#xA;and way faster than Subversion at most operations, I couldn&rsquo;t understand why&#xA;many claimed it was better at merging than Subversion (1.5 and above). Even the&#xA;&ldquo;Branch Handling&rdquo; section in Git&rsquo;s&#xA;wiki…

Simple Layouts with JSP in Spring MVC

Every web application has elements common to all its pages which are good&#xA;candidates for re-use. While Spring MVC provides integration with Tiles, it can&#xA;be an overkill for simple applications and needs using Spring&rsquo;s client side JS&#xA;library for AJAX (correct me if I&rsquo;m wrong).

Mocking Math.random() Using PowerMock

Let&rsquo;s consider the below Game class in a guessing game where a random target is&#xA;chosen by the system and the user guesses the target. The system returns an&#xA;appropriate message based on whether the guess was higher, lower or equal to&#xA;the random target.

ScriptEngineBuilder for Java

Java 6 allows you to execute and communicate with scripts written in any&#xA;scripting language, using the Scripting&#xA;API .&#xA;However, the code needed to create a&#xA; ScriptEngine &#xA;and evaluate a set of script files within it, is quite verbose and throws&#xA;several checked exceptions.

Keyboard Shortcuts in JSF Using AJAX4JSF

AJAX4JSF is library of JSF components which can be used to easily add AJAX&#xA;capabilities to JSF web applications. AJAX4JSF is available as part of the&#xA; Richfaces component library.

Python&#39;s String Translations for Java

Just as I started poking my nose into Python, I came across two really&#xA;interesting functions in its string module.

Creating a Local APT repository

I have long been wanting to make a local directory, which contains all my&#xA;Debian packages, as a repository to be added in, /etc/apt/sources.list .&#xA;Finally, I did it.

Easy Way to Create Slack Packages

I came across this interesting utility which allows creation of slack packages&#xA;easily.