BLOGical Thoughts

Documents

Archives

Search

Welcome to BLOGical Thoughts

April 2015

 

Thursday, 30 April 2015

I have completed compressing the images on this web domain. Without removing a single image, I have reclaimed 510.2 MB of space and have sped up access to the images by quite a bit.

To do the compression, I wrote a bash script that used two tools that are not normally available in a Linux distribution. One of the tools is mozjpeg, which consists of two programs: djpeg and cjpeg. These programs convert JPG files to BMP and BMP files to JPG. mozjpeg is available on GitHub and a debian binary is available at http://mozjpeg.codelove.de/binaries.html.

The other tool I used is a command line program called 'ren', which I got from a cd which came with the book UNIX Power Tools. Normally, wildcard renaming of files is painful in bash, but ren makes the task somewhat painless.

For those who are interested, here is the script I wrote to do the compressions:

    #!/bin/bash
    # ============================================================
    # mozjpeg.sh - Compress JPEG files using mozjpeg
    # author:  M Burton
    # written: 28 Apr 2015
    # ============================================================

    usage()
    {
      printf "Syntax:\n  mozjpeg.sh JPG\nor\n  mozjpeg.sh jpg\n\n"
    }

    printf "mozjpeg.sh - Compress JPEG files\n\n"

    if [ $# != 1 ]
    then
        usage
        exit 1
    fi

    XTSN=$1

    if [ $XTSN != "JPG" ] && [ $XTSN != "jpg" ]
    then
        usage
        exit 1
    fi

    ls *.$XTSN >/dev/null 2>/dev/null
    if [ $? != 0 ]
    then
        printf "There are no $XTSN files in this directory. Nothing to compress.\n"
        exit 1
    fi

    # Convert from JPG to BMP
    COUNTER=0
    printf "Converting $XTSN to BMP\n"
    for i in *.$XTSN
    do
        printf "$i\n"
        let COUNTER=COUNTER+1
        /opt/mozjpeg/bin/djpeg -bmp $i >$i.BMP
    done
    printf "\n"

    # Remove the old JPG files
    printf "Removing old $XTSN files\n"
    rm *.$XTSN

    # Convert from BMP to jpg
    printf "Converting BMP to jpg\n"
    for i in *.BMP
    do
        printf "*"
        /opt/mozjpeg/bin/cjpeg -quality 80 $i >$i.jpg
    done
    printf "\n"

    # Remove the old BMP files
    printf "Removing BMP files\n"
    rm *.BMP

    # Now rename from jpg to JPB
    # The ren utility is from the UNIX Power Tools book
    printf "Renaming *.$XTSN.BMP.jpg to *.$XTSN\n"
    ~/ren "*.$XTSN.BMP.jpg" "#1.$XTSN"

    printf "Compression completed. $COUNTER files processed.\n\n"

Silly sign of the day:


Free/Open Source Software


Security Theater/"Intellectual Property"

Tuesday, 28 April 2015

I took my '52 Plymouth and teardrop trailer to a car show at KTEC, on the Rathdrum prairie on Saturday. As is usual for this time of year, first it rained really hard on the show, then it graupeled (soft hail) on us. Other than that, it was nice to see so much participation at a first year show.


I was re-reading this month's edition of Linux voice and I came across a review of an interesting program called mozjpeg. It compresses JPEG image files, making the files smaller without causing them to be incompatible with the JPEG standard. I decided that would be a good thing to do, as my web site contains literally dozens of directories with JPEG files in them. There are about 12,500 JPEG files in those directories.

I managed to find a Debian package for mozjpeg and installed it. It took me a while to figure out how to use the programs (there are two of them). I had to write a shell script to do all the required operations, as the programs only work on one file at a time and I wanted them to do all files in a directory. The script works fine, but I will have to modify it as it is case-sensitive and won't work for some of my files.

Here's the bottom line of the exercise: I compressed 9 directories of JPEG images (1,404 files) and reclaimed 70 MB of space. I am definitely going to do all the other directories. I suspect I will end up reclaiming at least 500 MB.


Silly sign of the day:


Free/Open Source Software


Security Theater/"Intellectual Property"

Thursday, 23 April 2015

We are starting into the car show season. There are five or six of them on Saturday. I am going to a new show that is being held at KTEC (Kootenai Technical Education Campus), over by Rathdrum. They are doing the show as a fund raiser for the school. I will be showing my '52 Plymouth and teardrop trailer, and will take a bunch of pictures of the show. There should be a good turnout.

I am slowly starting to work on the '49 Plymouth. I will be ordering a bunch of rubber parts in the next few days. They are expensive, but when you consider how they are done, you understand why. Basically, a restorer sends Steele Rubber the old piece they want replaced. Steele makes a mold and sends back the resulting part, asking if it's okay. If the restorer says yes, they add that part to their inventory. They must recover the cost of making the mold, which is not cheap.


While sitting in front of the computer working on this blog, I heard a bunch of gobbling outside. I looked out and saw a huge tom turkey, all puffed up and displaying for some hens. It's great living in the country.


I have added a final part (3) to my presentation about how to rapidly develop an application in Linux with Lazarus. That part is code-intensive and implements multiple highlighters, as well as a search capability.


Silly sign of the day:


Free/Open Source Software


Security Theater/"Intellectual Property"

Sunday, 19 April 2015

I have started backing up cassettes again. All that are left of that task are audio books. I have just finished I Thought My Father Was God. It was nine hours on six cassettes. The next shortest is The Clan of the Cave Bear, which is 21 hours on 14 cassettes. That will definitely take more than the two days the first one took. The longest audio book I have to back up is The Plains of Passage, which is 36 hours long on 24 cassettes. Lots of work, as I need to be present every 45 minutes to change the cassette.


I added a second part to the presentation about developing applications. I added some more pieces to the example editor, but none that are code-intensive. That means that the two items I would like to implement haven't been implemented. The first is picking a text highlighter based on the file extension of the file being edited. The second is implementing a Find/Find Next.


Here's a great snack combination:

Really, really good. I was going to make refried bean dip, but this is much better.


Silly sign of the day:


Free/Open Source Software


Security Theater/"Intellectual Property"

Sunday, 11 April 2015

On Friday, I realized that a presentation I had given at the 2011 Northwest Linuxfest was never posted anywhere on the web. I updated and edited the presentation, and you can now find it at Rapid Application Development in Linux Using Lazarus.

Friday, 10 April 2015

Now that I have finished and released HMSCalc-RPN, I am working on gdvdslides documentation so I can also release it. I have completely revamped the tutorial that comes with the program's help. Since gdvdslides help is in the form of web pages, I will also include those web pages as part of the gdvdslides web page on this site.

All the help pages now contain updated, labeled images. All the new program options for the latest version of the program are also documented and some are utilized in the tutorial.


Silly sign of the day:


Free/Open Source Software


Security Theater/"Intellectual Property"

Monday, 3 April 2015

I have finally gotten my hours/minutes/seconds calculator packaged as a Debian package. I have created a home page for it here.

The problems with packaging for Debian are

I have overcome this, but not without a lot of work.


After reading a comment at the Teardrop Trailer Forum, I discovered I had not created an EPUB version of their cookbook. I did that this morning and uploaded it. There is a link to it at your left.


We haven't had anything except rain in the last month or two, but I woke up this morning to this:

We ended up with 3 or 4" of snow, which proceeded to melt from about 9:30 am on.


Silly sign of the day:


Free/Open Source Software


Security Theater/"Intellectual Property"

Friday, 3 April 2015

I spent most of the day yesterday up in Priest River, ID with one of my classic car buddies. We drove the 45 miles back with this car. Pete drove this one while I followed in my Concord.


It's a 1949 Plymouth Deluxe. Three years later, they renamed this model 'Concord'. So I now have two of them. The '49 is in pretty good shape, with bias-ply tires and all the parts there. The engine runs great and the transmission is fine. All the doors are tight and the interior is in very good condition. It needs some minor stuff like a paint job, brake lights hook-up and clutch adjustment. I'm going to clean it up and drive it while I work on the minor stuff. I suspect it gets lots better MPG than the Concord.


Silly sign of the day:


Free/Open Source Software


Security Theater/"Intellectual Property"