My So-Quantified Life, Part 1: Collecting Data

I lost 15 pounds and 3% body fat in 3 months. How did I do it? Quantification and slow but steady habit change.

A graph of my weight over the past year.

I’m a software engineer and tech leader. That’s fancy LinkedIn-speak for saying that I make computers do things and I keep other engineers happy in their careers. I like to collapse that down into the term Maker/Manager.

In my line of work, I’ve found the most successful software to be built using data-driven techniques. You generate lots of data, conduct lots of experiments, conduct retros and iterate. Why don’t we apply that to our personal lives if we want to be our best selves?

I applied these concepts to my own life to lose those 15 pounds. I’ve maintained this new weight now for 2 months. There are 4 main components to this quantification / data-driven technique:

  1. Collect Data
  2. Change Your Habits and Thinking
  3. Do the Work
  4. Reflect and Iterate

Collecting Data

Back in 2013, I bought myself a Fitbit as a birthday present so I could quantify my own health data. (Or perhaps it was because I’m an early adopter and I love gadgets.) You could do this with a variety of other devices like the Apple Watch, but I’ve found the sweet spot of data collection, features, and importantly battery life in Fitbit devices. I started with a Flex and I currently rock a Versa 2.

What kind of data is important for weight loss and improving your health?

  • Steps
  • Resting Heart Rate
  • Weight
  • Body Fat Percentage
  • Sleep
  • Additional Exercise
  • Calories Eaten
  • Calories Burned

The good news is that modern wearables (including my Fitbit Versa 2) can track all of the above automatically, with the exception of Calories Eaten, Weight and Body Fat Percentage.

Why are these data elements important?

  • Steps: This is your base exercise and you already know how to do it.
  • Resting Heart Rate: This helps you tell your overall fitness. If this goes down, you’re doing well. If it spikes up, you may be sick.
  • Weight: This is the main metric people use. Note that it tends to vary normally for whatever reason. It can also go up when you build muscle.
  • Body Fat Percentage: Another way to think about this is the inverse of your muscle and bone percentage. Since your bones don’t really change much that I know of, seeing this go down even if your weight doesn’t change is nice. Note that it can go up as well so don’t be discouraged if that happens and your other metrics are good.
  • Sleep: The more I read about sleep, the more I’m convinced that it is critical to our overall health. Studies show that if you don’t get enough sleep, it will lead to weight gain.
  • Additional Exercise: There are a lot of benefits, but basically you want to get 15-60 minutes of exercise daily if you want to get and stay healthy. There are a lot of different ways to exercise but you should get a mix of strength training which builds muscles, cardio which builds heart health and stretching which makes sure your muscles, ligaments and tendons stay in good shape.
  • Calories Burned is a nice calculated metric based on the above data. It helps to visualize your weight loss since this should be significantly greater than your Calories Eaten over a sustained period of time.

For Calories Eaten, which you should definitely track if you’re starting to get healthier or wanting to lose weight, the best I’ve found is using a mobile app, eating foods with barcodes and scanning them. If you want to eat fresh foods (which you do) and other food that doesn’t have bar codes, get a weight scale and enter it in. This part is a hassle but once you’ve learned how much you should normally eat, then you don’t have to measure anymore.

For Weight and Body Fat Percentage, get a smart scale. I use the Fitbit Aria. I weigh myself daily after waking up and using the bathroom. This helps eliminates variables such as hydration and food that you may have eaten. I do try to get down to the same amount of clothes every time as well. This syncs over WiFi with Fitbit.

Next blog post, I’ll cover Changing Your Habits and Thinking. For me, that was the hardest part of this whole process.

Closing a Chapter

I left my role as Director of Engineering at Capital One last Friday March 6th, 2020. Before I start the new chapter in my career, I wanted to say thank you to all of the people that I led, mentored, joined my teams after meeting me at recruiting events, collaborated with and those who led me, mentored me and taught me many things in my 6 years and 3 days at Capital One. I enjoyed working with all of you and I hope I made a positive dent in your career as well!

