Code / Appnel Solutions 

Posts from October 2007

Activity Log Classes in MT4

Developing a new plugin, I found a new quirk in MT4 and how it handles specialized activity log class for plugins. This can be a really useul means of monitoring the health of the system and identifying issue when they occur.

The activity log classes allow plugins to record metadata that is specific to its operation and then filter those entries from the rest of the log. Users can use the Activity Log interface to get this information or subject to a feed containing information about this specific type.

[Read more →]


Making it look easy isn't cheap

Late last week, Henry Blodget posted about an “Awesome Startup Idea” he has for a MT/WordPress as Service business after his group struggled through some system issues. I posted the comment below (with minor edits to add hyperlink) though I was kind of late to the party. (Better late then never!) It’s still pending moderation as I write this and may not ever get posted for all I know, so I thought I’d post it here since it touches on reoccurring themes.

[Read more →]


On Podcasting and Enclosures in MT4

Todd Cochrane posted a missive on Geek News Central slamming Six Apart and its podcasting support that doesn’t have its facts straight and sparked a thread on the ProNet mailing list discussing MT’s podcasting and enclosures support.

Here are the three points you need to take away from this post:

  • The Enclosures plugin is reported to work in MT4; however, I personally recommend caution in using it because it could contribute to sudden and severe delays in rebuild time with its current implementation. Details are below. The title of Cochrane’s post is not correct.

  • The podcasting support Cochrane claims is native to WordPress is in fact a single plugin called PodPress. (The Geek News post criticizes MT and Six Apart for relying on a “single plugin.”)

  • The Podcasting features in MT are still developing and Six Apart’s claims may be a bit “overzealous” at this point. They were discussed with users on the ProNet mailing list with those requesting such features.

If you don’t need to know more then that you can stop here. If not, my observations, peppered with some comments from other ProNet members, is as follows.

[Read more →]


So that's what it's for!

