Google App Engine’s Python Exception Syntax

Remember, Python 2.5 has this exception syntax:

try:
    raise FooException("Darn!")
except FooException, e
    print("Error: %s" % e)
The newer syntax is:
try:
    raise FooException("Darn!")
except FooException as e
    print("Error: %s" % e)
I ran into this when uploading an application to Google App Engine, which then produced this cryptic error:
<type 'exceptions.SyntaxError'>: invalid syntax (main.py, line 64)
Where line 64 is the line containing the not-yet-implemented as keyword.

Mac OS X 10.7 “Lion” Seems to Have a Broken Python easy_install

One of the first things I needed after upgrading to Mac OS X 10.7 (Lion) was to make some Python scripts work. However easy_install seemed to be broken:

$ easy_install psycopg2
Traceback (most recent call last):
  File "/usr/local/bin/easy_install", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2607, in <module>
    parse_requirements(requires), Environment()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
    raise DistributionNotFound(req)  # XXX put more info here
pkg_resources.DistributionNotFound: setuptools==0.6c12dev-r88795
I fixed this by installing Distribute and then the new Mac OS X Developer Tools.

 

Versature is Hiring

Thought I’d leave a note here that Versature is hiring. Notably, I’m looking for a developer with fresh user interface design ideas:

Versature is looking for a developer with experience designing and building awesome user interfaces for complex problem domains. Visual analytics tools, integration with Google Apps, Mobile Safari support, real-time user interaction are all topics we cover. Knowledge of the Java platform and experience using remote service APIs a must. Send your cover letter to the email address listed in the TXT record of hr.versature.net.

I’m hoping we can leverage the Google Web Toolkit (GWT) for this.

Solaris Shared Library Troubleshooting Notes

Recently I have been building a few packages under an OpenSolaris Zone hosted by Joyent. Ran into a few issues with shared libraries, so here are my notes:

Telling the Linker Where to Look

You will often get an error like ld.so.1: conftest: fatal: libreadline.so.5: open failed: No such file or directory. This simply means the linker can not find your library. The following command will tell the linker to append a new entry to the existing search path:  

# crle -u /path/to/lib/dir
You can retrieve the current configuration by simply running crle on it’s own, output should be something like this:
$ crle
Configuration file [version 4]: /var/ld/ld.config
  Platform:     32-bit LSB 80386
  Default Library Path (ELF):   /opt/local/lib:/opt/csw/lib:/usr/lib:/lib
  Trusted Directories (ELF):    /lib/secure:/usr/lib/secure  (system default)
Command line:
  crle -c /var/ld/ld.config -l /opt/local/lib:/opt/csw/lib:/usr/lib:/lib
 

Getting Yourself Out of Trouble

You can easily get yourself into a situation where your system is a brick by having an incomplete search path for the linker. For example, if you run crle -l /foo/path/lib, you will no longer be able to run anything at all since the linker will not find basic libraries it needs. I found a great post on this topic which instructs you do use the LD_NOCONFIG environment variable to tell the linker to use a default configuration. You can then fix the issue:

$ sudo crle -l /opt/local/lib -l /opt/csw/lib -l /usr/lib -l /lib
ld.so.1: sudo: fatal: libpam.so.1: open failed: No such file or directory
Killed
$ LD_NOCONFIG=yes sudo crle -l /opt/local/lib -l /opt/csw/lib -l /usr/lib -l /lib

Open Source Includes Support Options

O’Reilly’s ONLamp has a great article which is most interesting. The premise is that Open Source software includes support options instead of support futures. I love it:

[Open source is] converting warrants on future maintenance and enhancements into options, which means that instead of having a sole supplier (warrants), we have created a third-party market (options) of these derivatives.

How capitalistic is that?

Very well said indeed. Found it from here.

DrunkenBlog: Behind the Red Shed, with Jonathan ‘The Wolf’ Rentzsch

In this post on DrunkenBlog, Jonathan Rentzsch gives a terrific interview. Notably, he discusses Apple’s enterprise software development gem, WebObjects, which I’ve always wanted to know more about.

Anyone know if there is a downloadable developer’s version somewhere?

Update: Yes, you can download a 1 month evaluation copy from http://connect.apple.com/.

Trails Makes Tapestry Smell Good

I should now say something witty about Kool-Aid here…

I’m in the process of reading the Trails tutorial by this guy (Trails’ creator) and I am very enthused about the idea: I’ve always felt that code-generation is being overly used in J2EE development. I believe, as do others, that if you can generate it, you should be able to handle it at runtime. (There are exceptions to this rule, of course.) Java has an exceptional reflection API, we should use it. Also, Spring allows much of the work to be done via AOP. But I’m rambling a little here.

The major exception to my dislike of code generation has always been page templates. These are just dumb pieces of text, so you either need to build them by hand or generate them. I’ve never really understood what Tapestry was about until I started reading about Trails and realized that it was allowing us to push object oriented design all the way into the template layer of our applications.

They features of Trails, like allowing us to override the presentation of a specific field without building a template for the entire form and lack of code generation, are really exciting and will provide some great ideas for my current side project.

Those familiar with Plone development will see some similarities here.

A.

Top Ten Technology Predictions

I try hard not to link blog, but this post on Cameron Purdy’s blog, /dev/null, is great. I’ll save you the anxiety:

