Tuesday, December 16, 2008

Looking under the hood of Pinax

I've started to look around because one of the requirements I'll have to follow is to change the 'Tribes' section to be called something else like 'Groups' or 'Crews'. Of course I compared it to some of the other frameworks I've played with, and here are some thoughts. I went from module to module of Pinax, and found some nice commonalities that made me happy:
  • There is a minimum of boilerplate. Everything is doing something meaningful.
  • Django models are easy to read.
  • Relating your Django model to the User is easy.
  • Django forms are straightforward.
  • No interfaces!
More to come as I play.

Sunday, November 30, 2008

Deployment skills need work

I love being a developer. I love writing code, juggling objects, doing configurations, doing database stuff, styling HTML, and implementing themes. What I do hate is deployment. So while I feel empowered by tools like distutils, zc.buildout, and variations therein, actually doing that sort of work is very tedious to me. In both my dayjob and side consulting I have very good people to do that sort of thing for me so all I need to do is basic deployment work.

However, I readily admit this is a shortcoming. One I should work to fix.

The good people of Six Feet Up had a deployment workshop this month that I did not attend. If I wanted to I might have been able to press for it as a class, but had other things on my mind. I'm wondering if it is offered again if it makes sense to go next time.

Monday, November 24, 2008

Current plan for FeedFeeder v2

Somehow this blog post stayed in draft mode forever. But it details the plans I have for FeedFeeder v2, plans that seem to be pretty solid.

The problem with my previous FeedFeeder v2 architecture is that it tampered with something that was not broken; the basic FeedFeeder architecture. Why do code cartwheels when the use of Collections can do all the work for you?

The new idea is to have each FeedFolder be responsible for a single feed. Attributes to handle special cases (generally broken feeds your customer demands you handle) will be hung off the FeedFolder in which FeedItems will be generated and reside. If you need to combine multiple feeds then you just use a Collection. No need for a special FeedDefinition content type, keeping the architecture simple and ensuring that the code remains straightforward.

The quick-and-dirty UML above is nearly identical to the way FeedFeeder v1 is built. I've just added a 'rules' lines attribute. It could be more accurately be called 'feedParserEdgeCases', and will let you correct some of the funny cases you get when your customer says, "I need to have our site recieve feed from Joe Schmoe's bad feed and it has to happen next week!" In the case below, JoeSchmoe has decided to change the Title attribute in his Atom feed to JoeSchmoeTitle.
'JoeSchmoeTitle => Title'
Basically the idea will be that through a simple dialogue like the one below, you'll tell FeedFeeder to take the value of JoeSchmoe's custom title and put it into the correct FeedItem attribute. And you'll be able to do it without any custom/hard coding!

The credit for this goes to the Van Rees brothers. They looked at my crazy thoughts, forced me to defend them, and tossed in great ideas when they grokked the rantings of my insanity. ;)

Friday, November 14, 2008

Subscribers Zope 3 style

Vernon Chapman shared this with me. Very elegant.

configure.zcml (brackets replacing XML open/close because Blogspot sucks!)
[subscriber for="Products.CMFCore.interfaces.IActionSucceededEvent"
handler=".handlers.vernstuff_content_thing" /]
handlers module
def vernstuff_content_thing(event):
"""This will do all the work"""
action_as_string = event.action
content = event.object
# Do whatever you like here

Wednesday, October 29, 2008

Training failures

I remember reading once that until the 1920s you could take swimming lessons where you never entered the water. You could eventually teach swimming classes yourself without ever swimming! You would lie with your stomach on a stool and practice various strokes and techniques. These days we realize how stupid that approach is, since while exercises to learn fundamentals can be taught outside of an environment, until you really do something you don't really know it.

Yet we still use this method in the computer age and worse, in self-defense classes.

At some point in the 90s not enough press was made about the fact that Cisco certifications could be had without ever touching a computer. Heavy books were studied, expensive classes taken, and a paper exam was filled out. The repercussions were felt up and down company wallets and finally into Cisco's sales, so things changed. Nevertheless, my first IT job had a certified Cisco engineer who wasn't just bad, he was disastrous. He lasted long enough to cause a catastrophe, and was booted before more damage could be done.

Does this still happen today in the IT industry? Heck yeah. Finding computer security experts who can do manual penetration tests of the most basic cross site scripting types seems to be harder than finding people with degrees in IT security policy. They have paper degrees and no experience in what they are defending against! How can you defend against something you don't know how to do? Easy, you cannot!

Does this happen in the self-defense world? Oh yeah. People learn knife, stick, and rape defense without knowing the methods of attack used. Then feeling empowered they ignore their instincts about not going into scary places and get themselves promptly assaulted. You want to learn how effective your self defense is, then take this simple test:
  • Go buy a cheap, white t-shirt.
  • Get a brand new, reasonably athletic student who isn't used to attacking the way everyone in your dojo/kwoon/studio has been taught to attack.
  • Give the newbie a big, black marker.
  • Have them try and mark your arms and t-shirt before you can take the marker away. Tell them to go as fast as possible.
I've seen very skilled karate, kung-fu, hapkido, eskrima, and jiu-jitsu (Brazilian and Japanese) people all get marked up. The smart/experienced people will ask/improvise a longer weapon and won't take it hard when they get marked.

Moral of the story: Academic understanding is not a replacement for real-world experience or properly designed simulated experiences..

Wednesday, October 22, 2008

Morning brainstorm about FeedFeeder v2

I've been working on a .plan for FeedFeeder v2, but for some reason things were not really coming together. Something seemed off. In retrospect, what was off was that my proposed solution didn't immediately correct the current problem with the otherwise excellent current version of FeedFeeder. And that problem is that any anomalous feeds force you to write and deploy code (ie - plugins) to correct the anomaly.

Sure, the Van Rees brothers had agreed that a future stage would correct the problem via a TTW function, and we would even consider a handy AJAX powered GUI to make it intuitive. However, the issue with that is that it would occur at a future stage, not at a stage that worked with my current use case - that I get feeds from the customer that they want today to work in nasascience.nasa.gov. Speaking on the finanical side, how could I get NASA to pay for work done on FeedFeeder v2 if it doesn't correct our current issues out of the box?

Well, this morning the answer came to me. The solution to the problem was rather clear and simple. Rather than a sophisticated plug-in system what about a definition system? Currently FeedFeeder provides two content types:
  • FeedFolder:
    • includes a field listing the feeds consumed by this folder
    • and is a container for holding feed definitions and feed items

  • FeedItem:
    • individual feed content items provided by the feeds defined in the FeedFolder
My solution proposes adding a third content type called 'FeedDefinition' to handle defining of feeds:
  • FeedFolder:
    • a container for holding feed definitions and feed items

  • FeedItem:
    • individual feed content items provided by the feeds defined in the FeedFolder's FeedDefinitions

  • FeedDefinition:
    • Defines the source of a feed and how to handle the feed
A FeedDefinition would likely include the following fields in addition to the defaults:
  • Source:
    • URI of the feed source

  • FeedTitle:
    • default: standard
    • otherwise define location of feed title based on FeedParser output

  • FeedDescription:
    • default: standard
    • otherwise define location of feed description based on FeedParser output

  • ItemTitle:
    • default: standard
    • otherwise define location of item title based on FeedParser output

  • ItemDescription:
    • default: standard
    • otherwise define location of item description based on FeedParser output

  • Replacements:
    • default: empty
    • lines field that shows what text needs to be replaced with other values.
    • example: 'www.nasa.gov -> nasawww-origin1.hq.nasa.gov'
When handling feeds, when a FeedFolder has its update_feed_item action triggered it would:
  1. Iterate through its FeedDefinition children.
  2. Based off the rules in each FeedDefinition, fetch and parse each feed.
  3. The parsed feeds would be then added to the FeedFolder as FeedItems.
A supplementary view for FeedFolder would be provided that would not display the FeedDefinition.

Comments? Thoughts? Anyone think I should move my blog to a place that handles comments better?

Monday, October 20, 2008

FeedFeeder 2 plan

I started working on it last week. Basically the outline of who things will be set up, and our goals. Meant to finish it up and actually start coding on Sunday but then spent a good chunk of the day working on the house, raking leaves, and cycling.

Sometimes I wish I could be one of the guys who can code from wake up to bed time. :P

Normalization, Non-Normalization, Denormalization

I don't do much SQL anymore, thanks to tools like SQL Alchemy and the rather proprietary and object oriented ZODB. However, when I do interact with SQL databases I always go for the 5th normal form because this just seems right. I've dealt with more than enough non-normalized databases in my time to feel completely justified in this response to bad design.

