RSS Atom Add a new post titled:

This is a test to see what happens when I try to make a post using my phone. Sometimes it would be a good idea to put a post for everyone else to read while I'm on vacation or bored at a movie theater. This could also be used for journal entries in a more private environment. What do you think? Leave your comments below. Sincerely, Terry

Posted Sunday evening, March 1st, 2020

No Litter Boxes

A gratuitious code block.

#!/bin/bash

if test -d /media/Nas; then
  for i in /media/Nas/*; do
    if test ! -n "$(ls -A "$i/")"; then
      mount "$i"
    fi
  done
fi

plaindir="$HOME/Private"
cryptdir="$HOME/.Private"

if test -d "$cryptdir"; then
  if test ! -n "$(ls -A "$plaindir")"; then
    echo "Mounting $plaindir..."
    encfs --extpass="secret-tool lookup Private tjgolubi" "$cryptdir" "$plaindir"
  fi
fi

~/sync/bin/ubuntu/mntpcloud.bash
#include <rci/Time/Utc.h>

#include <vector>
#include <algorithm>
#include <cassert>

using namespace std;
using namespace std0x;
using namespace std::chrono;

namespace {

time_t MakeTimeT(int year, int month, int day) {
  if (year >= 1900)
    year -= 1900;
  rci::Time::GmTime result;
  result.tm_year = year;
  result.tm_mon  = month;
  result.tm_mday = day;
  return result.normalize();
}

} // local

namespace rci {

time_t UnixClock::Epoch() {
  static const time_t Result = MakeTimeT(1970, 0, 1);
  return Result;
}

time_t TaiClock::Epoch() {
  static const time_t Result = MakeTimeT(1958, 0, 1);
  return Result;
}

time_t GpsClock::Epoch() {
  static const time_t Result = MakeTimeT(1980, 0, 6);
  return Result;
}

namespace Time {

namespace {

TaiClock::time_point UtcEpoch() {
  static const TaiClock::time_point Result =
    TaiClock::time_point(seconds(10 - TaiClock::Epoch()));
  return Result;
}

} // local

TaiClock::time_point UtcConverter::toTai(GmTime t) const {
  int sec = t.tm_sec;
  t.tm_sec = 0;
  time_t tt = t.normalize();
  TaiClock::time_point result = _tai + seconds(tt + sec - _utc);
  if (tt < _utc)
    result -= _leap;
  return result;
}

GmTime UtcConverter::toUtc(TaiClock::time_point t) const {
  seconds dt = t - _tai;
  time_t tt = _utc + dt.count();
  if (dt >= seconds(0))
    return GmTime(tt);
  if (dt < -_leap)
    return GmTime(tt + _leap.count());
  GmTime result(tt);
  result.tm_sec += _leap.count();
  return result;
}

UtcConverter::UtcConverter(int year_, Month month_,
                           seconds offset_, seconds leap_)
  : _tai()
  , _utc()
  , _leap(leap_)
{
  _utc = MakeTimeT(year_, 3 * int(month_), 1);
  _tai = UtcEpoch() + seconds(_utc) + offset_;
}

namespace {

struct Leap {
  TaiClock::time_point tai;
  time_t utc;
  Leap(TaiClock::time_point tai_, time_t utc_) : tai(tai_), utc(utc_) { }
  explicit Leap(time_t utc_) : tai(), utc(utc_) { }
  explicit Leap(TaiClock::time_point tai_) : tai(tai_), utc() { }
}; // Leap

bool LessTai(const Leap& lhs, const Leap& rhs)
  { return (lhs.tai < rhs.tai); }

bool LessUtc(const Leap& lhs, const Leap& rhs)
  { return (lhs.utc < rhs.utc); }

const struct InitLeap {
 time_t utc;
 int offset;
} InitLeaps[] = {
  {          0,  0 }, // 1970 January
  {   78796800, +1 }, // 1972 July
  {   94694400, +1 }, // 1973 January
  {  126230400, +1 }, // 1974 January
  {  157766400, +1 }, // 1975 January
  {  189302400, +1 }, // 1976 January
  {  220924800, +1 }, // 1977 January
  {  252460800, +1 }, // 1978 January
  {  283996800, +1 }, // 1979 January
  {  315532800, +1 }, // 1980 January
  {  362793600, +1 }, // 1981 July
  {  394329600, +1 }, // 1982 July
  {  425865600, +1 }, // 1983 July
  {  489024000, +1 }, // 1985 July
  {  567993600, +1 }, // 1988 January
  {  631152000, +1 }, // 1990 January
  {  662688000, +1 }, // 1991 January
  {  709948800, +1 }, // 1992 July
  {  741484800, +1 }, // 1993 July
  {  773020800, +1 }, // 1994 July
  {  820454400, +1 }, // 1996 January
  {  867715200, +1 }, // 1997 July
  {  915148800, +1 }, // 1999 January
  { 1136073600, +1 }, // 2006 January
  { 1230768000, +1 }, // 2009 January
  { 1341100800, +1 }, // 2012 July
  { 1435708800, +1 }  // 2015 July
}; // InitLeaps

struct Leaps: public vector<Leap> {
  Leaps() {
    int n = sizeof(InitLeaps) / sizeof(*InitLeaps);
    reserve(n);
    int offset = 0;
    for (int i = 0; i != n; ++i) {
      const InitLeap& l = InitLeaps[i];
      offset += l.offset;
      TaiClock::time_point tai = UtcEpoch() + seconds(l.utc + offset);
      push_back(Leap(tai, l.utc));
    }
  }
}; // Leaps

Leaps& TheLeaps() {
  static Leaps Result;
  return Result;
}

} // local

TaiClock::time_point ToTai(GmTime t) {
  int sec = t.tm_sec;
  t.tm_sec = 0;
  time_t tt = t.normalize();
  if (tt < TheLeaps().front().utc)
    return UtcEpoch() + seconds(tt);
  Leaps::iterator iter =
      upper_bound(begin(TheLeaps()), end(TheLeaps()), Leap(tt), LessUtc);
  --iter;
  return iter->tai + seconds(tt + sec - iter->utc);
}

GmTime ToUtc(TaiClock::time_point t) {
  if (t < TheLeaps().front().tai)
    return GmTime(time_t((t - UtcEpoch()).count()));
  Leaps::iterator iter =
      upper_bound(begin(TheLeaps()), end(TheLeaps()), Leap(t), LessTai);
  --iter;
  seconds dt = t - iter->tai;
  time_t tt = iter->utc + dt.count();
  if (++iter == end(TheLeaps()) || tt < iter->utc)
    return GmTime(tt);
  time_t overrun = tt - iter->utc + 1;
  GmTime result(tt - overrun);
  result.tm_sec += overrun;
  return result;
}

} // Time

namespace {

TaiClock::time_point GpsEpoch() {
  static const TaiClock::time_point Result =
      ToTai(rci::Time::GmTime(GpsClock::Epoch()));
  return Result;
}

} // local

TaiClock::time_point GpsClock::ToTai(time_point t)
  { return GpsEpoch() + t.time_since_epoch(); }

GpsClock::time_point GpsClock::FromTai(TaiClock::time_point t)
  { return time_point(t - GpsEpoch()); }

} // rci

It's probably fair to say that even cat lovers don't love litter boxes. No matter how well you keep up with them, there always seems to be a lingering odor. Plus, litter often tracks all over the house. It's practically impossible to find a good place to put the litter box in a small house. Scooping the stuff is stinky and dusty.

Dogs don't need litter boxes. They can be house-trained and most can stick to a schedule. They can use the yard or do their business during walks around the neighborhood. You only have to pick up the poop, not the urine the way you have to do with litter boxes. And as for the poop, you can simply use poop bags on walks and a poop-scooper in the yard. Cleaning up poop may not be fun, but many think it's the lesser of two necessary evils.

Best of all, the poop and pee happen outdoors, not inside your home!

Dogs Just Wanna have Fun!

There's only so much play you can do with your cat. Many cats love to play with string toys and they'll bat their little cat ball toys around, but it's almost like they're humoring you. They can play on their own, not just with people.

Dogs absolutely love to play, and it's often interactive play that they want--especially with you. You can play fetch with a ball or a disc. You can enjoy an exciting game of tug-of-war. You can play chase in the yard. If your dog gets along well with other dogs, you can even set up a doggie "playdate" with another pup. Just make sure both dogs are healthy and will get along.

Dogs Adapt Better to Change

Cats are usually sensitive to their environments and dislike change. Many dogs tend to accept change more easily, especially when their owners act like it's no big deal. Of course, there are plenty of anxious and fearful dogs out there, but as a species, they're often calmer in the face of significant alterations to their lifestyles.

When it comes to introducing new people, pets, or items to your home or moving to a new house, cats generally need more time to adapt. They don't automatically trust that all is well. They want proof first. Most dogs take their cues from their owners. If you're cool and calm when that new baby comes in your door, chances are that your dog will be, too. Of course, some might not be quite as accepting of strangers.

More Control Means Less Destruction

Try to control a cat and you might hear the tiny sound of kitty laughter. Most cats will go where they want to go, jump where they want to jump, scratch where they want to scratch, and mark whatever they think needs marking. Then there are those hairballs, which are most easily found when you're barefoot in the middle of the night.

Yes, dogs can cause a whole lot of destruction, but you can usually crate train a dog and keep him and your home safe and secure while you're away. Most crate-trained dogs consider their crates to be their own special places. Try putting a cat in a crate or behind a closed door and you'll have one unhappy kitty.

Corrective training and a stern voice can have a lot of power over a dog. Try this with the average cat and you'll be lucky if he glances in your direction while continuing to do whatever he was doing.

Training Dogs is Easier (Possible)

Okay, cats can technically be trained, but even cat lovers admit that it's not usually as easy as training a dog. Even food-motivated cats will soon tire of training sessions and walk away. Or, they'll just smack the food out of your hand and eat it anyway. In general, cats train us humans better than we could ever train them.

On the other hand, most dogs actually enjoy training. It seems to give them a sense of purpose. It's a job, and most dogs love to work. Plus, many dogs are highly motivated by food and attention. They'll gladly sit, stay, shake, lie down, and roll over in exchange for a delicious reward.

Dogs seem to display a sense of pride when they've done a good job. In fact, dogs sometimes misbehave when they're bored. They need more exercise and mental stimulation. Training helps provide the latter.

Dogs Can Protect You

It's not in a cat's nature to defend you or your home. Cats are more likely to run and hide when faced with trouble. On the other hand, most dogs will instinctively protect their owners and their territory. They'll bark or growl to alert you to the presence of strangers, and many will even scare off intruders. Dogs can sense our fear and they'll respond if they think we feel threatened.

A large dog with a loud bark may seem like the better watchdog, but small dogs are sometimes even more alert when it comes to detecting outside noises. The little ones may not be able to physically fight off intruders, but they'll certainly alert you about the danger. And many would-be intruders will avoid contact with any dog for fear of being bitten, no matter what the pup's size. No offense, kitties, but protection is not your specialty.

When's the last time you saw a cat in a vest working hard to help people? It's true that cats have an important place in animal-assisted therapy, but they're generally not as well-suited to other types of work the way dogs are. Dogs have been helping people just about as long as they've been on earth. They were working on farms as herders and drovers hundreds of years ago.

Dogs have Greater Potential

Today, many dogs still work on farms, and they serve even more noble purposes. They act as service dogs, guiding the blind, assisting the handicapped, helping the police and military, participating in search-and-rescue efforts, and comforting the sick. Some dogs can even detect seizures and sniff out cancer. That's some way to earn one's keep!

Dogs Promote an Active Lifestyle

Cats tend to stay home and do their own thing, or they go out and do their own thing. Some people have been known to walk their cats through the neighborhood on harnesses, but that's not the norm.

Just like humans, dogs need plenty of exercise. The great thing is that we can make them part of our own exercise routines. Most dogs love to go on walks. Many enjoy running with their humans. Some can even be trained to run alongside a bike.

Many dogs make wonderful hiking companions. Also, dogs can participate in dog sports like agility, flyball, disc, and diving. Dog sports are great for fulfilling a dog's need for mental and physical exercise.

Dogs Come in More Shapes and Sizes

There are different breeds of cats, but many of them don't vary a whole lot in shape and size. Sure, you have your giant Maine Coon and your uniquely-coated Devon Rex, but most house cats are mixed breeds, sometimes called "moggies." They come in many beautiful coats and colors, but the differences between cats are subtle compared to the differences between dogs.

It's hard to believe that a tiny little Yorkie is the same species as the huge Great Dane. If you decide to get a dog, you'll have plenty of choices available. Do you want a giant dog, a small dog breed or something in between? Would you like a herding dog with endless energy or a cuddly lapdog? Perhaps a well-balanced mixed breed is your preference. Mutts are not to be overlooked! There are even some low-allergen dogs for the mildly allergic. There's a type of dog for just about any household.

(Hu)Man's Best Friend

The term "man's best friend" exists for a good reason. Dogs have been domesticated for 15,000 to 35,000 years or more. Dogs have been the faithful companions and loyal helpers of the human race throughout history. The bond between humans and dogs is unmistakable.

Cats seem to know that they were once worshiped as gods. Perhaps they resent the fact those days have ended. They may still be holding it against us.

I think it's fair to say that a dog's human is the center of his universe. A cat is the center of its own universe. We humans are merely orbiting servants (willing servants, of course).

Posted Sunday evening, March 1st, 2020