Print
PDF

Improve programming skills

I'm interested in growing my programming skills beyond my day job.  At work I'm primarily involved in projects on .Net (mostly C# and ASP + VB on MS SQL) and PHP (5.3 on MySQL 5.1 or ^)

I found this inspiration on Reddit and I've decided that I'm going to give it a go:

10 ways to improve your programming skills - http://www.antoarts.com/10-ways-to-improve-your-programming-skills/

I've already started on step 1 for a couple of my side projects.  (Python is my "newest" language, but its quickly becoming a favorite)

I've also started looking for a good set of programming books.  I still have a few from college I bought for classes and then cracked them open maybe twice.  (so I'm thinking those are first on the list)

I'm extremely interested in learning more about the 0MQ and OpenStack Open Source projects.  Hopefully I can pick up enough about Python and lower level C++ to contribute to the open communities.

I'll update this post after I make more progress.

Print
PDF

Keyboard Macro discovery: MadRuby rocks!

I've been looking for an excellent text editor with keyboard macro support.  TextMate is awesome but the keyboard macro recording only allows for single instance playback.  Won't work to edit large text files automatically.

For some odd reason I didn't think about it till today that I should try and decouple the keyboard macro recording from the text editor altogether.  So I found MadRuby, which is an awesome keyboard macro recorder that runs as a background process waiting and listening for a special key sequence to start recording a macro.  When done recording, just stop and either replay once, or multiple times (user specifies how many iterations to play back)

MadRuby - http://www.wingsforpigs.com/MadRuby/MadRuby.html

Screen Shot 2012-04-19 at 12.41.27 PM

Warning: it's not the prettiest thing in the world, but it's FREE and it works very well.

 

 

Print
PDF

MySQLDB-Python on Mac OS X 10.7 Lion

I've reached a point in my Django projects where it made sense to use a MySQL database server instance.  This was extremely simple for me on Ubuntu server because I'm pretty familiar with Debian and Ubuntu administration these days.  I did have to get my Django code on my local Mac dev environment to talk to MySQL though.  Unfortunately this one wasn't as easy as just running a pip (or easy_install) python package installation command.  I started getting error messages early on.

Here's something of the step by step on how I got this all to work on my Mac OS X 10.7 Lion OS:


 http://dakrauth.com/blog/entry/python-and-django-setup-mac-os-x-leopard/

MySQLdb
   * MySQLdb provides the Python bindings to interface with the database.
1. curl -O http://internap.dl.sourceforge.net/sourceforge/mysql-python/MySQL-python-1.2.2.tar.gz
2. tar -xvzf MySQL-python-1.2.2.tar.gz
3. cd MySQL-python-1.2.2

   * Edit the site.cfg file:

      * Uncomment the line that begins #mysql_config =

      * Edit the path to point to /usr/local/mysql/bin/mysql_config:
mysql_config = /usr/local/mysql/bin/mysql_config

   * Complete the build and installation:
1. python setup.py build
2. sudo python setup.py install
3. cd ..


 This isn't working.  I get an error message on step 1: (python setup.py build)

ruebenramirez@Ruebens-MacBook-Air:~/Downloads/MySQL-python-1.2.3 $ python setup.py build
running build
running build_py
copying MySQLdb/release.py -> build/lib.macosx-10.7-intel-2.7/MySQLdb
running build_ext
building '_mysql' extension
llvm-gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -pipe -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/local/mysql/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.7-intel-2.7/_mysql.o -Os -g -fno-common -fno-strict-aliasing -arch x86_64
unable to execute llvm-gcc-4.2: No such file or directory
error: command 'llvm-gcc-4.2' failed with exit status 1


I thought that my MAMP install might somehow be causing problems, so I went to the MySQL download site and grabbed the latest MySQL 64 build DMG to install.

   * before installation, I made sure to stop the MAMP services and completely shutdown the MAMP management utility
   * It turns out that this new MySQL installation doesn't conflict with the MAMP MySQL installation for my purposes because all of my accessing code uses the per installation bound socket file connection mechanism (instead of connecting to the local 3306 port)


http://activeintelligence.org/blog/archive/mysql-python-aka-mysqldb-on-osx-lion/

This helped me get going.  It helped me to understand that there were some environment variables that had to be set in order for the software to properly build.
   * make sure to place these in your ~/.bash_profile so that you have access to the mysql command even after reboot!


Even after configuring all the environment variables, the MySQL-python package wouldn't run.

The build was still choking on the llvm-gcc-4.2 not found error.  Googling the error turned up a couple of things:

   * an "easy" way to resolve the missing dependency issue is to install XCode from the App store
   * after "installing" from the App store, you still have to open up XCode (in the Applications directory) to complete the install
   * this still doesn't install the "command line tools" which was another 180MB download (from the XCode preferences pane's "downloads" section).



Finally after all of this, I have a working local Django install with access to MySQL via a sudo easy_install MySQL-python!

So here's the recap:

  1. instally the latest MySQL dmg from the mysql.com community site (currently mysql-5.5.22-osx10.6-x86_64.dmg) http://www.mysql.com/downloads/mysql/
  2. modify your ~/.bash_profile to add these environment variables (add these lines)
    • export PATH=$PATH:/usr/local/mysql-5.5.22-osx10.6-x86_64/bin/

      • (or the to whatever your version of MySQL was installed)
    • export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/

    • export ARCHFLAGS='-arch i386 -arch x86_64'

  3. install XCode (from the app store and then by running the XCode app found in the /Applications dir) and then also install command line utilities from the preferences "downloads" section
  4. run: sudo easy_install MySQL-python

 

Print
PDF

Easily create bootable USB drives

Instead of burning CDs and DVDs for every install I do, I started using spare USB keys to do the install.  This is both faster and more convenient, since most of the hardware that I use supports booting from USB. 

I had been using my Mac terminal command line diskutil and dd utilities, but this was a little tedious and error prone (on my part).  UNetbootin has releases for Mac, Windows and Linux, which all come with a very simple user interface.

UNetbootin - http://unetbootin.sourceforge.net/

Screen Shot 2012-04-10 at 10.31.08 AM

Using the tool is simple: Select the OS (or ISO) to create a bootable USB key, and then let the app work its magic!