iPod Touch
#355 Henry, Wednesday, 07 February 2018 11:18 AM (Category: Apple)
(Tags: ipod)

Our project manager left. He did FIRE, especially the last part of that - Retire Early.

The day before he flew to Mexico for an extended stay, he delivered a box of gadgets to me. He ran out of time to sell the stuff on eBay or hand it to friends and family, so he dumped it on me, and I was glad to get it.

There were Apple Lightning cables, and converters and dongles. There was an Apple USB modem. I haven't seen anything like that in years, and I can't even test it, not having a land line at home. There were two portable USB DVD Burners, and a portable USB 3.5" floppy disk drive.

Best of all, there were two iPods. One was an 8 gig iPod Nano, same as the one I already have. Best part of these iPods is that they pick up FM radio. I will sell this iPod. And there was an 8 gig iPod Touch. I had one of these a long time ago, but sold it. The batteries on both work just fine, and last a good time.

I started using the iPod Touch and have been enjoying it greatly. I love the smaller size of it. I have an iPhone 6S and I thought the size of that was pretty good, but now I have the iPod Touch to play, I realise that I like the smaller size much more. Perhaps the next work phone I get should be an iPhone 5.

I also came to realise that I liked the older versions of the iOS operating system more than I like the current version. I deeply dislike gestures. I don't like the more modern look of the iPhones either. It might suit young people with good eyesight, but to me it does not look good. I've been upgrading steadily on my iPhone, and it's like the fable of the frog in the pot of heating water. The irritations come very slowly, and I adapt to them. But that gets disrupted when I get a glimpse of what it was like when iOS was pretty good.

I think when I retire and hand back my work phone, I won't get one for myself. I can live without a phone.

And I am deeply disappointed in my iPad. I wish I could take back the latest upgrade. The latest upgrade really sucked. It continues to suck for me. I don't think I will get another iPad. I use it mostly for reading, so I think I will devolve to a good ereader, and that won't be a Kindle. It will be a tablet of some sort that handles epubs that I supply. A Kindle is a lock-in marketing device.

Every year that passes reinforces my belief that every app and application and device will be upgraded until it is no longer useful for its original purpose.

iPod Touch

No comments
Reading ebooks on the command line
#354 Henry, Tuesday, 06 February 2018 3:34 PM (Category: Books)
(Tags: ebook epub acroread calibre)

I live on the command line. I live in xterms almost all the time. I mostly use a GUI desktop to manage a whole slew of xterms. I do use graphical tools when they are needed, but mostly I spawn them off from the command line, and shut them down when done, and return to the command line. I am more efficient this way. Your mileage no doubt will vary, but this is how I do it.

I have been processing a lot of books lately, and this has introduced me to a number of irritations.

I use two viewers of ebooks - acroread for PDFs, and ebook-viewer for almost everything else. Ebook-viewer is a part of Calibre, and it works very nicely inside Calibre, but you can also run it from the command line. There is one irritating aspect with both of these, when I run them from the command line. If I get the filename wrong, they both start up, both display an error that the file cannot be found, and I have to click on that error dialog box, and then shut down the program. Far too many clicks to recover from a typing problem. This usually happens when I use tab-completion on the command line and there are multiple files that match the starting criteria.

This became irritating enough that I decided to stop it. First, I created two small shell scripts. I used ev for ebook-viewer, and ao for acroread (ac and ar are existing programs in Linux and I didn't want to overload them). They would check if the file exists, and stop if it isn't. If it does exist, they would fire up acroread or ebook-viewer.



if [ -f "$F" ]; then
  /usr/bin/acroread "$F"
   echo "$F does not exist"

As many of the books I am processing use spaces in the filename, I had to make sure I used quotes around $F in the scripts.

That worked very nicely for a time. And then I thought why don't I combine them and make a single script that can be used to read any book, and it decides what to use to view it. So I amalgamated them and came up with this script, which I called br (book-reader):



if [ ! -f "$F" ]; then
   echo "$F does not exist"

case $F in
  *.pdf)    /usr/bin/acroread "$F" ;;
  *.epub)   /opt/calibre/ebook-viewer "$F" ;;
  *.mobi)   /opt/calibre/ebook-viewer "$F" ;;
  *.azw)    /opt/calibre/ebook-viewer "$F" ;;
  *.azw3)   /opt/calibre/ebook-viewer "$F" ;;
  *.txt)   /usr/bin/view "$F" ;;
  *)        echo "'$F' cannot be viewed";;

