
I accidentally figured out how to make compute-expensive blobs in JavaScript using fillRect(). And….how to fix it.

I accidentally figured out how to make compute-expensive blobs in JavaScript using fillRect(). And….how to fix it.
I went way down the rabbit hole trying to convert RSSI (in dBm) to a useful signal strength meter, like you’d see on your cell phone.
I read many articles, but no one really had an algorithm. So….here is an algorithm written in Javascript.
//This assumes you have a way to obtain rssi... in my application,
// this is the rssi for the web server's connection (IoT device).
function rssiToBars( rssi , maxbars ){
var ret=rssi+80; //Useful range is -80 (bad) to -30 (good).
//+50 converts this to a useful range of 0 (bad) to 50 (good)
ret=(ret< 0)?0:rssi; //Clamping
ret=(ret>50)?50:rssi;
ret=parseInt(ret*maxbars/50); //taking a percent (rssi/50) of maxbars
// If you are using a language with integer data types, make sure you multiply
// first, then divide.
return(ret);
}
function rssiMeter( bars , maxbars ){
return("<PRE>[" + "#".reapeat(bars) + "-".repeat(maxbars-bars) + "]</PRE>");
//This is a simple example, but you could stack a couple of small PNG or
//render a table where the cells are bars.
}
const maxbars=8
var rssi=-55; //some magical way to get the rssi
var bars=rssiToBars(rssi,maxbars);
var meter=rssiMeter( bars , maxbars);
// rssi == -55
// bars == 4
// meter == <PRE>[####---]</PRE>
Received Signal Strength Indicator (RSSI) is the relative signal strength of a transmitter, from the receiver’s perspective.
RSSI is measured in dBm, or Decibel-milliWatts. Basically, this is milliWatts as perceived by the receiver, but represented on a logarithmic scale.
Because power drops inversely with the square of the distance, a logarithmic scale more or less represents this as a linear scale, rather than exponential.
For example, if you have signal strength of -30 (very good) and you walk 50 feet away with no obstacles between you and the router, you might drop to -40 dBm. If you walk another 50 feet, you would expect the signal to drop to -50 dBm. This a super-simple example, and there are a lot of other factors involved, but you get the basic idea.
The algorithm works like this:
Rendering can be done however you want. One slick trick is to use CSS and a small table, where each cell is a bar, and CSS dictates the cell color. Your code sets the class of each cell to “bar” or “nobar”.
<STYLE>
.bar , .nobar {
height: 10px;
width: 10px;
border: 1px solid gray;
border-collapse:collaps;
font-size: 1px;
/* Each cell has a non-breaking space in order to force it to render */
/* Setting font-size to 1px ensures that the height of the cell will be honored */
}
.bar{
background-color: #0000FF //Blue
}
.nobar{
background-color: #000077 //Dark Blue
}
</STYLE>
<SCRIPT>
function rssiMeter( bars , maxbars ){
var meter="<TABLE STYLE='border-collapse:collapse;'><TR>";
for(var i=0 ; i<maxbars ; i++){
var class=(i<bars)?"bar":"nobar";
meter+="<TD CLASS="+class+"> ";
//NO I DO NOT CLOSE MY TD TAGS. SUE ME
}
meter+="</TR></TABLE>";
return(meter);
}
// you can attach it to a DIV like this:
const maxbars=8; // define constants at the top of your script
const divname="meter";
function updateMeter( rssi ){
var bars = rssiToBars(rssi , maxbars); //maxbars is a global const
var meter= rssiMeter( bars , maxbars);
document.getElementById(divname).innerHTML=meter; //divname is a global const
}
// be sure there is <DIV ID=meter> </DIV>
// somewhere in your document
//Now, whenever you want to update your meter:
var rssi = somenumber;
updateMeter( rssi );
</SCRIPT>
updateMeter(-55);
would produce:
Enjoy!
I went down a rabbit hole trying to add a “favicon” (Web page icon) to an ESP32 web server project.
No one seems to have a complete answer, so here you go!
UPDATE: After I clicked “Publish” on the original version of this article, I started running in to all sorts of problems with my ESP32.
This sent me even deeper in to the rabbit hole, but I ultimately found a good solution.
Here is a step-by-step walk-through (UPDATED).
Did you know that the ESP32 has a built-in user LED and Utility Button? No need to build a simple circuit to do testing.
The ESP32 is an amazing Arduino device that has lots of GPIO pins, plenty of CPU and memory capacity, as well as built-in WiFi and Bluetooth, and many other features.

