Author Archives: jligda

Underwear & Alzheimer’s

Until you have given a pair of underwear to a person with Alzheimer’s do you realize what a complex piece of clothing they really are. There are so many combinations of holes, directions and appendages that can go in them. Just with the legs along (which is the appropriate way to begin to wear underwear), there are 36 permutations of legs vs holes combinations, and that not even taken into consideration forwards and back. I have yet to see them put on the arms (which is where socks often go), but I have seen them used as a headpiece. Of course, that is something I also remember from my high school/college partying days. So next time you put on your underwear correctly, pat yourself on the back for a job well done! Especially if you are a man and you have the extra pocket in the front, which might lead to additional complexities and challenges.

Ice Cream, Alzheimer’s and a Pandemic

It used to be easy … when I’d go to San Francisco to run an errand and I’d bring my mother with me, we’d stop by the world famous Ghirardelli for an ice cream.  Ghirardelli sits north of Fisherman’s Wharf near the Maritime Museum, Aquatic Park and the South End Rowing Club, where I spent a great deal of time swimming while i lived in San Francisco many years ago.  I moved out of San Francisco to Benicia CA when my Mom was diagnosed with Alzheimer’s.  The apartment in the City was too small to move her in so I could take care of her, so now we live in the ‘burbs in beautiful Benicia.
Even with Alzheimer’s she enjoys the ice cream.  She may forget it 5 minutes later, but in the moment she will be totally focused on the ice cream with occasional pauses to come up for air and exclaim, “This is delicious,” or “This is tasty.”  I get the “Marina” which is raspberry sherbet with the famous and delicious Ghirardelli hot fudge and whipped cream.  It comes with a square of Ghirardelli dark chocolate, which I eat myself.  I choose the Marina because it is the lowest in calories.  I’m conscious of my weight.  To reduce the calorie intake even more, I split the ice cream with my Mom.  OK, OK, the confession is out, it’s not really ice cream, it is sherbet, but the principle is the same.
 
Like I mentioned, it used to be easy.  We’d go to the City, usually across the Golden Gate Bridge.  Even though it is longer from Benicia, it is a nicer drive.  In addition to the sherbet, we’ll stop for a view or short walk here or there along the way.  Then, once across the bridge we make our way to Ghirardelli where we’d get our ice cream.  Often we’d brave the crowds an eat in the restaurant, but mostly, if it is nice out, we’d eat the ice cream outside looking at the beautiful view of the Bay.
20210130_124708
 
Now, however, is the time of the pandemic!  While this adds a few challenges to the average person, when dealing with someone with Alzheimer’s the challenges are multiplied.  For the average person the rules are to wear a mask, keep social distance (six feet apart) and indoor dining is closed.  The only option is to eat outside and enjoy the view.
 
For my Mom, with Alzheimer’s, there are the additional challenges.  She will not wear a mask.  She does not understand it, so just winds up pulling it right off.  Also, as an elder, she is a part of the most vulnerable population to the virus, so I want to be extra careful not to expose her to it.  Bringing her inside a public space is out of the question.  The last time we tried the ice cream at Ghirardelli during the pandemic, I attempted to leave her outside within eyesight so I could keep an eye on her and make sure no one got near her and she did not touch anything, while I went in.  However she kept trying to follow me in.  With the line at the register it was going to take too way long for me to be in there.  I finally had to abandon the ice cream dream and go for a walk instead.  If it was a quick in, place order and out while waiting for the order, and then back in to pick up the order when it was ready, I could have pulled it off, but that wasn’t going to happen on that day.  It was too risky!  I did learn from that experience, and was determined to succeed this time!
 
As we drove passed Ghirardelli, I could see the line.  It looked longer because people are spaced out, six feet apart, all wearing masks.  Ghirardelli is still open during the pandemic because it is considered “essential,” as a food service, but really … ice cream?  I was not complaining.  While it was right there, with all the challenges, it seemed this might not work out.  Everything had to be perfect, to get ice cream while keeping mom safe.
 
My plan was to leave my Mom in the car.  The trick is to be able to park close so I can have her in sight the entire time and only be gone for a minute or two.   I’m equipped with a handicap placard so this increases my chances.  I was in luck!  There was an open handicap spot right across the street.  The next trick was the line … I had to be able to bypass the line.  I took out my handy smart phone, went to the Ghirardelli website to see if they had online ordering.  I was in luck!  I could order through Doordash.  Of course I had to sign up for an account and enter credit card information.  This took about 5 or 10 minutes in total.  At anytime I could have abandon the plan and no one would have cared.  I kept thinking to myself, “I must really want this ice cream to go through all this effort.”  In the long run and big picture it was not going to make a difference, but at this point, I was not going to quit that easily.
 
