Author Archives: jligda

Trifecta, Comedy of Errors

My New Year started with a trifecta of comedy of errors. I got up early to pilot 100 swimmers from Alcatraz, the annual South End Rowing Club New Years Day Alcatraz. I’ve swum it a couple times during the hey-day of my San Francisco Bay swimming. Now I mostly just pilot swims.

My wallet had been missing for a few days. I could log in to my various financial accounts and could tell that there was no account activity. I just put it somewhere and could not remember where. I did a quick search around my house but did not turn anything up. I would do a more thorough search later. I could not think of anything I would need it for, but my sister was concerned if I was driving around without my license that I might get in trouble, and yes, I did wind up having to talk to a cop later in the day.

I also did not have my cell phone charger cable. It disappeared out of my hands the other day. This is the one I use in my car. It’s one of those fancy ones that retracts and is the one I like to use in the car. I took it out of my car and had it in my pocket the other night and then it just disappeared when I was putting it back in the car. Maybe it fell on the street or under the seat, but I looked everywhere. It’s one of those silly minor things that makes me sad to have lost it. I have yet to admit defeat and put one of the other many charger cables that I have at home back in the car.

I had 100% charge on my phone as I left. I figured that would be enough even if I were taking lots of pictures or the swim out on the bay.

The swim went off without a hitch … well without a hitch relevant to this story. I took many pictures while keeping the swimmers safe. By the end of the swim, I had 40% charge on my phone. This was still plenty to get me home. It was only an hour drive.

I had a little extra time before I had committed to being home so elected to swing by our rental unit in the City. We are doing some renovating due to a fire. I wanted to see what work had been done last week.

Because of the renovating, we have a lockbox outside with keys to the units that we are renovating for the various contractors. What I discovered when I arrived is that the lockbox had been missing. In retrospect, it was not too smart to attach it to the garage door handle, which was easily kicked off. A missing lockbox meant the building and apartments were compromised.

OK, missing wallet and the cell phone charger are a part of the trifecta comedy of errors. The break-in was not. One of the apartments was ransacked and items were stolen. That was when I called the police, all the while thinking about my sister’s warning of getting caught driving without my license. When the officer asked me for my ID, I just explained that I didn’t have it. He just took my information verbally.

By the time I was done at the apartment, all the texts and phone calls, my battery was at 1%. While waiting for the police I actually hopped in the car to go to the local drug store to purchase a charger but quickly remembered, I had no wallet!  You can see where this is going!  I asked the tenant, whose apartment was ransacked if she had a charger. “Yes,” she said and went to go get it. Well, let’s just say it is now on the list of items that got stolen.  I really didn’t need a phone for the ride home … so I thought.

The missing wallet and dead phone, two of the legs on the trifecta comedy of errors. What is the third?

I have a modern car with digital readouts. I usually keep it on display for average miles per gallon. I like to get it at 27. However, when I get close to an empty tank, I switch it over to “Cruising Range,” that tells me how many miles I have left on the tank of gas. When I left this morning it was at 60, which is more than enough to get to the City and back. I like to fill up at the Safeway in Vallejo as it is less expensive and figured I’d hit it on the way home.   With the extra trip to the apartments, however, the display was now at 19 as I started my trip home. I might be able to make it to the Vallejo Safeway but had better stop for gas just to be on the safe side. I knew the best stations on the way.

“Oh, s#$&,” I thought as I started to pull up to the gas station, “I don’t have my wallet!” I looked at my phone, which was now dead. I fumbled around the car looking for a lost $5 bill that might be there. There was about 40 cents in change. That would not help! I continued driving. The trifecta complete!

The good news is that the trifecta jogged my memory enough to remember where my wallet was. When I stayed the night at my father’s house the other night, I put it on the bookshelf.  I remembered putting it there, but I did not remember removing it when I left. I’m sure it must still be there.  This was perfect because that is where someone was who could come rescue me if I ran out of gas. If I could call!  I most likely would run out of gas.

