Sending Outlook Calendar Invite using Java Mail API

Today I had to implement a functionality related to sending Outlook Calendar invite. The app backend was written in Java. As it turns out the simple task of sending a calendar invite is much more complicated than I expected. You have to construct the message with all the right parameters set else your calendar invite will not behave as you expect. I wasted an hour or two figuring out why RSVP buttons are not coming in the invite. As it turned out it was one of the missing parameters that caused the issue. Also, I wanted to send calendar invite to both outlook and Google calendar.

Continue reading “Sending Outlook Calendar Invite using Java Mail API”

Writing Bencode Parser in Kotlin

This week I decided to write some Kotlin for fun. The best way to learn something while having fun is to build something with it. So, I decided to write a Bencode parser. From the Wikipedia[1],

Bencode is the encoding used by the peer-to-peer file sharing system BitTorrent for storing and transmitting loosely structured data.

Bencode supports four data types: Strings, Integers, Lists, and Dictionaries.

Strings are encoded as <string length encoded in base ten ASCII>:<string data>. So, spam becomes 4:spam

Integers are encoded as i<integer encoded in base ten ASCII>e. So, positive 3 becomes i3e and negative 3 becomes i-3e

Lists are encoded as l<bencoded values>e. So, list of [spam, eggs] become l4:spam4:eggse

Finally dictionaries are encoded as d<bencoded string><bencoded element>e. So, dictionary { "cow" => "moo", "spam" => "eggs" } becomes d3:cow3:moo4:spam4:eggse. You can have dictionary of any of the types supported.

I took the above examples from BitTorrent specification document[2].

Now that we understand about Bencode let’s start building the parser.

Continue reading “Writing Bencode Parser in Kotlin”

Paper Summary: Monarch: Google Planet-Scale In-memory Time Series Database

This week I read Monarch paper by Google engineers. The paper covers in detail design decisions involved in building Monarch. Monarch as the title of the paper suggests is an in-memory time series database. It is used by Google monitoring system that monitors most of the Google web properties like Gmail, Youtube, and Google Maps.

Every second, the system ingests terabytes of time series data into memory and serves millions of queries.

These are some very big numbers. Most of us do not have to deal with such large volume of data in our day to day work. Reading this paper can help us understand how engineers building such system make design decisions and tradeoffs.

Continue reading “Paper Summary: Monarch: Google Planet-Scale In-memory Time Series Database”

usql: The Universal command-line interface for SQL databases

Recently I discovered a useful utility called usql while trying to find a better CLI for MySQL. I personally prefer psql PostgreSQL command-line tool so I was trying to find a similar tool for MySQL. During my search for the psql like MySQL CLI I stumbled upon usql – universal command-line interface for SQL database. I like playing with CLI tools as they play a big role in improving the developer experience.

I discovered that there is another popular project in Microsoft world with the same name. It is called U-SQL. U-SQL is the new big data query language of the Azure Data Lake Analytics service.

Continue reading “usql: The Universal command-line interface for SQL databases”

Microsoft’s Distributed Application Runtime (Dapr)

We are living in a world where every other day we see a new technical innovation. For most of us mere mortal it is not easy to quickly figure out if the technology is worth our time. Making sense of new technical innovations is one of the core aspects of my current role so by taking the pain of writing this series I will help myself as well.

In this post, I will cover Dapr. Dapr stands for distributed application runtime.

What does distributed application runtime means?

These days most of us are developing distributed systems. If you are building an application that uses Microservices architecture then you are building a distributed system.

A distributed system is a collection of autonomous computing elements that appears to its users as a single coherent system.

Distributed application runtime provides you the facilities that you can use to build distributed systems. These facilities include:

  1. State management. Most applications need to talk to a datastore to store state. Common examples like PostgreSQL, Redis, etc.
  2. Pub/sub. For communication between different components and services.
  3. Service to service communication. This also includes retries, circuit breaking.
  4. Observability. To bring visibility into systems.
  5. Secret management. For storing password and keys.
  6. Many other

One important thing to note is that these are application level concerns. Distributed application runtime does not concern itself with infrastructure or network level concerns.

