Nicks Octopress Blog

A blogging framework for hackers.

Why Engineering?

I love the engineering mentality and how it pervades my life. As I learn to build software better, I also learn to live life better.

I love how studying software design and how to reduce complexity with concepts like information hiding and modular design has allowed me to simplify and take control of my life. I love how studying trees and OOP has allowed me to organize my life into categories (or nodes) and develop systems to organize my space and mind. I love how the detail-oriented process of writing algorithms has allowed me to trivially build life habits like waking up on time and working at hobbies like meditation, cooking, or fitness. I love how debugging skills allow me to track down and isolate practical issues. Then how my problem solving skills can draw out an okay brute force solution and iterate on it until it’s ready to be implemented in my routine (everyday life). I love how distributed systems tackle the problem of random spontaneous failure, because that’s how real life can feel sometimes, “Two is one and One is none”. I love how I see programming in everyday life (like memorization as caching), although I’m slightly afraid that this may cause trouble communicating with an SO.

Engineering is not just what I do, it is how I live my life.

How Traveling Changed My Life

Last year I spent several months backpacking around Asia. My favorite place was Vietnam, I originally meant to spend two weeks there but really enjoyed it and ended up spending over a month. I was lucky enough to travel with someone who grew up there (before going to university in the US, running a successful startup. They had family and employees in Saigon (Ho Chi Minh) who gave us tours and helped get us off the beaten tourist path. For example, we stayed with her Uncle, who had an absolutely gorgeous house, complete with a moat and palm trees (coconuts are popular there). He gave us a couple bottles of his herb-infused home brewed whiskey and gave us a tour of the surrounding dragon fruit fields. I made some great friends and ended up heading off with one to explore Central Vietnam, home of Hang Son Doong, the largest cave in the world complete with its own ecosystem. Unfortunately, it cost over three thousand dollars and had a several month long wait list to explore, but we explored some incredible caves like you see in the movies. Literally, we saw a rock star recording a music video in one, jamming out while his groupies watched in awe. My friend had met a Vietnamese girl while backpacking through Thailand and had kept in touch with her. She let us stay at her house in Sapa, a wooden hut you showered by hose, squatted to use the bathroom (if you were able to get around the pregnant pig), and would be woken up by roosters at 5 am. This was just a fraction of Vietnam, and then there was Hong Kong and Japan…

However, the most important part of the trip wasn’t any of these experiences. It was that I was capable of having these experiences. That I could leave my comfort zone, go to a foreign country with just a backpack, adapt, make friends, and not only get by but have a fantastic and unique experience. It’s a feeling that can not be bought, an invaluable confidence and independence that has pushed me out of my comfort zone countless times since. A confidence that I know I can lean on when I’m debugging a particularly nasty bug or simply trying to leave the warm comfort of my bed before I’m ready.

Little Schemer by Friedman and Felleisen

With the exception of a quarter or two, University exclusively taught in the Object Oriented Procedural Paradigm. And while that will always feel like home… I don’t spend that much time at home. It’s nice to get out of your comfort zone, and go explore and learn new things. So I decided to pick up Little Schemer and gain some insight into Recursion and the Functional Programming paradigm.

While learning JavaScript I watched Douglas Crockford’s lecture on JavaScript, Act III: Function the Ultimate. In this talk he recommended Little Schemer, promising that it would “Change the way you think, and there aren’t a lot of books that will do that”. It wasn’t the first time that I had heard of the book, but this gave me to push to go out and pick it up.

I can happily say that it did not disappoint. I’ve always been fascinated by graphs and how easily that can model real world problems. And this book has pushed me towards some key insights there… which will probably get a full blog post in the future. But to put in a words I never thought I’d say: I now find it easier to think in recursion - since I know that if I can cover all the possible cases I’ll eventually reach the solution.

Note that Little Schemer isn’t formatted like a normal book, it’s based on lecture slides and works in a Q&A format. You can see a short excerpt above. It also assumes zero knowledge of Scheme so it starts with the basic building blocks of the language and builds up from there. It builds up very quickly and gets to some really cool stuff towards the end: Collectors, Applicative-Order Y-Combinator, Interpreter.

Here are some of my favorite quotes and ideas from Little Schemer:

Mindfulness in Plain English by Henepola Gunaratana

I’ve always been interested in meditation. Having grown up in the Silicon Valley, I’ve found that the heart of the tech world has an ironic obsession with spirituality. While not busy mining the finest 1’s and 0’s from the Silicon Valley Mines, idols like Steve Jobs are/were well known for their obsession with spirituality.

About a year or two ago I began to read more about meditation and started integrating a basic form of deep breathing into my life. After backpacking around Southeast and East Asia for a few months this amateur interest gained steam. Theravada Buddhism is very popular in Southeast Asia, so during my month in Vietnam I had lots of exposure to it while visiting shrines or hanging out with natives. Zen Buddhism is more popular in East Asia, which matches my ethnicity (I’m half Chinese and half Japanese).

After reading around online and practicing the basics I found - r/meditation is a fantastic resource! I decided I wanted to dive deeper into the Theravada school of Buddhism. This was because it was more based on the scriptures and thus can be self-studied while Zen tends to need a mentor or teacher to guide you. Thus, I decided to read Mindfulness in Plain English, a well known and practical book on Theravada meditation.

Here are some of my favorite quotes from Mindfulness in Plain English by Henepola Gunaratana. These first four are actually ideas that I keep on hand and reread on a weekly basis.

Chapter 1: Meditation, Why Bother? pg 4

“The essence of our experience is change. Change is incessant. Moment by moment life flows by and it is never the same. Perpetual alteration is the essence of the perceptual universe. A thought springs up in your head and half a second later, it is gone. In comes another one, and that is gone too. A sound strikes your ears and then silence. Open your eyes and the world pours in, blink and it is gone. People come into your life and they leave again. Friends go, relatives die. Your fortunes go up and they go down. Sometimes you win and just as often you lose. It is incessant: change, change, change. No two moments ever the same.”

“There is not a thing wrong with this. It is the nature of the universe. But human culture has taught us some odd responses to this endless flowing. We categorize experiences. We try to stick each perception, every mental change in this endless flow into one of three mental pigeon holes. It is good, or it is bad, or it is neutral. Then, according to which box we stick it in, we perceive with a set of fixed habitual mental responses. If a particular perception has been labeled ‘good’, then we try to freeze time right there. We grab onto that particular thought, we fondle it, we hold it, we try to keep it from escaping. When that does not work, we go all-out in an effort to repeat the experience which caused that thought. Let us call this mental habit ‘grasping’.”

“Over on the other side of the mind lies the box labeled ‘bad’. When we perceive something ‘bad’, we try to push it away. We try to deny it, reject it, get rid of it any way we can. We fight against our own experience. We run from pieces of ourselves. Let us call this mental habit ‘rejecting’. Between these two reactions lies the neutral box. Here we place the experiences which are neither good nor bad. They are tepid, neutral, uninteresting and boring. We pack experience away in the neutral box so that we can ignore it and thus return our attention to where the action is, namely our endless round of desire and aversion. This category of experience gets robbed of its fair share of our attention. Let us call this mental habit ‘ignoring’. The direct result of all this lunacy is a perpetual treadmill race to nowhere, endlessly pounding after pleasure, endlessly fleeing from pain, endlessly ignoring 90 percent of our experience. Than wondering why life tastes so flat. In the final analysis, it’s a system that does not work.”

MyFitnessJourney

Under Construction

Introduction

I’ll start with a disclaimer: This isn’t a guide. This is my fitness journey, how I achieved my goals with the time and effort I was willing to put forth. Although, at the same time, I’m a pretty normal guy so maybe these things will apply to you as well. Also, friends will often ask for advice so I figure I can just direct them here rather than attempt to cover everything poorly in person, and have them not retain that much.

This whole post could be summed up with: Eat, Sleep, Workout, Be Consistent

Table of Contents

  • Background
  • What I used to do
  • Transition to Power Lifting
  • Studying
  • Routine
  • Nutrition, Lifting, Sleep, Sustainability
  • Cutting
  • Bulking
  • Progress Pics and Body Scan results
  • Favorite Resources

Background

Since June I’ve gone from 139 lbs to 143 lbs. From:

  • 67.2 lbs of Skeletal Muscle Mass, 21.2 lbs of Body Fat Mass, with a 15.1 Body Fat percentage
  • 72.3 lbs of Skeletal Muscle Mass, 16.3 lbs of Body Fat Mass, with a 11.4 Body Fat percentage

Here’s some of my lifts, I’ve mostly moved into intermediate going on proficient territory. So I’m pretty happy but I’ve got a long ways to go:

Lift 5 Rep Max (lbs) Theoretical 1 Rep (lbs)
Back Squat 240 280
Deadlift 240 280
Bench Press 185 225
Overhead Press 115 135
Weighted Pull-up 45 75
Pendlay Row 135 155

Learning Javascript

Under Construction

Table of Contents

Introduction

I’ve always been interested in learning Javascript, but have been too overwhelmed by the abundance of resources out there. I finally took the time to do some thorough looking around with lead me to this Stack Overflow link on resources for learning Javascript. This lead me to the MDN Javascript Reintroduction and Crockfords Lectures.

Favorite Tools and Tricks

I was showing two of my engineer buddies something on my laptop when I realized they didn’t know how to shortcut between tabs. It blew my mind that people don’t know these things, which got my thinking about all the little tips and tricks I’ve picked up over the years. I ended up making a list… so I figured I might as well share it. I’ll throw on a quick summary for why I use all these things. For example:

  • Google, Really really good search engine. A strong alternative to Bing if you’re willing to give up the $125/year that Microsoft will give you for clicks.

I’ve mostly found these through annoyance at minor inconveniences, whether they be multiple keystrokes or the laborious task of moving my hands to the keyboard and back.

Raspberry Pi Alarm

Under Construction

Table of Contents

Introduction

I’ve always had trouble waking up. Sometimes I wake up, sometimes I don’t, sometimes I just end up lying in bed… it’s been a lifetime point of stress. But in the last few months I’ve found a solution that works for me. I use the Sleep Cycle Phone App to gently wake me up so I’m ready for my out of bed alarm that goes off at 630 (weekdays) or 830 (weekends). This forces me to get out of bed to walk across the room and turn it off.

But with the larger problem solved, there’s always more you can do to make it more perfect. Right now I’m using an iPad as my out of bed alarm. There’s a lot of problems here: it’s a really pricey device being used for a very simple task, it can be inefficient to turn off or adjust alarm times (I don’t enjoy the gui), the battery will eventually run out, and if I wake up early there’s no kill button to stop my normal alarm from going off without remembering to turn them back on.

There’s a lot of pros though, the battery lasts for several weeks, it doesn’t need to be plugged in (I’m a little OCD and don’t want extra wires).

On top of this, I’ve been hearing about Raspberry Pi’s for years and have always wanted to mess around with one. This seemed like the perfect project to get started on the DIY journey.

Note: this isn’t so much of a guide as my reflections on my journey to solidify the things I learned.

A Tale of Two Cities by Charles Dickens

Here are some of my favorite quotes from A Tale of Two Cities by Charles Dickens:

“I should like to ask you: -Does your childhood seem far off? Do the days when you sat at your mother’s knee, seem days of very long ago?

Responding to his softened maner, Mr. Lorry answered:

Twenty years back, yes; at this time of my life, no. For, as I draw closer and closer to the end, I travel in the circle, nearer and nearer to the beginning. It seems to be one of the kind smoothings and preparings of the way. My heart is touched now, by many remembrances that had long fallen asleep, of my pretty young mother (and I so old!), and by many associations of the days when what we call the World was not so real with me, and my faults were not confirmed in me."

Meditations by Marcus Aurelius

Here are some of my favorite quotes from Meditations by Marcus Aurelius:

Book 6.54

“That which is not good for the swarm is not good for the bee either.”

Book 7.7

“Think not so much of what you lack as of what you have: but of the things that you have, select the best, and then reflect how eagerly you would have sought them if you did not have them. At the same time, however, take care that you do not through being so pleased with them accustom yourself to overvalue them, so as to be disturbed if you should ever not have them.”

Backpacking Japan: Part 2

It’s incredible how fast the months can pass when you’re having fun! As the trip came to a close we headed further into Japan to explore Osaka and Hiroshima before heading back to Tokyo. We actually went back to Tokyo earlier than we had planned, since it was just that incredible!

We caught a pretty good view of Mount Fuji as we sped by on the Shinkansen.

Backpacking Japan

While Vietnam was more of an adventure, Japan fell on the vacation side. The hospitality was incredible and the hostels felt like 5 star hotels. The cuisine was full of novel tastes and textures. The culture was quirky and energetic. Most importantly though, I got to visit one of my homelands, something I’ve always wanted to do.

Backpacking Hong Kong

I had originally planned to go to China during this period but decided a couple weeks would not be nearly enough time and didn’t want to waste a six month, relatively expensive visa on it. So I decided to go to Hong Kong instead.

Backpacking Vietnam: Part 2

After a couple weeks Andreas' Visa expired and he headed back to the U.S. The rest of us had planned to head to Indonesia at this point but decided we wanted more time in Vietnam. Zach, Quynh, and Sherrie headed south for the sunny beach resort of Nha Trang while Amber and I set off west for the green hills of Sapa before heading south back into central Vietnam.

Backpacking Vietnam

When I set out on the biggest adventure of my life, I was afraid it somehow wouldn’t match up to expectations. And expectations were high after hearing stories and having wanted to go for years. So I’m happy to say that Vietnam was perfect, it was a crazy and exhilarating adventure of strange things and marvelous places.

Here are some highlights from the trip:

Learning Ruby on Rails

Under Construction

Table of Contents

Introduction

I’ve always wanted a personal website, for such a long time that I can’t even remember the original reason. But it always felt so difficult, like there would be hoop after hoop to jump through. And there were, but I found that each hoop was very easy to jump through, with fantastic resources and frameworks doing almost the entirety of the leg work.

This was one of my first truly independent projects. Prior to this I had always had a partner, professor, TA, etc to fall back on if I got stuck. So this project was stepping out of my comfort zone, which is always difficult. But as I’ve found, pushing those boundaries has great reward and brings a certain feeling of personal pride and independence.

Learning Rails

To learn Ruby on Rails I made use of Codeacademy Ruby Guide, Michael Hartl’s Ruby on Rails Tutorial, and Railscast. Codeacademy was fairly basic and I think is catered towards complete beginners. But looking through there I found some good basic guides to brush up on things like git or commandline. Michael Hartl’s tutorial was incredible and even after finishing it I would come back and use it as a reference guide. For things that Michael Hartl’s guide couldn’t cover I would look through Railscast.

Apps

I started off wanting to build a blog, so I modified Hartl’s code for that purpose. Building a dynamic mysql blogged webapp. I wanted to try something a little bit different as well so I build a Photo Uploading app. It seemed like it would be difficult but by utilitizing Ruby on Rails gems it turned out to be easy. The Cloudinary gem was quick to setup and did all the heavy lifting, offering a way to upload and store images in the cloud.

I wasn’t entirely happy with the blog though, as a one person blog I found the dynamic nature to be redundant. Then I got lucky browsing around the internet reading blogs. I found that this ‘Octopress Blog: A Blogging Framework for Hackers’ came up repeatedly, so I decided to check it out. Turns out it was exactly what I was looking for. I thought Ruby on Rails did a lot of the work for me, but Octopress utilizes Jekyll to do even more. It generates posts, provides tools like improved image tags. And above all it is static, so no need for a database, one less thing to worry about breaking. It also takes care of the UI, and lets you download template themes for a personal flare. Or quickly plugin fun additions like Disqus or Google Analytics. Above all its static, so I don’t have to worry about the model part of MVC.

What I Learned

I learned far more than just Ruby and Ruby on Rails. The nature of an independent project is that every step you have to search for the proper tool to do this or that, and you end up finding a lot of new things. For example, I fell in love with the three window (commandline, editor, browser) workflow. I got more comfortable with using commandline debuggers, helping to reduce my dependence on the bloated IDEs I had been stuck with in college. The commandline is very romanticized and it was awesome to get to know it better.

I found out how easy things are, especially since Ruby on Rails has such a strong community. Heroku makes it effortless to deploy your app, gems like New Relic can monitor your app with less than 10 lines and 10 minutes of work. When I wanted to speed my app up, it took copying and pasting in two short blurbs and installing a gem. The hours I spent building a login system from scratch in Michael Hartl’s tutorial was replaced instantaneously with the Devise gem (the understanding I got from the tutorial can not be replaced though). I remember setting the devise gem up and looking for the generated code (I thought it was a scaffold). But after checking git and seeing that there were actually no changes to the source… that the system actually worked!

This is where I started to understand how much of programming is simply reading and interface and plugging to pieces together. How layers like ActiveRecord could be laid on top of your database so that it could handle anything from postgresql, mysql, etc. How REST could be laid on top off resources and interact with them through universal verbs/actions.

I learned to write user stories and plan out my code better before I started typing (school projects would generally provide structure). I learned to use git better, to branch on features and merge them back only once completed. And that they were only completed once that had an automated test suite. And to use Test Driven Development to make sure they that new features were fulfilling their test cases. I had theoretically known what MVC and REST were, but here I got some first hand experience with them. Things I take for granted like how to write in Markdown.

University didn’t expose me to the most interesting language, there were a few weeks of ocaml and python, but asides from that mostly Java and C++. I found Ruby to be very refreshing, being able to do things like inject. Or easy list comprehension and array splicing like python. Or how as a dynamic language, it would have really cool methods like ‘method_missing()’, lazy evaluation, or would put ‘?’ or ‘!’ if it returned a boolean or modified data, respectively. How it had an REPL to play around with an idea, or first class functions (procs, lambdas, closures) intead of the mess that Java callbacks are. It also enforced the idea that despite all the differences, at their root all the languages were very similar. Sure there would be some different syntax, typing, or libraries but in the end it all came down to the idea of structured programming: that everything could be done with a combination of sequence, selection, iteration.

I bought a domain and learned how to use its DNS, which was actually one of the biggest hassles. There isn’t a wealth of helpful information online about hosting, and it’s very unhelpful that providers work differently so the guides you find aren’t entirely applicable. However, the longer it takes you to find something out, the better you understand it, so no harm there.

I learned random invaluable things like Lorem Ipsum and the origins of foobar.

Conclusion

Overall I found it very analagous to backpacking around Asia. When you first set out its terrifying, you have no one to rely on. But you learn and quickly find everything to be very easy. You meet incredible people who want to help you. You discover new things about yourself and come out of it a stronger and more independent individual.

Technologies behind this Blog

This blog webapp utilizes the technologies/services:

  • Ruby on Rails obviously!
  • Octopress, powered by Jekyll. A blogging framework for hackers.
  • gandi.net for hosting and dns services.
  • Rack::Cache for faster loading
  • Heroku for hosting online as well as the New Relic addon to stop the dyno from idling.
  • Devise for user, session, and password management.
  • Bootstrap to make things look pretty since I’m no css wizard.
  • Rspec and Capybara for quick automated testing.

Source

Thoughts on Clarity

“That’s why stories appeal to us. They give us the clarity and simplicity our real lives lack” - Patrick Rothfuss. Since I love stories, whether they are from books or movies or tv… this quote struck me. However, I think that the hunt for clarity and simplicity applies beyond stories to everything that I love, to all the hobbies that I enjoy. I do not expect to ever understand life enough that I might claim that it is simple. However, I will certainly try. I feel that my best chance is to pick small pockets of life as hobbies and over a lifetime of learning, achieve a high level of understanding (or clarity).

I have always loved clarity. When I played hockey in high school, I loved starting a rush up the ice, all the possibilities laid bare before me. Or studying for a final as I could feel all the information consolidating, seeing how interconnected all the details were and understanding the flow of the subject matter. Thus, I loved games, learning their inner workings and obsessing over them until I could see several steps ahead. I loved learning because if you studied hard enough and read deep enough into the subject then there was no need to memorize, it would become natural and simply make sense.

But games come and go. The one constant has become programming, it is the ultimate hobby since I can get paid for doing it and spend my next 30-40 years exploring its nuisances under the guise of a career. I’ll be surrounded with others who have spent decades studying and learn from them. There will be no slacking since I’ll be disciplined to spending 40 hours a week. And yes, I will balance it with my personal life and other hobbies. Ultimately though, I see it as my greatest hope for achieving clarity.