Technology

Ruby On The Beach: Week 5

February 16th, 2015 - Ubud, Bali

In maintaining alignment with the direction of our programming bootcamp, I've decided to make an adjustment to the blog. Whereas the first half of the class focused on absorbing and utilizing foundational coding concepts, the second half is centered around self-directed learning through exploratory research and developing real web applications. For programmers, success in the face of a new challenge often depends not on your knowledge base, but rather how quickly and effectively you can add tools to your skill set. In this regard, comfort with ambiguity, frustration, and constant code errors must become second nature.

Although this mindset shift was challenging at first as it removed most of the curriculum's structure, I am confident that it will produce the kind of durable learning necessary to continue improving as a developer long after our cohort disperses from Bali. Moving forward, in lieu of breaking down one core concept each week and evaluating my productivity, I'll attempt to explain how the apps that we've been building actually work. This week, I worked on two projects inspired by platforms everyone is familiar with: Pinterest and Ebay.

Pinterest Clone

When developing technology, it's vital to first pare down all the possible features within the product scope down to the most basic requirements: the minimum viable product. Pinterest, at its core, is a photo sharing application. Once users are signed in, they should have the ability to post and view pictures.

One of the coolest parts of building software is the prolific availability and extensive documentation of open source projects. The entire user signup and login process in Ruby can be handled by a "gem": a code package that can quickly and easily be implemented into any existing application. The preeminent gem for user authentication in Ruby on Rails is called "Devise", which after just a few commands and some simple styling can handle all the necessary database manipulation and generate forms to be rendered in the browser like so: Screen Shot 2015-02-16 at 8.26.07 PM

You may notice that across the top here, I've included a navigation bar. Although it seemed daunting at first, another open source project, Bootstrap, made implementing this beautiful feature relatively painless. Bootstrap is a front-end framework that makes designing and styling website components ridiculously quick, and is definitely the fastest way to make a minimal rails app look much more impressive.

With just a few lines of code, I was even able to implement a responsive design that turns the navigation into a drop down menu when the width of the browser shrinks.

Screen Shot 2015-02-16 at 8.44.08 PM

Screen Shot 2015-02-16 at 9.20.10 PM

My favorite feature of the navigation bar is that it even renders different clickable options depending on whether or not the user is signed in! Can you identify where the split takes place in the code block below? (Hint: look for a part that includes either "Login" or "Logout").

Screen Shot 2015-02-16 at 9.15.57 PMNow that we've established user creation and basic navigation, it's time to ensure that users can achieve their original goal: the ability to upload a "Pin" and view it. Although this feature was significantly more involved as I had to connect to Amazon Web Services' cloud hosting platform for the first time and suffered through the same error for over 24 hours, it was glorious moment when the app finally successfully began saving the images correctly.

Screen Shot 2015-02-16 at 9.26.53 PM

Fbay

Fbay, "the world's premier auction site for all things F", was the group project that I worked on most extensively this week. The original assignment was to create a basic site similar to Ebay, but utilizing the new strategies that were introduced this week. One of these concepts was validation, so we started by creating a simple command that only enables users to upload items that begin with the letter F and ran with our app from there.

Screen Shot 2015-02-16 at 9.41.23 PM

Coding in a team environment is an invigorating process, as each member contributes unique ideas and knowledge, enabling the group to create something much stronger than the sum of our individual skills. Although our group was met with an exceptional number of new challenges this week, we were ultimately able to build progressively more complicated functionality into the application.

Upon completion, users could add an item to the site, include a description and image, and set a duration for the auction. Other users could then bid on the item, but only if their bid is greater than the highest current bid:

Screen Shot 2015-02-16 at 9.55.12 PM

After a few hard days of work, numerous merge conflicts on Github, and more errors than I could mentally handle at times, we finally produced a final product full of Fedoras, Ferraris, Ferrets, Flowers, and Flamethrowers! Screen Shot 2015-02-16 at 9.59.40 PM

 

As someone who works best when I can see the outcomes of my work, it feels spectacular to have turned the corner from fundamental programming to composing real web applications that people will actually be able to use. This week we're diving into the wide world of APIs, and I can't wait to get started on our next project.

