September 26, 2006

Development Links

Python Related

  • OnLamp - Python Logging
  • pyChecker
    One of the nasties of an interpreter is that errors in code are not found unless your thread of execution travels through the code that you have written. Although Python lets you get productive quickly, it also gives you a false sense of security. Just because your program runs without errors doesn't mean that it contain no errors. Hopefully pyChecker will help flush out those that are normally caught by a compiler within languages like C or C++. Here is a discussion from Guido about a proposal for static typing in Python: Optional Static Typing
  • PyRO - Python Remote Objects
    This is very similar to CORBA or Unix's RPC (Remote Procedure Call). It takes care of all the details involved in calling code residing on another machine. It also works as an IPC (InterProcess Call), pretty decent way to share data between separate applications. This is the Pyro Wiki Does anyone know what the overhead is?

Just Useful Tools

  • Dependency Walker
    This is one of many must tools for Windows developers.
  • NotePad++
    I am already using SciTE but NotePad++ is getting a lot of praise from its users. Both use the Scintilla component as the underlying engine so the look-and-feel of both editors should be very similar.

September 24, 2006

becoming a local in JAX

This birds-eye view shows Jacksonville and its nearby beaches. The surf has been pretty high these past weeks and the water is starting to cool down. I try to make it out to JAX beach every weekend but need to make time to explore Atlantic Beach as well as Ponte Vedra.

This is detail of the SouthSide area near the Turner Butler Blvd. I'm exploring San Jose blvd since it borders on the river (nothing related to San Jose, the city, of course).

Ok, time to go catch some waves and rays before the sun goes down.

September 20, 2006

Python Execution Context

One of the greatest benefits of the programming language called Python is that it has a large base of users. Unfortunately, it is also one of its greatest set-backs. Because of the open nature of Python, there are quite a few distributions of the interpreter. The following are some that I know of:

  • the core distribution managed by Guido
  • the ActiveState distribution: core + Win32 libs from Mark Hammond + additional libs
  • I am using Komodo as the IDE and it also distributes its own
  • Zope distributes its own

In addition to this, there are different versions of the interpreter floating around: 2.2, 2.3, 2.4, and most recently 2.5. I won't even get started with IronPython.

Compounded upon this wild permutation is the many differing versions of the libraries which we base our code on. Depending on whether the library was included in the core distribution or downloaded and installed on our machine at some point in time, we may have a mix of libraries which differ from anyone else's installation.

Well guess what....: when a Python program executes, the nature of its behavior is very heavily dependent upon whatever permutation of the above is installed on your machine. I was debugging a strange problem that occurred when using the logging module. In the interpreter shell, it operates as expected. From Komodo, it crashes and exhibits very strange behavior. Searching the internet for answers did not help either because logging had been changing quite a bit. On top of this, the answers I found were completely wrong because it assumed a specific version of logging. Of course, all of this is from hindsight so everything seems obvious when it is all laid out.

Ultimately, it turned out that Komodo had packaged their own version of logging (which of course differs from the one my shell uses). Once you know the problem, the answer is pretty easy. However, it does tell me that (in order to obtain consistent program behavior) you practically have to be on top of configuration management for your Python environment. The behavior of your source code is heavily dependent upon the Context of your execution environment.

POST NOTE (9/21/06): the execution context behavior under PythonWin is not exactly the same as in Python. I was using PythonWin along with ctypes. The entire PythonWin executes in the same process context as the script it runs. This means both your editor/debugger and your program run in the same process. (wild!!!) If you execute python.exe from the shell, your script gets spawned as an entirely different process. This is generally how other debuggers work. Depending on what system resources are affected, the script may behave differently whether or not you use PythonWin.

Posted by Hoang at 10:17 AM | 2 Comments | Python Programming

September 07, 2006

Language Links

