This is a space that holds a collection of my personal work and ideas
  • Efficient Text Highlighter
  • Implement the Lightning Algorithm
  • Build a markdown notes taking app
  • Serve Images in Next-gen Formats
  • Package-lock.json Explained

Efficient Text Highlighter

10/02/2021

When I built the search blog post feature of this site, there is a nice visual enhancement called text highlighter as part of the search component. I implemented the same feature with three different approaches, regex positive lookahead, brute force pattern matching, and finally a more efficient approach with Knuth-Morris-Pratt (KMP) text search algorithm. In this post, I will show all three approaches to implement this feature with some interactive visualization to hopefully help a few people see the joy of programming while applying some common algorithms to a practical use case.

Read more

Implement the Lightning Algorithm

09/15/2021

I was entertaining myself with the excellent video interviews from the Numberphile project, a lightning algorithm interview from the creator of the visualization of the algorithm clearly explained the techniques used behind the scene. The explanation was so clear and the visualization was so satisfying that I felt impetuous to implement it. A few hours later, the moment of thought became realized. Here sharing a few steps that I learned from the interview and while implementing it.

Read more

Build a markdown notes taking app

04/28/2021

I really like the experience Azure DevOps provides in a PR description section - it is a markdown editor with instant preview of the input. The feature I really like is the ability to be able to paste in any screenshots from the clipboard just makes it really easy to convey the information. I like it so much that I wish I could use it to take any notes with screenshots that I like whenever I am and also allows me to take them with when I am on a different computer.

Read more

Serve Images in Next-gen Formats

01/22/2021

Serving smaller images without sacrificing the resolution quality could be finally achieved with the next-gen formats. This article introduces three common next-gen formats and a tip to have fallback images when the browser doesn't support those.

Read more

Package-lock.json Explained

01/18/2021

Since the introduction of the package-lock.json file from NPM, I never had a good grasp of it which lead to my confusion when resolving a merge conflict that is due to the package-lock.json file. To understand it clearly becomes the first thing on my new year's resolution list. This is the way how I managed to get myself understood with the package-lock.json file.

Read more

Create a Scope limited Codeblock Web Component

12/30/2020

Modern web platform allows us to write custom elements and with the assistance of shadow DOM, we are able to ensure the style and behavior of the custom elements are consistent and no external styles or behaviors are propagated in or leaked out. This post walks through some keypoints by creating a scope limited codeblock element.

Read more

NPM Dependencies vs DevDependencies

10/24/2020

When you build a JavaScript library, dependencies and devDependencies matter. This post examines the difference between dependencies and devDependencies in NPM.

Read more

Distributed Transaction Management with REST and Try Confirm/Cancel Pattern

04/13/2019

This article introduces how to manage transactions effectively in distributed REST services with Try Confirm/Cancel (TCC) pattern. It also provides a repository that is a simplified Java implementation for anyone who is interested in learning the TCC pattern. This repository attempts to trim the most of the common boilerplate, but only preserve the minimal that could be most straightforward to observe this pattern. It could be adapted to use any backend stack.

Read more

Spring JMS and JPA XA Transactions with WebLogic

02/26/2019

This article shows the configuration of using XA transactions with the resources managed by WebLogic server.

Read more

Recursively Move a Directory

01/09/2019

This article shows one effective implementation that follows the Visitor Pattern to recursively move a directory using Java NIO library.

Read more