I leave with a lot of new skills, tons of swag, but best of all, positive memories and relationships. People to me are above all results.

Here’s an incomplete list of all the folks I worked with, incomplete because my memory isn’t perfect. I’m putting everyone in alphabetical order and I’ve uniq-ed the list.

Aalap, Aaron, Abel, Abi, Adam, Adey, Allan, Alex, Alexa, Alison, Amanda, Anatoly, Andrea, Andrew, Andy, Angelica, Angelina, Anne-Jeanette, Anthony, Aqeel, Anantha, Ankur, Armin, Art, Ashley, Ashraf, Atul, Austin, Bas, Baseer, Bbira, Ben, Beth, Bhavneet, Bob, Bori, Blair, Brad, Brian, Bryan, Cameron, Cara, Carla, Cary, Casey, Cat, Cathy, Chad, Charlie, Chris, Christian, Christina, Christy, Cindy, Claire, Clay, Colin, Connie, Corey, Dak, Dan, Dana, Dani, Danny, Darryl, Dave, David, Dean, DeeDee, Dipu, Drew, Divine, Eddy, Ehrin, Ehsan, Elaine, Eleina, Ellen, Emily, Eric, Erica, Erik, Eyobed, Fady, Firoze, Folarin, Gabe, Gayatri, Geetha, Glen, Greg, Gill, Gus, Haarika, Hameto, Hareen, Harrison, Hector, Heidi, Helen, Hicham, Hilary, Hutch, Ishita, Ila, Irakli, Ishtmeet, Jackson, Jason, Jamie, Jang, JaWaune, Jay, Jeff, Jena, Jenn, Jennifer, Jerry, Jessica, Jim, Jimmy, Jit, Joanna, Johanna, John, Jon, Jonathan, Joni, Jorge, Jose, Joseph, Josh, Josip, Justin, Kamal, Kaitlyn, Karen, Kasey, Katharine, Katie, Kay, Kaylyn, Keith, Ken, Keshav, Kevan, Kevin, Kim, Kinya, Kiran, Kobe, Korhan, Kristina, Krystie, Kshitija, Kyle, Kylie, Laith, Lani, Lawrence, Laura, Leon, Lesley, Lindsey, Lisa, Liza, Lloyd, Lakshmi, Lukiih, Madhavan, Major, Manish, Manuel, Margaret, Marie, Mark, Marty, Matt, Mave, Mayank, Meghnath, Mehak, Melissa, Michael, Michele, Michelle, Michi, Mihir, Mi Hon, Mike, Mikhail, Minahil, Mohammad, Mohit, Murshed, Nas, Naser, Natalia, Natasha, Nate, Navdeep, Naveed, Neel, Nick, Noor, Norbert, Pam, Pamela, Parvez, Pat, Patrick, Paul, Pete, Peter, Pradeep, Pranav, Priyanka, Raghu, Rajko, Rakesh, Ram, Ramesh, Ranjit, Rashid, Ravi, Reagan, Ren, Ricco, Rich, Riken, Renee, Richie, Ricky, Robbie, Robert, Robbert, Robin, Robyn, Rocky, Roderick, Rokas, Ruby, Rufus, Ryan, Saad, Sabrina, Sailesh, Sam, Sara, Sandra, Santosh, Sandeep, Sarath, Scott, Sean, Seth, Shaq, Shane, Shannon, Sharon, Shaunak, Shean, Sherman, Shirlinda, Sinclair, Skip, Sneha, Sobhan, Sonny, Sonova, Sri, Stacey, Stephen, Steve, Subhan, Sudheendra, Sunny, Supriya, Swapnil, Swaroop, Tanu, Taras, Tash, Teresa, Thai, Thomas, Tim, Tinu, Toby, Todd, Tom, Tony, Toria, Travis, Trey, Triet, Tripta, Trung, Valerio, V, Vanessa, Vicky, Victor, Vincent, Vikas, Viral, Vishal, Vivian, Vu, Walter, Wayne, Wil, Will, Yolanda, Yuchen, Youssef, Z, Zack, Zak, Zoey.