Continue reading “Microsoft’s Distributed Application Runtime (Dapr)”

Present vs Future Focussed People

The below is the text from Hell Yeah or No book. It gives a good mental model to reason how one live their life. I don’t think one has to entirely in one list or the other. You will be more aligned to one list than the other. Also, I don’t think one is better than the other.

Present-focused people

  • Pursue pleasure, excitement, and novelty
  • Focus on immediate gratification
  • Especially appreciate life, nature, and the people around them
  • Are playful, impulsive, and sensual
  • Avoid anything boring, difficult, or repetitive
  • Get fully immersed in the moment and lose track of time
  • Are more likely to use drugs and alcohol
  • Are better at helping others than helping themselves

Future-focused people

  • Delay gratification
  • Are driven with self-discipline because they vividly see their future goals
  • Tend to live in their minds, picturing other selves, scenarios, and possible futures
  • Especially love their work
  • Exercise, invest, and go for preventative health exams
  • Are better at helping themselves, but worse at helping others
  • Are more likely to be successful in their careers, but often at the expense of personal relationships, which require a present focus

Creating Visualization for Organization Entity Chart with Multiple Parents using dagre-d3

Last week I had to create a visualisation for organization entity chart. The complexity was that an entity can be created by merging of two entities. So, I was looking for a solution that gives the flexibility to have two parent nodes. I started with D3.js but quickly figured out that tree charts in D3.js can’t have two parent nodes. After a lot of googling and trying many different libraries I decided to create that using Graphviz. The only problem was that I wanted to do it on the client side.

Below is the chart that I wanted to create. As you can see below – Dummy Org ABC Limited has two parents Dummy Org India Ltd and Dummy Org East Africa DMCC. Similarly, Dummy Org Devs Project has two parents Dummy Org Infrastructure Limited and Dummy Org Infrastructure & Dummy Org Project

Continue reading “Creating Visualization for Organization Entity Chart with Multiple Parents using dagre-d3”

On Being A Full Stack Developer

I am doing software development for the last 15 years. Since I heard the term “Full Stack Developer” few years back I had a strong dislike for this term. To most people full stack developer is someone who can write frontend code, build backend APIs, and deploy applications to cloud. They can code in multiple programming languages(JS/Typescript, Golang/Java/C#/Python), knows enough to design and store data in either relational and NoSQL databases, follow DevOps practices (CI, Configuration management, etc.), knows about multiple architecture styles – Microservices, Monolithic, Serverless, and can at least deploy to one public cloud. Along with all this they also know and practice automation testing and can write clean, maintainable code.

Continue reading “On Being A Full Stack Developer”

Useful Laws For Software Developers

The 1% rule states that within an internet community only 1% of the users of a website add content, while the other 99% of the participants only lurk. Another variant of this law is 90-9-1 rule which states that in a collaborative website such as a wiki, 90% of the participants of a community only consume content, 9% of the participants change or update content, and 1% of the participants add content. – Link

The broken windows theory is a criminological theory that states that visible signs of crime, anti-social behavior, and civil disorder create an urban environment that encourages further crime and disorder, including serious crimes. Social psychologists and police officers tend to agree that if a window in a building is broken and is left unrepaired, all the rest of the windows will soon be broken. This is as true in nice neighborhoods as in rundown ones. This theory has been applied to software development, suggesting that poor quality code (or Technical Debt) can lead to a perception that efforts to improve quality may be ignored or undervalued, thus leading to further poor quality code. This effect cascades leading to a great decrease in quality over time. – Link

Continue reading “Useful Laws For Software Developers”

Using Flyway To Manage Database Migration In Spring Boot Microservices Application

Today, I was working on an application that uses Microservices based architecture. Each Microservice had its own schema and they talk to each other using their published contracts.

We wanted to keep database migration script with each Microservice rather than keeping a common module to manage database Migrations. We might later migrate to common module for database migration but we want to start by keeping schema for each Microservice separate.

Continue reading “Using Flyway To Manage Database Migration In Spring Boot Microservices Application”