The worst cases of non-normalized data in my experience have been with financial transactions or user data. Once I dealt with a financial databases that tracked the amounts in a pool of money in the same table as the historical transactions against that pool. Sound confusing? You bet, especially since determining what money was real and what was historic was done in an amazing piece of undocumented spaghetti code.

I've admittedly created two monsters of this sort of design. One was my first database design in a professional environment, and as the project went on I realized my mistakes and tried to fix them. The other was a database design where I took an application running by itself and tried to create an environment for it where multiple people could have instances of this application. It worked, but it was really hacked. I didn't know about source control back then so going back to doing it right was impossible.

So now you understand why I like normalized databases. Of course, once I get something working in 5th normal form then I start considering breaking the rules. And I do so in a systematic approach. This is called denormalization. The art of denormalization is knowing when to break the rules of normalization to improve performance and make life easier for anyone touching the project. The key is that when you do this that your breakage is clearly identified in developer documentation.

Some places I've found are good for denormalization include financial transactions, report helpers, and tables that track the history of another record.

Its shocking though how often I've run into people who equate non-normalized databases with denormalized databases. Sometimes you get a few newbies who like the sound of 'denormalization' as a word, but normally in my experience it is due to some 'senior developer' who hasn't read a coding book since 1997. You know who I am talking about.

Thursday, October 16, 2008

Tuesday, October 14, 2008

Can't seem to use zope debug mode anymore.

I drop out very quickly from my Mac OS X laptop running 10.5. Going to go home and try it on Ubuntu. Grrr... this is a royal pain.

Update: This was because I had a broken version of readline on my Mac. I did sudo easy_install readline and now it works.

Sunday, October 12, 2008

Help me with zc.testbrowser

I like zc.testbrowser. Toss in some BeautifulSoup to increase the accuracy of some tests and its a monstrously useful way to run tests. However...

For the life of me I can't get it to properly handle select fields (select or multi-select). Once I get the control, I can't seem to set select fields as selected.

Any help would be appreciated. This ate way too much of my time. What should have been a trivial test has caused me no end of frustration. The documentation is pretty good, and yet they don't seem to provide how to do this sort of thing.

In any case, once answered I plan to put the response in the zc.testbrowser reference card I am cooking up.

Update: Fixed the problem with some help from Aaron Van Derlip. Basically, since zc.testbrowser doesn't do JavaScript, sometimes you have to submit forms and links the hard way. I'll be putting that into my upcoming reference card.

Saturday, October 11, 2008

Day 2 of the 2008 Plone Conference

I was very rested by the time I arrived. I had slept well.

So you want to be a consultant by panel

No, I'm not looking to leave NASA these days. However, I do some side consulting, and even in my day job there are good project control lessons you can learn from the consulting crowd. For example, ideas on recruiting, customer relations, and how to handle billing when you need time to boost skills. There were 5 plone board members in the panel, and much wisdom was shared. Plone board members there:
  • Nate Atune
  • Gaer Baekholt
  • Calvin Hendryx-Parker
  • Jon Stahl
  • Matt Hamilton
What makes a great development team by Mike Robinson

He can code, he can manage, he can cycle, and he has the most awesome Irish accent, and he taught us about agile programming. And he explained why and how it works in a great fashion. I'm completely sold. I have been for some time, but he gives great arguments for it, or at least on evaluating on how to best handle this sort of thing.

Future of the Plone user experience by Alexander Limi

Limi has strong opinions and what he said may not reflect what ends up happening. He wants deliverance, strong media handling, more widgets, deliverance, better kupu, z3c form improvement, better validators, and an easier way to handle templates. All good stuff.

And he had a much, much better version of what I've been aiming at with my customer editor view in NASA Science. Great minds think alike, although I must admit his method is much better than my own.

Simplifying Plone by Martin Aspelli

He wants to do it with a chainsaw and make Plone more approachable from a developer's point of view.

Plone has a number of embarressments, with issues ranging from rich media support to import/export problems with the database. It is hard to learn and skinning is a challenge. He thanked Lennart for pointing out what Zope did wrong, and how developers expect things to be easy.

Wants to revamp much for Plone 4. Some quick bullets:
  • Follow the guiding lights shown by some of the other Python web frameworks.
  • Make learning follow a constant set of humps, not huge ones followed by a plateau followed by an insurmountable wall.
  • make certain things real easy to do (logo, branding, content types, etc)
  • Create one true way and remove the other ways
  • embrace through the web but allow filesystem round-trip for deployment and collaboration
NASA Science case study by Katie Cunningham and Daniel Greenfeld

Yes! I helped present!

So we presented and apparently did very well. We had a few luminaries in the room, including a couple Plone board members. I think we nailed all the points we wanted to make, which was a very awesome thing to do. We plan to send the slides off to Alex Clark shortly so we can have them on line for everyone to see.

Please go to NASA Science and leave feedback asking to release Umlizer to the world!

Evening Agile Development workshop by Mike Robinson

Two more hours of the awesome Mike Robinson ended the day for me. He gave a rock-solid lecture and then we played a game to support his statements. It was a fun game and learning was had by all. That said, I think this would have been better done as part of a day-long class, not at the end of a long day of conferencing.

General Socializing

Where to begin? I had great fun with so many incredibly awesome people. The quick and dirty list:
  • Vernon Chapman
  • Tarek Zaide
  • Alex Clark
  • Amy Clark
  • Matt Bowen
  • Jon Stahl
  • Nate Aune
  • Katie Cunningham
  • Gary Burner
  • Joel Burton
  • My whole agile development "team"
If I missed you, let me know!

Thursday, October 9, 2008

Day 1 of the 2008 Plone Conference

The 2008 Plone conference actually started on Wednesday, and Monday and Tuesday were training days. I'll be blogging about those later. Unlike the last conference, set in Italy, this is set here in Washington, DC. Since I am not being a tourist, I'm doing most of my posts here in my technical blog.

First off, Tuesday I had suffered from my periodic insomnia the night before so this day was a matter of a lot of water, light eating, and trying to keep cool in order to keep myself alert.

Registration

I had volunteered to work the registration desk as part of my effort to contribute to the conference. I arrived at 7 am. Others followed shortly and soon enough plonistas began to arrive. In no special order I got to meet or badge the following people:
I was not alone as a volunteer for registration! Also there was:
  • Emma Campbell
  • JoAnna Springsteen
  • Steve?
  • Paul Boos
  • Amy Clark
  • Matt Bowen
Keynotes

I drifting a little in and out, but mostly I was focused on the registration. I figured I could just catch up on plone.tv. Not perfectly ideal, but volunteering is good for the soul. ;) Then it was off to the talks!

Feed the Masses by Paul Bugni

This was about Vice a Plone 3.x syndication tool that lets you output types in RSS 2.0, Atom, and even RSS 1.0. It handles recursions and enclosures and much more. It looks like a wonderful tool for our efforts, but its not quite yet production ready. I may spring on it.

I like the Zope Component Architecture approach! Awesome!

I played timer guy for the nefarious Matt Bowen.

Theming a Plone Site from Start to Finish by Rob Porter

Rob Porter of WebLion presented on material I had just taken a 2 day class on, so in retrospect I should not have gone. On the other hand, I got a few gems and perhaps getting a reinforcement on the class was good. Again I played timer guy for the nefarious Matt Bowen.

Software in the Cloud Speech violates freedom by Bradley Kuhn

Awesome speech! The cloud is dangerous, because really, who own our emails and twits when we use gmail and twitter?

Usability by Ginger Butcher and Katie Cunningham

I did not go but visited. I have to say that I was impressed watching those two for just a few minutes. They NAILED it. They talked well, energetically, knew their material, gave good examples, and were having as much fun as two little girls in a sand box. They did an awesome job and got kudos from Alexander Limi himself.

Sunday, October 5, 2008

Plone Conference 2008 starts tomorrow!

I posted my bit of melancholy about the location on my personal blog under the ploneconf2008 label. Expect to see my more technical side here under my pydanny ploneconf2008 label. Hope that makes sense!

What will I be doing there? Let me see...

First two days will be Joel Burton's class on Plone Theming. Why theming? Because our team needs more skill in it!

I'll be volunteering to help out with the conference in the role of registration helper and general gopher.

I'll be helping our NASA Science team present on our big project, NASA Science!

I'll be attending talks and taking notes until my fingers bleed.

I'll be working in sprints.

I'm not sure about my social activities. We have a tight house budget.

Wednesday, October 1, 2008

Why did we use Plone for nasascience.nasa.gov?

I've had a few questions over time as to some of the specifics about http://nasascience.nasa.gov and I'm going to start providing answers. Here we go with the first question...

