Problems with rendering pdf.js in Web Worker

I was tinkering with pdf.js and pdf-lib. I was trying to see what open source free technologies can do. Then I thought of how efficient it would be to move the main computation of working with pdf-lib and pdf.js to a web worker. I did a small test. I created a small html file that places a select file input control on the UI and a div to hold images....

January 18, 2024 · 4 min · 804 words · Harsh Ankur

Using ChatGPT as an Assistant Developer

When I first heard that AI will replace software developers soon, I thought it could not have been true as it is just a large language model as of now and not so much of an ‘intelligence’ in any sense or form. Turns out, I was both right and wrong. It is trained well enough to support a developer but not to operate independently with simple instructions. So, it will take over a few people’s jobs, but that would be of the low-skilled software developers who only get to make a couple of small modules in the product at best....

January 7, 2024 · 7 min · 1279 words · Harsh Ankur

How I Setup View Counter on Raspberry Pi Zero W

I like working on my own mini-projects in my free time. Some of them are libraries or extensions and others are websites. The libraries or extensions are distributed from their own package manager of browser web store which keep a track of all the downloads from across the world. It gets a little tricky for the websites if I do not want to inject a random script on my website that shows a hideously looking view counter from the 2000s....

September 9, 2023 · 7 min · 1383 words · Harsh Ankur

The Curious Case of Undeclared Global Variables in Javascript

How does your usual variable declaration look like? Like this, right? const INTEREST_RATE = 20; // global const declaration and initialization var principleAmount; // global var declaration function calculateInterest() { principleAmount = 10000; // global var value assignment var timePeriod = 1; // local function scoped var declaration and initialization return principleAmount*INTEREST_RATE*timePeriod/100; } Do you know the difference between the above and below code snippet? const INTEREST_RATE = 20; // global const declaration and initialization var principleAmount; // global var declaration function calculateInterest() { principleAmount = 10000; // global var value assignment timePeriod = 1; // <-- GLOBAL variable initialization without declaration return principleAmount*INTEREST_RATE*timePeriod/100; } Did you notice that var is missing behind timePeriod?...

August 2, 2023 · 3 min · 566 words · Harsh Ankur

Code on remote servers with Visual Studio Code via SSH

Introduction Have you ever struggled with debugging your code on remote servers? There are usually two issues associated with debugging on remote hosting. You are not well versed with terminal-based editors like Vim and Nano Coding locally, uploading to GitHub, downloading on remote server, and restarting servers with updating code is tiresome Well, I have the perfect way for you! You can connect your Visual Studio Code application to your remote server directly via SSH....

August 1, 2023 · 2 min · 264 words · Harsh Ankur