| Interface | Description |
|---|---|
| ■ Power LED | Red when power is on |
| ■ User LED | Blue when activated by pulling GPIO2 HIGH. |
| ■ EN Button | “Enable”, normally HIGH. Pushing the button pulls LOW, which reboots. |
| ■ BOOT Button | When used with “EN”, causes the device to boot in to programming mode.
Normally GPIO0 is HIGH (Normal boot mode). Pushing the button pulls GPIO0 LOW (Enter programming / download mode). However, after the device boots normally, the BOOT button can be used to send input to GPIO0. |
I’ve always wanted to write my own tetris clone. I wrote one in javascript. To give it a retro feel, I implemented the game using text graphics.
Some ass hat took it upon itself to kill another human being because it didn’t agree with Charlie Kirk’s opinion.
This is a reprehensible act of terrorism designed to suppress free speech, committed by a deranged minority in a pathetic attempt to force the mainstream in to accepting their ridiculous ideology. In fact, this is more of a religion than an ideology, since religion requires nothing but faith.
So in addition to being an act of terrorism, this was also a religious hate crime aimed at mainstream America.
I choose to draw the line here.
I choose to reject some woke nutbag’s vision of what my world should be. I choose to reject the premise that I shall not speak up, lest I be struck down.
Please join me in celebrating Charlie Kirk the human being. Please join me in sending prayers and well wishes to his family. Please join me in rejecting ideological and religious extremism in all forms.
To those who disagree with me, I sincerely wish you a happy, peaceful life, and a peaceful soul. Please choose the path of peace. We need to build a world where people can use reason and logic, and disagree with eachother without killing eachother. We need to stop the hatred and the violence, and live with eachother in peace.
My old work laptop, a HP, was a complete piece of crap. When they sent me my new laptop, as a bit of a Dell fanboy, I was excited to see that it was a Dell. However, I quickly began to question some of the design choices. After using it for a couple of weeks, I have solidly decided that the Dell Latitude 7450 Laptop…Thing is badly designed.
Camera technology has evolved over the last couple of decades to the point where consumer-grade cameras are decent quality, but fairly inexpensive, and therefore cameras have become fairly pervasive. In general, having a camera is a good thing – it is a way to increase your awareness, and if the camera is being recorded, the camera can be a witness on your behalf. However, in certain situations, having a camera can work against you as well. We will explore several scenarios where your privacy and / or rights could be compromised, as well as technology recommendations for protecting them.
I’ve been meaning to get my thoughts down for quire some time.
Mrs. ParrTech and I went to Vegas last year for our 30th anniversary. After having visited Vegas many times previously, I was completely disappointed, and here’s why.
I looked up how to count the number of Sundays between two dates…. the so-called answer shocked me. There are a couple of popular answers, but they are horribly inefficient.
Let me show you a better way…..
Update 4/22/2025
Due to a severe copy and paste error, the formulas were completely wrong. 8-(
These have now been corrected.
Let’s say we have the following cells:
| A | B | |
| 1 | Start | 1/1/2025 |
| 2 | End | 5/1/2025 |
| 3 | Which Day | 1 |
We will follow the Excel convention, where Sunday = 1, to find the number of “1” days (cell B3) between 1/1/2025 (cell B1) and 5/1/2025 (cell B2).
Between the two dates:
=INT((B2-(B1+B3-WEEKDAY(B1)+7))/7)+1
Correctly returns 17
Between and including the two dates:
=INT((B2-(B1+B3-WEEKDAY(B1)+7))/7)+1+IF(WEEKDAY(B1)=B3,1,0)
Correctly returns 17. If we were to change B1 to 1/5 (a Sunday), the result would be 16 without the extra IF term.
For a more detailed explanation…
©2012-2026 Justin Parr and JustinParrTech.com, All rights reserved.