Author: mattchung

  • Friday donut ritual

    Today is donut day! Actually, every Friday is donut day.

    I started a weekly ritual about six months ago. Every Friday, my entire team (apart from one or two people) rides the elevator from the 13th floor down to the lobby, and then we proceed to take a brisk 2 minute walk Mighty O: Seattle-based shop that serves vegan donuts.  Once we arrive, I firmly grip the handle of the glass door, swinging it wide open and rushing the counter, where donut samples lies on a silver shiny platter.  I lower my head towards the samples, my nose hovering half an inch above them, and inhale deeply, getting a sweet whiff of all sweet smells: chocolate, vanilla, french toast.

    Following scarfing down a sample (sometimes two), I saunter over to the cashier and place my order: a french toast donut and a large almond milk chai.  Occasionally, I order a different flavored donut, depending if Mighty O offers a seasonal donut that appeals to my senses. For example, a few weeks back, Mighty O concocted an ore flavored donut — it was damn nice. But normally, I stick to the french toast.

    What can I say ? I’m a creature of habit.

    This entire donut routine spawns from my affinity for donuts. It’s an emotional food.  For me, donuts sends me back to my childhood.  When I was a young boy, about seven or eight, my father would drive me to school, the little me sitting in the front seat, feet dangling off the edge, too short to reach the floor. On the way to school, my father would stop by a local donut shop with a drive through ordering; we rarely (if never) ate inside the actual store.  As we pulled up to order, a cashier would slide open the drive through window, and my father would proceed with ordering: chocolate bar for him, me the sugar glaze with a side of milk.

    At the end of the day, here it is: I love donuts.

     

  • Why I love Seattle

    I consider Seattle my new home.

    Perhaps it’s the lack of pretension.  Folks around here tend to pragmatically dress themselves: sneakers, blue jeans, puffy Patagonia down jacket. This is unlike how people dress themselves in southern California, where I lived for over 25 years, where the overall vibe is to dress to impress. I admit, I once bought into that lifestyle, setting my alarm hour an hour earlier than normal in order to iron both my pin striped business long sleeve shirts along with my cream colored khakis. But not anymore — I dress for comfort.

    Perhaps it’s the overwhelming love people have for their furry four legged babies.  On the weekends, rain or shine, you’ll find the park bustling with people walking their dogs,  winding up and launching tennis balls into the lake, their dogs galloping at full speed and diving in for the retrieve. Dogs love swimming.

    It’s beautiful.

    Or perhaps Seattle just happens to be the city in which I started feeling comfortable under own skin, shaking off years of built up anxiety and self consciousness and low self esteem. It’s here in this city that I not only found my singing voice, thanks to Liz Frazier (a top notch vocal instructor), but a voice that resonates with love and confidence and conviction.

    Seattle. Thank you.

  • The beauty of dynamic programming

    I just discovered dynamic programming and damn, I’m blown away by the concept.  The other day, hile working through a homework assignment, I compared the run times between two python functions that I wrote, one function written recursively and the other written in a dynamic programming fashion.  Starting with the recursive solution, I arrived at the following:

    def fibonacci(n):
        if n == 0:
            return 0
        if n == 1:
            return 1
        return fibonacci(n-1) + fibonacci(n-2)
    

    That’s a fairly standard implementation of Fibonacci. There are two base cases; n=0; n=1.  So when n is either of these two numbers, the function simply returns 0 or 1, respectively.  But for any other number, the function recursively calls itself until reaching the aforementioned base cases.

    So far so good, right?  And for calculating small values of n, this implementation doesn’t really present a problem. But say we want to calculate fibonacci when n equals 40. How long does this take? Alarmingly, this computation hovers around 45 seconds:

    ./fibonacci.py 40
    fibonacci(40) = 102334155 took 45.22154 seconds
    

    Now, what if we run the same calculation. But this time, we run it using a dynamic programming technique? How much time does that shave off?

    ./fibonacci.py  --dynamic-programming 40
    fibonacci(40) = 102334155 took 0.00002 seconds
    

    What ?! From 45 seconds down to under a millisecond ?! How is that possible?

    def fibonacci_dynamic_programming(n):
        fibonacci = [0,1]
        for _ in range(0, n):
            fibonacci.append(fibonacci[-1] + fibonacci[-2])
        return fibonacci[n-1] + fibonacci[n-2]

    As you can see from the code above, instead of recurisvely calling fibonacci, we iteratively calculate all the values. In other words, this implementation runs linearly (i.e. direct proportion to n), unlike the first, recursive implementation, which runs exponentially.

     

     

  • Disabling remote loading of images (in e-mails)

    On both my laptop and iPhone, I’ve configured my e-mail clients to disable a setting called “Load Remote Images.”  Although there are a number of benefits in doing so, like reducing network traffic (i.e. bandwidth), my main motivation is this: preventing senders from tracking my e-mail behavior, preventing them from identifying whether or not I’ve open their e-mails.  When loading an image, the e-mail client sends an HTTP request to URL defined for the image(s). This, coupled with the the sender’s ability to craft a unique URL for each image, enables them to check the server’s access logs. In short, it answers the question: “Did they open up my e-mail?”

    Am I paranoid? Perhaps. Is it over the top? Maybe. But allow me provide you a screenshot (below) of an e-mail that I recently received from The Everygrey, an awesome (daily) newsletter sent out to those interested in what’s going on in Seattle.

    Touch base e-mail from Everygrey
    Touch base e-mail from Everygrey

    Despite the above e-mail, I’d like to mention that actually read their e-mails. Every day. But without loading of remote images (as well as not clicking on the links embedded in the e-mail), they can only assume that I’m an inactive user, which obviously isn’t the case.  And although I’ve used them as example, I’m actually defending against more nefarious senders.

  • Why I picked up the guitar

    Although I’ve been playing the ukulele for over a year, I decided to pick up the guitar four months ago, when I returned to Seattle after spending the Christmas holidays in sunny southern California.

    During my visit, my little 13 year old brother and I would occasionally jam. Me on my tenor ukulele strung with a low G, him on his electric guitar (and occasional grand piano).  We’d take turns playing rhythm, a steady tempo of 80 beats per minute.  I would start with strumming a simple I, IV, V progression (i.e. C, F, G), him soloing in the key of C. Then we would swapped roles, him shredding his guitar, me applying my (little) music theory, picking and plucking away, one note at a time.

    One day, while driving in the car by myself from Orange County to Northridge to my mother’s house, I was playing Spotify on my iPhone, music blaring through my Black Mazda hatchback’s speakers, acoustic and indie songs playing, one after another.  Spotify was playing songs listed in my “discover weekly”, a playlist algorithmically Spotify created based off of my listening behavior (i.e. listening to a handful of 80s music and acoustic guitar, over and over and over again).  Anyways, I’m driving up the 405 freeway, two hands on either side of the steering wheel, passively listening to the music in the background. And then, my attention shifts to the song playing, which was about already two minutes in, a song titled “When you love someone — James TW”.  At first, my ears perked up at the beautiful sound of the acoustic guitar, a combination of picking and strumming with an upbeat tempo.  In addition to the guitar, the melody was catchy, although I couldn’t really make out the lyrics.

    With two eyes glued to the road, I hover my right hand over to the center console, grabbing my phone and swiping the phone unblock, tapping on the back, restarting the song to the beginning. And then I intently listened to the song, as I continued to drive up the highway.

    The second time around, the song hit me emotionally, forcing tears to my eyes. Unexpectedly, the song’s lyrics revolve around a young boy whose parents are divorcing. “It don’t make sense. It don’t add up. We’ll love you. No matter what. ” – for some reason, those words shredded me apart. To be honest, I had not cried that hard in a long time (last time, if I can recall correctly, was during the episode of “This is us”, the episode where, spoiler alert, Randall’s father laid in the hospital bed, passing away and dropping words on wisdom before his consciousness faded).

    Anyways, after listening to that beautiful song play about three or four times, I decided that I wanted to learn the guitar and not only play that song, but accompany myself (i.e. sing).

    And for the past four months, that’s what I’ve been doing. Learning that song on the guitar, and only that song, one bar at a time.

     

  • Wrapping up discrete mathematics course

    Last Friday, I took the final exam for my (distant learning) discrete mathematics course and just now I had logged into the student portal (i.e. Blackboard), surprised to find that my exam had not only been graded but my final grade had been posted as well. I finished the course with an 88%, a B, a few points short of an A.  In the past, I would’ve incessantly beat myself up over not achieving the highest grade, denigrating myself with self destructive thoughts: if only I tried harder … if only I studied more … if only I was smarter …

     But not this time.

    This time, I’m inhibiting those thoughts. Instead, I’m celebrating. Celebrating that I’m fortunate enough to be able to take this mathematics course, a course where I learned about: writing proofs, solving Diophantine equations, applying set theory, counting with modular arithmetic, proving assertions with mathematic induction, converting recursive functions into closed form functions using characteristic equations method. Prior to the course, I was never exposed to those concepts.  Looking back, I only vaguely heard of those terms.  And who knows if I get to apply any of those concepts as I pursue a master’s – maybe a PhD, one day. Who knows if I’m lucky enough to apply that knowledge to my job as a software engineer.

    But who cares?  Because really, my goal was to stretch myself, learning more about my field and craft: computer science.

  • Graph theory and upcoming final exam

    I just scheduled my final exam for my discrete mathematics course, now that I submitted my homework for the final assignment covering graph theory. Throughout this assignment, I was introduced to a variety of concepts: Leonard Euler and his discovery of Euler paths and circuits, Hamiltonian paths and circuits, and a handful of graph related terminology (e.g. vertex, edges, degrees, bridge, cut-vertices, isomorphic graphs, trees, forests).

    In addition to the concepts above, I learned two different ways to represent graphs in (computer) memory. One approach is using adjacency matrix, a matrix whose columns and rows are represented by each vertex. The second way to represent a graph is by an incidence matrix; unlike an adjacency graph, an incidence matrix’s columns are vertices, the rows representing edges.

    Star like graph
    Star like graph
    Adjancey and Incidence matrix
    Two ways to represent the (above) graph

    Although the lesson only scratched the surface on graph theory, I reveled in the fact that many of the terms I learned were actually terms that I encountered at work, terms that I had no idea were rooted in mathematics.

    For example, the term forest (in graph theory) is defined as a collection of trees; I encountered this term while working as a system administrator, a time when I managed Active Directory (a centralized authentication system) and all the security rules and policies bound to a forest.

    In addition to the example above, I find comfort in the fact that some data structures (e.g. binary search tree) and algorithms (e.g. breadth first search) that I’ve studied in the past build on top of graph theory.

    Star-like graphs that are nonisomorphic
    Star-like graphs that are nonisomorphic

    In any case, I really enjoyed learning about graph theory, a lesson I’ll continue to build on top of as I pursue my life long study of mathematics and computer science.

  • Career contentment

    Lately, I’m feeling very content with my career.

    For the majority of my life, I’ve been constantly searching for some job that would fulfill me. Like many others working in the tech industry, I had a tendency to hop around from company to company every two years, always switching it up, never allowing myself to settle down. This tactic, of shuffling my career, was somewhat deliberate and strategic in the sense that salaries leap when switching from one company to another. In other words, if you want a substantial increase in your salary, you need to move. Otherwise, your stuck with receiving incremental pay raises that are considered trivial in comparison. For example, when I left Cisco to join Fox Networks, my salary increased by 40% .

    In addition to increasing my salary, I had vigilantly switched from one company to the next because I was afraid of intellectually stagnating, as if the company I was working at would potentially hinder my personal development. And this can be true, to a certain degree, since working for a small mom and pop software company will never present the same technical challenges as working for a large, cloud computing company.

    Regardless, I no longer feel as though there’s some magical company where I would work on a magical team that writes magical code.  In fact, as much as I enjoy working on new features or new products, I revel in maintaining software and systems.  In short, I realize that I control my technical growth and that regardless of what company I work for, I’ll always strive to improve my craft. Moreover, the more I study computer science, the more problems rise to the surface, problems that I would otherwise dismiss due to my lack of understanding.

    Despite my contentment, I’m not saying I’m going to settle down in my current role and current company for the rest of my life. Nobody can predict what’s going to happen in a year (or even tomorrow).  But for the foreseeable future, I see myself staying put, working for Amazon Web Services, developing software and building systems, one byte at a time.

     

  • Software and system ownership

    Although I sometimes find getting paged for operational issues enervating, I wouldn’t have it any other way.

    It’s well known that software engineers at Amazon (Web Services) own their systems, end to end. This means that we not only develop and maintain our software, but we operate the underlying system, complete ownership.

    From a software point of view, one can run into an infinite number of issues. Got a build error? Roll up them sleeves and start digging through the compilation errors.  You committed some code that broke the build? Fix or rollback the changes. You defined a dependency that’s deprecated? Update the dependency and ensure your unit and integration tests pass.

    Similarly, we maintain the underlying system. If we deploy our systems to a servers, physical or virtual (e.g. EC2), we must keep it alive, like a breathing entity. From checking disk performance, to checking heap allocation, we monitor our systems closely, configuring monitors to alarm us when any component misbehaves.

    In other words, there’s no divide between development and operations. There’s no separate team that handles operational issues, no DevOps. There’s no nonsense like writing our software and then chucking it over to another group to deploy it, a group that would otherwise find it annoying at best and frustrating at worst.  Because I’ve been in those positions, where I’m on the hook for deploying software that I cannot fix. Similarly, I’ve been in situations where the deployment fails and then I must ring in someone who’s more familiar with the code base.

    But now, I’m in a position where I’m responsible for the code I write.

    Why is this important?

    Although some would argue that software developers should stick to software development, and that there should be a clear separation of duty, I believe that owning a system end to end promotes operational excellence and a sense of ownership.

     

  • Where discrete mathematics meets an interview question

    Last week, I was sitting behind my desk at work, surfing hacker news and and at the top of the website floated an article by the co founder of “Daily Coding Program”, a small tech start up that e-mails daily newsletters with a programming question.  The article shared some of their insights over the past year and how they bootstrapped the company and eventually grew to $2,000 in monthly revenue.

    Although I was interested in reading the blog post, I ended skipping over most of it and navigated to their front page, where I scrolled up and down and read more about the company’s product.  When I reached the end of the front page, I was confronted with a sample interview question:

    There’s a staircase with N steps, and you can climb 1 or 2 steps at a time. Given N, write a function that returns the number of unique ways you can climb the staircase. The order of the steps matters.

    This question, I had initially thought, could be solved using some techniques that I recently learned from taking my discrete mathematics course. But to confirm whether or not I could apply permutations and combinations, I hollered at my colleague, repeating the question out loud and asking him how this problem could be solved. And as I started reading the question out loud, “There’s a staircase with N steps, and you can climb …” he interrupted me, finishing my sentence with, “1 or 2 steps at a time.”

    Apparently, while preparing for interviews with Google and Microsoft, he had stumbled across this same practice problem.

    So after letting him interrupt me, I asked him if this particular problem could be solved with permutations or combinations. In other words, do these two mathematical concepts apply to the problem. He confidently answered, “No — dynamic programming.” He then proceeded to step me through his solution, scribbling down his work on a white piece of 8.5 x 11 that sat on my desk.

    Fast forward to now.

    I’m at home, starting the next lesson for my discrete mathematics course, the lesson title: “Counting using Recurrence Relations” and “Solutions to Recurrence Relations.” I’m skimming the chapter, building a mental model of what the entire chapters entail, an overview.  And when I reached the end of the first chapter, where exercise problems live, I couldn’t help but form a little grin.

    To my surprise, the following chapters cover topics relating to the interview question that I had just read. In fact, the exercise in the chapter is phrased almost identically:

    Sal climbs stairs by taking either one, two, or three steps at a time. Determine a recursive formula for the number of different ways Sal can climb a flight of n steps.

    So, I find it always nice and serendipitous when what you are learning, either in school or on your own, can be applied to real life examples. Albeit, this application was only for an interview question.

    But I’ll still consider that as a victory.