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 use iOS Shortcuts

What are iOS Shortcuts Shortcuts is a visual-scripting tool available on the Apple ecosystem which allows users to create macros for executing specific tasks on their device(s). These task sequences can be created by the user and shared online through iCloud. iOS Shortcuts can be a really powerful tool if it is used properly. It has some very advanced automation and scripting possibilities built into it and its best part is that it is available on a mobile device....

November 25, 2023 · 4 min · 779 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