I wish you all the best in your own lives and careers. May we meet again!

By the way, I thought about adding in last name initials to differentiate, but just know that if your name is Alex, Amanda, Andrew, Andy, Brian, Chad, Chris, Dan, Eric, Hector, Jamie, Jared, Jason, Jeff, Jenn, Jennifer, Jessica, Jim, John, Jon, Jonathan, Josh, Justin, Kim, Mark, Marty, Matt, Michelle, Mike, Katie, Kevin, Nate, Nick,Paul, Pete, Robert, Robin, Ryan, Scott, Sean, Stephen, Steve, Tom, Tony or Will, that there’s a few of you in that big list. :)

pipenv

I’ve been writing more Python recently and package management seemed simple with pip. Then I learned about virtualenv to isolate your project’s environment. However I recently found a relatively new package manager for Python that combines the best of those worlds and also solves some existing problems called pipenv.

At the conceptual level, pipenv makes Python more equivalent to the development experience with Node with npm and iOS with CocoaPods. I’ve contributed to CocoaPods in the past and so am very familiar with the concept of a file that specifies all your dependencies and then a file that specifies the exact versions.

Package ManagerFile with dependenciesFile with versions of dependencies
CocoaPodsPodfilePodfile.lock
npmpackage.jsonpackage-lock.json
pipenvPipfilePipfile.lock

If you’re writing in Python, definitely check out pipenv!

How to enable headless networking on Ubuntu Mate on Raspberry Pi

I gave a talk tonight on Swift and how it works on the server-side as well as Raspberry Pi. I gave another talk about Swift on Raspberry Pi earlier in the year and I tried to use it like a full desktop. I had a keyboard, mouse and the projector hooked up to HDMI. That worked well, but it was clunky.

Nowadays, I consider a Raspberry Pi more like a tiny server. I ssh into it to execute commands and mount its filesystem with sftp. I can still work with its GPIO pins with a cobbler and a breadboard, but I don’t have an extra keyboard, mouse or monitor cluttering my desk.

However, the distribution that I’m using, Ubuntu Mate 16.04 for Raspberry Pi, does not start the WiFi until after you log in. Which requires a keyboard, mouse and monitor. I had these on a cart during my presentation tonight, but again it was clunky enough that it motivated me to figure out how to run it headless. I needed to ensure that the WiFi started when the system itself started, not waiting until a user logs in. I had done this in the past but forgot, so I am posting it here now.

The key is to declare your WiFi interface by appending the following to:

/etc/network/interfaces

allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

Then declare your WiFi network in the wpa_supplicant.conf referenced above (this is likely a new file):

/etc/wpa_supplicant/wpa_supplicant.conf

network={
    ssid="your-network-ssid-name"
    psk="your-network-password"
}

(Note, you can supply multiple network blocks as illustrated in Raspberry Pi Stack Exchange:
How to setup multiple WiFi networks?
)

Then reboot and you should be able to access your Pi after it starts up again!

Bonus tip: Ubuntu Mate seems to advertise itself via Bonjour. So if your pi is named “mario”, then you can ssh to it via “mario.local”.

Thanks to these references: How to setup your Raspberry Pi 2/3 with Ubuntu 16.04, without cables (headlessly) and WifiDocs/WPAHowTo

2016 Stats

Wow did I really not blog in 2016? I guess I was busy. Well because I like metrics, just wanted to update them here for the record.

My StackOverflow rep went from 8,055 to 10,455. That is especially cool because it gave me access to moderator tools. I’m effectively a StackOverflow Mod! Every so often, I go in and review questions. I feel like it is a developer’s way of doing community service.

Twitter followers went from 1,588 to 1,772. That’s like a new follower every other day. I think sometimes I get into a groove with my family and just get out all my extraversion with my wife and kids. I do want to keep sharing though, which is part of why I’m starting to blog again. When I share, I think I learn and I also help others. More of that community service mentality.

Well those are all the stats for now. I love numbers. Did I mention I’m level 288 in Overwatch?

Hello 2017!

