Wednesday, June 29, 2022

Photo Shootout: Bulky Phone vs Bulky Camera

In my last post I suggested that the Samsung Galaxy S22 Ultra's camera was a step up from previous phones I'd owned. The most obvious improvement was the inclusion of a functional telephoto lens. So can I stop hauling around my heavy Canon T6s with 75-300mm lens?

Let's take a look. Here's some pics from a recent blueberry picking expedition we enjoyed at Butler's Orchard. Note that each photo is annotated with the device that shot it.

I see two ways to look at these photos.

On one hand, the Canon with its 300mm lens definitely has more reach than 10x zoom on the S22. The Rebel's photos also seem less digitally processed to me. Finally, I was able to snap pics of the soaring turkey vulture with the DSLR that I didn't even attempt with my Galaxy. So yeah, the Canon T6s continues to outperform my cell phone.

On the other hand, the Samsung let's me tell essential the same story with the photos that the Canon did, all while fitting in my pocket. For example, I wasn't able to zoom in quite as tight in the bee pics using the phone, but I still got close enough and clear enough photos to see the expression on the child's face as he peered into the bee hive.

Also, I can clearly see room for improvement in the Rebel's pic quality; they aren't are sharp as I'd like. I'm not sure whether there are settings I need to tweak, or if it's time to consider a lens or body upgrade. If I factor in convenience and consider how close the phone came to matching the DSLR, I could argue that the Samsung won the day.

Alas, I think the answer to my original question continues to be 'no.' No, I can't opt to leave the DSLR at home and expect to capture the same photos with my phone. For action and wildlife photography, where I'll be at a distance and I want to capture as much detail as possible, as quickly as possible, the 300mm lens and Canon T6s are still my best option.

With that said, the S22 Ultra continues to impress. Should I be without my Canon I'm more confident than ever that I can capture the story of what I've witnessed; which is the ultimate goal.

Here's to hoping that Samsung continues to find ways to bend the laws of physics and that my next phone contains a high quality 100x lens.

Tuesday, June 28, 2022

Samsung S22 Ultra: Camera Hype vs. Reality

I've had a Galaxy S22 Ultra for about a month and a half. About the only downside to the phone is its weight: it's like carrying around a brick.

Fortunately, the phone's performance outweighs this annoyance. The S-Pen has been the biggest surprise, with quality and features surpassing anything I expected.

The phone's marketing material promised a 10x zoom. Between that and other stats on on camera, I had my expectations set fairly high. Does the S22 meet them? More audaciously, can I finally retire my heavy DSLR relying solely on the S22?

To answer the first question, consider these 'wildlife' pics I captured around my neighborhood using my new S22:

These photos all take advantage of the 10x zoom. In short, I'm impressed. I simply couldn't have captured these shots using past phones. Using a cheap add-on lens I may have gotten similar framing to these pictures, but then the quality would be nowhere near as crisp*. Additionally, the external lens takes time to find and mount. By the then, my subject easily could have moved on.

To me, the 10x zoom is far more than just a marketing gimmick. It really does make a class of otherwise impossible shots possible. My verdict: the s22 does find a way to step up the cell phone camera game, and meets my high expectations.

So, can I retire my DSLR? Hold that thought, I'll cover that in my next post.


*Of course, another way to look at this scenario is that my Galaxy S10+ and a $4.99 plastic lens can at least get into the neighborhood of what the Galaxy S22 Ultra can produce, all at a fraction of the cost. Perhaps that's higher praise for the lens than it is for the S22.

Friday, June 24, 2022

Defeating Blogger's Preview Click Trap

One quirk of Google's Blogger platform is that when you preview posts it sets up an invisible HTML element overlaying the page that keeps click events from being delivered. For example, in preview mode, this link can't be clicked on. In the preview page source code, Google names this element appropriately: blogger-clickTrap. Click trap, indeed.

If you right-mouse click on the preview page and select 'Inspect' you can see the details of this overlay:

Removing the click trap using the inspector panel is straightforward. Add display: none to the blogger-clickTrap element's style and clicks work again.

For years I've either ignored the click trap, or when necessary, manually removed it.

Yesterday, however, I wrote a post that made heavy use of click events. While composing the post I found I needed to frequently refresh the page and then take a few moments to manually remove the overlay. After the 100th time of doing this, I stopped what I was doing and took a moment to consider: could I automatically disable the blogger-clickTrap element?

Tampermonkey to the Rescue

With a few minutes of consideration, I realized that Tampermonkey should be able to save the day. Tampermonkey allows custom code to be injected on the page of your choice. All I needed was to write a few lines of code that would set display: none on the right element when the page loaded, and the click trap would be a distant memory.

