DrumSensei

betwixt code and music

Uglify Might Get Ya

(3 min read)

I still code almost every day. My GitHub commits don't tell the whole story, but I have taken very few days off this year. Most of my work is in private repositories, but I have a few "learning" projects out there, too. Not burned out at all; definitely working hard and learning lots every day, every week!

Pasted Graphic 2
Looks like I took at least two weeks off, kinda! 😜

I recently ran into a snag with an app we are building at my workplace. This is the ground-up rewrite of our desktop "single page app," as the kids say these days. We use
React for the front end alongside our favorite open source library Material-UI. Like most modern web apps, we jumped on the webpack train. This useful tool helps us build our app for a development or production environment. Webpack is flexible enough to allow many customizations through plug-ins and other fiddling with the code.

We use handy webpack plug-ins that do several tasks:
• Remove any comments in the app (which are not useful when the app is in production)
    
e.g. This would get removed // TODO: Don't ship comments
• Generate HTML files directly from the JavaScript
• Remove all unused files from the bundle
    
No reason to ship any files to production that are unused by the user
• Make a
nyan-cat fly across the screen while the project is building on our local machine

catdribblegif2
credit: "Nyan Cat" by Ola Tandstand from dribbble.com

Maybe our most important plug-in reduces the size of our bundle.js file—the single JavaScript file sent to the client that makes the app run. This plug-in will
"minify" or "uglify" our app.

Here's a real-world example of why this will be important. About a year ago I was fiddling with some code and accidentally un-applied the uglify process of our production code. (This affected zero customers, thankfully!) I went to check out why the production app was taking
so long to load. Turns out, the JavaScript bundle.js file that we were shipping in production was over 15MB! That's HUGE! When we corrected the error, it went back down to its normal size of about 400KB. If you are unsure about those MB and KB numbers think about it like this. Our development JavaScript file was over 15,000,000 bytes, but the production JavaScript file that we ship to customers is only 400,000 bytes. Since that time we have made even better progress to keep the size small while the app continues to grow.

Under the hood, the webpack plug-in reduces the size of the files by doing some pretty clever things. This simple example might clarify how the uglification happens.

We might have a function like this to find the sum of two numbers:

Pasted Graphic 3

When we uglify the code, we might get something similar to this:

Pasted Graphic 4

If you multiply this reduction in character size across 1,000 or 10,000 functions, then you can imagine why this is an important process to add to any production-facing application.

Now, the issue we faced was pretty funny and certainly a product of our own doing. When we are sending requests for data from the app, there is a process to handle both a successful request or an error. According to the error, we display a helpful message to the user to let them know something fairly specific about what happened.

For instance, you spin up the app, and your account information never gets loaded. In that circumstance one of several different types of errors might have occurred. We don't just say
"There was an error". We try to provide something more concrete like "We were unable to load your account information."

In the case of a credit card transaction, there are MANY different possible errors that occur: invalid CVN, invalid Postal Code, et al. We handle those specific types of errors by constructing a new object and labeling it with the new
name "HttpError". When we checked for this error to display a specific credit card error message on our local machines everything worked great! We shipped it to a production test environment, and it always failed…not just wrong error, but entire app crashes and burns.

crash bandicoot image
Oops, wrong kind of crash
(credit: "Bandicoot" by
Lic Pollito on dribbble.com)

Turns out, our newly constructed HttpError object was renamed to
r in production. We kept seeing the error "r.isCcError" is undefined. After several moments of 🤔, we realized that webpack's extremely useful plug-in was crashing our app by renaming our HttpError object to one simply called r.

So, this little line of code:
Pasted Graphic

Became this line of code:
Pasted Graphic 1

And we lived happily ever after.

dancing_nutella

Webpack and its surrounding orbit of tools makes modern app development very efficient and better for developers/users. BUT, one must be ever steadfast in understanding the "in"s and "out"s and "what-have-you"s of the what the tool is doing behind the scenes.

Getting to teach

(2 min read)

I used to teach music full-time. It was my identity and provided a way for my skills and personality to be useful to others. Teaching music provides a ton of adventure and busy-ness, and I prefer staying busy. I also love to perform music, either in the practice room or on a stage. Teaching provided me a way to play music and hear music constantly for many years. Connecting students with a passion for music and learning remains important to me and to our society.

When I decided to jump ship from the band director world, I fully knew that I would be "out of the loop," and I was okay with that. No longer would I instantly know the interconnected news of the band world like "so and so left that one school and is going to that other school next year." Since I would be less visible (or maybe even, gasp,
forgotten), then my teacher friends would tend to reach out to the other people that were still "in the game" if they needed some help for percussion.

I also knew that my chances to teach music every day would diminish. BUT this career change would allow me to spend more time with the family (that happened!) and be able to support our three kiddos plus my brother even better (that also happened!). Also, learning new things, especially about technology, and especially especially about creating new things with technology (i.e. "coding")…those are all
MY JAM.

The unexpected side effect of not having to teach my own program all of the time meant that I was available for my friends' students for the first time in years. Since I have a job in technology where we have a lot of freedom with our vacation policy (and I do not take advantage of it
😜), I make myself available from time to time to help some friends out in teaching their drum lines.

From the time that I announced that I was "
Switching Gears" in August 2015, I have been able to teach a handful of times. This has helped me to keep my chops adequately tuned-up and my teaching skills honed. Not to mention, the students at these groups were a blast to be around every day! Since I have been out of the game, here are some of the groups that I have seen since I "quit" teaching. (I cannot help but smile that I "quit" teaching…I definitely didn't quit, I just don't do it every day any more! 🤓)

  • 1 college drum line - 2 consecutive years
  • 1 Texas State Marching Contest champion drum line - 4 different weeks in two summers
  • 1 Texas State Marching Contest participant drum line - clinician and 1 week in one summer
  • 1 middle school percussion section masterclass

