Point your computer or router settings to OpenDNS and experience a faster, more reliable Internet.

OpenDNS IP Addresses | OpenDNS

Today, my 45th Birthday, is a natural time to reflect on this year’s experiences, to milk their essence down to a light-weight survival pack, suitable for long distance travel and for sharing. Without a doubt, this year’s lesson is that forgiveness requires daily practice. These words came to me this year after a particularly challenging time…

The nature of forgiveness is hidden in plain sight as we learn, through pain and love, that forgiveness may be that measure of unconditional love freely shared with, through and as each other, not only in response to being wronged, but before, during, after and always.

By Grace, today, we have once more chance to practice f-o-r-e-givness of self and others, to practice love.

At the end of each day, can I  ask myself, “do I have love in my heart, not just for the people in my life, but for the people of my life?”

And if all this fluffy puffy talk hasn’t softened us up toward the idea of forgiveness yet, just imagine how much we’d be getting on each other’s nerves if in fact we were all perfect. Yikes! I dread to think of it. But really, each of you, my friends, family and colleagues, mean more to me than words can say and are the only present I need. Love you guys!  …most of the time   ;  )

My best,

Jay

By default, OS X comes with a buggy implementation of bash startup files. Here’s my approach to configuring bash’s startup files:

Feel free to follow the steps below or enjoy this 12 minute video discussion:

Create .bash_profile in $HOME if .bash_profile doesn’t already exist and set its file permissions:

touch .bash_profile
chmod 755 .bash_profile

Edit .bash_profile to include any “bash specific” commands which will only work in bash, and not in other POSIX shells (zsh, etc.)

Create .profile in $HOME if .profile does exist and set its files permssions:

touch .profile
chmod 755 .profile

Call .profile from the end of .bash_profile by adding the following:

if [ -f ~/.profile ]; then 
        source ~/.profile 
fi

Utilize .profile to include all modifications of PATH or any environment variables.

Create .bashrc in $HOME if .bashrc doesn’t exist and set its file permissions:

touch .bashrc
chmod 755 .bashrc

Add the following lines to .bashrc:

# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
        source /etc/bashrc
fi

Call .bashrc from the end of .profile by adding the following lines to .profile:

if [ -f ~/.bashrc ]; then 
        source ~/.bashrc 
fi

Use .bashrc for creating aliases and other functions which won’t pollute the the environment variable namespace with duplicate names etc. For good measure, include the following shell function, written by Gordon Davisson:

pathadd() {
    if [ -d "$1" ] && [[ ":$PATH:" != *":$1:"* ]]; then
        PATH="${PATH:+"$PATH:"}$1" 
    fi
}

Use the following syntax when adding a directory, such /usr/bin to the PATH within .profile:

pathadd /usr/bin

Hopefully this configuration setup will promote good organization and express intentions clearly. Let me know if you come up with something better.

My best,

Jay

I created the following post to document the steps I took to update the existing installation of Python on my mac, as well as setting up additional installations of various versions of Python to be used as templates for fresh virtual python environments.

This document claims no exercise of best practice, simply an approach that seems to be working for me after several months of use. Your mileage may vary, but I hope you learn something valuable for your own journey. If you use Homebrew, it will issue a warning when detecting this Python configuration, so again only use this setup if you are comfortable with that.

On a more personal note, I can tell you beginners out there that setting up your system to your liking can be a painful process, especially the first couple years. It does get easier and no, your not stupid, this stuff is just layered with years of historical baggage and it just takes time to get comfortable with it. If I had to recommend one book to help, it would be A Practical Guide to Linux, Commands, Editors, and Shell Programming by Mark G. Sobell, which also covers OS X.


Goal: Install Python 2 and 3 on Mac OS X. To keep these separate from the system Python version, so they can be used as clean prototypes for virtual environments.

Motivation: As a Python developer, I want to consciously control the use Python on my system (OS X Mavericks 10.9.2)

Note: Many steps are performed on the command line to facilitate learning and scriptability but feel free to browse and click where you prefer. (For example, instead of using wget in the 2nd step, you can just browse the python.org site and locate the most recent OS X python dmg file for download.)

Game Plan

Update the built-in ‘system’ version of Python 2 with a clean install. Use this system version to install pip. Then pip install virtualenv.

Install 2 more instances of Python (the most recent versions from each Python 2 and Python 3) in a non-system location.

Point virtualenv at the non-system Python interpeters for creating new Python development environments. These environments can be upgraded independently of the system’s Python, increasing the flexibility of the system’s Python configuration.

Change into home directory

cd ~

Download most recent version of Python 2 for use by ‘system’

UPDATE 2015/01/17:  Oops! wget isn’t available on vanilla mac systems. Jump ahead to the “Install Macports” section, follow it, then run “sudo port install -t wget” from your command line, then come back to this point and proceed. Whew!

wget https://www.python.org/ftp/python/2.7.7/python-2.7.8-macosx10.6.dmg

Note: OS X doesn’t come with wget installed, so use curl instead of wget in that case.

Mount the disk image file

hdiutil mount python-2.7.7-macosx10.6.dmg

Install the Meta Package file (the Python.mpkg file found within the newly mounted image)

