Wednesday, February 12, 2025

Why I deleted my Stack Overflow account...



After over 4 years, I finally decided to delete my SO account. Don't get me wrong, there are a lot of great ideas on SO, one of which include the community rating system to bring relevant answers to the top. In addition, they have a whole structure built up to try and help people find answers to their problems. Overall it's a worthy goal. 

The failures come in several ways, however. 

No Answers for Unique Problems

I cannot tell you how many times I have gone in search of answers to specific problems and I just find other people with the same problem. This has felt like it is becoming more common just in the last couple years. Are people still using SO?

Bad Answers

This one is pretty crazy. Sometimes people leave absolutely terrible advice. I've seen comments promoting security by obscurity and outdated password practices (but recently posted answers). 

Outdated Answers

Sometimes the answers are from almost 10 years ago. Makes sense when you consider that SO was released in 2008, but that's not going to help most of us who have tried to keep up with the times and the tech. 

Moderating Disasters

A few times I have been in a hurry but left an answer with links to more resources. Within an hour or so, I would have 5 moderators jumping on me, editing my post, down-voting my answer (all 5 of them), and berating me for linking to websites or blogs and not providing more complete answers. I can understand the desire to keep answers clean and host complete information, but the way this was handled seemed overzealous. One moderator giving feedback would have been plenty. 

Anyway, I'm not going to put up with any of that, so today I decided to delete my SO account. 

So where do we find our answers now?

The Future of Finding Answers

AI comes to the rescue (probably trained in part by SO answers). But these answers (while not always 100% accurate or recent) are getting better and becoming more specific to our situations. The faults of AI are quickly minimizing, and the cost and speed keep improving (i.e. DeepSeek). 

Saturday, February 8, 2025

Full Color Spectrum Color Chart / ColorPicker

For a project I have been working on with ESP32, I wanted to make a simple drawing program. It would be simple enough to add a limited swatch of colors, but I really wanted to provide as many colors as would be supported by the hardware. 

Being that my input controls are limited (it is not a touch screen), I wanted to have all the (spectrum) colors available on one chart. After looking around for a bit, and playing around with DeepSeek, I was able to quickly produce the chart I was looking for, and it's actually pretty simple. 




The answer is that by using two gradients (one horizontal, one vertical) with drawing on a html Canvas element, would produce this result. Here is the HTML if you want to try it yourself. 


     <canvas id="paletteCanvas" width="500" height="300"></canvas>


    <script>
        // Function to initialize the color palette
        function initPalette() {
            const canvas = document.getElementById("paletteCanvas");
            const ctx = canvas.getContext("2d");

            // Create horizontal gradient (hues)
            const horizontalGradient = ctx.createLinearGradient(0, 0, canvas.width, 0);
            horizontalGradient.addColorStop(0, "rgb(255, 255, 255)"); // White
            horizontalGradient.addColorStop(0.1, "rgb(255, 0, 0)"); // Red
            horizontalGradient.addColorStop(0.25, "rgb(255, 0, 255)"); // Magenta
            horizontalGradient.addColorStop(0.4, "rgb(0, 0, 255)"); // Blue
            horizontalGradient.addColorStop(0.55, "rgb(0, 255, 255)"); // Cyan
            horizontalGradient.addColorStop(0.7, "rgb(0, 255, 0)"); // Green
            horizontalGradient.addColorStop(0.85, "rgb(255, 255, 0)"); // Yellow
            horizontalGradient.addColorStop(1, "rgb(255, 0, 0)"); // Red

            // Apply horizontal gradient to the canvas
            ctx.fillStyle = horizontalGradient;
            ctx.fillRect(0, 0, canvas.width, canvas.height);

            // Create vertical gradient (brightness)
            const verticalGradient = ctx.createLinearGradient(0, 0, 0, canvas.height);
            verticalGradient.addColorStop(0, "rgba(255, 255, 255, 1)"); // White (opaque)
            verticalGradient.addColorStop(0.5, "rgba(255, 255, 255, 0)"); // Transparent
            verticalGradient.addColorStop(0.5, "rgba(0, 0, 0, 0)"); // Transparent
            verticalGradient.addColorStop(1, "rgba(0, 0, 0, 1)"); // Black (opaque)

            // Apply vertical gradient to the canvas
            ctx.fillStyle = verticalGradient;
            ctx.fillRect(0, 0, canvas.width, canvas.height);
        }

        // Initialize the palette when the page loads
        window.onload = initPalette;
    </script>


I also replicated this in Photoshop using 2 gradients stacked, and the result is a bit nicer, having less of that start effect in the middle.