The adventurous side of me wanted to try to make it home, but the practical side of me thought I should just find a safe place and try to call … but no phone. It’s better than being stuck on the side of the road … with no phone. “What are my options,” I thought. “Starbucks!” Someone at Starbucks will have a charger. There are even some Starbucks that have wireless charging stations. If I found someone kind enough to charge my phone I could buy them a coffee with my Starbucks app! All the things we take for granted with all our creature comforts and technology.  Funny, I didn’t even think of a paid phone … if they still exist.  I had 40 cents in change.  Or, what else would have people done in the “old” days?  Going into a business and borrowing a phone.  These things never crossed my mind.

As I drew near to Starbucks I saw a Best Buy coming up on the right. “That’s a better option,” I thought. Across the street from Best Buy was an AT&T store. Somewhere, I was going to be able to get my phone charged! Best Buy came through. The kind folks at the mobile phone center plugged it in for me. I waited until it got to 5% before calling my brother, who lives at my father’s. “Guess where I am?” I asked.  As my partner owning the apartments (along with my father), I had been keeping him apprised of the situation with the robbery and my phone battery.  I told him that he’d never guess so volunteered the information, “I’m at the Best Buy in Pinole getting my phone charged.” Then I asked, “Is my wallet on the bookshelf in the spare room?” “Yes,” he replied after going back to the room to check. “OK, could you bring it to me. I ran out of gas.” We laughed.

Soon, my wallet and I were back together, phone charged to 25% and a gas station down the road. I coasted in on fumes, but was soon back on full!

Phone charger, wallet, and gas … don’t leave home without them!



Voice From Beyond

My friend Danny passed away way too young at the age of 24.  He drove off an embankment and that was the sad end for him.  A while after I was in my trailer where I lived in Arcata, CA when the phone rang. “Hey man it’s Dan,” the voice on the line said. I don’t know any other Dan and clearly from the tone he not only expected me to know him, but expected me to be surprised too. I can’t describe the feeling of getting a phone from the “other side.” It felt like the blood rushed out of my body.  I’m sure I turned as “white as a ghost” as the expression goes … as white as the ghost that apparently was speaking to me.

We often talk about ghosts and the after life, do we believe or not, but for the most part we do not know.  Here I was facing the prospect of moving from the whelm not knowing to having an actual experience.  What will become of me now?  I’d be that crazy guy swearing he knows and has talked to the dead, perhaps delivering messages to his family.  My world was about to change for sure … one I replied. There was a chilling cold accompanying the vacant feeling of blood.

“What? Danny?” I managed to say rather meekly. “No, Ken, man.  It’s Ken,” came a reply of relief.  My consciousness came back to reality.  It was my old buddy Ken from when I lived in Maine. He was still alive and kicking … and perfectly capable of making a phone call.  It felt good to get the blood circulating through my body again.  However,it would have been good to talk to Danny one more time.

How the Niagara Falls Formed

I left Niagara Falls without knowing much of how it was formed, so I did my own research and learned some very interesting things:

Niagara Falls was formed around 11,000 years ago when the receding glaciers carved out the great lakes.

The melt water began to flow over the Niagara Escarpment which is a wonder in itself. It is a long cliff that extends 1,000 miles from east-central Wisconsin to Upstate New York. It forms the northern boundary of Lake Michigan and Huron and Southern boundary to Lake Ontario. It has existed for 400 million years and is believed to be the edge of an ancient basin, the Michigan Basin.

When the glaciers retreated the escarpment was exposed and the melting water water began to flow over its edge. The water eroded the softer rock at the base of the escarpment wearing it away until the harder rock at the top of the cliff caves away. This keeps the flowing water flowing in a vertical fashion (a falls) rather than eroding into a cascade as the falls carved its way southward along the Niagara River. Over the 11,000 years that falls existed it carved the basin, moving it 6.8 miles southward from its original location at Lewiston, New York.

If you do the math that comes to and average of about 3 feet 4 inches per year, however while the water was flowing the erosion was probably greater. You see, after the falls was formed, for a few thousand years there was a time that it ceased to exist.

There is evidence that 8,000 years ago the water levels of the Great Lakes were lower by about 40 to 50 meters. During that time Niagara Falls would have dried up until the water levels rose again.

At the bottom of Lake Huron in the Bruce Peninsula there are the remnants of many waterfalls, many of these falls were greater than Niagara Falls, that used to exist during the time when the water levels were low.

