Train Tracker - Part 3: Scaffolding

This is part 3 of my Train Tracker project. Code from this post can be found in the scaffolding branch on Github. Previous post can be found here. Logging Log messages written to stdout and stderr are captured by systemd for services it manages. We can then access these logs using journalctl. In order to keep external dependencies low, I will be using built-in Java logging infrastructure. Default ConsoleHandler, logs everything to stderr with no option to separate the stream based on log level. I want log levels Warning and above to go to stderr and the rest to stdout. StdConsoleHandler will format using SimpleFormatter. ...

May 26, 2025 · 3 min · shiva

Train Tracker - Part 2: setup

This is part 2 of my journey to build a train tracker to aide my office commute. You can find part 1 here. In this post I am going to talk about setting up the project to customise the gradle project created by IntelliJ. Dependencies Only runtime dependency is going to be Gson, so lets add that to gradle config implementation("com.google.code.gson:gson.2.13.0") Dev dependency will be Junit and mockito. IntelliJ already adds junit, lets add mokito and update the Junit dependency. ...

May 5, 2025 · 2 min · shiva

Office commute Train Tracker

For my office commute, I rely on the train. While trains generally operate on schedule, occasional delays occur. When they’re running late, I’d like to be notified so I can adjust the timing of my walk to the station. Before I decided to roll out my own, I was using National Rail app’s alerting feature. At some point National Rail removed this option. I tried multiple other train apps, but they were “slow”. When I say slow, I mean the UX, performance on mobile connection. ...

April 10, 2025 · 3 min · shiva

HTTP server from scratch: Configuration

This post is the conclusion of HTTP server from scratch. Previous post about modularization can be found here. In this post we will make our webserver somewhat more configurable. We will add one more switch to the server.properties to point to a external directory that will be used to serve the documents from. Since it is a good idea to support compression of the documents that we send, we will add support to gzip compression and finally, we will update our build configuration to generate a property distribution. ...

May 18, 2019 · 5 min · shiva

HTTP server from scratch: Modularization

This is a continuation in the series of post to build a static HTTP server from scratch. Previous post about Unit testing can be found here. In this post we are going to refactor the code a little bit to make it somewhat more modular and configurable. Modular in the sense, break out from a single class into smaller classes based on functionality. Finally remove hard-coded configurations. Break it down At this point our entire code resides in one class HttpServer. We will break this down into two, an Interface Http and HttpRequestHandler. The interface Http is going to hold some of the constants like, status codes and header names and each instance of HttpRequestHandler will service one incoming request. After the refactoring our main class HttpServer will read the server configuration, based on the configuration create a ServerSocket and listen to requests. When a request arrives, creates an instance of HttpRequestHandler and spawn a new thread to process the request. ...

March 17, 2019 · 3 min · shiva

HTTP server from scratch: Unit testing

This is a part two in the series to build a web server from scratch without external dependencies. Part one can be found here Now that we have minimal setup working, next area of focus is testing. If we were to follow Test Driven Development (TDD), test cases would have to be written first before any working code. But it is never too late to write some test cases. When it comes to testing streams like in this case, the easy way is using ByteArrayInputStream and ByteArrayOutputStream. Feed it a byte array or get back a byte array and verify. To help with the unit testing we will be using JUnit and Mockito. I know these are external dependencies, but these are development only dependencies and does not affect the production output. ...

February 23, 2019 · 3 min · shiva

HTTP server from scratch

Almost everything available on the Internet is served by web server. There are plenty of web server implementations like Apache, Nginx, Express, etc. But ever wondered how to implement a web server from scratch without any external dependencies? I wondered about that and this post is the result of that little experiment using Java. Goals Before listing the goals, this post assumes that you have some knowledge of HTTP. Mozilla has a very good overview here. Now the goals ...

February 9, 2019 · 4 min · shiva

VueSelect: Accessible Vue.js component

VueSelect HTML provides a variety of input elements. <select> allows users to select one of many options. Accessibility tools like screen readers readily recognize these “native” input elements. However the downside of these elements is they are not fully customizable across browsers and platforms. Not being able to customize will be a problem if one is working a site that follows a specific design language like Material Design. One way around this limitation would be implement your own widget. This blog post is a walk-through of implementing such a widget as a Vue.js component which is accessible as well. Inspiration for this component MDN’s guide to implementing a custom widget. ...

November 1, 2018 · 5 min · shiva

Pychain: Blockchain in 200 lines of Python

Since in the introduction of Bitcoin and the explosion of crypto currencies has created quite a lot of attention around the concept of Blockchain. In this post I will try to explain the concept by implementing Pychain, a toy Blockchain, in about 200 lines of Python. What is Blockchain? Wikipedia defines Blockchain as A blockchain, originally block chain, is a growing list of records, called blocks, which are linked using cryptography. ...

August 13, 2018 · 6 min · shiva

Hello, World!

I’m Shivakumar. I am a Software Developer since 2005 (at least professionally). It all began when I tried to teach myself C++ programming by reading a book, which I gave up pretty quickly. After on I went to get my degree in Information Science in 2005. Since then I have been a developer. For the most part of my professional career till now, I was a backend developer and mostly wrote code using Java. About 3 years ago I got a chance to develop some UI and since then I have been working on the “Full-stack”. ...

August 7, 2018 · 1 min · shiva