Finally I got to the last part of placing the order, “pickup or delivery,” hmm, could I have them bring it to the car?  No, I didn’t want to complicate things.  I was just across  the street and could be there and back in less than a minute.  The app said it would notify me when the order was ready.  Everything was perfect!  However within 10 seconds of placing the order, I got a notice that it was ready.  Really?  What, do they have Flash employed scooping up ice cream and oozing hot fudge all over it?  I was skeptical.  I assumed they were just saying to was ready because they did not want ice cream sitting around waiting for pickup and that they were really going to make it once I got there.  There goes my quick pick up!  I was going to have to stand there and wait for it while my Mom, without memory would suddenly finding herself in a strange car in a strange place not knowing how or why she was there.  Can you imagine what that might be like?  Whenever possible, even though I know she is safe, I do not like to leave her along very long just because of those moments of worry. Like the ice cream, she will forget the experience within a minute or two, but she still goes through the experience whether pleasant like eating ice cream, or unpleasant lie worrying about where she is and if she is safe.
 
Parked and ordered, I still wasn’t quite ready for the Ghirardelli dash.  There are still details.  Ideally I leave music on in the car for her to focus on.  In my truck, that is easy because the radio plays without the key.  However today I had my sister’s car.  It’s a much nicer ride than the truck, so I borrowed it from her instead of taking the truck.  No key = no music.  I’ve learned from experience, leaving the key in the car with her is not a good idea.  She likes to touch things an push button.  Can you imagine trying to explain, through a closed window, to someone with Alzheimer’s how to unlock a door that got accidently locked while I was away?  Again, in the truck that is not an issue.  Without power locks it is hard for her to manually lock the door on the driver’s side.  But somehow, with the power locks, she has managed to lock both doors in the past.  In the pandemic, I do not want to leave the window rolled down, as that may expose her to the possibility of some passerby with the virus.  So I’ll take the key with me.
 
These details seem endless that we might normally take for granted in going to get an ice cream, but now I really was ready to go.  “BRB,” I said to her.  There are only two abbreviations that she remembers, “BRB” for “be right back,” and “RBI,” for “runs batted in.”  Don’t ask me why.  “BRB,” I said, “don’t worry.”  If I’m fast enough, she will not forget those words by the time I get back.  However, I figured that was not going to be likely knowing they probably still haven’t made the ice cream.  My heart was racing as I put on my mask and darted across the street.
 
There was a pickup table outside the shop, so I didn’t even have to go in.  A woman was just exiting the table with her ice cream and big smile on her face.  The shop employee was still there after helping the pervious woman and was looking me in the eye as I approached.  Perfect, no waiting!  I glanced quickly and smugly at the line of people going into the shop and then back at the employee.  “I have a Doordash order for Jay,”  Without a word she turned back into the shop, grabbed the ice cream that was sitting on the counter (it was ready!), and brought it back to me …  in less than 10 second.  However, I had to send he back in, to bring me an extra spoon.  I may share the ice cream with my Mom, but not the spoon!  I darted back across the street (looking both ways, of course) back to my Mom who was sitting there as happy as could be.
 
No, my friend, the story is not over.  We still have to eat the ice cream.  While we could just sit there in the car and eat it, but that is no fun.  We are just a few hundred yards away from one of the world’s most beautiful views of the Bay.
 
While it was January in San Francisco, it was still a nice day.  There was a little chill in the air, but not too chilly for ice cream.  Mom was bundled in her jacket.  I grabbed her by the hand and the ice cream in the other and walked her across the street.  I could feel the warmth of my Mom’s hand on my left and the warmth of the hot fudge through the plastic cup in my right hand.  There were many people out.  I had to pause often and alter my path to keep mom away, more than six feet, from anyone.  I’m glad for all those years growing up that I played Frogger.  This was real life, Frogger.  Then, after we crossed the street and down a path, there it was… a perfect empty bench.  I say her down in the middle of it, where she could not touch the arm rests on either side.  I tucked the ice cream to my side with my elbow to free up both hands and applied sanitizer to both her’s and my hands.  Then the feasting began.  She was loving it.  All the effort felt justified.  I could barely get my spoon is as she held the ice cream tight shoveling it into her mouth.  “This is yummy,” she kept explaining.  On occasion she’d let me hold the cup for a while and I would dive my spoon in, particularly interested in the gobs of chocolate, which were was no longer “hot,” that were clinging to the sides of the cup.  In the end,  I think she had more than I, but I was satisfied.
20210130_132611
 
