Wednesday, November 17, 2010

Plone, JQuery and Prototype: Easier Done Than Said

It's hard to believe, but jQuery hasn't always existed. So some of us used other libraries, like Prototype[.js]. We even built entire systems on them. And then upgrade day came...

I sat back with my largest bottle of beer and got ready for what was sure to be a javascript apocalypse. How could I merge 4 years of Prototype based javascript with Plones new JQuery libs? Surely it would be painful.

And yet it wasn't. It will take me longer to write this blog post. But just in case there is some other straggling soul like myself who just can't get enough Event.observe(), fear not! Follow these simple steps:

  1. Create a new js file and add one line: jQuery.noConflict();
  2. Then register that js file with your site. Prototype must go first or it will whine (remember not to compress or cook!). The noConflict js file must be listed before using any custom scripts. I recommend loading it right after jQuery.js. See below for a sample.
  3. Reinstall. 

Much can be said about jQuery playing nice and especially to the Plone javascript gurus who were kind enough to work within a namespace. Thank you. I owe you a beer.

Tuesday, September 14, 2010

LA Theme Sprint Report

Kudos to Michael Miller and Luke Brannon of the LA Plone Meetup for hosting the first (annual?) Plone Theming Sprint in LA. So many things about it were successful that I have had major writers block on how to get things started so I'm just going to jump write in.

The most exciting part of the sprint was not only the diversity of the people, but the diversity of experience as well. Plenty of newbies overcame their fears to tackle new skills. For example, Heather released her very first product to pypi, almost the whole crew picked up and ran with XDV, and Alice was an end user who just showed up and by the end of the first day was familiar with installing products through buildout, basic site admin, and fixing borked databases!

Why would her database get borked you ask? Because she went through and installed all 52 themes listed on plone.org to evaluate quality, take screenshots where necessary, and took copious notes of all posted themes that didn't uninstall cleanly or didn't install at all.

Now you are asking, why would someone do that? Only because we tackled the revamping PloneSoftwareCenter! This included adding ratings and we needed some data for when it goes live. Oh yeah. Alec took plone.contentratings from bad ass to bad asser while I worked on integrating and revamping the UI. Check out the screencast to get a preview of the changes. This will be a great accompaniment to the Plone 4 release so if you have any time at all to help get this deployed - ping me!

And finally you ask, why would you want to revamp PSC? Glad you asked. Plone.org has less than spectacular support for navigating themes and we needed to have a beautiful place to display all of the new themes that the rest of the crew came up with. 3 Mikes, Trish, Tyler, and Albert banged away on creating 3 beautiful XDV themes (coming your way soon after solving the packaging issue).

The best part of all? At the end all anyone wanted to know was when the next sprint would be. That's a trend I'm happy to obligue. Thanks to everyone who showed up and good work everyone!


Saturday, September 4, 2010

Feed a QA Sprinter

The 2010 Plone Conference is just around the corner and sprint planning is well under way. One of the sprints will consist of creating Selenium tests and integrating with Hudson. As Plone moves towards more and more Javascript and Ajax interface these tests will be essential for maintaining a high quality code base. This sprint will be great for newbies and veterans alike with some potentially boring but definitely worthwhile QA work.

Ideally this sprint is crowded and short so that people can get back to their regularly scheduled sprints. If you will be in Bristol for the sprints, please consider donating 1-2 hours of time to help us get up and running. If you won't be in Bristol and want to remote sprint stay tuned! However, if you can't do either (or just hate doing that stuff) but want to support the effort, please consider chipping in to feed a sprinter.

If anyone has other ideas on how to lure people in or has items to donate as door prizes/giveaways/whatever I'm all ears. Additionally, if you have a company and/or want to sponsor this sprint directly let me know and I'll cancel the chip in.

Happy bug hunting!

Wednesday, July 21, 2010

Changing the Order of Fields in Archetypes

I wish I knew this 4 years ago.

When creating new content based on archetypes, I usually start by copying the base schema, or one of my own base schemas with something like MyNewSchema = BaseSchema.copy(). One thing that has been historically hard in my case is that the schema order in the code directly correlates to the order in which its displayed. This means that the base copied data always goes first when displayed, which was not always what I wanted. The solution was custom templates and blech all over.

Apparently you can just reorder these things. Deep in the bowels of archetypes there is a function called moveField. Now, reordering the schema can me as easy as MyNewSchema.moveField('description', pos='bottom').  Hot dog! Pasting the interface for reference.

Friday, July 16, 2010

The Culture of Reporting Bugs

Did you know that Plone has a QA team? It does! The QA team is just getting off the ground, so it's a great time to talk about the culture of quality assurance. Since I don't use enough old english in my posts, I want to kick-off the topic with a couple of QA Commandments that when recognized by all members of the community ensure a yummy culture of quality. The first part involves bug reporting, and they go something like this:


1.Thou shalt report every bug, big and small, content, documentation, infrastructure, and beyond
Is it a spelling mistake? Report it. Is the interface about as useful as a bag of sand? Report it. Is it impossible to find the documentation you are looking for? Report it!

