During the course of the day I encounter lots of challenges, some of which take minutes to solve and others that take much longer. My goal for this section is to keep track of these challenges and their solutions. I will turn the longer ones into articles, while the shorter ones will stay as blog entries. You can expect topics to range from very specific programming challenges to broader topics like life.

Below is a list of the recent blog entries. You can also browse the blog by using the tags on the right side, or if you know what you are looking for then you can use the search box at the top right.

How to try out macOS Mojave without messing with your primary install

I am generally excited to try out new software.  This was the case when Apple announced the public betas for macOS Mojave recently.  I was excited to try out the public beta, but I didn’t want to mess with my primary setup.  Unfortunately, my older spare MacBook Pro is no longer supported by Mojave so my only option was using my primary MacBook Pro, which was a little scary.  After looking around for a little bit, I learned that I could install Mojave on a new partition without messing much with the existing install.

Read full post… “How to try out macOS Mojave without messing with your primary install”

Getting to a Shell in Alpine Linux on Kubernetes

I have lately been experimenting with Kubernetes and containers.  As I was playing around with a few configurations I had the need for exploring a container’s contents interactively.  Kubernetes’s dashboard has functionality to get into a container, but it assumes that you are using the bash shell.  Unfortunately, any Apline Linux-based container images do not have bash installed so we have to resort to other options to get access.

Alpine uses the busybox provided ash shell (which basically a symbolic link to /bin/busybox).  To get to the prompt you have to run.

kubectl exec <POD_NAME> /bin/ash -it

Ansible/win_get_url downloading 1KB file?

I have recently been looking at using Ansible for managing some Windows-based web servers.  Fortunately, I was able to get the authentication configured properly, but as soon as I got to downloading PHP, the Ansible win_get_url module started behaving oddly.  It downloaded some other files as I would have expected, but it would download the PHP distributable as a 1KB file.

Read full post… “Ansible/win_get_url downloading 1KB file?”

Apache Benchmark (ab) tool acting slowly?

I recently needed to do some informal HealthDecision API concurrent session testing. I decided to try out the Apache benchmarking tool (ab).  Given that I needed something quick, I started a new HealthDecision session in the browser and used Chrome Developer Tools’ copy as cUrl functionality to get the headers and the POST data.  This obviously worked on the command line, but each request was taking close to six seconds when I used ab!

The request something like this…

ab -n 1 -c 1 -H 'X-Session-ID: XXXXXX' -H 'User-Agent: curl/Farhan testing'-H 'Connection: keep-alive' -H 'X-Session-Passphrase: XXXXXXX' -H 'X-API-Key: XXXXXXXXXXXXX' -T 'application/json' -p post-data.txt ''

It didn’t make much sense at first sight because the exact same request was less than half a second every time.  I tried running with output turned on (-v 4) and could see that it was waiting after it received the response from the server.  After some more troubleshooting, I finally realized that it was the keep-alive header causing ab to wait for the connection to close!

Lesson learned, pay very close attention to the headers.

How to split chunks in Webpack 4.0

Webpack 4.0 was released a few days ago.  I happened to be in the middle of updating an older app and decided to jump to this version; especially because the webpack team is claiming a significant improvement in compile times (up to 98%!). Read full post… “How to split chunks in Webpack 4.0”

cURL error 77: error setting certificate verify locations: CAfile

I recently started randomly seeing the following error in a development environment for a PHP application that I am maintaining.