Way back on August 7th, John Kavanaugh asked:
Why didn't NASA use the eTouch CMS that the rest of NASA's portal runs on?
To explain what John is talking about, he means the NASA portal (http://www.nasa.gov), which is based on the commercial Java based CMS called eTouch. The portal contains a lot of content, and also serves as a nexus for the myriad of NASA sites hosted by various NASA centers (JPL, Goddard, etc) and organizations (Science Mission Directorate, Space Operations, etc).

On to answers!

First off, from what I understand, the Science Mission Directorate (SMD) started developing the Plone version of http://nasascience.nasa.gov before the portal was announced internally at NASA. By the time eTouch became known, we were well down the path of development, including integrating 1200+ articles and images. For various reasons the new portal launched first.

Second, SMD had a lot of very precise requirements and wanted to be able to get a lot of specific customizations to the project. Adding into the fact that we had already started on data migration and site design, and SMD felt that staying the course was the right way to go.

Third, and this comes from the business people, the portal project and our project come from two pools of money. The portal's pool is for providing a gateway for the public into NASA, and our pool is providing a gateway to Science at NASA. These are similiar yet different concepts, and allows each group to focus on what they do best. We link to each other, and that makes perfect sense.

Fourth, we are working with the Portal group to improve NASA Science. They are great folks and we applaud their work! I can't go into specific details into what we'll be doing but I will state that most of it is infrastructure and support.

Wednesday, September 17, 2008

Antipatterns I see here and there

Gas Factory
Yo-yo problem
Spaghetti Code
Copy-and-paste programming
BaseBean
Dependency Hell
God Object

And of course:

Brooke's Law

This isn't a finger point post. We are all guilty of these things, and sometimes doing it is necessary for completion of a project, especially when you get stuck with the limitations of a language (ie: my recent authorship of a God object).

Monday, September 15, 2008

Plone OS projects take two: Radius package and FeedFeeder package

I still haven't made up my mind. Lets go over my options, since working on either can be lots of fun. Do keep in mind my target Plone version is 3.x.

Plone Radius Package
This would be really useful for my job. A Plone package that allows authentication via Radius/RSA would likely mean lots more Plone work for NASA HQ. Once I got a functional prototype I'm sure I could get some funding for more work. Since Wichert Akkerman's pyrad python module is supposedly pure Python this makes integration really easy. I like easy integration.

One thing I like about this potential project is that it should be a pretty quick effort. Actually, the hard part will probably be finding a server to test against.

FeedFeeder Package
Reinout van Rees invited me in a response to this post to take a crack at FeedFeeder when I brought up this issue. The issue?

Feedfeeder assumes the best out of its sources, and assumes that FeedParser is going to return something nice. What if we could make FeedFeeder either assume the worst of its sources, or give FeedFeeder administrators more flexibility in how to handle feeds?

Alas, the problem with RSS (and even Atom) is that people consider the specification (if they actually look at the specification) as mere loose guidelines. I'm not going to point any fingers at anyone because I like my job, but I will say that the ability of Web Browsers to look at anything remotely like RSS and then display the contents like a feed makes life for us Plone developers a pain in the butt.

Periodically, I got people saying, "Include this as a feed!" until I trained them to realize that most RSS feeds are junk. Which is nevertheless embarrassing when the so-called feed that displays as an RSS feed in Firefox or Safari is completely screwy when it comes the XML. In fact, at my job we've pretty much forked FeedFeeder in order to support customer requests, with each RSS feed item being a custom script. The results work and yet are not very pretty.

So my big idea is this that FeedFeeder would be enhanced in one of two ways:

  1. Custom Scripts - FeedFeeder administrator can do TTW scripts (portable via Generic Setup) to control how FeedFeeder parses the incoming feed. The scripting would be restricted Python. This way the same feed that can be seen via the browser can now be interpreted by FeedFeeder as well. The problem is the normal sort of issues you get with TTW programming, especially when it comes time to validate the script, or port it around (Even with Generic Setup).
  2. Custom Plugins - How about a plugin system of some sort? Basically, you would follow a standard API and put your plugins in a particular folder. FeedFeeder would pick up the plugin and run the appropriate plugin (we would have a selector tool) against the appropriate feed. This way we could grow the functionality and robustness of the tool as more RSS and Atom feeds are added, and could also support new protocols as they become popular
Idea #1 seems quick to do, yet iffy and chock full of potential surprises, but Idea #2 seems like a solid way to do this effort.

BTW, Reinout van Rees has responded to all my posts on the subject of FeedFeeder. He commented on my first post, which was me whining about not reading the code, to the second which was deliberating on making a RSS package that was like FeedFeeder, but could handle problematic RSS better.

So hopefully Reinout is going to read this post too and share an opinion. ;)

Saturday, September 13, 2008

Best career technology choice I ever made besides learning python...

I refused to ever touch Crystal Reports. I became the ugly, ranty developer and yelled and screamed rather than touch Crystal Reports.

I don't even need to explain why this was such an awesome move on my part.

My life is so much better for it.

Friday, September 12, 2008