I created a new Tampermonkey script to get started:

// ==UserScript==
// @name         Bye-bye clicktrap!
// @namespace    http://blogbyben.com/
// @version      0.1
// @description  Remove blogger preview's clicktrap
// @author       Ben Simon
// @match        https://draft.blogger.com/blog/post/edit/preview/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=blogger.com
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    console.log("Is this thing on?");
})();

I loaded up the preview page and success!

I then updated the code to show that it could find the offending element:

// ==UserScript==
// @name         Bye-bye clicktrap!
// @namespace    http://blogbyben.com/
// @version      0.1
// @description  Remove blogger preview's clicktrap
// @author       Ben Simon
// @match        https://draft.blogger.com/blog/post/edit/preview/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=blogger.com
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var found = document.querySelector('.blogger-clickTrap');
    console.log("Found it!", found);
})();

And that's where I hit a problem: no matter how or when I queried the document, my Tampermonkey script couldn't find the click trap element. In the inspector, I could see it was there, and yet, I couldn't programatically access it.

After much debugging I realized that the preview page is a generic shell and imports a specific post by using an iframe pointed to https://<something>.blogspot.com/b/blog-preview?token=.

my attempts to access the iframe's contents via the main page were being denied, apparently because they weren't from the same origin.

My first thought was: I'm already mucking with these requests, perhaps I can turn off this security policy that's blocking me?

However in my search to figure out how to do this, I realized there's a much simpler solution. I needed to be running my Tampermonkey script not on the preview page, but on *.blogspot.com/b/blog-preview*.

When I updated the @match rule on the script above, my code began to work:

Once I was running the Tampermonkey code on the right URL, having it remove the click trap itself was trivial. Here's the final Tampermonkey script:

// ==UserScript==
// @name         Bye-bye clicktrap!
// @namespace    http://blogbyben.com/
// @version      0.1
// @description  Remove blogger preview's clicktrap
// @author       Ben Simonm
// @match        https://*.blogspot.com/b/blog-preview*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=blogger.com
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var found = document.querySelector('.blogger-clickTrap');
    found.style.display = 'none';
})();

Happy clicking!

Thursday, June 23, 2022

Story Time: The Pumpkin

It all started back in October of 2020 with a delightful trip to the pumpkin patch.

After checking out many pumpkins and taking many pictures, we decided to bring home this little guy.

Rather than carve him up for Halloween, we gave him a bath and put him on display.

When he started to get soft, we put him our backyard to feed the local flora and fauna. And then winter happened.

In the spring time, among all the weeds growing in our backyard were a few pumpkin plants. Once identified, their massive leaves were hard to miss. It was a pumpkin-patch miracle!

For weeks, our pumpkin plants grew. One day, flowers started to appear.

Before we knew it, our back yard was bursting with giant yellow pumpkin flowers. Pumpkin flowers are magnificent.

One day, a tiny pumpkin started growing off one of the plants.

And it grew.

And grew.

Finally, we were heading out of town one weekend and we opted to clip the pumpkin off the vine to keep it from getting noshed on by squirrels.

What can you do with a tiny green pumpkin? First, we carefully extracted and dried the seeds. How amazing is that our one little pumpkin can give us more pumpkins!

With the seeds separated, we turned our attention to cooking the the pumpkin. It was green, so we doubted it would taste good. We followed a 'recipe' a civil war soldier logged in his diary when he found himself with little to eat but a green pumpkin: slice up the pumpkin, add a little salt and sugar, and fry in butter until till tender. It was delicious!

As the last hard frost date approached, we took our dried pumpkin seeds and soaked them in water to get them ready for planting.

When we were confident the ground wasn't going to freeze again, we picked a few places around our property to plant the seeds. To increase our odds of success, we mixed our pumpkin's seeds with a packet of seed we purchased off of Amazon.

A few days later, the seeds sprouted! Of course, this is how plants work and this is all perfectly normal. Still, seeing a sprouting seed feels like witnessing a little miracle.

And now our next generation of pumpkins is growing. Will they grow massive leaves like their daddy did? Will they produce beautiful flowers and maybe even another tasty and beautiful pumpkin? We'll have to wait and see.

The End.

Wednesday, June 22, 2022

The Cure for Card (and Dice) Game Amnesia

It seems that whenever I have a deck of cards, a group and some time I immediately forget every card game I've ever played. This fact, combined with some upcoming travel had me looking for a fresh solution to remembering the names of, and rules to, interesting card games.

Before I started working on a solution to this problem, I decided to expand the challenge a bit. I picked up a 10 pack of dice for $1.99 with then intention of adding dice games to my repertoire.