I moved this blog from Linode to Digital Ocean this weekend, using a combination of GitHub, Ansible and good old fashioned sysadmin (me) sitting in front of a terminal. I also upped my security game, as you’ll notice by the nice https:// in the URL and lock in your browser. I’ll have more details later, but it has me feeling very in control of my personal digital destiny.

Which makes me want to blog. So Hello 2017! Expect to see more posts here in the near future.

2015 Year In Review

It is good to sit back and reflect sometimes and with today being New Year’s Eve, I thought it would be good to look back on what I have been doing this past year in 2015.

My wife Monica and I had our seventh son, Mario! He is super cute and huggable. He and the other boys keep me grounded and humble. Bonus: the company I work for is pretty family-friendly, I got to take a few weeks of Paternity Leave.

At work, I transitioned from leading a single Android team to leading several iOS teams. We shipped brand new, redesigned and modernized versions of our Capital One Mobile for iPhone and Capital One for iPad apps plus several monthly updates afterwards. I’ve now become what Lara Hogan from Etsy calls a “meta-manager” and I hope to find some time to write about that more in 2016.

I also helped to find ways for Capital One to invest back into the developer community. I think the Mac and iOS developer community was already strong but I want to make it even better. So we sponsored:

  • CocoaPods
  • Women Who Code
  • James Dempsey and the Breakpoints Live at WWDC
  • WWDCGirls
  • Swift Summit San Francisco 2015

I also organized the seventh annual iOSDevCampDC, along with Natasha (the Robot) Murashev, Jimmy Sambuo and Toria Dacus. We had some awesome speakers, but probably the most unique thing about this year’s is that the majority of speakers were female. I’ll have to revisit this in a future blog post as it deserves more time and attention. Plus I promised Cate Huston that I’d write about it sometime.

I also had a lot of fun with my hobbies, mainly playing video games with my kids (aka father-son bonding time) and watching eSports. I participated in the Alpha and Beta of Heroes of the Storm (currently our favorite multiplayer game in the house) and attended the action-packed and eSports celebrity-filled StarCraft II archon mode championship held at Red Bull Battlegrounds DC with my oldest son Diego, Jimmy and another coworker Cary.

I also spoke at a few events, including iOSDevCampDC, ModevCon, Android+Glass Meetup, Modev Coders Only and some internal events. I presented on a variety of topics including Swift, Frameworks and Kotlin. I’m working to encourage others to present as well. I’m organizing Modev Coders Only now and and it’ll meet monthly in 2016.

Before I go, I thought I should mark some stats for the end of 2015:

  • StackOverflow rep: 8,055
  • Twitter followers: 1,588

Well that’s it. I had much more to say in my unabridged blog post, but I think I’ll spread out that content over several posts. Hope that everyone else had a good year and hopefully 2016 is even better! Happy New Year everyone!

Swift – 53 Days Later

The bomb dropped at WWDC. 5,000 of my fellow iOS and Mac Developers were sitting there at Moscone West when Craig Federighi said:

But we had to ask ourselves the question what would it be like if we had Objective-C without the baggage of C?

At that point, there erupted a mixture of nervous laughter, gasps and excitement. My Objective-C heart sank but my curious brain lit up at the opportunity to learn a shiny new language: Swift.

I’ve been fortunate enough to be able to use it almost daily in my work at Capital One. So what have I learned in these past 53 days?

First, Objective-C is not going away yet. We still have a majority of our codebase in Objective-C. All the popular third party libraries that are utilized via CocoaPods are in Objective-C. Fortunately, Apple has built really good interoperability between Swift and Objective-C and vice-versa. My coworker Jonathan Blocksom and I gave a talk about this at MoDev Coders Only, titled “Swift and Objective-C: Best Friends Forever?”

Second, Swift is a real pleasure to code in. It is a lot more succinct due to the lack of header files, square brackets replaced with dot syntax and parentheses, no semi-colons, etc. You do trade in some dynamicness but you gain safety by the compiler doing work for you, like checking that you have assigned variables before use.
There is definitely a transition / learning curve, but it is relatively shallow compared to the one I faced when learning Objective-C back in 2005. Especially since we had to do retain/release and I had come from a series of languages that had garbage collection like Smalltalk and Java.