In my career I've been called in many times to figure out what another developer had done and not documented before becoming unavailable to answer for one reason or another. I guess I've developed a knack for it since these experiences of mine goes back to my days of Access 1.0 and Visual Basic 3.0. (Stop laughing. I'm not THAT old.) There have been many days then I thought I was a detective and not a programmer or that I should apply for a degree in forensic programming.

This skill is really helpful in getting the most out of Movable Type because of its generally under documented nature. (It is approving and will only get better.) Thankfully Movable Type has always had an open code base that has made this type of investigation easier then working with decompilers and looking through machine code.

Working on Feeds.App I came across is one of those small cases. I was integrating the Feed Widget Wizard in Feeds.App Lite back into Feeds.App and needed to make a registry entry for those modes. Lite has used code references that I don't like to use for reasons I'll detail here one day.

[Read more →]


Wrestling Tasks

I think the built-in and pluggable task manager in MT is a great bit of functionality, but I've been learning the hard way that its API in MT4 is a bit broken particularly when it comes to backwards compatibility with MT3.

Feeds.App RC1 users reported that the task that updates the feeds cache was throwing an error when they tried it with MT4. The system complained that a task could not be registered without an ID -- a new attribute in MT4. So this broke any MT3 tasks like the one in Feeds.App at that time.

When adapting Feeds.App to work under version 4 and handling issues like these, I also learned that MT did not take into account the perfectly legal practice of subclassing MT::Task as I had done rather then use a HASH to configure a generic object.

I made the ugly patch of creating a hash from the methods in my subclass methods. That seemed to work, but I was mistaken according to testers.

[Read more →]


We interrupt our regularly scheduled geekery....

Penelope Frances Trott was born in the wee hours of the morning October 10th after 32 hours of labor. (My wife was in labor for 36 hours when we had our first child so we're with you on the tired part there.)

What a darling beautiful picture. I bet she is even cuter in person.

Congratulations to Ben and Mena!


MT Authoring Options: HTML, WYSIWYG, Text Formatting

One of the reasons I (re)started my blogging here is that I do a fair bit of writing and knowledge sharing on MT, but its scattered through out frustrated users comments, mailing lists and even private inboxes. This is one of those instances I’m capturing for others.

Jack Carlson over on Radical Aethist writes:

Sadly, MT does not have an option to post in HTML. It’s interface is all WYSIWYG.

This isn’t true of MT. In fact, until MT4 was released, it was essentially the opposite.

[Read more →]


Syndicated Progress

Earlier this week two significant announcements were made in regards to feeds and RESTful web services. These issues have been of my utmost interest for years given my MT plugin work.

The Atom Publishing Protocol (AtomPub) completed the final step in becoming an official standard of the IETF with the assignment of RFC 5023.

While I’ve maintain that feeds are simple web services for some time, AtomPub goes much further building of the the Atom Syndication Format (RFC 4287) and REST principles to create a full web services protocol. The culmination of this work delivers a well defined and more extensible alternative to the Blogger API and its offshoots for publishing blogs and other forms of content.

Congratulations to the Atom Working Group on a job well done.

In other news, the RSS Advisory Board announced that it has endorsed published an RSS Profile that provides various clarifications and best practices to the use of the format. While not a specification or subject to the rigors of a standardization body like Atom, the profile provides a lot of good and welcome advice albeit it a a few years late.

Kudos to the group for having the wherewithal to see this process through this far in what has always been a thorny, thankless and hostile space.

One interesting recommendation in the RSS Profile that I was surprised to see was the recommended use of an atom:link tag to identify a feed’s own URL. It’s a good and useful idea granted. Given the intense acrimony of the past, it seems almost as blasphemous as a Boston Red Sox going to the New York Yankees. Oh wait a second…


On MT and mod_perl 2

I just commented on a post by a user trying to run MT under Apache 2 and mod_perl that was looking for options.

The bottomline is that you can’t run MT under mod_perl on an Apache 2 web server. I also doubt there ever will be without significant changes in the space.

Movable Type mod_perl support was added before FastCGI came (back?) into vogue and also before the mod_perl team blew it (IMHO and others) by totally changing the API in ways the were not backwards compatible. With FastCGI gaining popularity and attention in addition to being easier to install/maintain and supporting more then just one language (Perl), I don’t see there being enough demand to justify the effort at this point.

While MT has been known to run on Apache 1.3 and mod_perl I wouldn’t recommend it and would suggest FastCGI for consideration. In my extensive experience with MT I’ve know of two companies that have run MT via mod_perl and one of them recently switched to FastCGI.


No Settings for YAML

I admit to being very critical and not at all fond of the plugin settings interfaces to the extent I don't use them and rolled my own. Seems I have one more reason to be frustrated with them.

If your plugin has blog or system settings you can't use a YAML definition file.

There wasn't an example in the documentation or example code that doesn't mean much so I took the one plugin I wrote that uses the built-in MT plugin settings functionality and hacked together a quick script that dumps the settings data structure to YAML.

settings:
  -
    - api_key
    -
      Scope: system
  -
    - weight
    -
      Default: 1
      Scope: blog

Egads! Even the YAML looks ugly. I adapted what I was seeing for the plugin I'd been working on.

settings:
  -
    - enabled
    -
      default: 1
      scope: blog

This is when I found the shop stopper. When I enter a blog's plugin setting screen I get this error:

Can't call method "defaults" on unblessed reference at lib/MT/Plugin.pm line 179.

Plugins are now completely inaccessible. That's problem one. A misbehaving plugin shouldn't be allowed to know out MT like this. (How would a user without technical skills handle this now?)

The plugin stores the settings data structure in the correct registry location. The problem is line 179 expects a MT::PluginSettings object and not a HASH reference that causes the error to occur. (MT shouldn't lock up with an error of this nature either, but that is a different matter.)

This is a real bummer to me because I see YAML definition files being the best way for developing and managing components in MT going forward that it should be a good habit all plugin developers get into. With something as common and important as plugin settings unimplemented and the existence of a YAML file causing a .pl file to be ignored, it makes it really hard to use YAML for anything but the most simplistic plugins. I had a similar experience with MT 4.0 where callbacks defined in a registry file were note registered and never ran. (This was subsequently fixed in 4.01.)

This brings me back to one gripe I have about the MT4 code. The YAML registration files were are a highly touted part of the component architecture plan for MT4, but the application itself doesn't use them opting for embedded Perl code. (Whatever happened to practicing what you preach?) Had they been used in developing MT4 I'm certain these sort of issues would have come to light sooner and perhaps been fixed/implemented before MT was released.

There may be some trick or work around to implementing settings with a YAML definition file that I've yet to discover. If there is (please leave it in the comment below) this brings me back to another point I've been making since well before MT4 -- developers should have to work so hard to make things work. Things have improved, but it's times like these, when what's been communicated and what's been done in practice don't line up, that still burn me up.


Killing nav-commenters.gif

You may have noticed it being generated in your blog and wondered about it purpose. You delete it because you don't need it and it keeps mysteriously coming back. I'm talking about nav-commenters.gif, that small graphics icon that MT generates in the root of every blog.

When introduced in MT 3.0, many where annoyed by this graphic's presence. Some went to some lengths to get rid o it.

It's purpose was never entirely clear to me, but I know it is related to comment logins (TypeKey) and something to do with cross domain cookies -- I think. I'm sure there was a good reason, but I've never heard anyone have a problem for lack of this file.

If this feature annoys you and you would like rid of it, good news! You can turn of this default behavior. Starting in 3.16, MT implemented a configuration directive that can disable the generation of that graphic. Just add this to your mt-config.cgi file:

PublishCommenterIcon 0

Don't forget to restart your web server if you are running MT in a persistent environment like FastCGI. Delete the files the system may have already created in each blog. nav-commenters.gif no more.


Easy Count Labeling in MT4

If you've done any amount of blog reading you've probably seen labels or links that read "1 Comments." Perhaps if the designer was a bit more grammatically aware they placed the S in parenthesis, i.e. "1 Comment(s)." This is so common, not because the template designer is illiterate, but because they just did the quick and obvious thing:

<$mt:entrycommentcount$> Comment(s)

This seems a bit lazy to me since you can do better with a bit of extra effort. Here is a MT4 solution that will output the grammatically correct label:

<mt:setvarblock name="comment_count"$><$mt:entrycommentcount$></mt:setvarblock>
<$mt:entrycommentcount$> <mt:if name="connent_count" eq="1">Comment
  <mt:else>Comments</mt:else></mt:if>

This would output "1 Comment" and "2 Comments", but this is a bit convoluted and a slightly annoying to have to remember each time you need a count label. There is a better way though.

The Gizmos for MT collection provides a number of tags that make this easier to do. Each object (content or record in the database) now has a singular and plural label that the mt:countlabel makes use of. With that bit of data, the mt:countlabel tag can wrap up the logic of the above example (and then some) into one neat and tidy variable tag.

<$mt:entrycommentcount$> <$mt:countlabel class_type="comment"$>

By taking a class_type argument this tag is not only limited to comments, but TrackBack pings or even entries in an archive. Working from the class type this tag could also support objects added by other plugins given the proper context.

We can do even one better though. If we know what we are labeling then we can get the count also. The mt:countheading combines the above example into one tag. Now all you need:

<$mt:countheading class_type="comment"$>

The output is the same, but now with only one tag. Easier on the eyes and easier to remember.

One thing that mt:countheading does that may not be ideal is output labels like "0 Comments." Many may want to output an entire different message then display a big zero. We can address this with a mt:countiszero conditional tag in the Gizmos collection:

 <mt:countiszero class_type="comment">No Comments Yet
   <mt:else><$mt:countheading class_type="comment"$></mt:else>
   </mt:countiszero>

Now when the comment count of an entry or page is 0 instead of "0 Comments" the phrase "No Comments Yet" is output. I thought about making this a feature of mt:countheading, but thought the zero count label would often vary to often that I chose not to implement it.

For more details on these "gizmos" and more see the Gizmos for MT documentation in the knowledge base.


Alternating Values in MT Templates

When presenting a running list of items like comments or posts in an archive, designers will provide visuals cues to indicate where one item ends and the next begins. One of those methods that is commonly used is the subtle alternating background colors. Here is a screenshot of the technique in use:

mt-alternator-example.png

MT doesn't have a straight forward means of alternating or determining if the count is an odd or even number. The Gizmos for MT collection has a variable tag that makes that easy:

<$mt:alternator$>

Each time that template engine passes over the mt:alternator tag it outputs either "odd" or "even" by default. Using these labels as CSS class names we can alternate the style of each item:

.odd  { background-color: white;  }
.even { background-color: silver; }

We then apply the mt:alternator tag to the markup:

<mt:comments>
   <div class="<$mt:alternator$>">
     ...
   </div>
</mt:comments>

This will produce HTML something like:

   <div class="odd">
     ...
   </div>
   <div class="even">
     ...
   </div>
   <div class="odd">
     ...
   </div>

...and so on.

Perhaps "odd" and "even" are too drab for you or you're more of a inline styles designer. We pass no judgement. Use the odd and even attributes to set different values or the tag to alterate between:

<mt:comments>
   <div style="background-color: <$mt:alternator odd="white"   even="silver"$>;">
     ...
   </div>
</mt:comments>

Instead of "odd" and "even" the tag alternates between "white" and "silver."

The mt:alternator tag can track multiple alternators in one page by using the optional name attribute. For instance, you want to list comments and pings on one entry page and use the alternator effect.

<mt:comments>
   <div class="comment-<$mt:alternator name="comments"$>">
     ...
   </div>
</mt:comments>

<mt:pings>
   <div class="ping-<$mt:alternator name="pings"$>">
     ...
   </div>
</mt:pings>

Regardless of whether the list of comments ended with an "odd" or "even" value, the pings list will always begin with "odd."

For more details on this tag and more see the Gizmos for MT documentation in the knowledge base.


MTOS Progress: Moving Forward Though More Slowly Then Anticipated

Earlier today on the ProNet mailing list, MT Product Manager Byrne Reese posted this update about the Movable Type Open Source (MTOS) project:

I wanted to give everyone a quick update about the MTOS project. We are still committed to getting it released this year. We are behind schedule we know, but getting all the resources in place was more complicated then I had anticipated.

But, we are making progress on the biggest prerequisite for launch: all the infrastructure to support the project.

  • FogBugz has been selected to be our bug tracking system, which is awesome. The hardware is getting setup today and the software should be installed tomorrow.

  • The ops team is also looking to expand the capacity of code.sixapart.com where MTOS’s svn repos will live.

  • Brad is working on code segmentation and organization for our push of our latest MT code out to a public svn.

Anyways - just in case people were wondering. :)

It’s good to know this effort hasn’t fallen by the way side after all the buzz it generated over the summer. I’m just want it to start already.

While precisely what MTOS will be has not been defined, we do it will not just be MT 4 with a GPL license.

Other questions remain. How community feedback and submissions will be worked in. (This does not refer to licensing and copyright issues that are separate and have been terrible overblown.) To put it mildly, communication and collaboration, particularly when it comes to development and deployment issues, has historically been a real company shortcoming for Six Apart. While there has been a great deal of improvement lately with product and marketing communication, engineering is still generally inaccessible and absent from the community. A big leap forward is going to be necessary in order to handle the open community aspect of an open source project especially given the untrusting cynical detractors the company has in the open source community.

Besides the continual refinement and modularization of the code base, my hope is that MTOS will spawn other related subprojects where the major components that make up the MTOS core are available as separate pieces that can be more easily incorporated into other projects with forking. I see this as being similar to how Mozilla operates where things like the rendering, interface and scripting engines are available as separate components. The object database layer is already in CPAN. A close cousin of the base application framework also exists in CPAN also. I tried to force the issue and get the template engine down a similar path though will little success so far.

Time will tell.


Atom (Feed) Bomb

For those of you subscribed to one the new appnel.com feeds, you may have noticed that the full content of posts looked horrible.

appnel-feed.png

Sorry about that. I had forgotten that there was a bug in the default Atom (and perhaps RSS -- I didn't check because I only use Atom for all my feeds) template until Chad Everett wrote me with the above screenshot to let me know about the problem. (Thanks Chad!)

[Read more →]


← Before After →