More TidyWeblogger Stuff

Friday, 2008-12-19; 17:39:18

As TidyWeblogger has taken over the job of posting entries to my weblogs, I found that my motivation to continue to develop the app has rapidly increased. Here’s what’s changed in a little over a week.

  • TidyWeblogger is now generating every single page on my weblogs. Category pages, archive pages, entry pages, main page, RSS feed, dummy files, and a new addition, a JavaScript file that just contains an array of recent entries to use on other pages. I’ve republished all pages so that they conform to my new templates, and everything’s working just dandy!

  • Take a look at the new archive sidebar item, as well as the new archive page itself. The category stats are once again being updated, and the browse by date archive page is simply one long list of all entries on a single page. I realized there’s no need whatsoever to have separate month and year archive pages, since it’s just a bunch of unnecessary clicks when a single page can present all the necessary information all at once. It’s also convenient if you’re looking for an entry and not sure when it was posted.

  • JavaScript improvements have been made across the board. And by “improvements” I mean that a lot of JavaScript has been ripped out. iBlog created HTML files that constantly referred to the CommonLib.js file to create the sidebar items, the weblog and category titles, etc. My templates do all this generation beforehand and create mostly static files.

    It takes more time on my end, but I prefer that to more JavaScript on my pages. For example, since the category stats are all static, all pages need to be regenerated when I publish a new entry in order for the stats on all pages to be accurate. This is another case where it makes sense to publish a separate JavaScript file with the category stats, and have all pages get the stats from that file so that every page doesn’t need to be regenerated.

    In any case, the only things that JavaScript is handling now is the Linkable Supernova sidebar item creation, and comments. Category stats will probably be migrated back to JavaScript at some point.

  • I mentioned that TidyWeblogger creates dummy files. It’s been doing that for a while: dummy files are needed in order for the comments system to work. But I’ve added a new class of dummy files that TidyWeblogger creates now: for those entries that have the old crufty URLs from iBlog (the ones like “”), TidyWeblogger creates a redirection page that points to the new URL. Old comments on the new page are preserved, too. In this way, both the old URLs are preserved, but everyone sees the new ones since the crufty ones redirect to pretty ones.

  • I also mentioned the new JavaScript file of recent entries. This allows me to retire that ridiculous hack that I was using to get a self-updating list of Linkable Supernova entries in the sidebar here. Technological Supernova is no longer loading 11 invisible iframes with pages from Linkable Supernova just to get the titles of the pages.

    The result is that loading pages here should be much faster now, and this should be especially noticeable on the iPhone or iPod touch. It just now loads the RecentEntries.js file for Linkable Supernova, and then writes the list to HTML via JavaScript. It’s much more reliable, too — previously, it used to fail to write any links sometimes.

    Also, eliminating this hack allows my pages to validate again, at least according to the W3C validator. Previously, it was throwing an error because I was using an “onLoad” attribute for the iframes. I know, I know, validation shouldn’t be an end goal in and of itself, but it’s still a good indication of using web standards.

  • Speaking of validation, TidyWeblogger is using NSXMLDocument’s NSXMLDocumentTidyHTML option so that any generated content is transformed into valid XHTML automatically, as much as possible. There are some validation errors it can’t correct, like adding a title attribute to all images, though.

  • Various other things have been fixed: I can force TidyWeblogger to republish all entry pages in one action, now. Entry published dates now automatically update in the main window after a publish, and comments now will get enabled on publish even if the initial publish fails.

I think another factor in my excitement to develop this app is that I’m learning a whole ton of new stuff in Cocoa programming, some of which stems from the Leopard improvements. Here’s what I’ve learned over the past few days:

  • Bindings! I’ve finally gotten around to seeing the benefits of these things. My initial attempt at bindings in TidyWeblogger was pretty unseemly because I was using a dictionary of entries with an NSArrayController, which controlled a proxy object that I would update programatically to synchronize with the dictionary of entries.

    I later used bindings on a smaller problem, implementing an NSDictionaryController to control the values and titles of an NSPopUpButton. Then I back-tracked and re-factored my initial attempt at bindings, with great success.

    Bindings are really useful to eliminate glue code when initializing interface objects in an entry editor window, for example. There’s absolutely no code whatsoever to make the popup buttons present the correct categories according to the relevant weblog, which is nice. It also eliminates the need for any manual sorting code that was necessary when I created Memory Usage Getter; my table view of entries is automatically sortable by title, category, and date simply because it’s using bindings.

  • I finally figured out how to use the replacement for NSCalendarDate. You need to use a combination of NSDate, NSCalendar, and NSDateComponents. This is a change that came with Tiger, and it seems to have been done to accomodate calendars other than the Gregorian calendar which is used in the United States.

  • Creating toolbars in Interface Builder. This is incredibly useful, because it eliminates the need to create any code for getting toolbars and their buttons to work. You just drag and drop them into your window, and then connect outlets and actions just like you would do for a standalone NSButton.

  • I’ve been using more Objective-C 2.0 paradigms, like fast enumeration, which is pretty useful. I haven’t started using @property and @synthesize declarations yet, but now that I’m using bindings, I can see exactly why and how they’re used.

  • Some of my coding conventions have slowly been changing as well. Instead of using the alloc-init dance for stuff like NSMutableArrays and NSMutableDictionaries, I’ve started just using the -array and -dictionary constructors so that I don’t have to worry about releasing the objects later. Similarly, my setters have gone from retain-then-release to equivalence-release-allocate to accomodate the setting of mutable objects from immutable counterparts.

One of the things I think I’m most proud of in my code is that the method that’s generating all the HTML files is highly extensible, and I’ve only had to make minor modifications to allow the creation of archive pages, entry pages, main pages, etc. It’s pretty sweet.

It’s especially great because when I want to add new template entities (things in the page templates like “{[ENTRYPAGEURL]}” which TidyWeblogger dynamically replaces according to which page is being created), I can do it once and not worry about it again.

My goals for future development, roughly in order:

  • Publish category stats to a separate JavaScript file and have entries point to that instead.
  • Investigate why stylesheet cookies seem to not be consistently working. Also, I’ll see if I can eliminate the flash of the sidebar in the wrong position.
  • Figure out why my table view isn’t auto-saving sorting. Column positions and sizes are being auto-saved, though, so I’m not sure why sorting isn’t. Can anybody help out with this?
  • Figure out how to get the table view to re-sort when information is updated, like the publish date.
  • Figure out why my NSTextView is loading with small fonts for Markdown entries.
  • Thread my interface. Currently, publishing freezes the interface for minutes at a time if there are a lot of entries, because it’s all running in the main thread.
  • Figure out why undo isn’t supported in my entry NSTextViews.
  • Implement the dirty dot for entries, and update the entry composition windows with entry titles.
  • Test a few things that I haven’t been doing often, like reverting an entry, changing an entry’s category, or changing it’s custom URL. Make sure these all work.
  • Fix the last remaining feature that’s still disabled: the next and previous links on the entry pages. I might punt on this for a bit, because this may require some refactoring, again.
  • Implement the .Mac SDK (has it been renamed the MobileMe SDK yet?), so that I don’t have to rely on my iDisk being mounted in the Finder when publishing.
  • Implement local storage and composition of entries, and synchronization of local entries with the iDisk so that you don’t have to compose entries while online.

That’s a tall order, but since I’ve been making rapid progress anyway, a lot of this stuff might get done sooner rather than later.

Yay development!

Technological Supernova   Software Development   Older   Newer   Post a Comment