Third, Xcode betas can be painful. I separate this out from Swift as a language even though they are intertwined. It seems like the Xcode betas are on a two week sprint cycle, so we are on beta 4 as of this writing. This is only a temporary problem though, but I think it has dissuaded a number of developers from jumping in headfirst. Yes, sometimes I do cry when SourceKitService terminates and I lose all syntax highlighting, but that is balanced out by being able to code in a modern language like Swift.

Fourth, Swift has injected a lot of energy into the Apple development community. It hasn’t been buzzing like this since when the iPad first came out. We’re devoting half of iOSDevCampDC to it. I’ve seen a lot of new developers start to come out with the promise of a new, modern language that is more familiar looking. And the allure of a level playing field, since everyone, from Objective-C greybeards to college graduates, have the same challenge and opportunity to learn Swift from scratch.

I’m personally still excited about Swift. I think we’ve barely scratched the surface. We’re entering a new, more modern age of iOS development.

Further Thoughts on Being Productive

I’ve recently come across Cate Huston’s blog and she has inspired me to start blogging again. I thought I’d echo her post “Thoughts on Being Productive” with my own. I had been wanting to catalog my current best practices anyways so I can remember it in the future. Maybe many years from now, I’ll dig it up like they recently did with the E.T. Atari cartridge.

Mechanical Keyboard

I use a CMStorm QuickFire Stealth keyboard. I originally got into mechanical keyboards because of StarCraft 2 and picked CMStorm because they sponsor one of my eSports heroes, Polt. I realized though that they made typing really pleasant and as a result, programming. There’s just a satisfying feeling to the way mechanical keyboards respond to your fingers. I use the Red Cherry MX switches because they are a lot quieter than the clicky Blue switches that people use, plus they require a lower force to actuate. I’ve outfitted a keyboard at a previous client with red O-rings to make them quieter but they change how they feel so I prefer them without the O-rings.

Magic Mouse

Apple’s Magic Mouse has not changed in a while but it is still the mouse that I use. Some people may say that it is not quite as ergonomic as a Logitech Performance Mouse MX. However, for me, I’ve found that using that a Magic Mouse lets me click with two or three fingers at once, distributing the force needed among my fingers. I guess low force is key for me and programmers in general should think about this as well. If you’re a good programmer, you’re going to be typing and clicking a lot, so you should consider how you’re going to take care of your hands over the long run.

For gaming, I use a Logitech G300. It works well with my finger-tip style method of mousing, like the Magic Mouse. The many buttons are a lot better for control though. I won’t use that mouse for day-to-day development though, because then my index finger gets worn out.

Thunderbolt Display

The classic Thunderbolt Display is a staple of iOS Developers everywhere. I use one, propped up on a Beats headphone box (they’re really strong – a big chunk of the price is probably in the packaging…) with my 15″ Retina MacBook Pro centered underneath, in front of it. I don’t have many complaints about it especially since it serves as a hub for Ethernet and USB and it has a lot of real estate.

However, I think we should be well into 4K Displays soon so I’m looking forward to having a 27″-32″ Retina-quality display for day-to-day development sometime in the next year.

Walk 9,000+ steps a day

When I was an Indie Developer, I had no idea, but I basically sat around all day. Last year for my birthday, I got myself a Fitbit Flex and measured myself. I was shocked to realize I was super sedentary and was only taking an average of 3,000 steps a day. Recently, I joined Capital One and between a combination of walking up 5 flights of stairs from where I park to where I work, walking around the floor where I work, walking on a treadmill desk for a bit and going to the mall for lunch most days (plus some walking at home), I’m up to 9,000+ steps a day. As a result, I’ve lost 10+ pounds in the past 2+ months and have gained more energy throughout the day.

Stand or talk a walk every so often