Today the erosion caused by the Falls is greatly reduced by human intervention, mainly channeling about 75% of the water for hydroelectric power production.

Information for this article was gather from the following sources:

CORS POST to AWS S3 using PHP and AJAX

I’m going to post this here in case it helps someone down the line.  I spent days trying to get this to work including countless hours with AWS (Amazon Web Services) support, who go above and beyond to try to help.  Note: I modified the code a bit from my working, live example, so the code below is untested.  There may be a few minor bugs that I will let you work out :-)  And, sorry for the lack of formatting on the code below.

The problem is to upload a file from an HTML form on a website and have it go directly to an AWS S3 Bucket.  Sounds easy, right?  Here are the issues:

  1. The POST upload will work directly, however when we put the request in AJAX we run into issues with the denial of Cross Origin Requests Sharing (CORS).  This means a request from one domain is not accepted by a different domain … unless it is approved on the receiving domain’s server configuration.
  2. The request requires a policy and a signature that need to be generated on the requesting server.  The signature includes information (filename) of the file being uploaded, so it needs to be generated AFTER the file is selected.  Unless the filename is set in advance.
  3. The secret access key needs to be secure so the public may not see it.
  4. The AJAX upload POST request needs to be in a particular format.

The solutions:

  1. A few years ago AWS began to allow CORS on the S3 Buckets.  THis needs to be configured.  I’ll show you how to do in in a bit.
  2. I found many examples how to do this with Rails, but not with PHP.  The policy and signature may be done with AJAX requests to PHP scripts.  I’ll show you how i did this in a bit.
  3. The secret access key may be hidden in the PHP scripts as mentioned above.
  4. I’ll show you this.  I found it in this StackOverflow question here:  I modified it a bit to work with PHP.

Here is the code below:

Enabling CORS on your S3 Bucket