Ruby On The Beach: Week 3

January 25th, 2015 - Ubud, Bali

Another week of Ruby On The Beach has flown by! This week was particularly exciting, as we dove into the concept of Rails, a framework that enables the creation of powerful applications written in Ruby. Packages like Rails are an amazing reminder that software developers today are standing on the shoulders of giants, having been equipped with wonderful automation and behind the scenes processing power. It was incredibly empowering to see how quickly and easily we could build apps that just a decade ago would have taken exponentially longer.

It was another challenging week of absorbing programming concepts and beginning to put some of our knowledge to work by building real apps, but all of our work definitely began to pay off when we were able to interact with our code in the browser for the first time!

Screen Shot 2015-01-25 at 3.58.28 PM

One of the coolest aspects about reaching this milestone in the course is we were now able to tackle larger projects within small groups. This environment led to a lot of knowledge sharing, and I enjoyed picking up coding techniques and product management strategies from my peers within the cohort. Programming is hardly ever an individual undertaking, so it was a great experience to understand how folks with different backgrounds, skills, and mindsets approach solving the same problems.

Fabian, Luca, and myself designing a database schema (with instructor Brett observing)

The undertaking of a technology bootcamp entails a large portion of my week is spent in front of a screen, so having the accountability of RescueTime running in the background on my computer definitely helped keep me on track during those moments when focus started to fade. Although I bested my productivity score from the previous week, there's definitely still room for improvement. Screen Shot 2015-01-25 at 10.31.42 AM

As for my daily habit regimen, I started off strong this week before failing to check-in to all my habits on Friday and Saturday, as I definitely hit a wall and took some time to re-group before the beginning of another long week of learning. Screen Shot 2015-01-25 at 3.54.09 PM

The workout category is undoubtedly boosted by our yoga sessions three times a week, which I'm incredibly grateful to have incorporated into the curriculum. It's a testament to Ruby On The Beach's no burnout philosophy that we are encouraged to start our days establishing the mind-body connection and enjoying a much needed anxiety release. Screen Shot 2015-01-25 at 3.49.57 PM

Scaffolding in Rails

Our curriculum covered a plethora of rails concepts this week, including many I don't yet understand well enough to explain in a blog post. But there's one aspect that easily highlights the incredible powers of this framework: scaffolding. Pared down to it's most basic form, scaffolding enables the creation of a simple interactive website in just a couple of lines of code. Let's dive into this topic by building a semi-functional twitter clone.

Once the Ruby On Rails development environment is set up on your machine (which is no simple undertaking), to make a new application all you have to do is open the terminal and type:

rails new Twitter

Instantly, Rails goes berserk and configures a pre-ordained structure, then implements "gems" which enable the access of helpful third-party code blocks. Look at all those "automagically" generated folders and files!

Screen Shot 2015-01-25 at 4.34.57 PM

But at this point, our application doesn't actually do anything. We can quickly rectify that by running a devilishly simple command:

rails generate scaffold tweet username:string tweet:string

Let's break this down into bite-sized pieces:

  • Rails flags the terminal that what follows is a command in rails
  • Generate means we're about to create something!
  • Scaffold is what we're creating. Scaffolding is an easy way to build and interact with a simple application in the browser. It supports the creation, reading, updating, and deletion of objects - in this case, "tweets."
  • Author:string is an argument that means each instance of tweet should have a username that is a combination of numbers and letters.
  • Tweet:string means each instance of tweet should have some content as well.

Rails quickly interprets this and builds a whole set of files which serves as our basic scaffolding. If we now set up our database using rake db:migrate and fire up a local server by typing  rails server , then navigate to localhost:3000/tweets on a web browser, we can see the following:

Screen Shot 2015-01-25 at 4.40.04 PM

Incredibly, scaffolding creates bare bones HTML forms for all of the different pages you can now access. Without writing one more additional line of code, we can click on "New Tweet" to build an entire database of tweets. We even have the power to view, edit, and delete them.

Screen Shot 2015-01-25 at 4.55.53 PM

