Categories
Technology

Code day

Maria could be describing my day when she writes:

I love days like today, when everything seems to be well padded in mist and torpor. The leaf blowers are silent, no one is out there improving their house or garden, and with the windows closed, for all I know, cars have ceased to flow on the roads.

However, our day was more a cold rain than a mist. Still, it was in ‘in’ day, spent catching up on coding projects. After a day of hiking, coding seems more fun somehow, as well as it giving my knees a chance to ‘rest’, poor dears.

I worked a bit with the OsCommerce store application and think I’ve managed to get the CSS layers and the HTML tables to play together for the layout. I am not a CSS purist, but I do strongly believe that templates are more adaptable and easier to work with when done as CSS rather than tables — tables add a lot of extra baggage, making the pages harder to read and customize. I’ve found this with the weblogging tools I’ve worked with, and I’ve been through enough weblogging tool templates by now to almost think this could be a truism.

I also worked on Tinfoil Project today, and have incorporated annotation as well as comments into the pages. I did have to use popup comments, but there’s a little ‘goodie’ included in most of the popup pages–similar to the sidebar ‘goodie’ that appears, from time to time, with these posts.

My busy fingers didn’t rest once today, and I also spent time contemplating migrating IT Kitchen weblog entries into wiki entries. After looking at the wiki database schema, I found that this isn’t as complicated as I thought it would be. However, I decided against doing a migration today, primarily because the weblog writing doesn’t translate well to a wiki environment. After all, weblog writing is fairly static and created by one author; while wiki writing is fluid and authorless. I don’t want to move people’s essays over into an environment that encourages editing.

What’s needed is the ability to ‘freeze’ pages in a wiki, and annotate with the author–a ‘essay category’ page. Better yet, the ability to pull data in from the WordPress/Wordform database and format it as a wiki page, sans the editing capability. The code is so nicely organized and documented in MediaWiki, it wouldn’t be an especially difficult task, and could be a fun exercise. The hard part would be to merge discussion between the two tools, weblog and wiki. That could be tetchy.

I’m finding out that I really enjoy ripping into open source code, blending bits and pieces of different products together. I was even eyeballing OsCommerce code today, thinking, “You know, this could be combined with a weblog for subscription based online publications…”

So many possibilities, so little time. Speaking of time, congratulations to Scott on his five year blog anniversary, and Karl for his almost five year mark. Reading both of your weblogs, I found your words are still fresh and youthful–like the words of young blogging babe instead of the old blogging codgers that you are.

Categories
Technology Weblogging

Just around the corner

If I were a betting woman, I would bet that WordPress 1.3 (or would it be 2.0?) is releasing sooner rather than later. At least it looks that way from the code, though the developers are going back and forth on a couple of items. Even though I plan on doing my own development from this release on, I’m still interested in WordPress, and plan on being so in the future. After all, my decision to go a new direction has less to do with WordPress and more to do with wanting to try some ideas of my own.

Who knows, maybe some of those ideas will make their way back into WordPress. Life is full of both surprises and variety.

I’ve helped several people move to WordPress, and thought it might be of use to write out the major changes that I’m seeing in this release, and point to any additional information of which I am familiar. That’s the great thing about an open source project that’s being implemented in an open environment – we can all peek in while the work is underway.

Themes

I’ve been using themes over at Kitchen, and just implemented a Theme Switcher, so that the readers can pick their favorite. Ryan Boren wrote an anatomy of a theme, and the WordPress Codex wiki has an overview of how to develop a theme.

From a user perspective, a theme consists of two parts: one or more templates, and an associated stylesheet. The theme template can be as simple as a single index.php, which replaces the one that exists within the weblog root directory; or it can consist of a whole group of template files, such as comments.php, sidebar.php, footer.php, index.php, and so on.

The template files and the stylesheet and any incidental material is placed in it’s own subdirectory under wp-contents/themes/. For instance, one we have at Kitchen is called “Kitchen One”, which is located in a subdirectory called kitchen-one.

When the files are copied into the wp-content/themes directory, they’ll show up automatically within the themes selection list in the new Presentation page within the WordPress administation page. You can then activate whichever theme you want to use. Currently the theme at Kitchen is Kubrick, but that could change tomorrow.

The style sheet is named style.css, and this is critical because the theme name and what pulls it together is found in the stylesheet. The theme definition block for Kitchen One is:

/*
Template: gemini
Theme Name: Kitchen One
Description: A deep warm rich kind of style.
Author: Joni Mueller and Shelley Powers
Author URI: http://itkitchen.info/

Odyssey interface and Gemini template for WordPress 1.3 designed and built
by Root http://www.atthe404.com/blog/

CSS Design by Joni Mueller http://jonimueller.com/wordpress/ and Shelley Powers
Photo by Elaine Nelson
*/