Will your bug get fixed in a timely manner? Probably not. But that's ok. The point is that you noticed something that was below perfection, and you cared enough to document it by writing a bug report.

I worked on a QA team right out of college and I am proud to say we worked just as hard (if not more!) as the developers. There was constant arguing between the teams but together we delivered a super stable end product. A key component of our strategy was competition within the QA team itself over who could report the most bugs. There was no prize, just pride. And it worked! Every nook and cranny of that system that wasn't perfect was documented.

2. Thou shalt not bitch about bug reports
This follows from commandment 1. Good QA people care even more than the end user about a perfect experience, and caring takes a lot of effort. The thing that happens when developers stop complaining about bug reports is that it actually encourages people to report more bugs - imagine that!

A good set of bug reports should be treated like problem documentation. The better documented the faults are the easier it is to fix and the easier it is to provide support until that fix goes through (since it may be a while). 

The best part is that it's easy to encourage this culture. The next time you close a bug, big or small, thank the original reporter. 

3. Thou shalt make it easy for everyone to report bugs 
Yes you! If you want to find lots of bugs you need to make it easy to report them. This makes me nuts with just about every software product known to man. One click to report a bug. No screens, no searching, just get the info and get them outta there. And yes, it's on my list of things to change with Plone.org.

Unfortunately, I think Plone unnecessarily suffers from the bug collecting of zope and zodb. Searching for a zope bug collector without the exact keywords in google returns two bug collectors, one from 2003 and one from 2005. Both abandoned. And if you report in the wrong one they just close the ticket and that's it. Screw you end user for not being able to differentiate between a plone, zope, or zodb bug. Boo.

So I am putting a list of collectors here for my reference as well as yours. Go ahead, report that bug you've been sitting on for a while. 
Now, if a bug gets marked invalid because it's someone else's problem you can just move on to the next tracker and follow through there. Did I miss any? 

4. Thou shalt stand by that bug and not be bullied by developers
This is the hardest part of any QA effort. It's easy to give up when a developer spouts some mojo that you just don't understand. Nonsense poopy pants! Good QA people are so annoying developers wish they would go bury themselves in a hole in a forrest. And you know what? They are often wrong. But a lot of the time they are right, and a HUGE bug manifests from what seems like a template error. That's when it pays off to be a PIA.

So stick to your guns QA jedi's and do what's right for the end user. If you always keep them in mind the end result will always be what's best for the product and the community.

Thursday, June 10, 2010

Diversity in IRC

Confession: I was a closet female for a long time. My nick is purposefully ambiguous and when people assumed I was 'Eric' I never corrected them. I never signed my full name, not because I was afraid or insecure in my answer, but because I was afraid I would get treated differently for it. None of my profiles had my picture until just a few months ago, when I "came out" at the Plone Budapest conference.

I usually feel bad about it. For 7 years I could have been supporting women in technology. It seemed the easiest way to get by at the time. Was I being a coward? Maybe I was making it all up?

Then there are days like today, where a I get a gentle reminder as to where it all started. To the left is a screenshot of an #plone IRC chat with someone who was just completely lost in their task (probably still is). Many of us were helping out this person and at some point they moved it to a private conversation. Fine - that happens a lot. 

Click the image to get a "x-large" more readable version. I'll wait...

I'm not posting this to complain* - in fact I see it as a victory. I have no hard feelings and a simple correction not only took us back to business but raised the standard for getting help from that point forward.

Rather, I want people to understand why it's important for groups like PloneChix to exist. Diversity is scarce in the community and dealing with it is still new to many people. And guess what? The only way to make things better is to be more visible and pull through awkward moments like this. 

It's easy to dismiss this as "not a Plone problem" when it's plone "users" that are the offenders but that is a cop out. If someone is new to helping out on IRC and is treated like this, we risk permanently losing their help and expertise. If it's normal to have women in IRC, at conferences, etc... then the standard for behavior will be higher to begin with.

So ladies, help me out - I'm tired of dealing with this alone. Take a moment to be seen: get in IRC, go to a conference, talk at a local meetup and invite your friends. One at a time, we can make Plone a stress free place for everyone.

*I spend way too much time arguing with people about whether or not this stuff still exists. Many think that it's a problem of the past because it doesn't happen in public forums or chats anymore. My response is usually "Duh! Of course it doesn't." Most incidents DO go unreported for that exact reason.

Tuesday, June 8, 2010

Searching the Plone3 API

After kvetching about the Plone API documentation, I realized that maybe it's not the docs that need updated, but rather just a better way to navigate through them. Inspired by an awesome article by dukebody, I looked into how chrome could better serve me. To set up API search in the url bar:

  1. Chrome > Preferences > Default Search: Manage
  2. Click the + sign
  3. Choose your name and keyword. I used 'Plone 3 API' and 'api'. Use this beast for the url: http://www.google.com/search?hl=en&q=site:http://api.plone.org/Plone/3.0/private/products/+%s&aq=f&aqi=&aql=&oq=&gs_rfai=
  4. Save and enjoy.
In my case to use it I just enter 'api PloneModuleName' into the url bar and click enter. This gives me instant gratification and filters out the weeds of versions I don't want. Plone on.