Some ideas for open source Plone Products

  • RSA Authentication Plugin (I know they have them for Zope, but perhaps making them Plone 3 friendly if that is needed?)
  • Robust RSS/Atom consumer (I've worked with FeedFeeder. It is pretty good but has trouble handling ugly RSS feeds. Maybe I should just contribute to FeedFeeder?)

Tuesday, September 9, 2008

List of programming languages I know

Gakked from Corey Goldberg, here is what I've learned in the last odd 28 years of doing coding off-and-on, in the rough order that I learned them. Items are bold are languages in which I am current:
  1. Apple ][ Basic (1980)
  2. HTML (1995ish)
  3. Foxpro (1997)
  4. SQL (1997)
  5. WebML (1998)
  6. JavaScript (1998)
  7. ColdFusion (1999)
  8. Perl (1999)
  9. CSS (1999)
  10. Java (2000)
  11. Python (2005)

Monday, September 8, 2008

Don't bet on closed source third party software!

US Government Agency story
Sometime in the late 1990s a US government agency (NASA) made a decision to go with a certain set of form software. Basically, this software allowed a person to use a desktop application to easily generate complex government form with data fields. The ability to easily generate paper forms that could be effortlessly converted to PDF was allowed via Adobe Acrobat Professional. All was good.

Over the next few years hundreds, perhaps thousands of forms were generated this way. A few select staff of the agency became experts in creating these forms, or converting existing paper forms into this system. Changes required for whatever reason were easily and quickly implemented, and the forms reached a pinnacle of quality. All was good.

Then, in late 2004, the company that made agency's chosen form software was purchased out by a competitor. And the first thing the purchasing company did was to cancel the products of their competitor. You couldn't buy the forms product, nor could you get support. The product was dead.

At the agency's HQ, the person using the forms software left the agency for other things. The purchased copy/copies of the forms software was somehow lost. This meant that making any changes to agency HQ forms would require rebuilding forms from scratch. Since government forms are complex, you are talking about hundreds of hours of work, especially when stuck with limiting tools such as Microsoft Word, a tool not designed for this kind of work.

At this point I stopped paying attention because it was too depressing. My guess is that the agency fixed the problem with Microsoft Word, since it was already paid for, even though using it for this role is not very efficient. Or they might have a different solution, and I pray its something good, something in the open source arena, because then even if the project collapses, writing a migration system to pull your data out is a bit easier since you have access to the source code.

This sort of thing happens from time to time. People bet on close source third party software and it nails them hard. And sometimes they don't even realize its happening...

Democracy story
Let us imagine a powerful nation which decides to rid itself of paper or mechanical ballots and go modern and electronic. They pick a security firm to deliver computerized voting machines. The delivered voting machines were pretty much proven insecure and the tallying code was beyond review since it was compiled, patented, and closed. Electoral workers and security analysts both complained that since the code was closed, there was no way to ensure that election counts were accurately tallied.

Yes, I'm talking about Diebold in the United States.

Getting past the rather intimidating security issues, the issue of closed source tallying code is terrifying. How do we know that the systems can't be used for doctoring elections? Because Diebold says so? Even if everyone implicitly trusted Diebold, do we really want to bet our future on just one small group of hidden people when the whole country could be vetting their code?

Flashpaper Story
Until I moved to Mac OS X in 2007 I hated Adobe's Portable Document Format (PDF). It didn't seem very portable, the readers were slow, and just displaying it even in modern computers slow my machine down horrifically.

And yet, back in 2002 Blue Pacific released Flashprinter which Macromedia bought and released as Flashpaper. The beauty of it was that it was part of the Flash system, which meant that any browser that supported Flash (all of them I think) supported Flashpaper documents. It printed out nicely, displayed beautifully, was lighter than PDF, and tools were easy to write for it.

In December of 2005, Adobe bought out Macromedia. Amazingly, they didn't cancel Flashpaper right away. Nope, they waited until September of 2008 to cancel this competitor to PDF. Of course, most of us shied away from Flashpaper, since the writing was on the wall.

Not everyone shied away. Young internet startups specializing in documentation seem to have really focused on the technology. What the heck were they thinking? Didn't their Venture Capitalists (VC) examine the technology base at all? I'm hoping they have alternatives ready soon, but my guess is that at least one new venture is going to fail as a VC pulls out his money and rethinks how they do analysis of proposed efforts going forward.

Summary
This isn't to say that closed source is bad. Well, maybe it is bad.

As for me, when I have a choice I use Linux. I can get away with doing my code in open source text editors (although I do prefer the relatively inexpensive and superlative closed source Textmates on Mac OS X).


Note: On September 3rd, 2011 I updated this to state that the agency listed in the first section of this article was NASA.

Saturday, September 6, 2008

I've not quite done LAMP, or have I?

It hit me just now that while I've played with all the individual bits of LAMP (Linux, Apache, MySQL, Python), I've never actually done LAMP per se. I tend to play with Plone/Zope professionally, and in my goof off time I prefer to delve into wxPython, with my Django work being all too rare. I'm wondering if it might be worth it to do some formal LAMP work, and there might be available work at NASA for it real soon.

On the other hand, according to the Wikipedia entry on LAMP the 'M' in LAMP can mean 'middle-ware'. In which case I am professionally doing LAMP every work day.

Wednesday, August 27, 2008

Thoughts on Python interfaces

Python does not have interfaces. Yet people have implemented interfaces in Python via some really innovative code (PEAK and Zope 3 comes to mind, but Trac also has them). Those people have great arguments for interfaces, claiming documentation and enhancement of system structure. From what I gather the theory is that if you use interfaces its easy to create truly componentized architectures because you know what to expect from a component.

Now that said, I find it really amusing how often interfaces end up being just so much boilerplate. By this, I mean an empty, (or marker), interface. We are given to understand that one can do so much more, but sometimes a framework demands an interface in a particular place, and often that interface is just plain empty.

I've never played with PEAK elements beyond easy_install. I've toyed with the innards of Trac and been shocked by what makes up the core of that so important software tool. Zope 3 is weel organized and I've done some shockingly fun stuff there after I got over the Zope 3 ZCML hump. And in all of that, I barely saw the need for interfaces. So often I wonder if interfaces are needed.

Well, upon reflection for those systems interfaces work surprising well. The underlying code for Trac might be questionable but anyone can make a plugin by following rules obviously managed by the interface system. Zope 3 is really nice once you get past the curve because you can make components and tie them easily in knots with ZCML (or with python in the case of Grok).

The point of these thoughts? Nothing really. I can live with or without interfaces, and use them in the frameworks that need them.

Friday, August 15, 2008

Pluggable Authentication System for Plone

It took me a little to get started, because the paster template for Plone 3 Pluggable Authentication System (PAS) products doesn't work for me. Not sure why, so I submitted a ticket.

Anyway, once I figured out that it was the template, and not me, things went very fast. PAS is rather straightforward when you get the hang of it. The quick summary of how to do a PAS plugin as how I've done it:
  • Grab the gmail auth plugin and use that as your base.
  • In your 'content type', import and register the appropriate method and in the content type's class, create the appropriate method.
  • Follow the PAS documentation on Plone.org for different actions you might need to do.
Yeah, very basic. I also figured out how to detail properties that can be set via the ZMI. Easy, but the documentation is not as easy to find as it should be.

I might document things in more depth since in some ways this took much longer than it should have considering the simplicity of the end code. I'm sure the Plone folks would love a detailed set of PAS examples to reinforce the current documentation, and I seem to enjoy doing that quite a bit.

Heh, while I'm at it, maybe I should finish my KSS documentation that I left hanging since the Naples Plone Conference in 2007?

Anyway, my quick review of PAS is that its really powerful. That each element (Authentication, Authorization, Challenges, etc) is seperated into its own plugin/module means that you can switch out components without jeopordizing the security and role system that might already exist. So, for example, if you want to use LDAP for authentication and SQL for authorization and a Smart Card to handle security challenges, you can do that without having do rewrite the core Plone engine. Another big bonus is that to do the actual replacement of individual plugin/modules is really easy once you figure out how. And that is pretty damned hot.

Saturday, August 9, 2008

I missed a class taught by Lennert Regebro?

http://regebro.wordpress.com/2008/01/20/what-is-wrong-with-the-course/

It was way back in January. I never heard of it! Did they not advertise?

I doubt I would have gone because at 1500 GBP (about $2900) plus travel expenses (about another $1000) for three days it was way too much to either pay myself or get NASA to fund. Especially since the Plone boot camp is $500 for five days and was held locally.

Still, if I had known, I would have contacted him and begged for a more affordable class held in the Washington, DC area. I bet I could convince ZPUG-DC to host him and Jorgen, I'm sure of it. It would be worth it because Lennert is a really great guy and maybe if I had hung out with him more at Pycon I would be a better plonista today.

Later today if I get a chance I will email him and see what can be done.

Wednesday, August 6, 2008

Trials and Tribulations of avoiding vi

So I'm stuck working today with a Solaris box. That means no Emacs. Heck, that means even no nano! Instead all I have is vi. Oh no!

Sure, some of you think vi is great. More power to you. Its just not something I like to touch, even if I grant automatic respect to anyone who uses it well. Just like watching any competant craftsman doing their daily tasks, watching a good vi master is pretty fun.

I've been spoiled by Redhat, Ubuntu, and Mac OS X. They come with Emacs installed, and if you have a few rights, you can add in new text editors. On Mac OS X I'll use Textmates, but otherwise I'll make do with Emacs or even Nano if I must.

If I could have argued successfully for more rights on the Solaris box, and had the rights to download software, I would have gotten Emacs working on that machine. Alas, the chance of that happening is around the same amount as a presidential political candidate not selling out his morals and ethics. Which means it ain't happening.

So, my work around?

I had access to the python shell. I wrote the file in there and saved it to a text file. Annoying at times, but less painful for me than trying yet again to figure out vi. I got my stuff done pretty quick and went on to other things.

Wednesday, July 30, 2008

Funkload to be revisited!

Benoit Delbosc (I assume its him because the Blogger sign was 'Ben') last week responded to these two posts I made in February:
Benoit is the author of Funkload, a promising python based functional and web load tester I explored earlier in the year. Its biggest shortcoming was the problem with getting graphical charting to work because the graphing library it was using was impossible (for me) to find. Sure, numbers are important, but a picture says a thousand words.

Especially to managers.

Well, Benoit told me that the latest Funkload calls for python-gdchart2, for which linux packages (at least Debian and Ubuntu) can be had. So installation across the many machines I touch will be trivial. I don't always use linux, but now I'll make sure to use it when I need Funkload to do what I need. It might also work with Mac OS X, something I plan to investigate tomorrow.

This makes me very happy. I really enjoyed playing with Funkload, and plan to do more of it in the near future.

And, just to make Benoit happy, even though it wasn't official, for the past 6 months or so I've used it in many unofficial load/functional tests for http://nasascience.nasa.gov as well as other internal efforts. :)

Thursday, July 17, 2008

wxPython is fun!

I needed to generate lots of lipsum recently. I could use elephantangelchild's greaterLipsum but I like fancy GUIs. So I branched greaterLipsum and wrapped it inside a little wxPython app. Pretty easy to do and it works great. You can svn the results at the desktopGreaterLipsum branch.

I plan to add in new features like being able to choose the text source, making binaries for different operating systems, and other fun things.

In the meantime, it made me remember just how much fun wxPython is in general. I need to find excuses to work with it more.

Friday, July 11, 2008

Ready for boot camp!

Next week I'll be in Plone 3.x Boot Camp at American University. I've worked with Plone 3.x for months, but haven't had time to get really spot on with its features. So I'm looking towards this second experience with Joel Burton with a lot of excitement.

Anyway, after spending some time with elephantangelchild's laptop yesterday getting Python 2.4.4 installed, then PIL, then Plone 3.1.3, then taking it back down to 3.1.2, then installing in the boot camp modules, I decided to do the same for myself last night.

I decided to take a shortcut. I modified the buildout.cfg so from the start it did everything in one go, installing Plone 3.1.2 and the boot camp modules. That way I could just do one build and be happy.

Alas, buildout wouldn't work. I had to do my buildout for Plone 3.1.2 and then run it again with the boot camp modules. How silly is that? Oh well, its done and with ArgoUML I'm ready to go!

Monday, July 7, 2008

Me Grok generate Add and Edit forms!

So the first bit of documentation in the grok docs didn't work. Grok has evolved a lot so this is understandable. My thought when I dropped the effort in frustration was that my knowing of where the URLs for the add and edit forms were off. Since the docs I was first working on lacked the URL of what I where I was supposed to go that answer seemed to make sense.

My co-worker suggested I go to the explicit name of the view, which in the Zope 3 world is '@@' this or that. A good suggestion but that didn't work. More on that in a bit.

Examining the Developer Notes I discovered that the docs I was using were out of date. I changed my code to fit the notes, pointed Firefox at the URL named after the form classes, and it just plain worked. Code changes were minimal. And I'm posting to the Grok folks that the form docs are out of date.

Anyway, you can go to /myview or /@@myview in Grok. Which is good. For some reasons that others explain quite well, Zope 3 has this whole big thing with '@@' and '++' in URL bars to explicitly name views, adapters, utilities, oversized SUVs, bad American food, et al. I'm sure some people can't live without them but honestly since Grok avoids them it makes things feel more... pythonic.

Anyway, the add & edit forms, now that I can make them work, are wonderful. Pretty HTML forms with validation done in moments off a little python code.

Monday, June 30, 2008

Me Grok Smash!

So as I started on yet another graphviz application for the web, I decided to go with a new framework. I would use Grok!

Grok comes out of the Zope community, and has its foundation in the rather mature components of that application server. The difference is that tying bits of Grok together does not rely on seemingly arcane xml files. You just code in Python and a bit of TAL for the views. If you want you can leverage in more bits from the Zope world, such as zope.formlib and other interesting bits.

It is a matter of public record that I have a like/hate relationship with zope.formlib.


There are some really nice things I discovered about Grok:
  • Intuitive.
  • Only one magic bit, in that class defined as views look for their lowercase template automatically, and you can override this if you like.
  • The framework is out of the way.
  • Inheriting models is a cinch.
  • Lets you play with either the ZODB or SQL ORMs.
  • Easy use of TAL.
Some negatives:
  • A possible gotcha when you instantiate an object inside another object requires you to do a super(MyObject, self).__init__() inside the object's __init__. Not sure why I should have to write this out and it might be I did something wrong.
  • Um... still trying to find faults.
I'm rather pleased. Grok has grown up lots since I really looked at it in late autumn of 2007. I look forward to working with it more.

Friday, June 27, 2008

Beware Documentation By Topic

Yes, I know its supposed to be 'Browse', but while looking up some documentation and being distracted I took 'Browse' as 'Beware'. Since it was Grok I immediately thought of rampaging cavemen.

Heh. Fridays...

Monday, June 23, 2008

Ruby Security Problems

On the surface:

http://www.ruby-lang.org/en/news/2008/06/20/arbitrary-code-execution-vulnerabilities/

Digging deep:

http://www.zedshaw.com/rants/the_big_ruby_vulnerabilities.html

In my world, Ruby is the dark side. Tantalizing and yet there is a rock of stability about Python that I really enjoy, even if I can't define what I mean. Maybe its the security to know that the language is deep as it is broad?

Anyway, at least for today I'm grateful I've stuck with Python.

Sunday, June 15, 2008

Umlizer lives!

Still is an early alpha release but nevertheless it lives! At this moment it currently handles all the formats I want for version one and has been tested against all target Plone versions. In other words, it meets the requirements I set for this tool, and now what remains is cleanup, documentation, and more testing.

What is Umlizer?
Umlizer is a Plone 2.5x/3.x package that introspects your Zope Object DataBase (ZODB) and then returns a view of your database in the specification that you want. Currently Umlizer provides the following formats for its view:
  • DOT for rendering into UML via graphviz
  • UML in JPG rendered via graphviz if graphviz is installed
  • HTML list for easy reading
  • Comma Seperate Values (CSV)
  • 3-d animated graph rendered via ubigraph
Before you ask this is a very Plone specific tool. Django already has a similiar tool called DjangoGraqhviz.

Why Umlizer?Umlizer was designed to represent the complexity of the Nasa Science site architecture, which was originally a rather complex UML diagram. The XMI for that UML diagram became corrupted, and we did not have a backup. Training people on the database has thus been a chore since, whether they be developers or content editors. In a couple other projects I've noticed that going through Plone code to figure out an architecture can be a pain. So what about a pretty diagram?

For nearly a year I tooled around with different iterations of this effort. In general, each of these iterations relied on protected Python scripts in Plone, which are limited and forced the user of the tool to make many steps before getting a view. These scripts were fragile and arcane, and just plain sucked. Different views of the data were impossible to generate. The latest version of this hack had really nice code, but was a hack.

So I thought, why not try to make it a Zope 3 style Plone package again? My previous attempt in September of 2007 tanked, but my skills in this arena had really improved thanks to training, a cancelled Zope 3 effort, and lately my co-worker Reed's insistence on using it and my need to maintain and extend his work.

Also, in the Plone community, thanks to Jens Klein we have ArchGenXml which is why we used UML in the first place. When I met him in Italy in October of 2007 for Plone Conference 2007, he told me about a pet project of his called Genesis. From what he said at the oldest pizzeria in the world is that Genesis is ArchGenXml with a very modular architecture. So I was determined to make this as modular as possible, trying to work outside the confines of Plone and isolating individual pieces as much as possible.

After about a week of playing with this along with my other duties, Umlizer is working at an alpha level!

Where can we get Umlizer?
That is a very good question. Because of our internal need for documentation this was done under the auspices of NASA. One of the things on my schedule tomorrow is asking for permission to release Umlizer as an open source package. Since there is nothing sensitive about Umlizer, I don't see anything preventing its release.

Wednesday, June 11, 2008

Should I write a book?

I could be writing a technical booklet of sorts that might grow into a full technical text. Maybe for Plone 3, Zope 3, Grok, or Django. I think I would really prefer writing something for Django. Some concerns:
  • Time. Where would I find it?
  • Is the pay worth my effort?
Some alleviations to my concerns:
  • My consulting has been going slowly. Time could come from there.
  • Writing a book would get me more and better work thanks to recognition

Thursday, June 5, 2008

MVC public service videos

The railsenvy guys do it again with a series of public service videos on model-view-controller. I especially like the third and fourth videos. Unlike their RoR versus videos, these are tool neutral.

http://railsenvy.com/2008/6/3/mvc-videos

Tuesday, June 3, 2008

Must use ubigraph

I finally spent a few minutes playing with Ubigraph, a 3-d animating tool for generating nodes and edges graphs on the fly. The API is straightforward xmlrpc which Python handles very well. The result is nothing less than amazing.

Granted the documentation needs work. But even what exists lets you do a lot of really fun things. I look forward to finding ways to use this amazing tool. As I go forward it will be interesting to compare the very complete (some say cluttered) Graphviz feature list with that of Ubigraph.

Its all good though. This makes a great companion for Graphviz. Thats because Graphviz can generate things in many static image formats where as Ubigraph renders inside an OS window that I guess you can capture via Flash or Quicktime. So both have their place in my world.

Monday, June 2, 2008

How not to build a view

I like simple, sweet, and easy to use. Which means sometimes Zope 3 style things are awesome, and other times it sucks. What's worse is implementations you have to maintain where someone took something very simple and made it very complex.

In our case study, lets see what a predecessor to me did using Plone and a lot of Five:
  1. Extended the ATEvent type.
  2. Created a view using portal_catalog. This creates an object which calls another object which calls a specific function to grab relevant data from each brain object and place that data in a dictionary.
  3. Made the view, 2 objects and functions bolded above not as extensions as other bits that existed elsewhere but coded them individually.
  4. Tied it together with zcml.
The end result was a results object containing brains and a counter. Um... okay. I understand this was done so that the Plone template serving this would have the batch features and all, but this is over engineering.

I think a better solution would have been this:
  1. Extend the ATEvent type.
  2. Create a utility package with code to be reused in creating batches later.
  3. Make the view call the utility package so you don't have to code much.
  4. Tie it together with zcml.
I like this method. The better developers I work with and the gurus I admire will tell you any time you write the same section of code more than once you should look at code reuse techniques. Either wrap your code in functions, use inheritence, or play with polymorphism. All that good stuff.

Sigh.

At least I get paid to maintain this code. Finally it isn't in the NASA effort.

Friday, May 30, 2008

Inheritence is fun!

Imagine this view in python:
class MyFirstForm(formbase.PageForm): lots and lots of finicky code.

Now lets say we want to capture everything in that view, but give it a slightly different behavior. How about this?
class MySecondForm(formbase.SubPageForm,FeedbackForm): pass

So what does this do?

Well, in Python what this does is make the second class inherit the properties of a similar base class, then overwrite it with the properties of the first form. The order of precedence in inheritance in Python is very clear and straightforward. The result is a wonderful case of object oriented code reuse.

I believe Ruby does it in a very similar fashion.

Thursday, May 29, 2008

Visit the Greater Lipsum Project at your own peril

Don't say that I did not warn you, but kf has added her Greater Lipsum project to Google Code.

Now that I've posted this link to an exploit of forbidden knowledge, I can hear the keening of the Deep Ones all the time. What once sounding like insane cries of the damned now is starting to sound all too sweet.

Wednesday, May 28, 2008

Genius will be rewarded

KF is a business analyst for NASA. She is smart. Too smart for her own good. For she has gained the arcane knowledge of the Python Programming Language and dared to write her own lipsum generator. One serving up snippets of the works of H.P Lovecraft. I give unto you the Cthulhu Lipsum Generator!

Or not.

I'm not going to be responsible for those who dare to use her tool.

Her mad, mad, mad genius will be reward. Just not by me!

:o

P.S. If she puts it up on google code I'll link to it and let you use your own judgement.

Monday, May 26, 2008

Phoenix

Don't forget, I work for the people who made this happen!

http://nasascience.nasa.gov/missions/phoenix
http://www.nasa.gov/mission_pages/phoenix/main/
http://apod.nasa.gov/apod/ap080525m.html

To Shell is to love Python

One thing I like about Python is the shell. Or if you have rights, the iPython shell. Combine that with PDB (Python Debugger) and you get quick, accurate insights into the behavior of snippets of code. You can tweak things to your heart's delight. I think list comprehension would not be as much fun as it is if python did not have a shell.

I think one of my future prerequisites for new languages (not that I'm looking) is that the language have a shell.

Tuesday, May 20, 2008

Apologies to Chris

Who is Chris and why does he get an apology?

Chris is a co-worker of mine. He's more than a co-worker, he saved my soul. About three years ago he introduced me to Python, SVN, Trac, and Plone. He also first pointed me at Pylons and Django. He has pointed me at open source alternatives. He fended for me with certain NASA functionaries. He is honest, visionary, brilliant, opinionated, creative, funny, witty, well-spoken, principled, and has helped me in a thousand ways. If he was the boasting type I would probably still be calling him my python mentor.

That is Chris.

So why the apology?

This past Friday afternoon another coworker was asked to give a certain relatively important someone (aka a VIP) a short bulleted list (5-6 items) of innovations on our big project to go onto that VIP's periodic personal review which was due the next day. Not to NASA. Not to anyone important. It was just the normal sort of crud that goes into self-reviews. The other coworker turned to me and suggested I provide the list.

And then I turned to Chris and asked him for some input. Chris refused for several good reasons:
  • A short list did not do justice to our project.
  • A longer list would require effort that would require approval. Approval from our manager who had left for the weekend.
At this point what I should have done is said, 'Nevermind, I'll just do it myself.' If he got pissed then things would have rolled over eventually and we would grumble/laugh about it over drinks at some point. However, instead I tried to convince Chris that this was no big deal and that we ought to spend five minutes getting it done.

See, cause I really respect Chris, I'm always looking for his approval on things. And sometimes thats the wrong thing to do. I should have stopped listening to him, told him definitively that I was going to do this, and done it. Instead I waffled, fighting my desire to get his approval and my knowledge that a battle over a five minute task was not a battle worth fighting.

I did some stuff in retrospect that looks stupid. The worst was that I wrote an email to my boss, sent it, then got Outlook to recall it. When I found that Chris had written one of his masterful detailed lists I didn't tell him that his effort, while exemplary, really complicated things for me.

You see, some battles are worth fighting. Some are not. I agree that the list I was asked to provide did not do our project justice, but I also recognize that this was NOT intended for general distribution. Provoking this fight wouldn't score a victory of any value, just make a VIP's job a little harder, and incur their ire. I have no problem with fighting good fights, but in my opinion this fight just wasn't one of those good fights.

A better fight would have been for documented processes, requirements software, nixing the cubes, collaborative software, and for work on new and exciting projects.

So late that night after 5-10 minutes of effort I put together a list and sent it to the VIP. Then I started to think about sending a note of explanation to Chris. I note I never sent. Why? General stupidity on my part. I was trying to figure out how to write it in a way that kept his approval. I procrastinated over the weekend, which really was not the thing to do.

Chris found out on Monday what I had done. From his perspective I'm a/an @#$%-#$@ for not only providing the list and for not being straight with him. I can't really say I can blame him. I knew the former was going to happen, the latter could have been avoided if I had been forthright from the start.

I'm not sure anything I write can make a difference at this point. Apologies are just words, and words are easy to say. Which is why if I'm going to say anything its going to be public and in a place associated with me.

My apologies Chris.

Monday, May 19, 2008

I love graphing

I don't mean charting (pie, bar, line, etc). I mean drawing edges and nodes and showing relations between objects of all sorts. That means between data objects, code objects, people, companies, and so much more. Its lots of fun and writing clean, extensible code to do it is a blast for me.

Mostly I work in graphviz using Python. I played with PyDot for a while but wasn't happy with it so I tend to write some base code to handle things in a way that ended up being duplicated by the GvGen project. Which is very nicely done.

However, there are limits to graphviz. Graphviz doesn't do animation or make 3-d images are two big items. However, its nice and light as a renderer which is very important especially for generating content for the web on the fly. Nevertheless I've done wonderful things like mapping out relations between 150 applications or reverse engineering ZODB content into UML.

So imagine my delight when I found Ubigraph this morning. It does 3-d graphs and animates things. I don't think it will replace Graphviz because it does different things. I haven't played with it yet but I will.

Friday, May 9, 2008

The problem with comparing Pylons to Django

...is that my experiences with Pylons are from nearly two years ago. My experiences with Django are ongoing. So any comparison I do will be completely unfair. But lets do a little anyway because there are some issues I want to raise.

ORM non-Issue

I don't have any issues here with either framework. At the time played with Pylons I think it used SQLObject. Now you can use SQLAlchemy. If you want, Pylons can also handle Python's DB-API if you want a bit of pain with your SQL. Django has its own ORM. Personally, I'm happy with any ORM to handle all the mundane tasks, and all three ORMs have good enough documentation to make working with them a snap. So ORM is a non-issue.

Routing non-Issue
Pylons routing of URLs to methods was easy. Django has an easy method too. I'm sure some folks might take issue with some of the finer points but I haven't ran into any killer issues myself. I think both let us specify things ending with slashes, or '.php' if we have a sense of humor. So routing is a non-issue.

Django Templates versus Myghty/Mako
The problem is my own lack of discipline. It can be so easy to start adding in more and more logic into your views. I would rather call python modules with python methods written in python then cook up fancy logic in a view-focused templating engine. Yet again and again I do the stupid, and mix my content with presentation. So I want a templating system that limits what I can do with it.

When I did Pylons the default templating system was Myghty, patterned after a Perl library called html::mason. I did not like Myghty. Since then, Pylons adopted Mako. The same things that made me not like Myghty appear to be in Mako. Too much power! I can mix my business logic code too easily with the view stuff.

I like Django templates because it has good, hard limits on what you can do. You aren't cooking up creative ways to do logic in views. You are just simply writing views. In return, it gives you a bunch of default utility methods/filters that do a bunch of repetitive work.

A common alternative with Django is Jinja templates. I think Jinja might give application developers Myghty/Mako like power. So I'm not very interested in Jinja.

Django versus Pylons Documentation
I like good on-line documentation. Its very hard to do, and Django has done a smashing job with tutorials and on-line books. Pylons has some really good stuff, and I know that they've improved, but they are still not there with Django.

Admin Interface
So I create an application and have a table with 5 status values. The application goes to production. Turns out I mispelled a status title and it needs to be fixed.

In Django I log in as an admin, go to the errant record, and fix it. To make that work I just added an internal class to the Status model.

In Pylons (and I might be wrong), I can't do this. I either have to log into my database directly, or write a snippet of code to correct the problem, or code in an administrative module myself.

Summary
This comparison was totally unfair. I'm skipping a lot of wonderful things about Pylons. Things like Pylon's unbelievable flexibility in choosing components, the rails-like webhelpers, and the collective smarts of the people who work on the project. Or its close friendship with the latest versions of Turbogears, which probably smashes the admin interface issue right out of the ballpark.

So, in conclusion I'll play it completely safe and say that Django and Pylons are both good stuff. I just prefer working with Django.

Sunday, April 27, 2008

Feedparser does not work with Google App Engine

After my laughable mistake of trying to do a import feedparser.py, I sat down yesterday and spent half an hour writing my rss aggregator for Google App Enginer. Critical, of course, was use of the excellent feedparser project. It was easy to get everything working, and while not styled it looked good. Everything except for using Feedparser to parse the incoming rss and atom feeds.

Alas, Feedparser tries to use a few modules that the enterprising folks at Google restricted. I haven't done any research yet, but I wonder if it is in the arena of fetching data from URLs, since app engine has its own library. I'll poke at it tomorrow.

In any case, I was very pleased with Google App Engine. Lets go over why:
  • Database is not a RDBMS. Some people might scream at this issue, but the benefits we get are wonderful. Expando seems really fun to use.
  • Built-in ORM. Sure, its not SQLAlchemy or the Django system, but its not that far different in approach and implementation.
  • Django Templates! If I'm not doing TAL and I'm doing XHTML/XML, then my choice is Django. Templates.
  • Cleanly documented. Clear and simple sentences with good examples that are working code, not doc or CLI tests.
  • Easy and intuitive. This part is critical. The framework is not in the way.
Update: Apparently Feedparser works with GAPE. Either something changed about GAPE (feedparser hasn't been updated in a while) or maybe I had a bug. Thanks to Alex UK and crchemist for pointing this out.

Thursday, April 24, 2008

What I want in a feed aggregator

The list is simple:
  1. One page that displays all the content. Maybe do some pagination, or hide descriptions and just show titles. Otherwise have tags, author, description, and link to original post.
  2. One page with a text area that accepts one feed per line.
  3. Include some sort of authentication.
Ways to get this done
Google App Engine handles #3 for me nicely and gives me free hosting. But feedparser doesn't play well with it and I'm not about to do that kind of debugging. Maybe I ought to try BeautifulSoup?

I'm tempted to try a pure Django system, since that could handle all three, but then I would have to pay for hosting. The same would go for Grok as well. I don't want to pay for hosting yet. Or maybe I ought to just pony up a few bucks a month anyhow...

Of course, I can always write my own simple wxPython client.

What to do... what to do...

Update: Never code on two hours sleep. I'm going with Google app Engine because I realized that when you import of feedparser you can't do this:
import feedparser.py

Wednesday, April 23, 2008

Suggest to me a feed aggregator!

I need a good RSS/Atom aggregator. I'm not having any luck. And this is giving me issues because I can't remember everyone's blogs I like to peruse. Any suggestions?

Tried Google Reader and hated it. Updates happened haphazardly and the interface was confusing. The one google product I can't stand.

Tried Rojo and it would be great but I can't seem to easily add my own @#$% RSS feeds. No dice - instead I have to search for everything. WTF?

Or should I perhaps write my own in Django? Or a local version in wxPython? I've worked with FeedParser a number of times and it is an easy API. So is Beautiful Soup for that matter.

Monday, April 21, 2008

Friday, April 18, 2008

Sick but Ubuntu

I was out of work for a couple days. Stuck at home, the first evening I grabbed an old machine and installed Ubuntu plus a surplus wireless card. This was my second Ubuntu install, the first suffering from a Microsoft wireless card. I was amazed by how fast and easy the install was to do. I kept the old XP on a seperate partition and got on the house network in 30 minutes.

Of course the basic installation doesn't have all the python tools I like to use. That took me another 30 minutes.

The only real downside I discovered was a lack of Mac's Textmate. I can do emacs, but Textmate is my preference. So I toyed a bit with gEdit and was pleased. Its also free!

One thing that Ubuntu beats out Mac and Windoze for is speed. Granted, this is a new install but I have to say I love the speed of the machine. And this machine is about 3.5 years old.

Good times indeed.

Monday, April 14, 2008

Oops... forgot RSS feed

Its not a big thing cause adding RSS feeds to Plone is painfully easy. Nevertheless, it is amusing how NASA Science didn't have RSS feeds listed on the front page on launch.

I think atom feeds are also planned.

Friday, April 11, 2008

Zed Shaw, YAML, Python Community

Zed Shaw posts about something I found annoying about a ways back when I was first exploring Python.

Like Zed, I too have run into the "YAML is not Python so don't use it, but wait someone else is using something YAML which is not Python so lets use that!"statement in the early stages of my Python use. Since Zed and I trade emails I should have warned him this would happen but the past few weeks have been hectic.

So this is an official apology to Zed for not giving the warning.

I wish I had given him the warning because that would have been awesome. Likely he would have ignored me, gone down the same path anyway, and then I would have a handy 'I told you so' to hold over his head.

Anyway, this is one of those few things I don't like about Python or the Python community.

Overview of NASA Science

I cooked something up for non-technical family members asking what I did for the NASA Science project. It gets a bit technical in places, but I'm a geek so that's just too bad.

Anyway, you can read it yourself at So what did I do on the website?

I'm also writing something that gets more technical here. I've got to be careful though cause The Man will make my life hard if I give out anything that can be construed as a security leak. So for example, if I give out the IP address of the site, that may or may not, under various conditions, be up for consideration as a security leak.

I kid you not.

Thursday, April 10, 2008

History of my most used shell commands

Courtesy of me -> flub:

history | awk '{a[$2]++ } END{for(i in a){print a[i] " " i}}'|sort -rn |head -n 20
107 svn
101 cd
101 ./bin/instance
58 ls
37 python
26 mate
16 grep
11 rm
8 ssh
4 ipython
4 easy_install
3 sqlite3
2 sudo
2 pwd
2 mkdir
2 history
2 django-admin.py
2 django-admin
2 ./bin/instance1
1 wget

Our NASA Plone project launches

http://nasascience.nasa.gov

This represents the work of about 20 people or so in many areas. Some details:
  • Plone, Zope, and Python application stack
  • Served by Apache and cached by Varnish
  • Section 508 compliant and meets usability requirements
  • Valid XHTML, so you can easily write stuff to hit it
  • Lots of custom views.
  • Lots of imported plone products
  • Several custom plone products
  • Hitting the mass media now.

Tuesday, April 8, 2008

This looks interesting...

http://code.google.com/appengine/

And Django comes as a default.

It is a very good time to be a Pythonista.

Friday, April 4, 2008

Issues with zope.formlib

Disclaimer: I am not an expert on Zope 3, much less Five, which lets you integrate Zope 3 technology into your Plone efforts. on the other hand, that arguably lets me speak as joe developer trying to meet a deadline, so I think things balance out.

I was tasked with extending a Five based package to include several extra new forms. This post details my efforts, what pleases me about zope.formlib and what annoys me.

Zope.formlib is a Zope 3 product that lets you create HTMl forms with handy bits of Python code. In general I like this approach, because if done right it means less work (thanks to DRY or Don't repeat yourself), and instead of just hand-coding the same form elements again and again - you utilize easily understood libraries that take advantage of inheritance and polymorphism.

Since we weren't storing any of the data I just extended a few existing interfaces, added a new view, a new response template written in a few lines of TAl, and tied it together with ZCMl. It was very straightforward and I had lots of fun. I had done a few bits before with zope.formlib and things were so easy I was delighted. Zope technology is like this, in that you can accomplish tasks quickly.

The basic form looked good, the form submission worked without a hitch, now I just needed to change some checkboxes to radio buttons. I didn't do it earlier because the documentation didn't have that described, but I figured it would essentially be really fundamental to the bool type in zope.schema (for you Django folks, Zope schemas can be likened to your models).

After many efforts at googling the answer I was nowhere. I dove into my 3rd edition copy of Web Component Development with Zope 3. No answer. I started checking the Zope 3 APIDOCs which has tons of information but nothing on turning a field/attribute into a radio button. I did introspection everywhere and might have stumbled across it eventually but a coworker made a suggestion that answered the problem.

So that was done. Now I wanted to encapsulate my forms in a set of macros that other products could easily use. I wanted to wrap SubPageForms in template macros containing form tags so whoever used these forms just needed to a macro include. Again the documentation was lacking, and for the release going as I write this, we created a temporary work around.

So there are described a couple major annoyances. Another one to list right now would be that anything besides a template change in Zope 3 based technology requires a server restart. Now pardon me for saying this, but I thought modern application servers did refresh.

Now keep in mind that when I wasn't trying to unearth the hidden mysteries of zope 3 and five or waiting for my server to restart yet again, I was incredibly productive. The frustrating thing was enough time was wasted with monkeying around zope.formlib that I could have written the TAl for the forms and then used old style Plone forms and been done much more quickly. Yes, I won't make the same mistake again, but I shouldn't have had to poke around as long as I did.

Alright, it may not be quite that bad. But it's bad enough. In my opinion, every HTMl formlib should have in its core documentation working examples of all the standard HTML input tag types. Text, textarea, checkboxes, radio buttons, and so forth.

For example, with the Django Newforms library, you have clear documentation of how to substitute one widget type for another. You are also clearly told that the forms library does not handle wrapping your input fields with form tags. Zope.formlib, combined with the rest of the Zope 3 API is much more powerful, but the Django documentation makes it much more accessible. Here is the Django newforms documentation if you are curious:

http://www.djangoproject.com/documentation/newforms

And here is the current zope.formlib documentation:

http://pypi.python.org/pypi/zope.formlib/3.4.0

The former is complete while the latter is verbose. That's an important distinction.

Just so it is known, I'm wouldn't mind documenting zope.formlib more and putting it somewhere useful on the web once someone gives me a good suggestion as to where to put it.

In any case soon after these issues were resolved I was essentially done and most of the remaining work is/was dealing with the normal sort of last minute unwritten requirements that makes life 'so much fun'. In fact, I rolled out another form in record time and using zope.formlib. I had fun! Just the learning experience was not.

Tuesday, April 1, 2008

I got a job at McDonalds!

I'm going to be a food champion. Which means preparing delicious culinary treats at the grill. Life is good!

Friday, March 28, 2008

Reality Graph

http://www.michaelnygard.com/blog/2008/03/reality.html

This seems to very true, as I remember clearly from my J2EE days and what I see here.

Of course, my first real response upon looking at this graph was pretty certain knowledge this was cooked up in Graphviz.

Wednesday, March 26, 2008

Need better charting for Python

With the release of Pyglet 1.0, I'm hoping that we get better chart support in Python. Yeah, I know that ReportLab does it, but I need prettier charts.

Of course, if I were more adept at manipulating graphics, I would cook this up myself. Thats my excuse and I'm sticking to it!

Monday, March 24, 2008

Django at Pycon

Pycon 2008 was notable not just because it was my first Pycon, but because the scope of the Django presence. It was huge. There is some talk of a spin-off convention for the Django folks. Wow.

Django is good stuff. Regardless of what naysayers say, they've been moving towards a more Pythonic and WSGI compliant way of doing things. Sure, it calls things in the MVC stack by funny names, but who really cares? At first I was apprehensive about Django templates, but while its very rich in what you can do with filters, you are really blocked from doing logic in views. I like the ongoing SQLAlchemy integration and the hesitancy to lock the core framework into a particular JavaScript library.

More important is that the leadership seems on the ball. Sure, they invented a bunch of their stuff again, but thats the way things used to be. And they've been becoming more compliant ever since.

I'm looking to doing some Django work. And I'm looking for how it will fit into the various other WSGI compliant frameworks in the days/months/years to come.

Meeting Plone friends at Pycon

Lennert Regebro is one of the guys who did Five for the Zope and Plone world. He's smart, fun, accessible, and seems to live out the ideals of open source. He's famous for talks on the mistakes his frameworks of choice have made, and enjoys sharing it with the new kids like Django, Pylons, and TurboGears. I'm of the firm opinion he should run classes/tutorials at the next Plone/Python conference.

I also bumped into Christian Theune, a German Zope/Plone guy who isn't just smart, but also good to be around. Wish I had found time to eat dinner with him again.

Calvin Hendryx-Parker made his presence there known too. He's another sharp guy and is part of Six Feet Up. Which reminds me, I need to look into some Python hosting.

Note: Lennert Regebro's role in Five has been updated.

Pycon Wrapup

I meant to write this sooner, but I came back to my 10th wedding anniversary. So whatever makes up my audience has had to wait. Waiting is over so here we go:

Bring more business cards
I ran out of my own business cards the first day. Next time I go to a conference, I'll bring a hundred of them.

Tutorials were worth every penny.
Don't go to these conferences and miss out on the tutorials. Much of the rest of the conference is hallway conferences, short presentations, and sprints. The tutorials are hours of focused training given by really smart people. You hurt yourself if you don't make time and money for these things. On the other hand, 16 hours of training on multiple topics after traveling to get there is not super ideal. I was sad to have missed out on the middle slot, but on the other hand I was really focused for all the training I did get. I think two days of tutorials is better than one really long day.

Mt first tutorial was Numpy, which exposed me to the crunchy fun of the real grinding power of manipulating giant data sets at speed. The multi-dimensional arrays are really powerful, and I suspect that if used correctly 2-d arrays could make standard SQL database number munching look anemic when it comes to doing calculations. It might be interesting to create some tests comparing MySQL to Numpy for doing sums and the like. Another thought is fetching out data and using other Python science tools to generate charts and graphs. I've got a page full of ideas and I can't wait to try them out.

Second was Agile Testing and the experience was great. I've been a big fan of this since my Java days, and loved DocTests for Python. Up until my current big project, I did tons of testing in everything I did, and used Selenium for things where I wasn't happy with the system's test suite (that was with Plone until October 2007). Anyway, we were walked through Stupidity Driven Development (write code and write tests for things that break), Nosetests (a global test suite that just plain makes writing tests easy), Twill (simple dialogue for writing HTTP tests), and a number of other useful tools. While there I met Remco Wendt for the first as well plus the noted Larry Hastings of Facebook.

Keynote Talks
I liked all the keynote talks. Sure, Guido might be giving the same one on Python 3 each year, but besides Youtube I've never seen it before.

Unlike some people, I didn't mind the presence of White Oak's Chris Hagner giving a speech on why Python rocks in their corporate world. He gave a good speech and showed how WOTI uses their knowledge of open source to increase the worth of US tax dollars spent. This is important to me because I see so much waste living as I do in the Washington, DC area. I've seen mediocre developers leave their positions to become Enterprise Architects for projects that really just needed a CMS like Plone or a number crunching application best served by Django. Money wasted on these tools could be invested into Open Source efforts, the same way that Apache has benefited by patronage from IBM and other large firms. Remember kids, with some good leadership on the OS side, you get this equation:
patronage != control of open source project

Van Johnson's speech on Intellectual Property was really good. I take a Lawrence Lessig approach to the whole thing so listening to him as sort of like being in a church and nodding to the pastor. Sure, I had my differences, but its good to see an Open Source lawyer explain the real world to the masses. I don't want to get in trouble for not paying attention to the particulars, so this was good for me. I've heard/read much of it before, but the refresher was important to me since its so easy to forget the particulars and get yourself into trouble.

Session Talks
I went to a lot of these, and rather than repeat my notes I'm just going to review highlights and the odd lowlight.

An early favorite was Chris McDonough's talk on repoze. I had seen it before in November at ZPUG but this time he demonstrated something stunning. This time he got Trac to work inside of Plone. How cool is that?

I had hoped for more on the Stackless Python talk. However, that was not meant to be. The original presenter cancelled out and he was replaced by someone who was not good at oration. Also, the slides were the same as a presentation 2 years ago. Lastly, the speaker couldn't properly answer any questions so basically was just clicking slides.

The SQLAlchemy talk was great. The package has really come a long way. A lot of features probably aren't needed for most efforts, but having them there means you have to dip less and less into SQL and database specific items. I like how you can do Sqlite purely in memory for testing, which means for development on the genwriter project its perfect.

I've been a fan of Alex Martelli since I first opened the Python Cookbook. His talk on callback patterns was like a firehose of really useful knowledge and lessons learned right into my brain. People left early and I guess I pity them. Sure, some of the stuff he talked about was advanced, but it wasn't that bad.

Also of good note was the Pyglet talk. Pyglet is a cross-platform multimedia library that lets you code in graphics and audio for anything you want. Unlike Pygame it uses the OS standard bits to do its media actions which means technically its core cpython. I downloaded one demo that is a fractal terrain generator and didn't download the 3-D shooter. Yes, someone made a half-decent 3-D shooter using a high level language. Wow.

I went to the Iterators talk which taught me about namedcollection.tuples. This is good stuff because you can stick complex data into a list-like object and then do fun stuff like easy sorting and other interesting things.

In retrospect I wish I had gone to the talk on python containers but the one on Nose testing was not bad. The speaker, also the creator, was not good at speaking. But his philosophy and tool are great. Very simply, Nose is a script you call that runs all the tests inside what you point it at. It runs anything that looks like a test. Sure, it doesn't have as much finesse as other tools, but its easy to use. And in my opinion, when testing is hard to do, it means you tend not to do it as much as you should.

Finally I was impressed by Mark Ramm of TurboGears. His talk was not so much on his framework but on that with WSGI all frameworks just become glue bits for bigger and better things. He wants people to play together and adhere to standards so if you want something else to use, you can do so without breaking your tools.

Lightning Talks
I wasn't that much impressed by them. There were, as Bruce Eckel pointed out, too many commercial based talks which generally were hiring spiels. I've got nothing against recruiters, but lightning talks are supposed to be technical, with maybe a '...and we're hiring' at the end. So what happened is I didn't pay attention to a number of them, and they blurred together. there were some awesome things presented there, like Larry Hastings of Facebook or Zed Shaw's great humor, but most of it was rather bleah. So sad that makes me.

Summary of Pycon
I'm not done yet! Lots more happened like a BOF or two, touching OLPCs, shaking Guido's hand, eating the odd good meal, and the sprints. That will come in a later post.