Fitness aside, I think it helps to take breaks during the day. I’ve literally sat for hours at a time in front of a computer and I’ve come to realize that it is bad. Spending time with your computer is fine and all, but just not so many minutes straight. Every so often, at least once an hour, either stand up and stretch or take a quick walk. I’ve been doing that over the past year and it has helped me avoid the aches and pains that I’ve had throughout my career when I sat at my computer too long.

Also I use an push-button sit-stand desk. At home, I use a GeekDesk and at work, a Haworth. They’re both great desks in my opinion. I probably sit 2/3rd of the time and stand 1/3rd of the time, but the key I think is just varying it throughout the day. I find I can work effectively either way.

Treadmill desks like I mentioned earlier are also good, but they make you give up a lot of manual dexterity. So they’re not great for wiring up storyboards and configuring auto-layout. However, they’re fine for doing things like checking email and Twitter or reviewing resumes where you’re doing more reading or viewing.

Immerse yourself in headphones

I work in an open workspace. I think it is pretty cool with the different textures and varied lighting making it a very pleasant place to be. But frequently I want to tune all that out and really focus in on my code. I’m not sure if we Apple is going to acquire them or not, but we’ve got a rack of Beats headphones at my work, both the Solo HDs and the Studios. They come in a variety of colors so I can sort of match them to my outfit, which sounds vain when I type it out, but trust me, it is kind of a nice touch, especially with my blue shirt that matches the Beats blue perfectly. In any case, we have a rule on my team where if someone has headphones to not interrupt them, so as a result, I can get a lot of work done, with music that helps my mind flow. Plus I may dance a bit when my desk is standing. Because if you’re enjoying what you do and enjoying how you do it, I think you can be really productive.

Contributing to CocoaPods

If you’re an iOS Developer, you probably have heard of CocoaPods. More and more developers are using it. I’ve personally used it on many projects and I’m not sure I would want to go back to the old manual way of adding in libraries.

A few weekends ago, on March 29th-30th, they had the CocoaPods Bug Bash. I used to work a lot on the weekends when I ran my own iOS/Android consulting business, but now that I’m working at Capital One, my weekends are pretty wide open. Yay for work-life balance! (P.s. We’re hiring iOS Developers, just contact me.) But since I’m kind of nerdy, I thought what better way to spend my new-found free time than by writing some code.

I hopped onto the #cocoapods IRC channel, registered and then asked the CocoaPods bot to assign me a ticket. By the luck of the draw, I got issue #1489.

I set up my development environment by cloning the CocoaPods/CocoaPods repo, then initialized via rake bootstrap and ran the tests via rake spec.

At that point I realized, oh this is all in Ruby! For some reason I had thought it had more Objective-C in it, since it dealt with Xcode so heavily. Fortunately for me, before the iPhone SDK came out, I had made my living for a while creating Ruby on Rails apps. I quickly rediscovered my love for Ruby.

I loved it so much, I spent most of that weekend hacking away on CocoaPods and the weekend afterwards. At the end of it, I had touched not only the main CocoaPods repository, but also the internals of it in CocoaPods/Core and the high level tests in CocoaPods/cocoapods-integration-specs.

I’m now an contributor to all of those repositories and thus the CocoaPods project! I also got into the CHANGELOG twice:

0.32.0

An informative error message is presented when merge conflict is detected in a YAML file.
Luis de la Rosa #69 #100

0.31.0

Generated prefix header file will now have unique prefix_header_contents for Pods with subspecs.
Luis de la Rosa #1449

The most enjoyable aspect for me though is that it is fun to hang out with other developers from around the world. @orta, @irrationalfab and @alloy are pretty cool fellows and they are welcoming and helpful when they are around in IRC. They are definitely not shy about asking you to squash your commits, but they are also quite friendly with their emotes in pull request reviews.

I’m planning on doing some more hacking on CocoaPods. If you’re interested, I can help you get started with it if you’re in the DC area and come to NSCoderNightDC. Another good way to get started is to join the IRC room #cocoapods, set up your development environment and then just ask which issue might be good to work on. You might also want to follow the CocoaPods Twitter account and look for the “Simple open contribution of the day” which highlights simple issues to get you started.