Code It

I eventually settled on a simple plan. Rather than build a comprehensive list of games, I focused on just a few, about 5 card games and 5 dice games. From there, I created a cheat sheet for each game to simplify remembering the rules and game play. You can find version 1.0 of this effort over at: github.com/benjisimon/offline-games.

Each game has its own Markdown file that captures the rules, scoring and links to How To Play resources on the web. I created two PHP scripts to work with these files. One script converts the Markdown file to a portable HTML file, while the other creates a top level index for browsing the games.

The Markdown files try to be consistent in how they describe game play. The hope is that the terse and consistent nature of each file will make it easy to bring myself and others up to speed on how a game is played. Looking at what I've created, you'll see that some of the files are fairly detailed, while others are little more than learn more links.

Keep in mind that the point of the cheat sheets is to give me a quick reminder as to how the game is played; not to be a comprehensive guide to the rules.

Once you grab the github repository, you can run make to generate the relevant HTML files.

$ make
(cd scripts/lib ; composer install)
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Package operations: 1 install, 0 updates, 0 removals
  - Installing michelf/php-markdown (1.9.1): Extracting archive
Generating autoload files
mkdir -p games/card/
php -f scripts/mkhtml.php srcs/card/Ninety_Eight.md > games/card/Ninety_Eight.html
mkdir -p games/card/
php -f scripts/mkhtml.php srcs/card/Golf.md > games/card/Golf.html
mkdir -p games/dice/
php -f scripts/mkhtml.php srcs/dice/Bunco.md > games/dice/Bunco.html
mkdir -p games/dice/
php -f scripts/mkhtml.php srcs/dice/Ship_Captain_Crew.md > games/dice/Ship_Captain_Crew.html
mkdir -p games/dice/
php -f scripts/mkhtml.php srcs/dice/Ducks_in_a_Bucket.md > games/dice/Ducks_in_a_Bucket.html
mkdir -p games/card/
php -f scripts/mkhtml.php srcs/card/Horse_Race.md > games/card/Horse_Race.html
mkdir -p games/card/
php -f scripts/mkhtml.php srcs/card/Rummy.md > games/card/Rummy.html
mkdir -p games/card/
php -f scripts/mkhtml.php srcs/card/Casino.md > games/card/Casino.html
mkdir -p games/dice/
php -f scripts/mkhtml.php srcs/dice/Farkle.md > games/dice/Farkle.html
mkdir -p games/card/
php -f scripts/mkhtml.php srcs/card/Coup.md > games/card/Coup.html
mkdir -p games/card/
php -f scripts/mkhtml.php srcs/card/Cribbage.md > games/card/Cribbage.html
mkdir -p games/card/
php -f scripts/mkhtml.php srcs/card/Slapjack.md > games/card/Slapjack.html
mkdir -p games/card/
php -f scripts/mkhtml.php srcs/card/The_Mind.md > games/card/The_Mind.html
php -f scripts/mkindex.php > index.html

Serve It

Because the HTML files are all self contained, you can open them up in any web browser, including your phone's. You can also serve up the files via a simple web server. On my desktop I can browse the games using PHP's built in web server:

$ php -S localhost:9001
[Tue Jun 21 15:35:46 2022] PHP 7.4.27 Development Server (http://localhost:9001) started

More than a little surprisingly, I can do the same thing under Termux and proot on my Galaxy S22 Ultra. Again, I'm using PHP's built in web server:

A less geeky Android solution is to install the Simple HTTP Server app on your phone, and serve up the content that way:

The most practical way I've found to access the game files on my phone is to open up the games directory in My Files and select the Add To Home screen option. Once this is done, a short cut is added to my home screen that gives me one click access.

Problem Solved. Maybe.

I'm far from convinced that I've actually solved the problem I set out to.

On one hand, curating a limited set of games was clearly a good idea. And writing up the cheat sheets is very much in line with the adage that if you want to truly understand something, teach it to others.

The Markdown, PHP and Make solution was fun to work out. Learning that I can run php -S localhost:9000 under Termux / proot and access that content via my phone's browser is downright mind blowing.

On the other hand, I'm not convinced that my game write-ups are of any more useful than existing web content. In fact, I fear that my cheat sheets will end up being both incomplete and hard to understand. And I'm pretty sure I could replace nearly this entire project with a simple Google Sheet that included a list of games and links to existing How To Play videos and web pages.

Still, I'm glad I've got this iteration of Offline Games built out and I'm psyched to field test it over the next couple of months.

Casino anyone? How about a round of Ship, Captain and Crew?