cURL error 77: error setting certificate verify locations: CAfile: c:\<<Path removed>>\cacert.pem CApath: none (see

What was weird was that the CA file existed at the path that was shown in the error.  Restarting Apache seemed to fix the issue for a little bit, but then the issue would come back.

Read full post… “cURL error 77: error setting certificate verify locations: CAfile”

Logitech MX Ergo Trackball Review – Great Upgrade from the Logitech M570

Logitech MX Ergo Trackball

I switched to a trackball earlier this year because my wrist was getting tired after a few hours of using Microsoft’s Sculpt Ergonomic Mouse. After some search, it seemed that my only good option for a trackball was the predecessor to this trackball, the Logitech M570. I was a little disappointed in the build quality and the scroll wheel of the M570, so I was happy when Logitech announced the MX ERGO and pre-ordered it.

I used the M570 since July until the start of October when the MX ERGO arrived. Even though the MX ERGO cost almost twice what the M570 is going for, I am glad to see that the build quality is way better. The angle on this trackball also feels much more comfortable than the M570, which laid a lot flatter. I have now gotten used to the steeper angle on this and M570 now feels odd and a little “off.” Given how much time I spend using the trackball, I can easily justify the cost for myself.

I was looking forward to the inclusion of Bluetooth, but I was also a little concerned that it might not work as seamlessly as the proprietary Logitech adapter. After using it for a few weeks now, I am glad to report that it works just as well as the Logitech adapter and that now I don’t have to worry about connecting/disconnecting yet another USB device.

The older Logitech M570 Trackball

With Logitech’s new “Logitech Options” software for macOS, I have noticed that the forward/back buttons seem more reliable than the M570 buttons and that they now seem to work with more applications than their previous software/drivers. I have noticed that their Logitech Options Daemon software keeps using 1-2% CPU majority of the time. I am contemplating trying to use this mouse without the Logitech software, but I haven’t done it yet.

An additional benefit with Logitech’s new Options software is that I no longer have to run an additional application (called Scroll Reverser) to reverse the scroll direction. Their Options software has an “option” to reverse the scroll direction.

One thing that I am curious to see pan out over the next few months is the battery life. I did not use the M570 long enough, but I have heard that it easily lasts longer than a year. Logitech advertises the MX ERGO’s battery to last four months. My trackball shows about 2/3 battery still left to go after almost two-and-a-half weeks. Given that it’s sitting on the desk with easy access to plenty of micro-USB charging cables, I guess recharging this won’t be too big of a deal.

Overall, I am happy with my purchase and would recommend it.

Fluentd configuration for PHP errors

Lately, I have been working on centralizing the logs from all of our servers and application layers.  I decided to use Fluentd instead of Logstash because it claims better reliability without jumping through hoops (e.g. adding a kafka layer).

Anyways, working on the configuration, I noticed that it doesn’t have any default configs for PHP errors.  My quick google search didn’t reveal anything either.  So, I decided to write the regex myself.  Here is what I ended up with.  This also accounts for multiline stack traces.

 @type tail
 tag SERVERNAME.php.errors

 # Example
 #[03-Sep-2017 22:51:06 UTC] PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 65536 bytes) in Unknown on line 0

 format multiline
 format_firstline /^\[(?<time>[^\]]*)\] (?<level>.+?):/
 format1 /^\[(?<time>[^\]]*)\] (?<level>.+?):\s+(?<message>.*)/
 time_format %d-%b-%Y %H:%M:%S %Z

 read_from_head true # Read the file from the start.

 path C:\webroot\php_errors.txt
 pos_file C:\opt\td-agent\tmp\hd-dev01.php.errors.pos

To Automatically Follow Redirects or Not?

I have recently been working on a SMART on FHIR integration with an EHR vendor.  One of the REST calls required posting some data and retrieving a launch code.  During development, I use Postman to test the functionality.  This call kept failing, and I could not figure out why.

Read full post… “To Automatically Follow Redirects or Not?”

Long-term Impact of the Upcoming Self-Driving Vehicles

I am cautiously and excitedly looking forward to the upcoming revolution of connected and self-driving vehicles. This advancement is bound to change so many things and the ways that we do those things. Taxis and truck driving are the most apparent professions that will see the initial impact, but this will also impact many other occupations and areas.

Read full post… “Long-term Impact of the Upcoming Self-Driving Vehicles”