What a fun experience to be able to stop working on code for a short time to go work on guiding young people toward musical greatness! Y'all keep hitting drums, I will keep hitting my laptop keyboard!

In Memoriam: Mark Mathew

(5 min read)

My bride Melissa and I arrived in California today. We flew into Orange County's John Wayne International Airport. After getting our nifty Toyota Corolla rental car, we headed directly to Newport Beach to hang out. My very favorite comedy show ever is "Arrested Development," so I was excited to maybe see the Original Bluth frozen banana stand in person. Spoiler alert: not one there! However, we did see three dolphins playing near the pier!

I have learned some fun facts about Cali on this visit.
  • The FM 101.1 radio station has some fantastic jams, just like the one in Dallas…except the Big D version is 100% orchestral music!
  • You can order a combo at Del Taco and get french fries…this is unheard of in TX!
  • California has mountains! Very cool to see this after spending most of my life in Dallas.

On to my Dad…

My dad Mark Mathew passed away on Easter 2017 as a result of several long-standing health issues. As a Christian man who spent a long time playing in worship bands, this was a great day to arrive in heaven!

The story of how my mom, Elizabeth "Denise" Stephens, and my dad met and became smitten with one another is surely a good one. However, I do not have a good timeline on this due to conflicting stories and partial tales through the years. Some of the information herein is from both mom and dad, as well as my mom's best friend from high school Valerie Chapman.

My mom was a student at Lloyd V. Berkner High School in Richardson, Texas when the two met. The magic between the two must have been spectacular because they were married on 9/27/1977 when my mom Denise was 16 years old and my dad was almost 21. When I pressed my mom's friend Valerie about how this came to be, Val said that my grand-parents must have acquiesced because they knew that Denise was going to get married to Mark with or without their approval. It was best to keep her close by and let the newlyweds live together with them in the Dallas suburb of Garland. Valerie also said, "Your parents were SO ready to go to CA, to Haight Ashbury, but I know your grandparents wanted her to finish school." My mom and dad were trying so hard to be good hippies!

mark-and-denise-2

Valerie goes on:

"Can you believe I remember what I wore at the wedding? I stood by your mom. Of course, I thought she was all grown up. Though she did seem to have a bit of an "old soul." I remember your dad as having an easy smile, an easy laugh, and a desire to make people feel comfortable/happy. He was a big man even at that young age, and he was kind. He played guitar and sang really well. They had a band for a while . . . with Tommy? Mainly just jamming in the garage, I think. I think they finally moved to CA (or did he go back without her?) and things spiraled down. I didn't stay real connected, because I'd gone off to college and was real wrapped up in my life there. What I do remember vividly was that when your parents were together, in the happy days, they loved each other very much. They were very connected, and seemed to have a real strong bond and understanding. Your mom was very supportive of him, in whatever way was needed… They did seem like soul mates at the time, and maybe your grandparents hoped there was a chance. …I can tell you that you came about out of a real, strong love. Your mom was excited about you. I bet you already knew that.
🙂

I know that they shared some great times. There are not many photographs from this time period, but the ones I have seen are full of smiles and good cheer. Something happened in Texas, and my dad took me to California to be near his parents in Buena Park. Or maybe they both went to California together. It gets fuzzy. In any case, things seemed to go downhill after they moved with me back to Cali.

mark-and-denise-1

My mom Denise passed away on Christmas Eve 2012 after a life-long struggle with co-dependence and addiction. My parents sure celebrate their Christian holidays in a strange way, eh? Some of the artifacts left behind by my mom included several photographs from her Photography class at Berkner High School and just other general photos. Some of my favorites are included here.

just-before-led-zeppelin-4-1-1977
April 1, 1977 in Dallas, TX - Dinner just before the first performance of Led Zeppelin's final North American tour
left to right: Kim, Val, Mark, and Denise


mark-1
March 1977 - photo credit: Denise Stephens


mark-3
February 17, 1977 - photo credit: Denise Stephens

mark-4
February 9, 1977 - photo credit: Denise Stephens

mark-5
February 7, 1977 - photo credit: Denise Stephens

mark-6
photo credit: Denise Stephens

mark-7
photo credit: Denise Stephens

mark-8
March 1977 - photo credit: Denise Stephens


mark-9
photo credit: Denise Stephens

Also among my mom's things from high school was a book of song lyrics. Imagine for a moment being a kid pre-internet. Knowing the lyrics to a song meant listening to it and writing the words down. Mom has hundreds of song lyrics in her journals, most from known artists, lots from her or her friends. Some of these song lyrics appear to be written by my dad. Well, the by-line reads "Mark King," but the last name is crossed out and replaced with "Mathew." Did my dad fancy a pseudonym?

As fun as it is to focus on the past, to consider where we come from, what those ancestors were doing when they were our age…we would do well to think about the legacy left behind by those who came before us. I am my dad's legacy. His other children—Stephen, Jennifer, Audrionna, Tyrene, Brittany, Tiffany—we are his legacy. His quick wit, his puns, his sense of creativity flow through his kids and grandkids to this very day. I truly regret not making more time to spend with my father while he was living, but the only thing to do now is honor his memory by spending time with the family we have left on earth. So much of my personality and traits come directly from my dad. I am so glad to be passing these great things down to my children, as well. Let's make him proud of us!

I will let my dad Mark have the last word here. This was the final message he ever sent me in Facebook Messenger, dated January 8, 2017, and I think it really sums everything up nicely, don't you?
Screenshot 2017-05-12 23.36.48