Python Related

  • Python Unit Testing Tools
  • Of snakes and rubies; Or why I chose Python over Ruby
    I have already made my choice 5 years ago over Java, PHP, Perl, JavaScript, Visual Basic. I'm sure like other developers, we haven't regretted it yet. (knock-on-wood). The link is a write-up of the path of someone else making the choice.
  • Python Infrequently Answered Questions
  • pyNSource - class diagramming tool
    This is great for reverse-engineering existing code or just to give a framework diagram of existing code.
  • HappyDoc - Python Documentation Extraction Tool
    I had used this successfully back in 2002 and decided to try it again. It didn't work for me with ActiveState's Python 2.4 distribution. Hmm, I wonder why.. then again the last release of HappyDoc was quite a few years ago too. pydoc (which is now included in the regular python batteries distribution) gives about the same functionalities. I will stick with pydoc just to simplify matters.
  • IPython
    Like above, I checked this out some time back but since it didn't automatically come with the Python distribution, my usage of the tool didn't stick. However, as I will be using Python more regularly now, there are several issues relating to the standard Python Shell that needs scratching. The latest IPython was just release in June. Hopefully it will alleviate the itching from the standard shell.

Other Languages

  • programming APIs in different languages
    This is a good reference for programmers.
  • PHP shell
    Have I ever mentioned how useful an interactive shell is for rapid development cycles? Everytime I talk to other PHP folks, the topic comes around debugging a script that crashed while executing on the server. Our concensus was that the only option is the printf statement. Yuck!!!

Just Useful Tools

  • TextRep - Text Replacement across multiple files.
    Visual Studio has a text replacement function that is applied across multiple files. After working with Python regularly and editting with plain-ole-editors, the loss of this function is making itself felt. This free and relatively miniscule tool helps alleviate the problem.
  • Free compilers: Turbo Delphi, C++, C#
    It's wonderful that Borland is deciding to release free versions of these tools.

September 01, 2006

Anna Nalick in Jacksonville

Breathe (2AM)

(August 30th) It was my second day in moving to Jacksonville and as I was flipping the pages of the local rag, I noticed that Anna Nalick was playing in town today. The newness of the city smacks me in the face and hurricane Ernesto was supposed to hit us tonight. My first thought was, I didn't want to go poking downtown in a strange city so soon. It soon dawned on me that Anna wouldn't come around this way again anytime soon so I took the plunge and went searching for the dive. The place was called Jack's Rabbits that lies in a run-down section of town and behind a single red door. (Looking around, no blue door was to be found)

The crowd that waited for the show was pitifully small. There couldn't have been more than 100 people at the show. And like Anna said later on during the show, "it's a smoky little bar". Maybe it was a blessing in disguise because many concert goers were just well within 2 feet of the stage.

Joshua Radin openned up the set. His music was fully acoustic guitars and he played the set in a wonderfully humble manner. He had one backing guitarist and a girl as an accompanying vocalist (she was pretty cute, by the way). Josh sat in a chair right in the middle of the stage and played some material from Zack Braff's TV shows and movies. His music was mellow, sad, and comforting. Unfortunately the Jacksonville crowd was a little too loud and I felt bad as the band noticed the interruptions during the songs. The acoustic set was lovely.

nalick2.jpg Anna Nalicks gives a great live performance as she saunters on stage fully comfortable in the strength of her voice. She banters with the crowd in a cheerful manner. There were a few false starts in some of her songs as the band's electric equipment and her microphone flakes out. However she recovered on-stage quite nicely and spurted out some F words that fit the occasion. I was close enough to the front to notice her prominent cheekbones, skinny nose, and the big ugly ring she wears on her index finger. This is an unfortunate comment but she is just not photogenic. Quite the opposite, she looks better in person than in her pictures and videos. It could be that her personality gives a 3-dimensional wholeness which is different than many people you see on stage. As you can imagine, she played most of her album. Everyone was waiting for Breathe and there wasn't much clamor for Wreck of the Day. Too bad because that was the best heart-wrenching track. I snuck out in the middle of Bleed into what's left of Ernesto in an attempt to avoid the departing crowd.

Anna Nalick - Wreck of the Day on YouTube