Now this might not seem miraculous to you, but the amount of work that Rails is doing on the back-end to enable this is relatively mind-boggling. Additionally, this is just one example of the power this framework enables developers with. I'm excited to see what next week's deeper dive into Rails has in store.

Ruby On The Beach: Week 2

January 18th, 2015 - Ubud, Bali

Just two weeks in to the Ruby On The Beach bootcamp experience, it's incredible to look back at the software concepts I was struggling with ten days ago and laugh at my own naiveté. Although my goal of becoming a bona fide programmer is undoubtedly still far away, it feels great to make progress every day and I've undoubtedly traversed a massive amount of material already.

In an effort to share insights into this experimental learning process, I've decided to share the outcomes from two ways in which I'm quantifying my progress and holding myself accountable throughout the course. The first, RescueTime, is an application that automatically tracks and categorizes how you're spending the time on your computer, providing insights into productivity and the biggest drains on your time. My first Weekly Dashboard shows a pretty focused week overall, with plenty of down time for reading Grantland, catching up on The Challenge, and even streaming NFL playoff games:

Screen Shot 2015-01-18 at 10.10.56 AM

 

The second, Coach.me, is the new name of Lift.do, an app I've written about before. Coach.me now offers chat-based coaching for $14.99/week, but the feature I love is completely free: daily habit check-ins. After experimenting with tracking a variety of different habits over the course of the last year, I've settled on six that are truly fundamental to my personal development and well-being. Most are self-explanatory, but #500WED just means writing 500 Words Every Day about anything that's on your mind. My first week of tracking got off to a solid start:

 

Screen Shot 2015-01-18 at 10.06.22 AMWondering why flossing made the cut? Want to learn more about developing positive changes in your lifestyle and be "scared straight" into developing a flossing habit? Check out this awesome illustrated Medium post.

During the first week, I was extremely motivated and actually really enjoyed diving into the fundamental aspects of programming. The concepts we approached in the second week of the curriculum were more challenging, and I spent significantly more time planted in front of my computer this week (13.6 more hours, according to RescueTime). Although there were stretches where I felt like I was repeatedly banging my head against a brick wall, in retrospect I definitely took huge strides in my understanding of Ruby.

Screen Shot 2015-01-18 at 10.11.15 AM

Although by sheer volume this was the most productive week I've ever had on RescueTime, those late nights of coding took a tool on my energy level and willpower, and I didn't prioritize well enough to have a great week of daily habits.

Screen Shot 2015-01-18 at 10.09.58 AMO Christmas Tree!

One of the most challenging projects we encountered in the curriculum this week was on the surface, incredibly simple: write a program that draws a Christmas Tree that looks like this:

Screen Shot 2015-01-18 at 11.44.18 AM

Appearances can be deceiving. Constructing this program left me utterly stumped for hours at a time, but I was eventually able to grasp the concepts associated with it and will now try to distill the code into terms anyone can understand.