The values on the left have meaning to the theme system and should be written as shown here. From the top, these provide for the theme name, a description, the author, the author’s web site, and any incidental information. The key variable is the one named ‘Template’. This points to the template being used for the one theme, because one template can be used in many themes. In fact, all the themes at Kitchen use the Gemini template except for one, Kubrick.

In this case, the Gemini theme is a simple one – a single index.php page. For all other functionality, this theme uses the existing default files, such as wp-comments.php. For Kubrick, the theme uses several template files: 404.php, archive.php, archives.php, comments.php, footer.php, header.php, links.php, page.php, search.php, searchform.php, sidebar.php, and single.php.

So how can a system handle one theme that has one file, and other theme that has many? Simple, it checks for the existence of files when a page is accessed, and if the file exists in the theme, it’s used. If not, the default file is used instead.

So for Kubrick, when you access a single entry page using index.php, the application checks to see if there is a single.php page in the template subdirectory. If there is, it loads this; if there isn’t the index.php page handles the request. The same functionalty is used for archives, category, author, searching, and so on.

This is a very effective way of managing file-based templates without having to worry about overwriting a user’s existing modification when you upgrade the application. No more going, “Oh crap, I just copied over the index.php file.”

You can check out the use of templates and themes at Kitchen, and even use the new theme switcher (look at the bottom of the right hand column).

Pages

Another significant change with the next release of WordPress is the existence of pages. A page is like a post except that it’s not included as part of the archives or categories. For instance, the link titled “How to Participate” at the Kitchen is built using the page functionality, not the post. If you click the link, you’ll see it opens at the top-level of the site.

The challenge with a page is that each one requires a new entry within the .htaccess file. So if you want to create a page and have it immediately accessible, you have to make your .htaccess file writeable. Or you have to re-generate the permalink entry for .htaccess every time you create a page.

Still, you’re not going to create that many pages. Rather than make .htaccess writable, I’d recommend creating the pages, and then generating the permalink entries for .htaccess all at once.

There is a new status appearing in WordPress code of ’static’, which makes me wonder if these pages are going to be created using the regular weblog post page and then statically generated – which would make more sense for this type of page. Once one moves past the same problems we’ve had with writing to a directory. Stay tuned…

Paging

Nothing more fun than to go to a weblog that’s been around for years and search on a popular term. What returns is an extremely long page with every entry that matches that search term. If you’re lucky, you’ll only see excerpts. If you’re not, you’re in for a long wait.

WordPress has dealt with the problems associated with too many entries being returned by implementing a thing called ‘paging’. You can see it in the Kitchen, if you access a popular category like Administration, a frequent poster, like The Chef, search on a popular term like weblog, or access an entire month’s entries. At the top and bottom of the page is navigation to go from the current group of posts to the previous, and so on.

The count of posts displayed is based on the same number of posts that you display on the front page of your weblog. You include the navigation bar using something like the following, from the Kubrick theme:

<div class=”alignleft”><?php posts_nav_link(‘’,’’,’« Previous Entries’) ?>&;lt;/div>
<div class=”alignright”><?php posts_nav_link(‘’,’Next Entries »’,’’) ?></div>

At this time, the Gemini template does not have the navigation links. What will happen, then, is that the last specified number of posts show in the results, but there is no navigation for older posts.

Which is a very effective demonstration about how themes can have different behaviors, as well as different appearances and layouts. This has some interesting possibilities for experimentation.

Change is Change

There are some changes that may or may not make it into the finished problem. For instance, the previous nightly build included enclosures, which would automatically pull images and audio files into enclosures in RSS feed. This has subsequently been removed, and hopefully will be implemented as an option.

There is no longer an option to turn auto pinging on or off at the page level, but you’ll want to turn it off for the application, because it’s a performance killer.

There’s a new one that allows users with rank of 9+ to post as another person. Based on this, I’ve updated all the Kitchen writers that were 9 to 8, and changed the menu options accordingly. There’s discussion about turning moderation on automatically for all posts over ten days old, but most of us are doing this anyway. Or closing old posts off completely.

The global variables such as $tableposts are now deprecated, but should be around for at least one release so that old plug-ins won’t break when the application first releases.

There is now a WordPress export, which will be handy if you’re merging weblogs, which I had to do recently. From what I can see, there’s also been improvements in the other imports.

And looks like we’ll be able to have email list management to all users. That’s good news for the Kitchen.

And so on