I threw in txt files too, and view them with the read-only version of Vim.

But once I did that, and looked at the man page for acroread, and the help for ebook-viewer, I realised that I could solve some other irritations.

Acroread, no matter what I do, is going to display errors about files not existing even when they do. I could get rid of this rubbish by redirecting stdout and stderr to /dev/null.

If I have a PDF open, and then in another xterm in another window, I open another PDF, then the two PDFs appear in the one acroread screen in tabs. And if I go to shut it down, then it complains about shutting down multiple PDFs. And if I avoid that trap and just close the PDF I no longer want, the remaining PDF is in the wrong window. I am able to solve this whole mess by using -openInNewInstance on the command line and each PDF would get its own instance and things would work the way I want them to work.

Another irritation is opening a PDF and finding that it is scaled down to 20% and it's unreadable, or scaled up to 300% and equally unreadable. This was solved by using /a "zoom=100" on the command line. And because when I am checking books for the correct names and authors I always want to start at the beginning and not where acroread last left off or where the author wants me to start reading the book, I can force it to open on page 1 too, by expanding the /a option to /a "zoom=100 & page=1".

Ebook-viewer has less start up options, probably because there are less things irritating me, so the only thing I wanted to do with it was force it to start at page 1 too, and that is done with --open-at=1.

So I added these options to my br script and ended up with something that works really well for me.



if [ ! -f "$F" ]; then
   echo "$F does not exist"

case $F in
  *.pdf)    /usr/bin/acroread -openInNewInstance /a "page=1 & zoom=100" "$F" > /dev/null 2>&1 ;;
  *.epub)   /opt/calibre/ebook-viewer --open-at=1 "$F" > /dev/null 2>&1 ;;
  *.mobi)   /opt/calibre/ebook-viewer --open-at=1 "$F" > /dev/null 2>&1 ;;
  *.azw)    /opt/calibre/ebook-viewer --open-at=1 "$F" > /dev/null 2>&1 ;;
  *.azw3)   /opt/calibre/ebook-viewer --open-at=1 "$F" > /dev/null 2>&1 ;;
  *.txt)   /usr/bin/view "$F" ;;
  *)        echo "'$F' cannot be viewed";;

If I learn new tricks, I can easily expand this script. It's a good start, and my irritation level is seriously reduced, but more importantly, I am much more efficient using this script. I can process books very quickly now.

No comments
Turning off search in the URL bar of browsers
#353 Henry, Monday, 28 August 2017 10:38 AM (Category: General)
(Tags: search browser firefox chrome)

I have old habits formed from long ago. I have strong likes and dislikes. I often feel out of step with modern computing and modern development and modern web practices.

Many years ago, the Firefox browser changed their URL bar to be both a place to type in a URL and a place where you could type in search terms. It irritated me a little, but I coped. I still have the search bar to the right of the URL bar. I type URLs in the URL bar and most of the time they autocomplete. I type search terms in the URL bar and they search. Lately, it's been bugging me that when I type some terms in the URL bar, the autocomplete doesn't work and it searches on it, and I end up with a Google page of search results. If it happens once in a while, I ignore. But lately, it started happening far more frequently. It started happening enough to trigger my "how can I turn this off" reflex.

Then I remembered that Chrome has a similar issue. They have a URL bar and it's a search bar and URL bar combined, and I have even more problems with this. I was backtracking frequently. And then there's the privacy issue. Sometimes I just want to go to a URL and not let Google know about it. Using Chrome, that's probably futile anyway.

So on the weekend I got triggered enough to do something about it. I searched for ways of turning it off. Yes, I used Google search to find out how to turn off search in the URL bar.

For Firefox, these are the steps.

  1. Bring up about:config
  2. Search on keyword.enabled
  3. Toggle that to False.
  4. Then use the URL bar for URLs and the search bar for search terms.

Chrome is more difficult. You only have one bar to serve both URLs and search. I ended up adding a new search engine, and then making it the default.

  1. Click on the three vertical dots at top right "Customize and control Chrome".
  2. Then choose Settings.
  3. Choose Manage search engines.
  4. To the right, below the default search engines, click on ADD.
  5. Add a new search engine, with Null for both Search engine and Keyword, and http://%s in the URL.
  6. Scroll down to the bottom, and click on the three vertical dots to the right of that entry, and then select Make default.

So now the URL bar is only for URLs. If I want to search, I have the home button turned on, and google.com set as my home page. I click on the home button, then search in there.