Finally the last bit of the ice cream was removed from the cup.  She showed it to me that it was done.  “That’s that on that,” she said.  Not convinced, I took it from her and scraped the sides for just a little more chocolate.  I left her there on the bench for a moment as I deposited the much empty cup in the nearby garbage can.  Then back to the bench where we sanitized our hands again.  I held her, slightly cold hand from the cup as we walked back to the car.  Another game of Frogger ensued as we avoided others back to the safety of the car.  Job well done!

Squirrel vs. Bike

Today, while riding my bike, a squirrel darted out in the road ahead of me about 20 yards away, so well out of h. arms way However, it stopped dead in its tracks in the middle of the road.  Without much though I aimed my front wheel right at it figuring that it was either going to go forward or go back, but rest assured, it would not be in the same spot that I was currently aiming at.

As I drew closer, the squirrel did not move!  Proportionately my confidence that it would move started to fade as my anxiety about running the little guy over increase.  I could feel a rush of adrenaline suggesting I act.  Memories of running over a squirrel with my bike a few years ago flashed through my mind, as well as the horror of watching it run off into the bushes dragging its now broken hind legs behind it.  Certainly, I owe a karmic dept to that poor soul as it surely lived out the rest of its shortened life suffering.

I did not want that to happen to this creature that was still motionless with the doom of a speeding bike drawing rapidly closer to it.  I made the quick decision to veer left to the stern of the squirrel.  Squirrels, as you may know are very quick and can turn on a dime to dart in any direction.  Just because its front was facing the other way was no guarantee that it would head in that direction, but that was the gamble that I took in that moment.

The rest of the bike ride was uneventful.  I finished the 26 mile loop in just a little over two hours … slower than I’d prefer, but at least I was free of guilt as the squirrel and I chose alternate paths that did not test the theory that two object cannot occupy the same space.  That experiment, i can try another time … in a safe and controlled environment.

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:
https://en.wikipedia.org/wiki/Niagara_Escarpment
http://onmilwaukee.com/visitors/articles/niagaraescarpment.html
https://en.wikipedia.org/wiki/Bruce_Peninsula
https://en.wikipedia.org/wiki/Michigan_Basin
http://historyoftheearthcalendar.blogspot.com/2014/03/march-12-michigan-basin.html

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: http://stackoverflow.com/questions/11240127/uploading-image-to-amazon-s3-with-html-javascript-jquery-with-ajax-request-n.  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://*.yourdomain.com).  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=”http://s3.amazonaws.com/doc/2006-03-01/”>
<CORSRule>
<AllowedOrigin>[YOUR_FULL_DOMAIN]</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>PUT</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>

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):

<?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.’.s3.amazonaws.com’;

$policy_document=’
{“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):

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

function hmacsha1($key,$data)
{
$blocksize=64;
$hashfunc=’sha1′;
if (strlen($key)>$blocksize)
$key=pack(‘H*’, $hashfunc($key));
$key=str_pad($key,$blocksize,chr(0x00));
$ipad=str_repeat(chr(0x36),$blocksize);
$opad=str_repeat(chr(0x5c),$blocksize);
$hmac = pack(
‘H*’,$hashfunc(
($key^$opad).pack(
‘H*’,$hashfunc(
($key^$ipad).$data
))));
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/’+file.name;
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);
fd.append(‘signature’,signature);

fd.append(“file”,file);

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);

xhr.open(‘POST’, ‘https://’+bucket_name+’.s3.amazonaws.com/’, true); //MUST BE LAST LINE BEFORE YOU SEND

xhr.send(fd);

}
}
xmlhttp2.open(“GET”,theSource2,true);
xmlhttp2.send();

}
}
xmlhttp.open(“GET”,theSource,true);
xmlhttp.send();

}

function uploadProgress(evt) {
if (evt.lengthComputable) {
var percentComplete = Math.round(evt.loaded * 100 / evt.total);
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 – ” + evt.target.responseText );
}

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.”);
}

</script>

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>
<div id=”fileName”></div>
<div id=”fileSize”></div>
<div id=”fileType”></div>
<div class=”row”>
<input type=”button” onClick=”uploadFile()” value=”Upload” />
</div>
<div id=”progressNumber”></div>
</form>

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.