Bike to Work Day 2012
Thursday, 10 May 2012
Today I road a total of 40 miles to and from work. The photo below shows where I decided to take a shortcut (or perhaps got lost) and realized that NASA does not have trails that offer shortcuts around their facilities. So I decided to backtrack costing me 5 miles.
Leave a comment
Django Base
Tuesday, 01 May 2012
I created a nice commandline utility a while back for automating the process of creating a Django project template. Since doing so, Django 1.4 arrived which added similar functionality but my script takes project creation a step further.
What is so cool about this script:
- A commandline wizard with pretty colors!
- Bash autocomplete command called mkdjango (like mkdir but for Django)
- Pick from the 4 of the most common server setups which will auto generate the configuration files needed.
- Use your own project template (if mine isn't good enough! :p )
Installation:
Checkout the code here: Django Base
Leave a comment
Coachella 2012
Friday, 27 April 2012
Last weekend, I took my very first trip to SoCAL to attend Coachella; the most amazing music festival of them all.
Here is a list of musical artists I saw this year:
50 Cent, Andrew Bird, AVICII, The Black Keys, Bon Iver, BoomBoomBoomBand (RedBull Speakeasy), Calvin Harris, DJ Shadow, Dr Dre, Eminem, Florence and the Machine, Flying Lotus, Frank Ocean, Girl Talk, Godspeed, Gotye, The Hives, Justice, Kendrick Lamar, M83, Miike Snow, Radiohead, SBTRKT, Snoop Dogg, Swedish House Mafia, Tupoc hologram, Warren G, Wiz Khalifa, & a few others that I can't recall.
Pro Tips for next year:
- Get a campground for drinking, eating, and hanging out. Who wants to pay $10-14 for beer and food inside?!!
- Rent a condo b/c if you sweat like all of the other smelly campers you will want to take a shower (at least I hope you would). Also it's nice to sleep in a real bed and not a blowup bed or worse, the ground.
- Bring your own TP. Does this point really require detail?
- Buy some walking shoes with tons of padding. You will be walking around for 6-12 hours at a time. I made the mistake of walking around in my Vibrams sock shoes which has zero padding. Don't make that mistake or you will regret it, like I did.
Check out my Gallery: Coachella 2012 Gallery
Leave a comment
Django on Mac OS X Lion
Thursday, 22 March 2012
Django on Mac OS X (10.7) has never been easier.
- Install Xcode which can be found on the Mac App Store. Grab some coffee for it will take a while if you don't already have it installed.
-
Install the database of your choice:
MySQL Server
MySQL can be downloaded here:
http://dev.mysql.com/downloads/
Be prepared to click through layers of links and a registration nag to join their community just to get to a actual download link. Very Lame MySQL!
Also take note that MySQL will be a pain to setup and you should avoid pains at all cost!
First issue: MySQL's installer is so ghetto that it does not SymLink it's own executable to /usr/bin/ for commandline usage. So here is the command to do this manually.
| sudo ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
sudo ln -s /usr/local/mysql/bin/mysqladmin /usr/bin/mysqladmin
|
PostgresSQL Server
You can download postgres here (no link trickery):
http://www.postgresql.org/download/macosx/
Amazingly enough, PostgresSQL comes with an awesome installer and will even install PostGIS for you.
Oh wait, no complaints?!? Yep, it just works. Moving on..
-
Install Python libraries.
Prerequisites for the python imaging library
JPEG Library
| curl -O http://www.ijg.org/files/jpegsrc.v8c.tar.gz
tar -xvzf jpegsrc.v8c.tar.gz
cd jpeg-8c
./confgure
make
sudo make install
|
Free Type Library
| curl -O http://ftp.igh.cnrs.fr/pub/nongnu/freetype/freetype-2.4.5.tar.gz
tar -xvzf freetype-2.4.5.tar.gz
cd freetype-2.4.5
./configure
make
sudo make install
|
Install PIP, a better way of finding and downloading Python packages. Also install VirtualEnv, a nice way to isolate dependencies on a per project basis.
| sudo python easy_install pip VirtualEnv
|
Now lets install Django and PIL (You might want to consider virtualenv at this point).
MYSQL Python Client - You can clearly skip this section since you realized early on your mistake in considering mysql but if you haven't your mistake yet continue on.
Oh wait, before we start, I have to set an Environment variable or this library won't install?!! Ok its time to switch to a real database like PostgreSQL (instructions below).
| export DYLD_LIBRARY_PATH='$DYLD_LIBRARY_PATH:/usr/local/mysql/lib/'
|
In some cases it my be helpful to place the mysql bin directory on your path
| export PATH=/usr/local/bin:/usr/local/mysql/bin/:$PATH
|
Now you can pip install
If you are still having problems installing mysql and you haven't decided to switch to Postgres at this point, you can always install from source. Select a version HERE then follow the steps below:
Download and unpack mysql-python:
| tar -xvzf MySQL-python-x.x.x.tar.gz
cd MySQL-python-x.x.x
|
Make sure to edit and change the mysql_config variable under site.cfg to point to:
| mysql_config = /usr/local/mysql/bin/mysql_config
|
Install mysql-python
Lastly, check that mysql-python did in fact install correctly
| python -c "import MySQLdb"
|
PostgreSQL Python Client - Wait, that's it? Glad you chose to switch?!
And that is it. enjoy!
Leave a comment
Submitting your Python Packages
Saturday, 25 February 2012
Below are a few simple steps for submitting Python packages to the Package Index.
1) Create a setup.py file:
| from setuptools import find_packages, setup
setup(name='python-awesome-package',
install_requires=('required_packages_here',),
author='Me',
author_email='me@example.com',
version='x.x.x',
packages = find_packages(),
license="BSD"
)
|
2) Build the source distribution.
3) Register for an account or login using an existing account.
4) Upload the package.
| python setup.py sdist upload
|
That's it!
Leave a comment