Creating a Counter or Progress Bar for a Python Program

I’ve written a number of Python apps where I would like it to print some sort of counter or progress bar to STDOUT to let me know that it is still running instead of locked up or died somehow without me being able to see it.

I had tried using a couple of different existing progress bar related modules but none of them really worked except in a very specific use case.

So, after a bit of futzing around I → Continue reading “Creating a Counter or Progress Bar for a Python Program”

How To Spy and Verify a Static Void Method in Java

The Mockito and PowerMockito libraries for JUnit4 are not always the most intuitive.

Following is an example of how to spy and verify a static void method.

    public void testAdd() {

        // Prepare the Utils class to be spied.

        // Run the test and get the actual value from the OUT
        int actualValue = App.add("Test1", 1, 1);

         * To verify the number of times that we called Utils.doSomething we
         * first need to tell the PowerMockito library 
Continue reading “How To Spy and Verify a Static Void Method in Java”

Using sed with regex capture groups

There are many times when you have a file from which you want to extract specific strings based on a regex and using a capture group is a very efficient way to parse multiple strings from the same line.

I have found that sed is the easiest way to do so on the Linux command line.

Given the following input file:

This is a line of text with a year=2020 month=12 in it
This line of text does not have 
Continue reading “Using sed with regex capture groups”

How to Find Ingested Foreign Objects in Poop

Admittedly, not the most savory subject. But, for those of us with pets and/or children it is sometimes a necessity to try to find a previously ingested foreign object in feces to make sure that it does not cause medical problems in the person or animal that has accidentally eaten it.

Recently, we thought our dog had eaten a relatively small magnet and figured that we would have to be checking his feces over the next few days to ensure → Continue reading “How to Find Ingested Foreign Objects in Poop”

If you don’t like bugs, you are on the wrong planet

Something I mention to my wife now and then when she get’s irritated by some sort of insect. There’s a lot more of them than us! I stumbled upon an interesting article today that gives some information on the numbers of species and individuals on the planet.

Other than bacteria (approx 25,000,000 different species) arthropods (of which are insects, spiders, etc.) number approximately 6,000,000 species.

Another interesting fact . . . total number of arthropods on earth . . . → Continue reading “If you don’t like bugs, you are on the wrong planet”