Log into your AWS account and browse over to S3.  Select the bucket that you wish you upload to and click on “Properties.”  Open the “Permissions” area.  Click on “Edit CORS Configuration.”  There you will see the CORS Configuration.  Change it to the code below substututing [YOUR_FULL_DOMAIN] for your full domain name.  This si the domain from where the POST request will originate.  You may use one wildcard (ex: http://*  You may also just use a straight wildcard here * to open it up to all origins.  This is helpful for testing and debugging.

<?xml version=”1.0″ encoding=”UTF-8″?>
<CORSConfiguration xmlns=””>

PHP Scripts to Generate Policy and Signature

I use two different scripts.  Each will be called with an AJAX request.  These will be separate PHP files on your server:

PHP to generate the policy.  (I saved this as filename:  php/s3_upload_create_policy.php):


$key = $_GET[‘key’]; // This is the filename as it will be uploaded to S3
$type = $_GET[‘type’]; // TThis is the file type

date_default_timezone_set(‘America/Los_Angeles’); // Update to your time zone
$now = strtotime(date(“Y-m-d\TG:i:s”));
$expire = date(‘Y-m-d\TG:i:s\Z’, strtotime(‘+ 10 hours’, $now)); // This sets the policy expiration time. I select 10 hours from now, but it can be much less. Keep in mind time zone differences from your instance time to the time of the AWS region that your bucket is located.

$aws_access_key_id = ‘[YOUR_ACCESS_KEY_ID]’; // Substitute for your access key ID
$bucket = ‘[YOUR_S3_BUCKET]’; // Substiture for your S3 Bucket name (ex: my_aws_bucket)

$acl = ‘public-read’; // if you prefer you can use ‘private’
$url = ‘http://’.$bucket.’’;

{“expiration”: “‘.$expire.'”,
“conditions”: [
{“bucket”: “‘.$bucket.'”},
[“starts-with”, “$key”, “‘.$key.'”],
{“acl”: “‘.$acl.'”},
[“starts-with”, “$Content-Type”, “”]

// create policy
$policy = base64_encode($policy_document);

echo $policy;


PHP to generate the signature.  (I saved this as filename:  php/s3_upload_create_signature.php):

$policy = $_GET[‘policy’];
$aws_secret_key = ‘[AWS_SECRET_ACCESS_KEY]’; // Substitute for your secret access key

function hmacsha1($key,$data)
if (strlen($key)>$blocksize)
$key=pack(‘H*’, $hashfunc($key));
$hmac = pack(
return bin2hex($hmac);

function hex2b64($str)
$raw = ”;
for ($i=0; $i < strlen($str); $i+=2)
$raw .= chr(hexdec(substr($str, $i, 2)));
return base64_encode($raw);

$signature = hex2b64(hmacsha1($aws_secret_key, $policy));
echo $signature;


Page Script

And finally we need the HTML page script.  This includes the javascript and the form.

Here is the javascript.  This is mainly copied from the StackOverflow question mentioned above, with a few minor tweaks including nested AJAX requests to the PHP documents above to generate policy and signature.  You will need JQuery as well.  I’m using 2.1.3:

<script type=”text/javascript” src=”/js/jquery-2.1.3.min.js”></script>
<script type=”text/javascript”>

function uploadFile() {

bucket_name = [YOUR_AWS_BUCKET_NAME]; // Substitue with your bucket name
access_key_id = [ACCESS_KEY_ID]; // Substitue with your Acess Key ID

var file = document.getElementById(‘file’).files[0];
var fd = new FormData();

var key = ‘uploaded/’;
var type = file.type;

theSource = ‘/php/s3_upload_create_policy.php?key=’+key+’&type=’+type;

var xmlhttp;
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
} else {// code for IE6, IE5
xmlhttp=new ActiveXObject(“Microsoft.XMLHTTP”);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
policy = xmlhttp.responseText;

theSource2 = ‘/php/s3_upload_create_signature.php?policy=’+policy;

var xmlhttp2;
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp2=new XMLHttpRequest();
} else {// code for IE6, IE5
xmlhttp2=new ActiveXObject(“Microsoft.XMLHTTP”);
xmlhttp2.onreadystatechange=function() {
if (xmlhttp2.readyState==4 && xmlhttp2.status==200) {
signature = xmlhttp2.responseText;

fd.append(‘key’, key);
fd.append(‘acl’, ‘public-read’);
fd.append(‘Content-Type’, file.type);
fd.append(‘AWSAccessKeyId’, access_key_id);
fd.append(‘policy’, policy);


var xhr = new XMLHttpRequest();

xhr.upload.addEventListener(“progress”, uploadProgress, false);
xhr.addEventListener(“load”, uploadComplete, false);
xhr.addEventListener(“error”, uploadFailed, false);
xhr.addEventListener(“abort”, uploadCanceled, false);‘POST’, ‘https://’+bucket_name+’’, true); //MUST BE LAST LINE BEFORE YOU SEND





function uploadProgress(evt) {
if (evt.lengthComputable) {
var percentComplete = Math.round(evt.loaded * 100 /;
document.getElementById(‘progressNumber’).innerHTML = percentComplete.toString() + ‘%’;
else {
document.getElementById(‘progressNumber’).innerHTML = ‘unable to compute’;

function uploadComplete(evt) {
/* This event is raised when the server send back a response */
alert(“Done – ” + );

function uploadFailed(evt) {
alert(“There was an error attempting to upload the file.” + evt);

function uploadCanceled(evt) {
alert(“The upload has been canceled by the user or the browser dropped the connection.”);


And finally here is the HTML.  This is mainly copied from the StackOverflow question mentioned above:

<form id=”form1″ enctype=”multipart/form-data” method=”post”>
<div class=”row”>
<label for=”file”>Select a File to Upload</label><br />
<input type=”file” name=”file” id=”file”/>
<div id=”fileName”></div>
<div id=”fileSize”></div>
<div id=”fileType”></div>
<div class=”row”>
<input type=”button” onClick=”uploadFile()” value=”Upload” />
<div id=”progressNumber”></div>

The last mystery will be how to get the Access Key ID and Secret Access Key.  This is done in AWS’s IAM service.  I will not go into detail.  You need to set up an IAM user that has access to the S3 Buckets.  I did this a long time ago and do not have the specific steps.


Raccoon Communication

I woke up early this morning.  After making use of the time to get a little work done, I lay myself down to try to sleep a little bit more.  It was working too, however just as I was about to doze off I heard a strange sound … like a cooing.  I discounted it at first, but the cooing persisted.  It was coming from outside, I could tell, so I wasn’t worried about it.  I knew it was likely a raccoon.  As long as it didn’t find its way through the cat door and inside to the cat food, we won’t have any trouble.  There hasn’t been a raccoon invasion in a long time.  Until now I had not known if they had just not been around or if they had given up trying to get through the cat door.  I used to block it off every night since the last invasion.  However, I had grown lazy about it after a month or so of consistent cat door closure and stopped doing it.  Six or so months had past without an incident.  I, as well as the cats, have been happy about that.

The cooing outside continued.  Sometimes closer, sometimes at a greater distance.  I had to investigate, and I looked out the window into the dark street.  I could hear the cooing across the street.  Then I got a visual and saw the critter running down the sidewalk.  The silouette definitely looked like a raccoon, but I was not sure.  I watched as it crossed the streets, up and down, back and forth.  Then into our yard where it climbed up the tree.  I had to go out to investigate, and I put on my robe.

I turned on the porch light and cracked open the front door.  I heard nothing so walked on out onto the lawn.  Then, I heard the rustling of the tree and the scampering of the critter as it ran away.  That would have put an end to my raccoon adventure for the night, had it not been for my curious and humorous mind.  “What strange behavior,” I thought, for a creature of the night … the scampering back and for and the constant chattering.  Wouldn’t a thieving animal want to be more stealthy as it went about its mission?  The only thing that I could think of is that it had a partner in crime and had been separated from it.  It was running around looking for it … back and forth, calling out to its friend “coo, coo.”  No, the poor raccoons did not have the convenience of cell phone technology to text each other, “Where the f$#% are you.”  Or did they?  Perhaps it was running back and forth and up the tree trying to get the best signal.  The cooing … the phone seeking out a signal.  Raccoon Cellular is just not that strong in Southampton, Benicia.

It’s Not the Truth …

“It’s not the truth.  It’s what I believe to me the truth.”  Huh?  Here we are distinguishing between the truth and what one believes to be the truth.  OK, people have a hard time telling the difference.  To compare the truth with a belief about the truth is like comparing a painting of a landscape with the actual landscape.  Even to most accurate painting is going to have some variation.  On top of that, the canvas is just not big enough to include the entire landscape.  A belief is the canvas for which the person paints their estimation of the landscape of truth.  It will never be 100% accurate, but it gives us somewhere to roam, otherwise we only will roam within our immediate surroundings.

On a simple level, I have to believe that there is a roadway, a bridge and that my car is in the driveway before I will attempt to go out the front door and drive to another City.  Those beliefs are based on my experience of reality.  However I have not experienced everything.  On each journey, I will add more to those beliefs.  Each time expanding the beliefs a fraction of an inch closer to reality.

I must be humble to know by beliefs will never 100% be the truth about reality.  And, one piece of new information may change everything.

A Real Abbott and Costello Moment

The scene:  Mom & Jay watching the Giants’ baseball game.  Mike Krukow and Duane Kuiper are announcing:

Krukow: He does that a lot like Bobby Bonds always did.
Mom (look of confusion on her face): Bobby Bonds?  Who is Bobby Bonds?
Jay: Bobby Bonds was Barry Bonds’ father.  (Mom still looks confused).
Jay (trying to guess what she is confused about.  Sadly, her cognitive abilities have been declining with her age):  Barry Bonds was the Giants’ big star that retired a few years ago.
Mom:  I know that, but I’ve never heard of Bobby Bonds (she’s trying to put things into perspective)
Mom (here it comes): Who played 1st?
Jay (in disbelieve she just asked that question.  I can’t think of how to reply until I just start laughing):  They both played left field.
Mom (starts laughing and references Abbott & Costello): Who played first (laughing).

She meant who played in Major League Baseball before the other.

Kirby Cove Swim, 2014

I failed the last time I did the Kirby Cove swim in 2012.  By the time I got to the opening of Aquatic Park I was still a quarter of a mile out.  I had to be picked up and repositioned.  In retrospect I wished I had just swum straight across and let the current do the work to carry me east.  That was my intention this year.   I’d rather end up across the bay early and swim parallel to the shore with the current than end up carried too far east and have to be repositioned again.

But ultimately it is up to the pilots.  We have to listen to the pilots even if we disagree.  It’s an issue of the safety of the entire swim and all the other swimmers.    We can’t get too far spread out, or the boat coverage is not as good.  They may also be aware of other hazard we cannot see with our fish-eyed view.

During the briefing we were instructed to swim directly south until we reached mid span of the bridge.  We wanted to go under the bridge south of mid span.  This is important because at that point the current splits, the southern current heads straight into the Bay.  The north current will start to head north to fill Richardson Bay, flow through the Raccoon Straight and head on up to San Pablo Bay.  If a swimmer is stuck in that northern current it becomes a fight to get across.

After we cross under the bridge, we were instructed to swim east for a while.  The current is stronger the further out we are, but we don’t want to be out too far to make it too difficult to get to the other side before the current carries us to the opening of Aquatic Park.  That is the balancing act with this swim … finding the sweet spot, far out enough to catch the current, but not too far out we can’t get in on time.

This briefing was contrary to my plan, but I had to let that go and trust the pilots and swim organizers.

We had the coverage of one kayak for every two swimmers.  We were to pod up with someone our speed.  I’m pretty slow and had a hard time finding another slow swimmer.  I podded up with someone I did not know too well, but suspected was faster than me.  He asked me how fast I was in the pool.  He said he was about the same … but that’s another story.  That’s the pool.

We swam together for about 25 minutes.  He was backstroking to keep pace with me.  Eventually he started to pull ahead, splitting the kayak coverage.  The kayaker was staying in-between us, with each minute getting further away and I was swimming more alone.

I caught up to him at the bridge.  I crossed under about 100 yards south of mid span, so I was in good shape.  The kayaker instructed me to swim direct east.  I felt good that I made it past mid span and was perfectly OK abandoning my desire to keep swimming south.

From that point on I had the kayaker all to my self, Bill James, a very experienced pilot for our swims.  He told the other swimmer to go on ahead and catch up with another kayak.  Later I learned that he did this with no problem.

After about 10 minutes of swimming east Bill James instructed me to start heading into the shore.  Not directly at 90 degrees, but at about 30 degrees.  I still wanted to get across as soon as possible, but trusted his guidance.

It turned out to be perfect as you can see from my map:


Unfortunately I do not have a GPS trail of my last attempt, but what I think happened then is a failure to cross under the bridge before mid span.  Then I must have got caught in the northern current, which kept me out too far and for too long.

Now, what if I did the swim my way?  Here’s the deal … I’m a slow swimmer, yet I completed this swim mid pack instead of towards the end, like I usually do.  I finished before swimmers that I know are faster than me.  The reason?  After interviewing a few of them I learned that they went too far south where the current was not as strong and even reaching where there is a back eddy near Crissy Field.  If I did the swim my way … that too would have been my fate.  Instead, I had the perfect line.  I attribute this to my highly skilled pilot, Bill James.

Here are GPS details of the swim:

Buzzard Road Kill

I almost hit a buzzard on my bike ride today.  I was cruising down a slope about 25 mph when I heard the rustling of a startled animal in the bushes ahead of me.  Suddenly the shape of a huge bird flew out in front of me, just a few feet … I could have reach out and touched it!  I could hear the powerful trusts of its wings as it pushed against the air trying to get further out in front of me.  It’s big read head looked back at me as it gave a couple more trusts of its wings and veered off to the left.  “Wow!” I thought.  Then I started to wonder … who eats the buzzards when they become road kill?

Salton Sea

I just had an interesting visit to a very fascinating place that may not be around very much longer, the Salton Sea.

Most of this information comes from this website:  Please check it often for updated information.

Most lakes have been around for thousands of years and are a part of the natural balance of nature.  The Salton Sea was made by accident.  An engineering mistake flooded the waters of the Colorado River into the Imperial Valley over the course of almost two years.  The valley was not new to water:

View Larger Map

Above you can see how the area where the Salton Sea is now used to be a part of the Gulf of California.  Over the centuries the Colorado River dumped enough sediment to cut the Imperial Valley off.  Over the years 5 lakes have come and gone from the region.