There are a lot of other changes, many of which take place under the skin so to speak. The development team is working on new comment spam prevention techniques, as well as doing some good code clean up such as moving SQL statements into the functions and out of the pages. The GEO fields have been moved from the administration pages to a plug-in, though I know most people didn’t use this. Then there’s the mysterious Dashboard, but we probably won’t get a peek at that until the tool releases.

All in all, some very tasty additions, with only a few hiccups now and again.

Didn’t notice until today that the WordPress development team released a heads up on 1.3 at the Development weblog November 17th. This lists out some other new features, and confirms the themes and pages additions.

Categories
Technology

Can I reformat my life next?

After leaving the hard disk recovery process running all night, this morning I decided that a better bet would be just to reformat the hard drive and start fresh.

After installing the OS, and running Software Update to ensure I had the newest versions of everything, I reinstalled PicturePerfect, Adobe Photoshop CS, my Dimage software for my Minolta scanner, Firefox, Thunderbird, and Fugu for secure FTP. This took about an hour, mainly because Photoshop CS has got to be the most stuffed full, compressed software installation there is.

When I installed Panther (Mac OS X 10.3), I checked the option to install X11 so I could use OpenOffice. Downloading this software and installing it took about ten minutes. I also installed the X Code development tools, just for grins and giggles.

I tried to use wget to access WordPress, when I remembered that this isn’t installed on any version of OS X greater than 10.1. I used cURL, instead, though it’s going to be hard to break the wget habit. I also downloaded MySQL and ran its installation program, turned on personal web sharing, and adjusted the httpd.conf file to allow PHP. This took about ten minutes–once I remembered how to use cURL.

My system is much happier now that the hard drive had been reformatted; the performance has improved significantly, and I now have oodles of free space. This whole thing ended up being a piece of cake, and my PowerBook is now a buff little beastie–leaner and meaner.

If only we could reformat our lives so easily.

Categories
Technology

Oh my oh

Tried to upgrade OS on my Mac, and it has failed badly. I’m right now in the middle of running fsck -yf to try and repair the volume, though it seems to be hanging on “Repairing volume” an awfully long time. I’m beginning to worry.

I’ll try all the tricks I can and then probably troop back to the Apple store, only to hear I’m sure that this is something else the ‘geniuses’ can’t handle.

Disc Warrior might be able to repair this. Or I’m looking at the possibility of formatting and re-installing. Everything. That’s not something to contemplate lightly.

Just a little reality injected into the rosy glow of happy Appledom.

Categories
Technology Web

The whole thing

Recovered from the Wayback Machine.

The Architecture of the World Wide Web, First Edition was just issued as a W3C recommendation. I love that title – it reminds me of Monty Python’s “The Meaning of Life”, volume one.

Interesting bit about URIs in the document. To address the ‘resource as something on the web’ as compared to ‘resource as something that can be discussed on the web’ issue, the document describes a resource thusly:

By design a URI identifies one resource. We do not limit the scope of what might be a resource. The term “resource” is used in a general sense for whatever might be identified by a URI. It is conventional on the hypertext Web to describe Web pages, images, product catalogs, etc. as “resources”. The distinguishing characteristic of these resources is that all of their essential characteristics can be conveyed in a message. We identify this set as “information resources”.

This document is an example of an information resource. It consists of words and punctuation symbols and graphics and other artifacts that can be encoded, with varying degrees of fidelity, into a sequence of bits. There is nothing about the essential information content of this document that cannot in principle be transfered in a representation.

However, our use of the term resource is intentionally more broad. Other things, such as cars and dogs (and, if you’ve printed this document on physical sheets of paper, the artifact that you are holding in your hand), are resources too. They are not information resources, however, because their essence is not information. Although it is possible to describe a great many things about a car or a dog in a sequence of bits, the sum of those things will invariably be an approximation of the essential character of the resource.

The document then gets into URI collision:

By design, a URI identifies one resource. Using the same URI to directly identify different resources produces a URI collision. Collision often imposes a cost in communication due to the effort required to resolve ambiguities.

Suppose, for example, that one organization makes use of a URI to refer to the movie The Sting, and another organization uses the same URI to refer to a discussion forum about The Sting. To a third party, aware of both organizations, this collision creates confusion about what the URI identifies, undermining the value of the URI. If one wanted to talk about the creation date of the resource identified by the URI, for instance, it would not be clear whether this meant “when the movie was created” or “when the discussion forum about the movie was created.”

Social and technical solutions have been devised to help avoid URI collision. However, the success or failure of these different approaches depends on the extent to which there is consensus in the Internet community on abiding by the defining specifications.