So that eases my irritation.

No comments
Blurays and makemkv on Linux
#352 Henry, Monday, 07 August 2017 2:43 PM (Category: Linux)
(Tags: bluray makemkv linux)

My workflow for Blurays has involved Macs for a long time.

I have a portable Bluray drive that I attach to an old MacBook, and I use makemkv to rip the main film to a mkv file, which I then transfer to my Linux desktop, where I process it. I've been doing it that way for quite some years. When I started this process, I don't think Linux handled Bluray, whereas Macs did.

Recently, I did a fresh install of Slackware on my Linux desktop and I noticed what I thought was Bluray support. And then I found that makemkv is available for Linux too, and even better, it's in sbopkg, and even better still, it downloaded and installed and actually worked. I used it to make mkvs from some DVDs.

This weekend, I attached the portable Bluray drive to my Linux desktop, inserted a Bluray and ran makemkv. And it just worked. It looks pretty much as it does on the Mac, and it sure works the same way.

makemkv on Linux

Only thing was, it warned me that it was a beta version and I had 30 days and I needed to register and pay for a license. I dug out my old license key from 2013, entered it, and that was that. I was licensed. It works. It created mkvs of the Bluray titles. Even better, the mkvs include the Bluray subtitles, which can be used by Handbrake. This does everything I want.

Now my Bluray workflow does not involve the Macs at all. It will be a lot faster from now on.

No comments
Fortnightly cron jobs
#351 Henry, Tuesday, 01 August 2017 3:22 PM (Category: Linux)
(Tags: linux cron)

In the League Website that I run, the players requested a fortnightly league - start and stop on Mondays and run for two weeks.

Up till now, I've only every had weekly events or monthly events. I stop and start the events by running scripts from cron. Weekly and monthly are very easy to set up in cron. Turns out fortnightly is not so easy.

Weekly events are easily started with a cron job like this:

59 16 * * 1 $HOME/wgl/bin/weekly_start.py -l15 >> $HOME/wgl/bin/weekly.log 2>&1

My first approach was to think about it and try a few things myself. I failed.

So I searched online for ideas from others. StackOverflow and ServerFault had plenty of ideas about running test in cron. I experimented with it, but found it hard to specify which Monday to start on. It kept starting on the Monday after the one I wanted to start on. The logic was difficult to understand, it was hard to restart and manually fiddle with it. So I kept looking for a simpler solution.

Eventually, I found the SysTutorials website that had a couple of methods of doing it. First, using test in the crontab again. The second way immediately interested me.

They called a shell script every week, and that script would test if it was the first or second week by the existence of a small dotfile. If it was not there, run the rest of the script and create the dotfile. If it was there, delete the dotfile and exit. Very neat, very elegant, and you could set which week to start it on by either changing the logic slightly or touching the dotfile. So I set up cron to do this:

59 16 * * 1 $HOME/wgl/bin/skyfall_start.sh

And the start script looked like this:


# a file marking the state on disk

# check whether the job run last time it is invoked
if [ -e $mark_file ] ; then
    rm -f $mark_file
    touch $mark_file
    exit 0

# Run the league start
$HOME/wgl/bin/fortnight_start.py -l34 >> $HOME/wgl/bin/skyfall.log 2>&1

That worked and got me started. But I thought about it some more and decided I could simplify this a lot. I don't really need a shell script to go in-between cron and the Python fortnight_start.py script. I could build that logic directly into the Python script.

So I simplified cron to look like this:

59 16 * * 1 $HOME/wgl/bin/fortnight_start.py -l34 >> $HOME/wgl/bin/skyfall.log 2>&1

and added this code to the start of the fortnight_start.py Python script:

#!/usr/bin/env python

import sys
import os

home = os.getenv("HOME")
markfile = "%s/.skyfall_start" % (home)

if os.path.isfile(markfile):
    fh = open(markfile, 'a')

# Rest of the Python to start the league event

That's the simple version without any error checking or exceptions. And for my purposes, I probably won't use any as I control the environment and it works well enough, and if anything goes wrong, my players will rapidly alert me to it.

Having done that, now I can see how to easily create three-week events or two-month events or five-day events or any sort of crazy event. This opens up a lot of possibilities.

I like how the control is a dotfile that I can touch to create, or rm to delete for manual fiddling. That lets me easily restart or switch around events. For non-binary events (example one week on, two weeks off), I could extend it by considering the contents of the dotfile.

No comments