Monday, October 29, 2007

What is a real language?

I remember back in my Java days I thought it was cool I was doing a 'real language'. That meant it used semi-colons to close statements, had static typing, was compiled, and could do pretty much anything. Unfortunately, I was also unhappy with hunting down semi-colons, found static typing to be annoying, and found the compile phase to be dull.

I drifted back into scripting languages then, and was ashamed for a bit. I mean, I can't tell you how many times I heard this phrase: 'Language x is a scripting language' as 'Language x is just a scripting language'.

Of course, I could throw back that I was much more productive in a scripting language, or that my code was smaller, meaner, and easier to read. But deep inside I felt guilty that the scripting languages I was using weren't 'real languages', but rather just scripting languages. It was a classic demonstration of how emotion can triumph reason.

It was frustrating because there were things I am easily doing in Python that are really hard in Java. Ever put together a quickie script to read a text file and then use that data to generate critical responses? Or write a hundred views in a month? Doing either in Java is painful, but in Python its a snap. So my gut and instinct told me that I was right to back my intellect, but sometimes I felt like I had stepped backwards.

It look me a long time to get over that self-inflicted stigmata, but I think its gone now. Why?

Because I suppose time heals all wounds.

Sunday, October 14, 2007

Handy code snippet

[div content="structure provider:plone.leftcolumn"]

Thursday, October 11, 2007

KSS or Plone4Artists sprint choice

I'm interested in both. I think I might do better at the KSS sprint because they really need a good set of tutorials and documentation. But Plone4Artists would be good for me to do because I would get stronger on Interfaces and Subtypes, however, my ability to do them some good is limited by the fact that the HTML/CSS trick I want to do I haven't figured out how to do yet.


After some thought, I'm going to do the KSS sprint until I get to a point, then switch over. I'll be able to take the skills from one sprint and bring it into the other group.

Technorati Fun

Technorati Profile

Wednesday, October 10, 2007

Top 5 Design Tips for Skinning Plone

Tip 5 - Centered Design
- Fixed width
#visual-portal-wrapper {
width: 980px;

- Liquid Design
#visual-portal-wrapper {
width: 980px;

Tip 4 - integration of IE
- put all stuff in IEFixes.css
- Write styles for IE7 first
- Then hack your styles for other IE version
- portal top is top part of Plone
- For IE6 and lower hack:
// Below is IE7 , Firefox, and Safari
#portal-top {
background: blue;

// below is IE6 version
html #portal-top {
- easy to use
- almost no chance of breakage
Tip 3 - Styles alterations
- different sections styling
- site root
- news: blue
- products:orange
- events: yellow;
- about:green
body.section-news {
background-color: blue;
body.section-products {
background-color: orange;
// This is auto-written and any_custom_view could be
body.template-any_custom_view {
background-color: spotted duck;
// example {
background-color: spotted duck;
Tip 2 - Drop down menus
- Suckerfish for Plone 2.5.x
- Accessible
- valid CSS
- Obvious and clean XHTML
- Plone Dropdowns is for Plone 3.x
- webcouturier.dropdownmenu
- Build it out in folder items and use a heirarchy
- Autobuilds via Plone 3 into portal tabs
- Uses INavtreeStrategy
- Uses SitemapQueryBuilder()
- Can change the depth of the navtree via sitemap properties

Tip 1 - Rounded Corners
- Cornerstone of designer's minds
- pure CSS solution
- Initial nifty corners
- Too ugly XHTML
- No hooks in Plone
- People don't like dealing with CSS if they have to change images
- Images based solutions
- Sliding doors - often used for rounding corners
- Adam Kalsey technique
- Plone has XHTML hooks in portlets for this
- pretty simple css
- Most of the cases use nested HTML elements
- Fixed set of images for the corners
- JS + CSS solution
- The most flexible
- Doesn't require nested elements in HTML
- Does not require additional CSS
- Potential Solutions
- Nifty Corners Cube (Javascript Library
- First doesn not work with borders and background images
- JQuery corners
- Requires jquery and does not work with Safari
- CurvyCorners library (recommended)
- Supports most modern browsers
- Works with borders
- Works with background images
- Supports antialiased corners
- Cons:
- Some problems when background images are used and box has different colors
- Does not work well when used with multiple boxes
- collective.roundedcorners
- On presenter's laptop
- Normal Plone Package/Product
- Uses a mix of Javascript + CSS
- Raw, and will be released hopefully soon

Tuesday, October 9, 2007

Required methods to make a class iterable

Really useful:
#required iterable elements
class MyIterator(object):

    def __iter__(self):

    def __len__(self):
        return len(

    def __contains__(self, v):
        return v in

    def __getitem__(self, v):

Saturday, October 6, 2007

Travel Blog!

Here it is for those who want it:

Friday, October 5, 2007

Case sensitive search in Zope 2.9.7

I'm not 100% happy with this function, and I'm wondering if I'm doing too much work. Especially waking up the object when the word object is not found in the object.Description attribute. Is there a better way?

def getWords(word):
pc = app.msrd.portal_catalog
results = []
for brain in pc(SearchableText=word):
if word in brain.Description:
content = brain.getObject()
for field in content.schema.fields():
name = field.__dict__['__name__']
if 'body' in name or 'Body' in name:
accessor = field.__dict__['accessor']
text = content[accessor]()
if word in text:
return results

Wednesday, October 3, 2007


Choice quote that worries me about counting lines of code:
"Speaking of lines of code, my friend Rebecca, who's a Pentagon reporter, has sat through countless briefings about military software projects. She's bemused at the briefer's fondness for citing the number of lines of code in the systems they're developing."
Lean, mean code is better than big, bloated code. And using lines of code as a metric is something I thought went out of vogue a long time ago.

Here is another interesting bit:
Let's look back at the F-22. Why did it take dozens of software engineers working on the F-22 avionics code four times as long to produce 750,000 lines of code as it's taken the Fracture team? Is the average programmer at Day 1 Studios a hundred times as productive as the average programmer at Boeing? Of course not. The F-22's avionics suite is life-critical software. It has strong interdependencies on changing hardware.
Life critical software is hard. Toss in the extra work developers have to do in a CMM-5 shop and things start to bulk up. Everything has to be explained and checked. On the other hand, often your code ends up looking pretty good since you get really smart people giving you peer reviews.

The closer thought is this line:
The hardware it runs on is nearly twenty years old now, which increases iteration times (the F-22 runs on a VAX/VMS system like the college mainframe when I started at Davidson, back in 1990)
I'm not sure I'm happy or not at this statement. The F-22 costs us about $450 million dollars a plane so I'm happy that they've got super mature systems in place. On the other hand, wouldn't it be nice to see five hardened Linux pizza boxes in the place of the VAX mainframe?

Better yet, lets ditch this series of fighter and just go to UAVs. Cheaper, better performance, and no pilot risk.

I'm so glad I don't work for DoD anymore.