And a drum roll, please ..

1 – At the 2005 TSS Symposium, Rod Johnson will not be able to resist saying the word “Spring.” Yup, it’s like trying not to think of pink elephants — impossible once you get that in your head. Spring, spring, spring, spring. La tee dah, spring spring spring. Take that, Linda. Spring-diddy-spring spring. Spring.

grin

Maven vs Ant Reloaded

Some time ago, I posted a short entry on Maven vs Ant. Since then, I have continued to use Ant while periodically taking yet another look at Maven.

This week, I came across this post on Otaku talking about keeping your Ant builds maintainable using <import> and <macrodef>. Greater maintainability seems to be one of the reasons Maven was created: allowing you to avoid creating build target spaghetti by describing the project and applying standard goals. These new Ant features can provide this maintainability, while keeping all the flexibility we’ve grown accustomed to.

Cedric’s post then led me to this comment thread on techno.blog(“Dion”) where a good discussion is taking place.

Finally, I can no longer remember how I got there, but dependancy management tools for Ant came up. TSS has an Inversoft‘s Verge project and a post on Mallim Ink pointed me to Jayasoft’s Ivy project. Both projects look very interesting; I think I will try out Ivy shortly.

Update: Colin writes about Ivy and seems very positive.

IPsec with Linux 2.6.9 & Shorewall

My previous post promised some information about how firewall rules interact with IPsec under Linux 2.6, well here it is.

The Shoreline Firewall has full support for declaratively defining IPsec tunnels and hosts under the new IPsec support. To do this however, you will need the policy match netfilter extension from the Patch-o-Matic NG and also 4 other patches:

  • ipsec-01-output-hooks.patch
  • ipsec-02-input-hooks.patch
  • ipsec-03-policy-lookup.patch
  • ipsec-04-policy-checks.patch

While these patches are in the POM-NG, they will not cleanly apply to linux 2.6.9. Ronald Moesbergen was nice enough to port the patches are are available from the list archive.

To apply the patches, simply run patch -p1 < ipsec-* from the top of our kernel source tree. Also copy the policy match extension’s files from the POM-NG directory into your kernel tree and insert the contents of the two .ladd files into the relevant Makefile and Kconfig file. Then reconfigure, enabling the policy match, and rebuild. Then follow the documentation.

If I have time, I’ll try and add some more information here.

NailGun Released

Martian Software was talking about NailGun way back in January of 2003 when I emailed them asking about it. I received a message today from Marty Lamb:

If you are receiving this, you have expressed an interest at some point
in a notification when NailGun is available.

Well, it's available.

If it's been so long that you don't remember what it is, NailGun is a
client, server, and protocol for running Java programs within a
persistent JVM, eliminating the JVM startup time.  I appreciate your
patience with the project as I have been swamped with other priorities
for some time now.

Although there are no known issues, there is still some work to be
done.  Most importantly, I need to compile Windows and OSX binaries for
the client.  If you can provide any assistance with this I'd be most
grateful.

More information, a quick start manual, javadocs, and downloads are
available from http://www.martiansoftware.com/nailgun.  There's also
information for joining the NailGun mailing list.  The fact that you are
receiving this message does NOT mean you have been added to the list.

This is a one-time mailing.  If it's unwelcome, you have my sincere
apologies.

- Marty

--
Marty Lamb
Martian Software, Inc.
mlamb at martiansoftware dot com

I’m quite excited about NailGun for use in writing trivial command-line Unix scripts in Java. Going to download it and build a Mac OS X binary while I’m at it too.

Update: Runs nicely on my system, now to explore a bit.

Awesome Quote from Frank Herbert

A fantastic quote from Frank Herbert:

Above all else, the [architect] must be a generalist, not a specialist. Experts and specialists lead you quickly into chaos. They are a source of useless nit-picking, the ferocious quibble over a comma. The [architect] on the other hand, should bring to decision-making a healthy common sense. He must not cut himself off from the broad sweep of what is happening in his [application]. He must remain capable of saying “There’s no real mystery about this at the moment. This is what we want now. It may prove wrong later, but we’ll correct that when we come to it.” The [architect]-generalist must understand that anything which we can identify as our [application] is merely part of a larger phenomena. But the expert looks backward; he looks into the narrow standards of his own specialty. The generalist looks outward; he looks for living principles, knowing full well that such principles change, that they develop. It is to the characteristics of change itself that the [architect]-generalist must look. There can be no permanent catalogue of such change, no handbook or manual. You must look at it with as few preconceptions as possible, asking yourself: “Now what is this thing doing?” – From Children of Dune by Frank Herbert (1976)

I love it. Something to keep thinking about. Thanks Grant.

Scalix Brings Group Calendaring to Linux

eWeek is running an article on groupware for Linux:

Companies looking to migrate from Exchange to a Linux-based messaging system or that want broader groupware functionality will find a good solution in Scalix’s Email and Calendaring Platform. From the user’s perspective, the Outlook experience is very good, although the Web client could use some improvement. Email and Calendaring Platform is priced at $60 per user, $600 for a server with 500 mailboxes and $3,500 for the Enterprise Edition. More information is available at www.scalix.com.

I know that many clients are using Microsoft products only for groupware, so this is important.