I was just thinking…

Entries categorized as ‘Programming’

Python 2.5 to 2.4

November 16, 2008 · Leave a Comment

Last night we ran into a slight problem.  We are running Python 2.5 on our Macbook’s, but our server is running a very stable 2.4.  No problem right? Well kind of.

The first problem we encountered is related to PEP 308.  Someone who had written a RSS parsing plugin for Django, failed to mention that it minimally needed Python 2.5 to run correctly.  But this is one of the greatest advantages of open source.  I rolled up my sleeves and removed what the PEP calls conditional expressions.  I’ve always referred to these as the Ternary operator [or operation]. (more…)

Categories: Programming · Python
Tagged: , ,

iPython on Mac OS X

November 15, 2008 · 2 Comments

What worked for me; short and simple:

1) Install iPython

  1. sudo easy_install ipython

2) Download the file/egg for Mac OSX readline, and place in path, then edit easy_install.pth

  1. Download:  http://ipython.scipy.org/dist/readline-2.5.1-py2.5-macosx-10.5-i386.egg
  2. cp ~/Downloads/readline-2.5.1-py2.5-macosx-10.5-i386.egg .
  3. sudo vim easy-install.pth
  4. While editing the file add:   ./readline-2.5.1-py2.5-macosx-10.5-i386.egg

3) Run iPython and test.

Categories: Apple · Programming · Python
Tagged: , ,

Django 1.0 install on Mac OS X 10.5.5

November 4, 2008 · Leave a Comment

I initially used this guide, but made some changes:

1) Downloaded Django-1.0.tar.gz from here.

2) Created and extracted the contents of the tar.gz:

mkdir ~/sandbox
cd ~/sandbox
tar xzf ~/Downloads/Django-1.0.tar.gz

3) Make the following soft-links:

cd /Library/Python/2.5/site-packages/
ln -s ~/sandbox/Django-1.0/django django
cd /usr/local/bin/
sudo ln -s ~/sandbox/Django-1.0/django/bin/django-admin.py django-admin.py

Categories: Apple · Programming · Python · django
Tagged: , , ,

Apple iPhone Development Program

August 29, 2008 · 1 Comment

I thought I’d share some of my initial experiences with the Apple iPhone Development Program.  A lot of people are complaining about the Fucking NDA.  I don’t know if even my feedback is subject to breaking the agreement I accepted with Apple. :-/

Initially, I heard it cost $99 to register and become a iPhone developer.  This is not the entire truth.  Upon jumping on my new MacBook, I downloaded and installed XCode with the iPhone SDK.  This is completely free to do and requires nothing for you to spend.  You have access to the documentation, code samples, etc.

So here is where I thought perhaps the $99 was only when I was ready to distribute an application?!? Wrong again.  Once I had began downloading code samples, and writing some of my own.  I found the virtual iPhone to be a great tool, but not so great when you want to play with the accelerometer.  I had considered shaking my MacBook! Apple typically does think of everything. :) (more…)

Categories: Apple · Programming
Tagged: ,

Google App Engine over lunch

June 11, 2008 · Leave a Comment

I decided to grab lunch and read more of what I could find on Google App Engine (GAE).  Found a few interesting sites.

Steve talks about how GAE fills a much different need in the cloud computing arena than Amazon has done with its own S3 and EC2.  Google doesn’t charge you for the server you rent (i.e. like EC2), but rather they charge you with how much you actually use.

Next up is Shannon, who explains how .NET can leverage GAE through abstraction via a webservice call.

Last up, is a solution I found very interesting.  Andreas explains how GAE can be used as a Content Delivery Network (CDN).  I won’t bother going into details of what a CDN is, it is explained well on his website.  What I found interesting is how this would compare to Amazon’s S3; where I’ve seen several people adopt a similar strategy using Amazon’s S3.

Over the last couple nights, I also watched the GAE video on YouTube introduced in Google Campfire One.  Parts One, Two and Three.

You can download the GAE SDK herePricing is discussed (not confirmed) here.

Categories: Programming · Python · Technology
Tagged: , ,

JSON serialization with Python

April 3, 2008 · Leave a Comment

First part of the problem: How should objects serialize to JSON, and can this be exchanged between different languages (.NET/Python) without writing custom Encode/Decoding implementations?

Second part: Why does Python’s Pickle serialize (reflect) an object, but simplejson which mimics the exact same interface behave differently? (more…)

Categories: Programming · Python · Technology
Tagged:

Create simple ANSI based UI with Python-Newt

January 25, 2008 · 2 Comments

I stumbled across this simple UI, Python-newt.  Newt which is common to many non-graphic installs on various Linux flavors. Newt is a simplistic UI that lets a programmer specify entry fields, radio buttons, ok/cancel buttons. You name it…

Python-newt Snack Popcorn demo snapshot

The Python extension is called Snack. Read more on support here. Two examples come with the docs, showing how easy it is to assemble UI entry request pages/forms.

Categories: Linux · Linux Programming · Open Source · Programming · Python

pyAtl January Meeting

January 11, 2008 · Leave a Comment

I attended the Atlanta Python meeting tonight and discovered a few new things to help me out.

KeyJnote
KeyJnote is a fancy way to display slides during a presentation. It uses smooth transitions to create some nice effects. It uses OpenGL hardware acceleration support for the cool effects. The program is actually one file, and written in Python. I had some issues getting it to work on my laptop at first. My current version of pdftoppm would not convert the pdf pages to images. So after a bit of searching, I found if you edit the file, there are configuration settings at the top of the file. Simply setting UseGhostScript to True, resolve my issue.

I had to export a Open Office presentation to a PDF document. Then KeyJnote actually converts each page in the PDF document to an image and renders it nicely.

virtualenv
Virtual Python Environment builder…do I have to say anything else? I mean how many times have you wanted to isolate a development environment without moving libs around, re-linking, etc. The first thought that came to mind is I can now isolate customer1’s environment on my development pc separate from customer2.

buildout
Wow, after seeing virtualenv, I thought I was all set. Then we were shown buildout, what it is, what it can do for you, etc. Think of it this way. You specify what your product environment contains, and it ensures you have what you claim you should have. This includes libraries and source code. You can set this up, and hop on another machine, like a production machine and quickly update the buildout there knowing everything will just work. The required libraries are there, and so are all of your product source files.

While the latter two are Python specific. I can’t wonder how much pain it would have saved us before and would save us even today in other development worlds to have tools similar to these. I’ve seen many times what it takes to set up a new development laptop project environment. I’m not talking the tools, I’m speaking of making sure 3rd party libraries, source code and .NET libs are all installed. buildout offers a nice snapshot solution.

Of course some of us are still content with just storing things in subversion and checking them out. There is nothing wrong with this, as long as you don’t forget about that pdf library and image conversion library you needed to install. Did I mention you needed a specific version too? Sound familiar? Yah…we’ve all seen it.

All in all it was a good night. Then I struck up several conversations about Linux, developing and stuck around until midnight…crap I need to be back here in a few short hours. Time to bolt.

*One small note.  hash -r clears the memorized program locations in bash.  It caught me tonight, and luckily Bernard was there to kindly point me in the right direction!

Categories: Programming · Python

Gluon Web Framework

November 15, 2007 · 1 Comment

I saw this new web framework and couldn’t pass it up to write about it and link to it. There I’m done.

(more…)

Categories: Blogging · Programming · Python
Tagged:

Beer mixed with programming

October 25, 2007 · Leave a Comment

I knew this was true, but I had no idea how fine of a line it was…

Programming BAC levels

Categories: Programming