Unique id generation in distributed systems
Unique id generation in distributed systems

Recently at work, We were looking for a way to generate unique IDs across a distributed system that could also be used as the primary keys in the MySQL tables.

We knew in a single MySQL database we can simply use an auto-increment ID as the primary key, But this won’t work in a sharded MySQL database.

So I looked at various existing solutions for this and finally learned about Twitter Snowflake — a simple 64-bit unique ID generator.

Why don’t you use UUID? 🤔

UUIDs are 128-bit hexadecimal numbers that are globally unique. The chances of the same UUID getting generated twice are negligible.

The…


The Trojan — Nullish Coalescing Operator
The Trojan — Nullish Coalescing Operator

In this article, we will see what’s the difference between a Nullish Coalescing Operator (??) and a Logical OR (||)

But before going further, let us refresh ourselves with one very common concept in Javascript which is, what are the truthy/falsy values.

In JavaScript, there are 6 values that are considered to be falsy:

  • undefined
  • null
  • NaN
  • 0
  • “” (empty string)
  • false

All other JavaScript values will produce true and are thus considered truthy.

Here are few examples 👇

const value1 = 1;
const value2 = 2;
const result = value1 || value2;console.log(result); // 1

Both value1 and value2…


Most Famous Interview Question
Most Famous Interview Question

What is the most famous interview question?

FizzBuzz is the most popular coding problem, and perhaps also one of the easiest.

For those of you who don’t know, here’s the problem statement :

Write a short program that prints each number from 1 to 100 on a new line. For each multiple of 3, print “Fizz” instead of the number. For each multiple of 5, print “Buzz” instead of the number. For numbers that are multiples of both 3 and 5, print “FizzBuzz” instead of the number.


Non Fungible Tokens
Non Fungible Tokens

Recently, Digital collectibles have exploded in popularity because of NFTs. You’ve probably seen people in your social media feeds talking about NFTs too.

The growing market for NFT is turning the art, music, gaming, and finance industries upside down.

NFTs can be confusing to understand for someone who is hearing it for the first time.

So today let’s unwrap what is NFT and why suddenly it is becoming the next big thing on the Internet.

We will be running through everything you need to know about them.🙂

What the heck is NFT?

You’re probably familiar with this famous tweet by Jack Dorsey, the billionaire co-founder…


Chrome Extensions To Try Out : Apoorv Tyagi
Chrome Extensions To Try Out : Apoorv Tyagi
Github Chrome Extensions

As a developer, we use GitHub every day and it is already a great tool, but what if we can make it even better with some chrome extensions!

Let’s have a look at some of them 🔽

1. Octotree

It enhances GitHub code review and exploration with features like:

  • IDE-like code tree
  • Folder and file search
  • Issues and Pull Request bookmarking
  • Support for private repositories

I like this extension very much! It lets you explore the files and folders of a repository with a tree like structure.


Web Dev Resources : Apoorv Tyagi
Web Dev Resources : Apoorv Tyagi

Introduction

Learning web development is like learning to drive a car. No matter how much you do not enjoy it, learning these skills sometimes can help you a lot and can even act as a great skill to put on your resume.

It’s been over 3 years since I last touched anything related to HTML, CSS, or any Javascript front-end framework but recently I happen to come across all of them at once.

I needed to create some landing pages, custom logos, and mockups.

So I decided to go through all these technologies once again and during that process, I found…


Hey👋

This is just a small post to let you know, where you all can find me apart from “medium”

Feel free to @ me on any of these platforms 😀


🔊 If you want to listen to the AUDIO version of this article while you read, you can do it by clicking here

This post is from the third issue of The Trojan’s Wednesday Wisdom newsletter.

Here’s what we will be doing this time:

  1. You’re going to help me in finding the bug in my code.
  2. I will be sharing one mind-blowing python tip with y’all.

So, grab a coffee☕ , and Let’s get started -

🐞 Find The Bug

The first issue of the newsletter started with “Hello World!”. …

Apoorv Tyagi

Fledgling software developer. I write about algorithmic solutions for software engineering problems (May also include machine learning & blockchain)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store