Category: Software

  • Using Random Numbers for Unique Error Codes

    My objective for producing a unique error code is for it to be truly unique without the need of keeping track of used codes. I have selected the javascript crypto.randomUUID() function for this purpose. It produces 5.3 undecillion possible values. My implementation of this is here and the exact algorithm is here in the codeGenerator.js file.

    5.3 undecillion is the number 5.3 × 10³⁶, written out fully as:
    5,300,000,000,000,000,000,000,000,000,000,000,000

    When picking a million values, what is the probability that 2 will match?

    • Pool size: P = 5.3 × 10³⁶
    • Number of picks: N = 1,000,000 (10⁶)

    Using the Birthday Problem approximation, which is explained here:

    Probability (of at least one collision) ≈ 1 – e^(-N²/2P)

    Calculation
    • N² = (10⁶)² = 10¹²
    • 2P = 2 × 5.3 × 10³⁶ = 1.06 × 10³⁷
    • N²/2P = 10¹² / 1.06 × 10³⁷ ≈ 9.43 × 10⁻²⁶

    Since that exponent is tiny, we can simplify:

    Probability (collision) ≈ N²/2P ≈ 9.43 × 10⁻²⁶
    ≈ 0.0000000000000000000000000943

    Or about a 1 in 10 septillion chance.

    Conclusion

    Using 1 million picks from a pool of 5.3 undecillion values, a collision is extraordinarily unlikely. You’d need to run this experiment roughly 10 septillion times (10²⁵) before expecting even a single collision.

  • The Proper Use of AI Coding Tools

    I was browsing through some project postings on Upwork when I saw one which stated, “The use of AI coding tools in the work product will not be accepted.” I suppose that this client would prefer that all work take ten times longer than it could. A coder should not reinvent the wheel; they should first research what they are trying to do to see if there are any solutions already published. However, using a published solution without completely understanding it is NOT recommended. Searching for published solutions on platforms like Stack Overflow is just another tool in a good coder’s toolbox. An AI coding tool is also just a tool in the toolbox, and it should be used responsibly.

    I remember coding before resources like this were available. We had to reinvent the wheel all the time. No one would suggest using a large wrench as a hammer just because it can be made to work; it simply isn’t the best tool for the job. With the advent of AI, there are better tools for researching coding solutions. However, using a researched solution without fully understanding it is a big mistake, and that includes code available through AI coding tools. It’s a great way to introduce code that might appear to work but has unintended side effects or bugs that the coder is unaware of. A coder should have the same level of understanding as if the code was written from scratch.

    Coders should definitely not use AI-generated code that is complex and hard to understand. Doing so creates problems when making future changes and bug fixes. I have fed ChatGPT code written solely by a human and received a simpler and easier to understand version with half the lines of code, achieving the same goal. While I feel sure this won’t always happen, it’s a welcome result. The number of coding problems is directly proportional to the number of lines of code.

  • Photo Sorter for Windows

    Have you ever needed to reorganize your photos? Here you will find a free tool which you can use to sort your photos from a single folder into multiple folders. It will work on 64 bit Windows 10 and it should work on 64 bit windows 11.

    Unzip this file and double left click on “photo-sorter-2.6-setup.exe”. Windows Defender may warn you that this is an unrecognized app. This happens because I’m not willing to pay for a security certificate to sign software that I’m giving away for free.

    Assuming that you are ready to try it, go ahead and double left click on it.

    You may or may not see the following screens or something similar:

    Photo Sorter Setup

    Seeing the above window means that your new tool is correctly installed!

    This program is completely free to you. There are no internal locks or paywalls.
    It is free of viruses and malware. This the only official download page.

    If you find this software useful, feel free to send me a tip.

  • Make a Folder File List Using Windows

    Have you ever needed to make a list of files of a Windows folder that you could paste into an email or another document? Incredibly, this functionality is missing from the Windows GUI. Here you will find a free tool which you can download and use for this purpose. It will work on 64 bit Windows 10 and it should work on 64 bit windows 11. A video demo is here.

    Unzip this file and double left click on “SetupFolderDisplay2.2.exe”. Windows Defender will warn you that this is an unrecognized app. This happens because I’m not willing to pay for a security certificate to sign software that I’m giving away for free.

    Assuming that you are ready to try it, go ahead and double left click on it.

    You may or may not see the following screens or something similar:

    Seeing the above window means that your new tool is correctly installed!

    This program is completely free to you. There are no internal locks or paywalls.
    It is free of viruses and malware. This the only official download page.