29 April 2013 0 Comments
Install Octave on your Mac using Homebrew

If you are taking Andrew Ng’s Machine Learning class on Coursera this Spring, it’s about time that you set-up GNU Octave on your computer. I have done my fair share of googling, but could not find a comprehensive guide to install the latest version of Octave on Mac OS X 10.7/10.8 (Lion / Mountain Lion) using my favorite package manager for Mac, Homebrew.

The class website offers a help page for installing Octave. However, I wanted to go a little bit further from the provided installer. The Octave Wiki site offers a good starting point for installing Octave on your Mac. If you want to install Octave using MacPorts, Tom Lous posted his setup here.

Before you start, estimate this process to take at least a few hours. Make sure you’re comfortably at home, with power, internet and coffee/snacks while installation goes through. This will be the perfect time to finish watching week 1 & 2 lectures.

 

Command Line Tools for Xcode & XQuartz

Homebrew requires to have Command Line Tools for Xcode set-up on your Mac. If you have (and use) a current version of Xcode for development, you can install the CL Tools by going to Xcode > Preferences… > Downloads > Components. if not, I recommend the following method:

  • Uninstall Xcode first (paste the command below in the Terminal)
sudo /Developer/Library/uninstall-devtools --mode=all
  • Download the standalone installer from Apple (need Apple ID, ~150MB download) and install from the .dmg file

https://developer.apple.com/downloads/index.action#

  • Download and install the latest version of XQuartz

https://xquartz.macosforge.org/landing/

 

Homebrew Package Manager

If you are familiar with Linux, you probably know what a package manager is. Homebrew is an open-source package manager for Mac, for easy installation of software and tools.

  • Go to the Homebrew site for reference, and follow the installation instructions, or paste/enter the following at the command prompt:
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
  • Check for any issues with:
brew doctor

 

Installing Octave

Now, we will use the Homebrew package manager to install Octave.

brew tap homebrew/science
  • Update Homebrew to the latest package definitions
brew update
  • Install Octave (takes a few hours)
brew install octave
brew install gnuplot
  • Install ghostcript (needed to save plot files)
brew install ghostscript
  • Create an Octave configuration file in your home directory
echo "setenv GNUTERM x11" > ~/.octaverc
  • and finally, restart your computer

 

Running Octave

Now you have the latest version of Octave running on your machine. To start using Octave, just type

octave

at the Terminal command prompt

image

Feel free to discuss this post in the comments below. Let me know how this works out for you!

#Updated August 19, 2013: octave installs dependencies automatically. Removed “brew install gfortran”

23 December 2012 0 Comments

19 September 2012 0 Comments
Getting started with Git

Git has been part of my lexicon for a while, without me understanding exactly how to use it. For this post, I would like to provide an overview of Git, GitHub, and getting started with your first repository. For those new to the word (which is understandable when you are not a coder), Git is a distributed version control system (DVCS) for source code management - in plain words, think of it as software that helps you keep an essay that is constantly being written and updated under control. It knows about all your save states over time, and you can easily go back to any previous instance to continue your work.

The Linux community created Git in 2005 as a means to develop and maintain the Linux kernel within the open source community. Its main strengths are speed, simplicity, and a branching system for non-linear development. The branching system in Git is its core competitive advantage over other VCS. You can create as many branches (think branches in a tree) from your master branch as you want easily at low cost (time/resources), because Git stores your data as a series of snapshots. Each branch has its own snapshot in the project history. Therefore, when you create a branch, it’s easy to experiment with it, and if you decide to stop working on it, return to a previous snapshot of your content. If the branch develops into something substantial, it can merge with the master branch. And because branching is done by saving a small file containing pointers to the snapshot, precious time and resources are saved by not copying files to another directory as some other version control systems. For more info, I recommend the Pro Git book, which is available for free and has everything you need to know about Git. 

Enter GitHub, a free(mium) web based hosting service for Git repositories that launched in 2008. It came to combine the powerful features of Git as a DVCS with a collaboration platform targeted to programmers, especially open source. Collaborators can follow each other, star (favorite) repos, and fork (copy) repos for you to work independently. GitHub encourages you to share your code with the community in an interesting way. When you sign up for a free account on GitHub, you can have an unlimited number of public repos with unlimited collaborators, only needing to upgrade when you must have private repos. Therefore, anyone can have a free GitHub account as long as you decide to share your code. When the tech world was hot with Social Networks such as Facebook and Twitter, GitHub came to create what would become the world’s largest social network of code repositories and its contributors. GitHub owns the code graph.

Why is Git and GitHub important to me, a non-coder? If your goal is to become a product manager but you lack the technical background (non-CS majors), it is important to understand the language, the culture, and the tools of engineers. I am re-learning how to code, thanks to the free courses on Udacity (CS101), Learn Python The Hard Way, and Coursera (Machine Learning), but there’s a certain limit on how much you can improve your skills based on classes/practice without real-world experience. It has been said that you can improve the quality of your programming by more than 50% from reading great code, and GitHub has made such task easily accessible and widely available.

Today I’m starting the first step in my journey into GitHub. I’m assuming that if you’re also interested in GitHub, there’s a programming language you’re working on and want to start using it. GitHub has a step by step tutorial on how to get started, but if that’s not enough there is plenty of help available for free, which I will list below:

  • Hand’s on “Try Git” course from Code School (highly recommended)
  • Git - the simple guide by Roger Dudler
  • The “Git Immersion” guided tour from New Context
  • The complete “Pro Git” book from the official Git site
Now, you’re ready to start using Git and reading some real code. A good place to start is https://github.com/github, or head to Stack Overflow or Quora for some advanced questions and recommendations.

If you need further help and you are willing to pay for it, you may find the following links also helpful:

  • Git Real from Code School (subscription required)
  • Git Essentials from Tuts+ Premium (subscription required)

When you become an advanced user, come back and check out How to GitHub from gun.io. Interested in using Dropbox as a Git repository? Check out awesome posts by Roger StringerBradley Wright, and cantina.co.

Thoughts or comments? Let’s talk on Twitter