Ben Lobaugh Online

I think, therefore I am. I am, therefore I sail

S/V Shadow - 1987 Catalina 36

Introducing “Shadow”, our new Catalina 36 sailboat

Update: Shadow has her own website! See it at https://svshadow.com

I am very excited to announce that Alix and I have completed the purchase of S/V Shadow, a 1987 Catalina 36. She is in tip-top shape and ready to take us cruising!

S/V Shadow - 1987 Catalina 36
S/V Shadow a 1987 Catalina 36

Shadow started her life in Long Beach, CA and had the same owner for 33 years! The original owner used her to visit Catalina Island, which is an easy cruising distance from Long Beach. From the time it left the factory, the boat has been professionally maintained, and it shows. The first time I stepped onto the boat I wondered if I had somehow been transported back in time to when she was new!

The second owner purchased her in August 2020, trucked her up to Washington, re-rigged her and then set about doing lots of updates, such as new stereo, new faucets, fresh bottom paint. Oh, and all new B&G instruments! This owner was not able to take her sailing before moving out of state, making us the third owners, but second users of the boat :).

The Catalina 36 is a stable boat, with a large and comfortable cabin for the family. The cockpit is roomy enough to have many friends aboard for good times sailing. Her amenities, such as: inverter/charger, fridge and freezer, toilet, shower, hot water, and a stove, will make for luxury cruising in Puget Sound.

Most importantly, Clara loves the boat!

How to fix the “sed command expects \” error on Mac OS

If you are familiar with the sed command on Linux then you might be in for an unpleasant surprise the first time you try to use it on Mac OS.

Mac OS runs the BSD version of the sed command. As such, there are some syntax differences.

An example of a classic sed command, that is used in build scripts everywhere:

sed -i 's/WORD/REPLACEMENT' file.txt

If you run that command on Mac OS you will be very grumpily greeted with the error:

sed: 1: "file.txt": command expects \ followed by text

huh?

Oh right, this is the BSD version of sed.

You could fiddle with the command until you find something that works on Mac OS. Then you have to ensure it still works on your Linux machines as well.

Or, you could bypass the issue and install the GNU sed via Homebrew.

I choose the second option. It is easier and none of my build scripts will require changes. It can be installed with:

brew install gnu-sed

After install, there will be a new command called gsed. This is great, but still requires updating everything using sed. Simple fix, alias sed in your shell profile. I am still a bash user, so I edit ~/.bash_profile and add the line:

alias sed='gsed'

Source the profile file and voila, the familiar sed version has been restored for you on Mac OS!

Happy sedding.

Photo by Green Chameleon on Unsplash

Highly Performant PHP Sessions with Redis

The web is stateless, but often the apps we build are not. To facilitate state in web apps, PHP provides a session handling mechanism. Sessions are off by default, and enabled with the `session_start()` function.

Read more about PHP session handling at https://www.php.net/manual/en/book.session.php

If you have worked with PHP sessions before you may have noticed performance issues caused by the `session_start()` function. On a small scale your app may be ok, but as you scale up issues will pop up. In particular, if the app makes several ajax calls back to the server during a page load there will see issues. This happens because PHP stores its sessions as files on the drive. During each request, PHP opens the session file for reads and writes. The file is locked during the request. That means if there are three ajax requests to the server, request two and three will be blocked waiting on the request in front of them.

By way of example, let’s assume the web server responds in 300 milliseconds for a single request and we have the initial request with three ajax requests that run asynchronously.

The load time should be: 
300 ms initial request + 300 ms ajax requests = 600 ms

When using PHP’s default session the load time becomes:
300 ms initial request + 300 ms ajax request one + 300 ms ajax request two + 300 ms ajax request three = 1,200 ms or about 1.2 seconds!

And that is a light example. With content systems, such as WordPress, shipping with a built in API, it has become common practice to send many requests to the server during a single page load.

To get around the file locking issue we have to change the session storage mechanism. PHP provides the ability to write custom session handlers. We could do that, or we can tap into the Redis session handler. Redis does not have the locking issue, and it is already set up to be highly scalable. File based sessions are dubiously scalable at best.

To get it running all we need to do is update two lines in the php.ini file to instruct PHP to use Redis and where to find the Redis server. I will not cover how to set up a Redis server in this article.

Open the php.ini file and add or update the following two config values:

  • session.save_handler
  • session.save_path

The session.save_path value instructs PHP where to find the Redis server.

For example, the config values may look something like:

session.save_handler = redis
session.save_path = tcp://1.2.3.4:6379

Restart the PHP service and you will see sessions being stored in Redis instead of the filesystem.

If you do not have access to the php.ini file do not give up hope! It is also possible to set these values during the application runtime with the following PHP code:

ini_set('session.save_handler', 'redis');
ini_set('session.save_path', 'tcp://1.2.3.4:6379');

Make sure those two lines run before the session_start() function is called.

Depending on the server configuration, it may also be possible to set this in a .htaccess file.

Congratulations! Your users will now experience a considerable performance boost, and you have taken another step towards building a highly scalable and performant site.

First water adventure of 2021!

What a beautiful day to be on the water!

Still boatless, Harold and Jesse took us out on their 36′ Unitflite, for a tour around the Tacoma harbor, across to Dockton, and we even poked into Gig Harbor to pick up some lunch at Tide’s Tavern.

This was Clara’s longest trip on the water, and she loved it! She even kicked Harold out of the captain’s seat and took over for a while 🙂

Turn Me Up! How I Control My Own In-Ear Monitor Mix

“I need more of myself! Turn me up!” – Musicians Worldwide

It is an age old dilemma for the sound crew- how to provide the volume levels that each musician wants in order to hear themself. I recall the time when floor monitors were ubiquitous and all the time the band would spend arguing over their monitor levels. In smaller venues it sometimes to the point that the stage monitors were louder than the house speakers! The drop in price of good in-ear monitors to a range the average music could afford was a game changer.

As a drummer, I love in-ear monitors because it puts the monitor audio closer to my eardrums. I do not have to strain to hear the floor monitor over the sounds of enthusiastic banging. 

As a keyboardist, in-ear monitors have allowed me to increase the lushness and types of sounds I can use. Getting the floor monitor volume up where I wanted it often would cause the rest of the band to not be able to hear their own part due to the covering nature of pads.

One problem solved, but there is still the issue of many mixing consoles having a limited number of aux channels for monitors.What I commonly encountered were four aux channels, split something along the lines of:

  • Piano
  • Singers
  • Drums and bass
  • The rest of the band

That left everyone to bicker about their own volume still.

Nearly two decades ago I came up with a deceptively simple solution that allowed me to both hear as much of myself as I want and control my own volume. All without affecting anyone else sharing the monitor mix. In fact, I could be removed from the monitor mix entirely if desired and still hear myself. 

The solution: Run the monitor send from the board and the output from your instrument into a personal mixer.

Here is a diagram of the idea:

The Personal Mixer sits next to your instrument and allows you to turn up and down the volume of your instrument independently of the monitor mix coming from the soundboard.

During set up, connect a splitter to the output of the instrument, in my case a keyboard. One side runs into the direct box and out to the house, the other into the personal mixer. The monitor send from the house runs into another channel on the personal mixer. Headphones plug in to the personal mixer and viola! I now have control to hear myself as loudly as I would like.

For the splitter, go with something like

My current go to personal mixer is the Rolls MX28, due to it’s compact design and how easy it is to mount on a flat surface.

Other mixers I have used with great success

And, of course everyone wants to know what earbuds I used. For the price and sound quality I have never found any better than the KZ lineup

Page 1 of 168

Powered by WordPress & Beards