sudo installer -pkg /Volumes/Python\ 2.7.8/Python.mpkg/ -target /

Unmount image to tidy up

hdiutil unmount /Volumes/Python\ 2.7.8/Python.mpkg/

 

Confirm current path search to system python

Open a new Terminal window and then:

which python #returns "/Library/Frameworks/Python.framework/Versions/2.7/bin/python"

Check your .profile (or equivalent) to ensure the installer appended the following text to update the PATH evnvironment variable:

# The original version is saved in .profile.pysave

 export PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"

Update Active Tcl to fix IDLE bug: http://goo.gl/9XRCF2

wget http://downloads.activestate.com/ActiveTcl/releases/8.6.1.0/ActiveTcl8.6.1.1.297588-macosx10.5-i386-x86_64-threaded.dmg

double click this file to install

Set PYTHONPATH for GUI programs such as Finder

Xcode makes working with plist easy, so I recommend installing it.

If it does not exist:

mkdir ~/.MacOSX

Use XCode to create a plist file by selecting File | New | File, then select Resource (Under OS X) and then Property List

Then create a key called PYTHONPATH and set its value to:

/Library/Frameworks/Python.framework/Versions/2.7/bin/python

Install Pip

follow instructions here: https://pip.pypa.io/en/latest/installing.html

wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py

Install virtualenv

sudo pip install virtualenv

Close and reopen the terminal window and run:

which virtualenv

This should return:

/Library/Frameworks/Python.framework/Versions/2.7/bin/virtualenv

Install MacPorts

visit macports.org and follow most recent instructions:

wget https://distfiles.macports.org/MacPorts/MacPorts-2.3.0-10.9-Mavericks.pkg

double click .pkg file and follow the instructions.

Please read this if you have Homebrew on your Mac too: http://superuser.com/a/830796/248728

It basically says to always use:

port install -t <portname>

when using Macports in order to avoid conflicts with Homebrew.

Install ‘segregated’ version of Python 2.7.8

sudo port -v -t install python27
cd /opt/local/bin

Note:

ls -lha | grep python

returns symlinks and source locations of installed python executables etc.:

lrwxr-xr-x 1 root admin 73B Jun 2 04:42 python2.7 -> /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7

lrwxr-xr-x 1 root admin 80B Jun 2 04:42 python2.7-config -> /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config

lrwxr-xr-x 1 root admin 74B Jun 2 04:42 pythonw2.7 -> /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw2.7

Install ‘segregated’ version of Python 3.4

sudo port -v -t install python34

Add some aliases to ~/.profile ~/.bashrc to streamline creating new virtual environments

(UPDATE 2015/01/26: Please see http://www.webapphero.org/configuring-bash-startup-files-on-os-x for more information on why .bashrc is now my preferred location for storing bash aliases.)

The following step will cause python 3.4.1 to be used when creating new virtural environments with the arbitrarily chosen mkenv alias. This author uses Heroku as a deployment platform, which officially supports python 3.4.1 and 2.7.8 at this time.
Append the following to ~/.profile or ~/.bashrc depending on which you happen to use:

# https://virtualenv.pypa.io/en/latest/virtualenv.html#environment-variables-and-configuration-files
# Use /opt/local/bin/pythonX.X here because pointing to Python.framework causes permissions error

(UPDATE: 2015/01/26: Also, per my own advice found here: http://www.webapphero.org/configuring-bash-startup-files-on-os-x I recommend doing exports in ~/.profile, so the the following export should be done there.)

export VIRTUALENV_PYTHON=/opt/local/bin/python3.2

alias mkenv=’virtualenv’ #python 3.4.1
alias mkenv33=’virtualenv –python=/opt/local/bin/python3.3′
alias mkenv2=’virtualenv –python=/opt/local/bin/python2.7′ #python 2.7.8

 

The end. (Try installing ipython notebook next and enjoy coding with python!)

The best thing about computers: they do exactly what you tell them. The worst thing about computers — they do exactly what you tell them!    –me

Programming for Everyone

April 24, 2014 — 1 Comment

Enjoy a peek into the future of programming. Aurora is a new project from the makers of Light Table.

A recent study provides evidence that the scent of Rosemary essential oil, emitted from a diffuser, can increase memory. You can read more in this article from ScienceDaily.com. I’ve started to diffuse the oil in my home office even though the tasks described in the study may differ from learning to program. I’ll take any help I can get, as long as it’s healthy.

If I can remember to, I’ll follow up in a few months and let you know how its going.

My best,

Jay

Use command and minus keys to enlarge content when someone is sharing their screen with you in Google Hangouts. Yes, that’s backwards from you might think. Check out this 1.5 minute video for more. Enjoy!

My best,

Jay

Command Line Help

February 11, 2014 — Leave a comment

A new web app, explainshell.com, provides an elegant solution to understanding command lines. It’s just about the coolest thing I’ve seen this year. Enjoy!

Have you ever wanted an easier way to work with regular expressions? A new tool, RegExpBuilder, by Andrew Jones aims to simplify the process of building regular expressions while boosting their readability. This 10 minute video will help give you a quick start with this clever approach to creating regular expressions. Enjoy!