Author: mattchung

  • Waiting for one day …

    “If you want to be successful, find out what the price is and then pay it.”

    Scott Adams

    I agree with that Scott Adams wholeheartedly. I also think this rule can be more broadly applied: “If you want something — anything — find out what the price is and then pay it.”

    This quote reminds me of a story that my therapist recently shared with me. During this Covid-19 shelter in place, he’s participating in an online workshop lead by a poet named David Whyte. During the most recent workshop, one of of the other students in the program shared their life long dream: becoming an anthropologist. It’s something they always dreamed of but before they make that giant leap, they are first going to build a financial foundation and work in tech for another 8 years.

    David Whyte’s response? “You’re probably not going to become an anthropologist.” Ouch — brutal honesty. But David Whyte softens the below and elaborates, stating that when we do something on a daily basis, we assume that identity and that activity — in this case being a tech worker — becomes part of our fabric. He’s right.

    This short story struck a chord with me. And over the last couple days, I’ve been reflecting on my own one day dreams and aspirations, askingmyself what are some things in my life that I’ve been wanting to do but have been waiting for something — something in the distant future, only after I do x and do y.

    And the first thing that surfaced was writing. Writing on my blog. I used to write much more frequently but every since I started my masters program in computer science, I’ve pretty much abandoned writing all together convincing myself that I have zero time to commit to writing. That’s nonsense.

    So instead of waiting to graduate from the program — which is another 1.5 years — I’m going to chip away at my writing. Every day. Even if it’s for 5 minutes. Even if it’s just collecting field stones or existing content. Whatever it is, I’m making tiny incremental progress: and I’m happy with that. Little wins.

    Now I want to turn the table and ask you if there is anything you want to do one day? Is there something you are waiting for? Or waiting for someone to give you their approval? Or for the stars to align?

  • Week 1 and Week 2 of compilers

    Last week, I couldn’t carve out enough time to write a post on my reflections for week 1 of my compiler’s course so I’ll do the next best thing: write a post that combines week 1 and week 2. The quarter kicked off on January 10th and since then, I’ve felt a range of emotions, from excitement to anxiety. Meanwhile, I’ve been scarfing down a ton of knowledge about compilers (previously, I viewed the compiler as an elusive, magical and mysterious black box). On top of all this, I’ve been experimenting with Cornell Note taking system, switching back and forth between typing up notes on my laptop, writing notes down on my iPad, and using the good old pen and paper.

    Study Habits

    I’m constantly refining the way I study, optimizing my sessions for increased understanding and maximizing long term retention. Last quarter, I had taken notes using LaTex, generating aesthetically beautiful documents. The idea behind this was that that I would one day look back at them in awe. But in reality, I haven’t looked back at any previously taken notes, not for any of the four prior classes, so there’s really no point (as of right now) to continue precious cycles on typing out LaTex notes when (I think) I’m more actively engaged when scribbling notes down with pen and paper.

    Emotions and feelings

    A couple things make have been making me feel anxious. First, the sheer number of hours required for the course. According to the omscentral reviews, students estimate roughly 20-25 hours per week. To compare against these estimations, I’ve been tracking the hours I put into this course. So far, on average, I’m studying — watching lectures, reading the textbook, creating flash cards — in roughly 2.5 hours a day; same applies for the weekends. That means, in given week, I’m putting in roughly 17.5 hours, give or take. Will the number of hours increase once the first project is announced (two days from now) ? Perhaps. One way would be to reduce the number of commitments (e.g. singing, writing music, writing blog posts like this one) or sacrifice some sleep — not ideal at all. Instead, I think I’ll just accept that, given the finite number of hours in a week, I may be only able to pull off a B, which I’m totally fine with.

    What have I learned so far

    As mentioned before, I have zero prior background with compilers. But in just the past two weeks, I’ve discovered that a compiler is not just a black box. It actually consists of three major components: front end, optimizer, back end.

    The front end’s job is to scan and parse text and convert that text into a format (intermediate representation) that’s consumable by the backend (more on this below). And if we drill down a bit further, we’ll see that the front end actually consists of subcomponents: scanner, parser, and semantic analyzer. The scanner reads one character a time and then groups them into tokens. These tokens (tuple of type and value) are passed back to the parser (who initially requested them), which then calls the semantic analyzer to ensure that the generated tokens adhere to the semantic rules, ensuring that they are meaningful and make sense.

    How does the compiler know whether something is both syntactically and semantically correct? Based off of the rules of the language: the grammar. These are the set of rules that specify the language and can be formalized using finite automata and represented as state machines. What I found most interesting is that we can express the grammar using a human readable format called regular expressions.

    Regular Expressions

    If you are a programmer, you certainly used regular expressions (in your favorite language like Python) for searching text. But regular expressions are much more powerful than just creating search patterns. They are fundamental to compiler design.

    By using regular expressions, we can create a formal language, which consists of the following:
    • Alphabet – finite set of allowed characters
    • Transition Function
    • State – finite set of states
    • Accepted State – finite set of accepted states
    • Starting State – initial state of the state machines

    State Machines

    As mentioned above, regular expressions can be converted into state machines (similarly, state machines can be converted back into regular expressions) that fall into one of two categories: deterministic and non-deterministic. Next week will cover this topic in more detail.

    Summary

    So that about wraps it up. I’m looking forward to next week (I.e. Week 3) !

  • Top 6 photos from first family photo shoot

    Below are my top 6 photos I cherry picked from our first family photo shoot that took place a couple weeks ago.

    As some of you my already know, my daughter Elliott was born recently, on October 3rd (2019). And shortly after, my wife had arranged for a professional photographer — Stephanie BC — to spend half the day in our Pacific Northwest home, scheduling the photographer on a typical, no sunshine Sunday to snap some photos and capture some moments of our growing wolf pack: once four now five (3 humans and 2 dogs).

    And I must say, the images turned out nothing short of beautiful; I could not be any happier with not just the end product but the process itself. Apart from one or two photos, all the captured images are not staged, meaning we were not posing or putting on a forced smile or contorting our arms and body in some uncomfortable (but aesthetically pleasing) position. The entire shoot felt organic.

    Anyways, enough of the chatter. Here are my 6 photos I hand picked from the our shoot.

    Music. Such a gift. Here I am playing guitar and singing for Elliott and my wife. The song is titled “My Little Bird”, which I wrote when Elliott was just a week or two old.
    This is how I spend 90% of my time with Elliott: cradling her in my arms and rocking her to sleep.
    Here’s my and my first fur daughter: Metric. In her head, she weights 10 pounds still and loves to lean all her weight on those willing.
    Look at this cutie staring out the window while I hold her in the foot ball position. I cannot imagine that I’ll be able to hold her like this much longer since her weight is increasing exponentially, my forearms no longer able to sustain the burn.
    Yes. She’s peeing all over me. Luckily, this time, the pee only hits my shirt and my jeans. I have been tagged in the eye and mouth (who knew girls and projectile pee like boys).
    Me giving Elliott what I call “Kissy kisses” (no idea how I came up with that name) while she rests on top of my wife’s folded legs.
  • Almost half way through M.S. in Computer Science

    I’m almost half way through the OMSCS (online masters in computer science), last week marking the end Spring 2020, my third term in the program. And although I’m looking forward to taking compilers next semester, my mind often wanders into the distant future , my mind fast forwarding to the time in which I’ll be graduating from the program. So, I stitched together a line graph that includes the classes, breaking down each term along with the courses that I’ve already taken (and will take). Here’s what it looks like:

    As you can see from the above graph, I’ve historically taken one class per semester (except for the previous semester, when I simultaneously took information security and computer networks simultaneously); taking one class per semester takes the middle path, allowing me to balance school and work and family and other obligations and the millions of my other hobbies (e.g. singing, guitar). So at this current rate, I anticipate that I’ll graduate in Spring 2021 — 2 years from now. Seems like a long time away but it really isn’t. Because as they say: time flies. And It really does. Feels like yesterday when my wife and I were discussing whether it even made sense for me to apply and enroll to this masters program.

  • Masters in CS paying off

    Taking computer science courses are already paying off in my career. Nothing too significant (yet) but I am witnessing small wins.

    For example, this past summer I suffered through HPCA (high performance computing architecture), a course historically only offered in the longer semesters (e.g. fall, spring). In the course, I learned a lot of theory: barrier synchronization, processing pipelines, instruction scheduling, multi level caches, branch predicators, cache coherence protocols, and much more (many of which I have already purged from my memory). However, since most of that knowledge was primarily theory, very little of it I’ve been able to directly apply to my day to day job.

    Until a couple days ago.

    While at work, my co-worker had pointed out that the unlikely C function calls were sprinkled throughout our code base, used for branch prediction. And thanks to theory, I was able to describe to another co worker how the compiler (with its understanding of the underlying CPU architecture) will rearrange the assembly (or machine code) in order to avoid a branch prediction miss: if the wrong instruction is fetched, the processing pipeline must flush all the previous instructions queued in the pipeline, temporarily halting the pipeline, which ultimately reduces the throughput.

    And this is just one example of how taking my masters had paid off. There have been a number of other situations (like understanding shared memory and interprocess communication) that I’ve been able to apply theory from academia to practice at work.

    Thanks to the program, I’m feeling much more competent and confident working as a software developer at Amazon Web Services.

  • Next up: Compilers (theory and practice) and reflecting on fatherhood

    For next semester, Spring 2020, I enrolled in what I expect to be one of the most difficult (yet rewarding) courses: compilers – theory and practice. I’m stoked and at the same time, feeling very nervous.

    I’m stoked for several reasons. First, according to the previous semester’s syllabus, I’ll be learning a ton of theory: Automata, finite state machines, grammars, predictive parsers. Many of these concepts I’ve learned on my own with my self directed education.

    The second reason that I’m elated is that I’ll be given the opportunity of building an entire compiler, from the ground up! No existing code base, all from scratch. That in itself strikes fear in me.

    And third, Steve Yegge’s executive summary (on his post on compilers) — “If you don’t know how compilers work, then you don’t know how computers work” — motivates me, making me want to prove (to myself) that I know how computers work.

    So with all that good stuff, why am I feeling nervous?

    Normally, taking a master’s course while working is manageable. I often carve out about an hour (or sometimes 90 minutes) of my early morning, studying while eating an avocado toast and sipping a ginger tea, headphones wrapped around my head while people are buzzing in the background at a near by café. In addition to the early mornings, I will leverage my one hour lunches, again watching lectures or banging out code for a (school) project.

    But my life has changed.

    Although my previous routines and rituals worked well for me for the last several years, my life has changed in significant ways. Most obvious is the arrival of my (first) child, Elliott. With Elliott now here (and no longer just an abstract creature curled up in my wife’s belly), I want to make sure that I’m present for her: not just for the big moments (like her first vaccinations) but for the little, day to day moments (in fact, I had one of the weirdest feelings when I stepped into the office this past Monday, my first day back in the office after 4 weeks off of paternity. while staring into the wide screen monitor pinned up against the wall of my not too shabby cubicle, I wanted to be at home, changing Elliott’s dirty diaper).

    Elliott with her thinking hat on

    On top of all of this, omscentral reviews (the unofficial review website for courses offered by online master’s program at Georgia Tech) suggest that the course demands anywhere between 15-25 hours per week. Those extra 10 hours gotta come from somewhere. But from where? Sacrifice it from hanging out with my life? Or strumming my guitar? Or singing? Or writing music? Or exercising at the gym? Or playing with my dogs? Or spending time with other friends and family?

    You see, there’s only so much time (you already knew that) and all the decisions (small and large) are trade offs. These choice reflect our ethos. The sum of where and how we spend our time essentially defines who we are and what we believe in.

    Okay. Rant over.

    Back to studying (information security and computer networks) on my day off of work — thank you Amazon for offering a ramp back period, allowing me to work 50% (of course my salary is pro rated) and allowing me to pitch in with my family on Thursdays and Fridays.

  • Information Security – Project 4

    This afternoon, I started on project 4 for introduction to information security (IIS). This goal for this project is to have us students learn more about web security and consists of three objectives, manufacturing three web attacks: cross site scripting, cross site forgery and structure query language (SQL) injection attack. And although I’m very familiar with the terms, I’ve actually never carried out any of those attacks in neither an academic or professional setting. In this post, I’ll share some of the things I learned while spending 4 hours in a cafe chipping away at the project.

    Cross site request forgery (CSRF)

    This attack was very straight forward: inspect the source code of the (PHP) files and carefully tease out which form inputs could be set in the body of the HTTP POST.

    Cross site scripting (XSS)

    This task was a ton of fun. Initially, I headed down an entirely wrong path and found myself getting very frustrated. Initially, because of the video lectures, I had wrongly assumed that the only way to perform the attack was to embed an iFrame my hand crafted HTML page, the iFrame loading the contents of the remote website, the target of the attack. And although this entirely possible, embedding an iFrame is unnecessary: what I really need to do is basically send an HTTP post to the remote site, embedding javascript in one of FORM values, carefully ensuring that when the page renders in the browser, it’s identical to the original website.

  • My wolf pack

    At work, I’m subscribed to an e-mail distribution group called “dogs@amazon.com”, a list dedicated to anyone interested in dogs. And today, I read an e-mail that broke my heart. A fellow Amazonian just had their second child and they are now giving away their 3 year old Labrador because they can no longer give it the attention that it deserves.

    I cannot stomach the idea of letting go of either of my dogs — Metric and Mushroom. To me, they are permanent members of my family, my pack.  Metric joined my world 6 years ago, when I picked her up from a backyard breeder in Austin Texas; Mushroom joined us about 4.5 years ago, when Mushroom was pretty much spending most of her days in a crate at my mom’s house.

    Anyways, I’m looking forward to having them around for a long long time. In fact, I cannot wait for them to welcome another member to my pack in September, when my wife and I are expecting our first child.

     

  • Week 1 of master’s in computer science

    January 7th, 2019 marks the first day of my computer science master’s program through University of Georgia Tech. The week leading up to the first day was somewhat stressful since I was mid flight (returning to Seattle from London), my plane hovering over the massive blue sea, while I frantically typed away on my keyboard trying to register for a course in my allotted time window. Because of the spotty internet connection on the airplane, it took me about an hour and half to register for my course and by that point, the open spots filled up so fast that I positioned 100+ on the wait list (which I discovered, later on after reading online posts, that 100+ wait list is normal and that I would like get get into the course, which I did).

    Anyways, despite all that headache, I’m officially enrolled in a course that I’ve wanted to take for a very very long time: Introduction to Operating Systems. So far, although it’s only been 1 week, I love the course, for multiple reasons.

    First, I love the collaborative and sense of community of the program. Before getting into this master’s program, I was taking a handful of undergraduate computer science courses (e.g. computer organization, discrete mathematics, data structures) from University of North Dakota and University of Northern Iowa, two excellent schools that offered courses through their Distant Learning platform. Now although I learned a lot from the courses, I always felt like I was working in isolation, by myself, my only interaction was through a few short threaded e-mails with the professors. But now, with this course, there’s an online forum (i.e. Piazza) and chatty chatroom (via Slack, which was paid out of pocket by one of the TA of the course), where students fire off questions and comments (especially random comments in the #random slack channel). So in a sense, despite never meeting these folks, there’s a sense of comradery, a shared a goal.

    Second, I’m learning a ton of material that’s not only applicable to my day to day job (as a software engineer) but material that I’m genuinely interested in. For the first week, the professor of the course has us reading a 30 page white paper (titled “Introduction to Threading”) written in 1989, a seminal piece of work (on threads and concurrency) that gives me perspective and appreciation of my industry. In addition to reading the white paper, I’m watching lectures covering fundamental operating system concepts (e.g. processes, virtual memory) and above all, writing C code! A ton of C code!

    The project has us writing code for a multi-threaded client and multi-threaded web server (think implementing HTTP protocol) that’s intended to teach us how to write safe, concurrent systems that utilize the threading facility offered by the operating system.

  • History of i,j,k variables ?

    Any time you read code (in production or from a textbook), you’ll often see the control variable, when employing for loops, being declared with the variables i,j,k. And for most of my programming career, I’ve never really questioned why we specifically choose those three letters. Why not m (a great letter), or c or d or e — or any other letter for that matter. Seems rather arbitrary.

    But, I suspect that it has to do with William Rowan Hamilton, a famous Irish mathematician, who published a book in the 1800’s, the book titled “A theory of Systems of Rays”. And in this book, William uses i, j, notation when representing vectors (in R3).  This representation of vectors became the standard notation and he’s the person we need to thank when we type in those three letters when programming.