First, notice that the entire program consists of merely printing spaces and asterisks (let's call them stars). In the first row, there's 1 star, followed by 3, then 5, and so on. If we were to represent this sequence as an equation, it could be (row number[starting at 0] = row number * 2 + 1). We can create a chunk of code to represent that:

def calculate_stars row
  row * 2 + 1
end

Ok, WTF is going on here?! First, we're defining a "method" called calculate_stars. Every time we type calculate_stars in different parts of the program, it will run this block of code. Calculate_stars also has an "argument", called row. Now when you run "calculate_stars 7", the method will take 7, multiply it by 2, then add 1. In row 7, calculate_stars knows to create 15 stars!

Second, let's calculate the number of spaces in each row much the same way.

def calculate_spaces width, stars
  width - stars
end

When we run the program at the end, we'll be providing it with two inputs: the number of rows and the width. Think about each individual line: if you know the number of stars and the total width, then you can figure out the number of spaces. Just do width - spaces! That's what is going on here.

Third, let's create another chunk of code that takes these calculations from above and translates it into actual printed stars and spaces. In order to do this, we'll need to run a loop that looks like this. Comments start with #HASHTAGS :)

# start with a blank line 
line = ""
# Below, stars is a variable. 
# It says, if there are 15 stars, run through this 15 times
stars.times do 
# Every time we do this, add a star to that blank line
  line = line + "*"
end 
# Print that line out! 
 puts line

This is a good start, but we need to add in our spaces first. The final result is a method named print line that runs through two variables, the number of spaces and the number of stars. Good thing we calculated those using the first two methods!

def print_line spaces, stars
  line = ""
  spaces.times do
    line = line + " "
  end
  stars.times do
    line = line + "*"
  end
  puts line
end

Finally, we have to put it all together! This time we'll write a master method that uses the three sections we've already built.

# Let's draw_trees with 2 variables: rows and width. 
# This enables the creation of custom size trees. 
def draw_tree rows, width
# Let's run the code below for however many rows there are. 
# |row| will go up by 1 each time through the loop.
  rows.times do |row|
# Remember calculate_stars? Let's use it right now! 
    stars = calculate_stars row
# width - stars is equal to the number of spaces. 
    spaces = calculate_spaces width, stars
    print_line spaces, stars
# This handy line adds a star to both the left and right side. 
    width = width + 1
# End the loop 
  end 
# End the method
end

Now let's check out what happens when we run the program in our terminal with a width of 15 and 10 rows.

Screen Shot 2015-01-18 at 11.43.54 AM Success!! The best part is this program is flexible enough to create any size tree. The final output looks something like this. Can you figure out what each line means?

Screen Shot 2015-01-18 at 11.52.07 AM

Although we eventually figured out how to draw a base, invert the tree, and re-factor our code to include other fancy concepts like arrays and hashes, I think I should leave it at that for now. If you have any questions or certain parts didn't make sense, I would love to hear about it in the comments below!

If you're interested in other perspectives on the "bootcamp in Bali" experience, be sure to check out the blogs of two of my fellow students at http://www.chic-ceo.com/blog and http://rubybali.tumblr.com/.

Ruby On The Beach: Week 1

January 11th: Ubud, Bali
"All life is an experiment. The more experiments you make, the better."

Ralph Waldo Emerson

For the next nine weeks, this blog will adopt a decidedly different flavor compared to my previous travel writing. During this time I'll be a student at Ruby On The Beach bootcamp, learning software development while living in Ubud, the cultural and artistic capital of Bali, Indonesia. This is ultimately an intellectual experiment in pushing the limits of what I'm mentally capable of, and I'm excited for what's to come.

Immediately upon arrival, it quickly became clear that this wouldn't be a typical tech bootcamp experience. For starters, accommodation, as well as access to a delightful bamboo co-working space steps away from our classroom, is included in the cost of the program. How much would this villa run you in Silicon Valley?

[embed]https://www.youtube.com/watch?v=RO0GOBU4d9w[/embed]

DCIM100GOPRO

 

For the last week, I've slowly been growing accustomed to returning to a regular working schedule and re-calibrating my brain to think like a computer programmer. However, the course has been structured much differently than I anticipated. As opposed to working 12 hours a day and cramming material into our brains as quickly as possible, Ruby On The Beach is founded under the principle of avoiding burnout. By taking a comfortable pace through the curriculum, taking frequent breaks to let information percolate, and starting with yoga class three days a week, class so far is legitimately delightful.

Beanbag Chair + Board Shorts + Pool = The ultimate stress-free coding environment

As our fearless leader Dan reminded us during a morning stand-up session, every concern and fear we have while coding must be appended by two words: in Bali. As in, "I'm getting really confused by this utterly impossible assignment....in Bali." This mindset puts everything into perspective; take in the gorgeous surroundings and don't get too worked up because you will figure out the solution eventually. So far, the most spectacular aspect of the class is the people. My fellow students hail from all corners of the globe and each one brings unique experiences and perspectives to the table. Our instructors have infectious positive attitudes and the bootcamp's 4:1 student to teacher ratio means an experienced and knowledgeable code monkey is never more than a shout away.

10841926_414025768754132_480371821934831727_o

Becoming proficient in Ruby on Rails, a popular software framework for developing web applications, won't be an easy undertaking; there's a lot of ground to cover over the next two months. While taking Coursera's wildly popular Learning How To Learn to prepare for the class, one big takeaway was that if you can distill a complicated topic into segments simple enough to teach anyone, it becomes much easier to retain concepts. To quote Barbara Oakley's fantastic A Mind for Numbers"when you cultivate simple explanations by breaking down complicated material to its key elements, the result is that you have a deeper understanding of the material." For the duration of the class, I'll take one seemingly complicated concept we learned each week and try to make it simple, right here on the blog. Although this week we dove into version control using Git and even wrote our first programs in the Ruby programming language, I'll start with something devastatingly simple: the command line interface.

The Terminal

 

Unless you're a designer or developer, it's unlikely that you've ever opened the command line interface on your computer on purpose. But until the invention of the GUI (graphical user interface) this is how everyone interacted with computers! On the Mac operating system, it's called the Terminal and looks something like this:

Screen Shot 2015-01-11 at 8.19.24 PM

Huh? Yea, most students in class were befuddled and intimidated by this screen on Monday morning, yet by the end of the week we were all well versed in the powerful (and potentially destructive) applications of the Terminal.

If you're unfamiliar with the Terminal but comfortable with a Mac, an easy comparator is Finder's file management system. Compare the two shots below: Screen Shot 2015-01-11 at 8.32.10 PM

Screen Shot 2015-01-11 at 8.33.10 PM

Notice the similarity? The first shot is the Finder's display of the root folder on my computer, whereas the second picture shows what happens when you run the ls -l (ls = list, -l = long form) command of the same root folder from the terminal.

When properly manipulated using commands, the terminal becomes an easy and convenient way to create new folders and file systems. In the example below, I created a new folder for my Blog Content (mkdir Blog_Content), moved to that folder (cd Blog_Content), created two additional Folders for images and text (mkdir images, mkdir text), moved to the text folder (cd text), then created a text file for this post (touch ROTB_Week1.txt)

Screen Shot 2015-01-11 at 8.48.10 PM

For comparison, here is how the outcome is demonstrated in Finder.

Screen Shot 2015-01-11 at 8.55.18 PM

Boom...now you know how to make folders and files using your command line interface! Exciting, isn't it? Ok, not exactly. But while laying the foundation for more complicated applications and concepts, you have to crawl before you can run. Check back next week to learn something else about computer programming!

Achieve Anything with Lift

If you were to scroll through the top charts of the Health and Fitness category in either Apple or Google's app stores, you would find much repetition. Many of the apps accomplish the same goals, whether that be tracking your steps, helping you count calories, or providing a workout companion while at the gym. But there’s one app that is on a mission to do so much more: unlock human potential. Lift is an app that helps you achieve your goals through tracking, community, and coaching. Although many goals are health and fitness related, Lift also incorporates things that you normally wouldn’t consider play an impact on your well-being, like flossing, playing a musical instrument, or keeping a journal. Each different goal on Lift is accompanied by a question and answer section where you can utilize the vibrant community to find their favorite tools or get over tough roadblocks along the way.

 

IMG_1784  IMG_1786 Lift has also developed a growing database of challenges in categories like Meditation, Yoga, Cardio, and Strength Training. One of my favorite aspects of these plans is that they subtly incorporate BJ Fogg’s Behavior Change Model of tiny habits. Instead of suggesting intense workouts, each plan starts off with something that seems incredibly small and easy, like just holding a plank for 30 seconds. But as you progress through these month long challenges, the daily expenditure gets incrementally more challenging.

Recently, Lift has unveiled  1-on-1 coaching for $15/week: a big feature that will surely be an important inflection point for the app’s development. It will be interesting to observe how this new channel impacts user engagement with the Lift platform and how coaching gets enhancements over time. Using the coupon code COACHME, the first week is free right now! What are you waiting for? Give it a try and see what happens...

Screen Shot 2014-10-30 at 10.58.45 AM

Mobile Mindfulness

In 2013, I became interested in meditation as a form of developing mindfulness, self-awareness, and emotional intelligence to improve performance and general well-being. Like most people, I was incredibly skeptical at first. Sitting still and quiet has never been something I’ve found particularly enticing; I’m much more comfortable being constantly stimulated by music, TV, podcasts, and the internet. However, I've also noticed that in many ways, technology has shortened my attention span and altered the way I think and work. This has driven a personal interest in products that are able to flip the paradigm and have the opposite effect, sparking deep stages of productivity and calm.  

Throughout the last 15 months, I’ve had many false steps with starting and maintaining a meditation practice. I’ve often thought “I’m doing this wrong” or spent an entire session being unable to quiet my inner parade of thoughts. One toolkit that has proved immensely helpful in this regard has been the recent proliferation of meditation apps. My phone is within reach for almost the entire day, and I’ve found it extremely accessible to just plug in my headphones for 5 or 10 minutes for a brief break in my day to center myself. There are three apps that I’ve discovered in this space that might be helpful for others, no matter how skeptical of meditation you may be.

 


1. Calm

Calm is the meditation app I’ve used the most and found the most success with in advancing my practice. For $9.99/year, Calm provides access to a set of guided meditations of varying length and amount of instruction. You can scroll through different background environments, each with their own unique set of ambient noises, then select a guided meditation or simply set a timer for your desired amount of time. 

Calm1      Calm2

Call me silly, but the simple feature that has got me to use Calm consistently is the “streak.” I love the feeling of progress that comes from seeing that I've been able to establish a daily habit, and I don't want to let myself down by not completing a session every day!

 


2. Headspace Narrated by a guy named Andy who does an amazing job of making meditation feel approachable, Headspace is quickly growing into a meditation community of users who absolutely love the product. Headspace starts with 10 sessions, each just 10 minutes, designed to get you familiar and comfortable with meditation practices and is a great jumping off point for anyone interested in flexing their mindfulness muscle.

FullSizeRenderHeadspace2

Stingy as I am, I haven’t explored the paid version of the app yet ($7.99/month), but based on the glowing reviews in the app store and growing community online, it’s sure to not disappoint.

 


3. Omvana

A product of Mindvalley Creations, which has an entire suite of mindfulness products, Omvana users are provided with a few free guided relaxations to start off, which you can mix with calming background noises for some pretty engaging effects. When you tire of the free tracks, Omvana has a paid library modeled on the iTunes store which makes for an intuitive design.

Omvana1 Omvana2

The reason I haven’t experimented with Omvana more is that past the basic library, individual tracks cost around $5 each. Although it’s easy to see how some people would end up spending a lot on the product, I much prefer the subscription model with access to a full library.

 


These platforms are surely still in their infancy, but it will be interesting to see how their products and designs evolve with the introduction of HealthKit, wearable devices that can detect your respiratory rate, and other advances at the intersection of mindfulness and technology.

The Necessity of the Connected Self

Everyone who knows my passion for the intersection of Health and Technology reached out to me recently to get my thoughts on the Apple Watch. Does it seem like a sound investment? Will it be a FitBit & Jawbone killer? With all the fancy new features, will I finally be able to lose those last stubborn 10 pounds? Honestly, my excitement for the Apple Watch is tempered for the time being. It seems like a well-designed piece of hardware, but just collecting data is not enough to actually improve someone's health. More value will result from behavior change software that harnesses all this data to provide individuals with actionable insight. And with a price point starting at $349, it may be a few years until this type of device goes mainstream.

Peter Drucker readers know quite well that “what gets measured gets managed.” This was the original allure of the “Quantified Self" movement: If I can track my health metrics automatically, I should be able to get healthier. But health is a complicated combination of factors and just collecting data about your steps doesn’t paint the whole picture, especially if you’re eating a Snickers bar while taking a walk.

That’s why I’m much more excited about the potential of HealthKit, GoogleFit, and other connectivity platforms that promise to centralize previously disparate sources of data in the growing Health and Fitness application ecosystem. Hopefully, by enabling both medical professionals and developers with the opportunity to paint a more complete picture of an individual’s health, we can drive real outcomes in the healthcare system.

This is the promise of the “Connected Self”, a new frontier in Health and Wellness. I’m excited to see what these new technologies can accomplish.