inessential by Brent Simmons

March 2002

AEStream and Friends

New Apple technote “describes the AEStream* collection of APIs that can be used to construct Apple event records and Apple event descriptors using stream oriented calling conventions. These APIs allow you to use interesting and easy to maintain stream oriented algorithms for creating complex Apple event descriptor records.”

iBooks Love Linux

O’Reilly: “It feels a bit like a homecoming. After years wandering in the cranky wilderness of mix-and-match PCs I’m working again on a computer that feels like it has a soul. The reason I feel like this? The other week I switched from an Intel-based laptop to an iBook.”

More Cocoa progress

I was proud of myself. After another day of working through that Cocoa book I had the urge to do a simple app from scratch.

So I did. It just displayed one window with an input text field and a button. Type in the text field, then click the button, then the browser runs a Google search on whatever you typed.

It took me about ten minutes from start to finish.

Admittedly it’s not very useful, so I’m not releasing it (even as sample code). Unless, that is, that I decide to take the obvious next steps, which are... Anybody? Anybody?

Yes, that’s right, a pop-up menu allowing you to choose the search engine. So you could choose Google, Apple developer docs, the PHP website, Dictionary.com, etc.

And of course via Preferences you could add, edit, and delete search engines: it would have to be customizable. Now that would be a pretty useful app—more useful than the unfortunate Sherlock, at least.

All mimsy were the borogoves

It’s funny. (Perhaps only to me.) Of all the poems ever written, the one whose first stanza I can remember best is one with a bunch of made-up words. From memory:

’Twas brillig, and the slithy toves
did gyre and gimble in the wabe.
All mimsy were the borogoves,
and the mome raths outgrabe.

Graveyard?

If you mix Diet Pepsi with Diet Coke in a glass is it a graveyard? How ’bout if you mix Diet Pepsi with Diet-Coke-with-lemon?

Learning Cocoa Progress

I made it about a third of the way through the Cocoa book yesterday. Good progress.

I still get sturvish when I think about outlets and actions too much. Actually, the concept is easy, the problem is knowing what to drag to what. My hurdle in learning Cocoa is understanding the relationship between what I see in Interface Builder and what I see in my code.

The joke I’ve heard about Cocoa is that a tutorial will advertise something like, “You can write a full-featured text editor with just three lines of code!” And then the tutorial takes 25 pages showing all the non-coding steps you have to do. For a certain type of programmer it’s pretty alien. Me, I’ve even always preferred .r files (text files) to working with ResEdit. And I never dug PowerPlant or MFC much. I like text.

That’s not to judge Cocoa but to say it’s different from what I’m used to. I’m enjoying learning it, and I already expect to use it in the future.

In fact, it’s about all I can do to stick with the book—I want to leap off and start working on some of the ideas I have for new apps. Patience!

Template Languages in XSLT

xml.com: “This article will show you how to implement your own specialized template languages by building up a simple example capable of transforming a music database in XML into any form of HTML.”

Tips for Scripting Java with Jython

O’Reilly: “Jython is a complete re-implementation of the Python programming language, written in 100 percent pure Java, which runs on any Java Virtual Machine (JVM). Python is a high-level, interpreted, object-oriented scripting language which combines elegant syntax rules with powerful built-in objects to create a language that is very easy to write, read, and maintain.”

What is XML?

xml.com: “Is it even possible to explain XML in simple English—especially in the limited space of an XML Q&A column?”

CPAN PLUS

perl.com: “Its objective is simple: do what CPAN.pm does, but do it better. We’d start with a clean code base designed to accommodate different types of use.”

Building an Extensible Form Validator Class

Developer Shed: “I’ll be attempting to build a reusable library of functions for form input validation, in an attempt to save myself (and, hopefully, you) some time the next time an application needs to have its input checked for errors. The end result of this experiment will be a PHP class that can be easily included in your scripts, and that exposes basic object methods for data validation.”

Why

One of the reasons I did the AppleScript and Frontier/Radio contextual menu plugins is so that writing tool and weblog tool authors have an easy way to connect to the desktop and other apps.

If you’re the author of such a tool, and you’re interested in working together in some way, let me know. I’m open-minded, looking for win-wins. I can also do contextual menu plugins for classic Mac OS and Windows (for a good cause).

CGIs in C

I must be nuts. I really, really like C. I like pointers. I don’t just use them, I like them. And all that memory management stuff. It’s fun.

I like the control, I like being close to the metal.

So sometimes I think the Web development language I should use is C. No scripts, no Java. C.

And then I think: what would I write in C?

I’d start with a templating system, of course, to make development easier. Gotta have templates.

And then of course one wants the ability to embed macros in the templates.

And then I realize—nuts, I’ve just re-invented Frontier, Zope, and PHP. I’m back to writing scripts!

Luckily this all takes place in my mind and I haven’t wasted any time on writing code.

But, you know, I really like writing in C.

Two Ways to Implement Session Tracking

WebReference: “The techniques presented in this article do not use the new technologies present to implement session tracking, but use some old, tried and tested ways which are extremely popular even today. After reading this article you would be able to implement session tracking using any language, since you would understand the concepts of session tracking rather than some language dependent implementation.”

Learning the Mac OS X Terminal, Part 4

O’Reilly: “Things really become interesting, however, when you take advantage of a little known feature of term files, the ability to define a command line to run when the window opens. Doing this allows you to create your own double-clickable run files that open in Terminal within a window of your exact specifications and run any command line (or script file) you can come up with.”

Error Handling in PHP

Developer Shed: “No developer, no matter how good he or she may be, writes error-free code all the time. Which is why most programming languages—including PHP—come with built-in capabilities to catch errors and take remedial action. This action could be something as simple as displaying an error message, or as complex as heating your computer’s innards until they burst into flame.”

Mailsmith 1.5

BareBones: “Not only is Mailsmith a scriptable mail client—giving you scripting access to checking mail, sending messages, and moving messages between mailboxes—but it’s also a fully scriptable text editor. Most AppleScripts written for BBEdit work in Mailsmith.”

Sort-of Easter Egg

It’s not uncommon for programmers to want to leave their mark on a product they’ve worked on. Some sort of small Easter egg or something, something personal. Some kind of signature.

I’ve never given in to that temptation. Except once, that is, in a very small way.

On the Manila Appearance Prefs page, in the pop-up menu where it asks what date format you want to use for the home page, the example date is March 26, my birthday.

I had to pick a date—any date would do—and the first one that popped into my head was that date. So why not?

Thanks

I turn 34 today. Thanks for all the happy-birthdays!

And remember to wish Josh Lucas a happy birthday—he turns 30 today.

MySQL Explained to Frontier Users

I wrote a little piece explaining MySQL to Frontier users.

“Old programmer’s philosophy: if you work primarily (or exclusively) in one environment, it’s a good idea to learn about others. It stretches your mind, helps you think more widely and imaginatively about how to solve problems.

“It’s the programmer’s equivalent of being ‘well-rounded,’ which always sounds like something boring like eating your brussels sprouts—but really it’s not just nutritious but fun.

“So the point of this article isn’t to get anyone to switch from Frontier to MySQL but just to tell you about another environment.”

Menu sharing replacements

I don’t really miss menu sharing on OS X any more.

First thing is that the Frontier contextual menu plugin allows one to run scripts—it replaces OSA Menu for me.

Next thing is all the places Apple has allowed one to attach AppleScript scripts. There’s the script menu, toolbar scripts, and Script Runner. The key with those is that you can use AppleScript scripts to run a script in Frontier or Radio. Just send a doscript message to Frontier.

Another thing is that many apps—Eudora, AppleWorks, and BBEdit, for example—have a Scripts menu where you can attach AppleScript scripts. Again, you just use a small AppleScript script to run a script in Radio or Frontier.

It’s not quite as convenient as menu sharing—but, if you add it all up, you end up with an environment that’s at least as scriptable and customizable as classic Mac OS.

uuidgen

Tip for OS X developers: sometimes you need a UUID. One case is when developing contextual menu plugins. The easy way to generate a uuid is the command-line uuidgen tool. It takes no parameters and returns a UUID.

Vertical Text in Java

O’Reilly: “If you’re developing your application using Java on the Macintosh, you may have noticed that Apple’s Human Interface Guidelines specify vertical text in side tabs, but Java only supports horizontal text. To address this, I wrote the VTextIcon class, which manages vertical text with support for localization.”

DeskPictAppDockMenu

New Cocoa sample code from Apple “shows how to add a dock menu to your Cocoa application, so that clicking and holding on your application’s dock icon displays a menu. It demonstrates this by scanning a folder of your choice (which you can choose from the ‘Preferences...’ menu item) for pictures, displaying those pictures in the dock menu, and setting your desktop picture to the picture you choose from the menu.”

acgi Dispatcher 1.0b4

James Sentman: “New in Beta 4: Adds ‘debug windows’ that let you see exactly what data is going back and forth between dispatcher and the scripts.” acgi Dispatcher allows traditional-style acgi scripts and apps to run behind Apache on OS X.

Scripting Apple DVD Player

Jesse Shanks: “The DVD Player application comes with a scripting dictionary that allows the intrepid user to control aspects of the way the player acts, looks and responds. Besides commands to start, stop, pause and stop DVDs, there are commands for the arrow keys, the return key and ability to go to any of the menus found on a disc.”

RCSearch

Macrobyte: “RCSearch is the super-easy-to-use search engine for UserLand’s Radio Community Server. It’s also a Just-in-Time search engine: within minutes of a new page being uploaded to your community server, the page will be fully indexed and searchable.”

Go-carts

Last night I dreamt that me and Sheila and my extended family were racing around the streets of Paris in home-made go-carts. It was a yellow sunny day. We were all wearing old-fashioned aviator hats and goggles. There was a big pack of us. It was so fun. TV cameras appeared to cover the event, but we raced right past them. Finally we stopped for coffee. Then we raced around some more until dusk.

Router problems solved

Not to keep you all in suspense about my router issues—I ordered a new router from a different company. It arrived the next day. I plugged it in—and, much to my kitten’s delight, it worked on the very first try.

So now I’ve fully switched over to using my cable modem. Surprisingly, this is the first time I’ve used NAT and DHCP and had a firewall. It’s about time. I always felt naked without all that stuff.

To my surprise, I get faster download speeds with the cable modem than I got from my T1. It’s amazing. Of course, uploading is another matter. But it’s not too bad, it’s roughly like having a dual-channel ISDN line. (I had ISDN for a couple years back in the ’90s.)

A Perl Hacker’s Foray into .Net

perl.com: “So for our exploration, the components of the .NET Framework that we care about are the Common Language Runtime and the C# language. And to nail it down beyond any doubt, these are things that you can download and use today. They’re real, they exist and they work.”

An Update on the Eclipse Project

LinuxPlanet: “IBM, Rational Rose, HoloSofx, CommerceQuest, Versata, and at least 25 other vendors have all been readying tools for the open source integrated development environment (IDE). Meanwhile, a greatly enhanced Eclipse 2.0 is slated for release in May.”

Regular Expression Basics

evolt.org: “If you’ve seen a regular expression before and thought it looked like alien space-algebra, it does, but have no fear—you’ll be fluent in alien space-algebra in no time!”

AEBuild*, AEPrint* and Friends

Apple Technical Note: “The AEBuild* suite of routines provide simple to use and easy to maintain facilities for constructing complex Apple event structures in memory for sending information to other applications. AEPrint provides a symmetrical pretty printer routine for viewing complex Apple event structures as strings formatted using the same syntax as the strings AEBuild* is able to read.”

Modifying Dreamweaver to Produce Valid XHTML

A List Apart: “Problem: Dreamweaver 4 falls short in its ability to produce well-formed, standards-compliant markup. Solution: You can easily harness Dreamweaver’s two greatest strengths, its flexibility and its user community, to make it one of the best tools on the market for producing good XHTML.”

Accessibility and Authoring Tools

A List Apart: “With the advent of standards-compliant browsers, we need to turn our attention to the tools that help designers and developers build the web. Professional developers and homepage hobbyists alike can code their pages with simple text editors. Hand coding, however, won’t always allow developers to meet tight publication or delivery deadlines.”

Using Mailfilter on Mac OS X

Paul Bissex: Mailfilter is “a command-line POP client whose only job is to kill spam. It connects to your POP account, compares the headers on waiting messages to its configurable list of rules, and deletes messages accordingly—before your e-mail client even downloads it. You don’t have to change any settings in your e-mail client or on the server where your POP account resides.”

XSL Transformation with Xalan

DevShed: “In this article, I’m going to take things further, exploring yet another addition to the Java/XML family. It’s called Xalan, and it’s an XSLT transformation engine that should substantially simplify the task of converting, or ‘transforming,’ XML documents into other formats.”

Tech Support

Sometimes tech support gets right to the point.

My kitten and I spent several hours yesterday trying to install a router. Now, I pride myself on being able to use mass-produced products that are designed for the average home user. But I couldn’t get this thing to work. No matter what I tried I got no net juice.

In exasperation I finally called tech support. I described the problem and what I did to fix it.

“You better take it back,” the tech support guy said.

No twenty questions, no assumption of stupidity—the guy knew I had a lemon and told me so. Cool.

Secure Mail Reading on Mac OS X

O’Reilly: “In this article I describe a danger inherent in most mail-reading methods, and ways to work around it on OS X, using the Mail program. I’ll also give you a brief tour of some SSH client tools that subtly stow away in the Mac OS X distribution.”

Frontier ODBC Extension

Tallent Communications Group: “The ODBC Extension allows a Frontier user to easily write cross-platform scripts for connecting Frontier to any ODBC compliant database system such as Oracle, Sybase, MS SQLServer, Access, mySql, or anything with an ODBC driver for your platform.” This new versions works in OS X.

Look Up PHP Reference from BBEdit

Many years ago I was trying to learn AppleScript and just not getting it. Nothing against AppleScript—everybody’s brain is wired differently. For me, a language that seems like natural language but really isn’t was just confusing.

But that’s just me. While struggling with AppleScript I discovered Frontier, and it immediately clicked for me.

Since then I’ve learned lots of other languages, but AppleScript has always been the language that stumps me. Which is why I’m proud to have finally written a useful AppleScript script.

The following is a script for BBEdit. If you write PHP scripts in BBEdit it’s useful.

This script allows you to select some text then search for it on the PHP site. Drop it in your Scripts folder as a compiled script. On my machine I called it Look Up PHP Function. Here’s the source:

set s to ""
set searchurl to "http://www.php.net/manual-lookup.php?pattern="

tell application "BBEdit 6.5"
   set s to selection of text window 1 as text
end tell

set searchurl to searchurl & s

tell application "Internet Explorer"
   Activate
   OpenURL searchurl
end tell

It’s pretty simple—it creates a URL by appending the selected text to a base URL. Then it tells Internet Explorer to open that URL. You could probably change the Web browser and it would still work.

Building with Ant: Directory Structure

developer.com: “The foundation of any build process is the project directory structure. A messy project directory, cluttered with files dropped willy nilly into whatever directory the ‘file save’ dialog happened to open up with, leads to arcane and bug-prone build scripts. On the other hand, if you try to organize too compulsively, you can end up with a byzantine nest of sub-sub-subdirectories that make it tedious to find the files you’re looking for.”

Transactions in MySQL

Webmonkey: Jay Greenspan “answers the age-old Q: ‘What’s the big deal with Transactions?’; investigates the four properties that a database must have to be considered transaction-capable; takes a closer look at locking mechanisms; and finishes up with a look at MyISAM tables, the lesser cousin of fully transaction-capable tables.”

Night

When it’s as dark and rainy as this, night comes asked-for; the lights in the house seem so much brighter than that feeble sun filtered through the clouds.

Radio traffic

Have you wondered what kind of effect Radio has on sites with RSS feeds? Check out the user agents page. Radio occupies 8 of the top 10 spots on this site.

I’m not complaining, by the way. This server isn’t having any problems keeping up. It’s all good.

Membership added

I finally added membership to this site. The main benefit is that you can edit your comments (those posted from this point on). More membership features to come later.

If you were a member of the old inessential.com, you’ll have to sign up again. Sorry about that!

Ranchero.com also has membership now. (Since it runs the same code as this site.)

Roxen WebServer 2.2

Linux Journal: “The Roxen WebServer, from the Swedish company Roxen Internet Software, is a viable alternative for those who find Apache inappropriate for their needs. Although Apache dominates the internet web server market, it has some weak points: it lacks a built-in SQL database backend, flexible administration tools and easy SSL certificate management.”

Radio Community Server

UserLand: “Radio Community Server (RCS) is a software application for Radio UserLand or Frontier/Manila that makes it possible for individuals or organizations to host communities of Radio users. It offers all of the community functionality currently offered by UserLand’s centralized system.”

Choosing Linux libraries

So here’s what it’s looking like: I plan to use the gnome libraries and use KDevelop as my IDE. That still could change of course.

I chose the gnome libraries for the simple reason that I can write in C rather than C++. I have nothing against object-oriented languages—I’m a fan of Python, Java, and Objective C, for instance—but I prefer C to C++.

Search engine feature added

This site now has a search engine—still in beta, I need to add some features. It searches just weblog posts, but not comments or other pages (yet).

Search engines for your own site can be addictive. I keep finding things I wrote, and thinking, Wow, I wrote that?

It uses MySQL’s standard fulltext index feature. The search engine was thus very easy to write: essentially just a where clause.

The Wrong Way to Use CSS in Page Layouts

evolt.org: “Unfortunately, many people are still using WYSIWYG packages to do their web development, and many of them are trying a table-free approach in their attempts to ride the wave of the CSS flood. What some of these developers tend to forget is that pixel-precise layouts are anything but, especially when you consider all the custom settings users may have on their systems.”

Creating Toolbars for Mac OS X

O’Reilly: Programming with Cocoa: “Today we’re going to continue our parade through the new Aqua interface with a look at toolbars. Toolbars are a great addition to the Macintosh GUI. They provide a consistent interface across all applications and are highly customizable by users, taking some of the UI burden off the developer.”

OmniOutliner 2.0 beta 1 debuts

MacCentral: “New features in OmniOutliner 2.0 include a customizable toolbar, new column types, notes, auto-numbering, sorting, summary values, new keyboard shortcuts, support for alternating row colors, an updated info window, and more.”

PHP and Regular Expressions 101

WebReference.com: “Regular expressions are simple to implement, and once you’ve mastered a few regular expressions (which are specially formatted strings that we can use to tell the regular expression engine the portion of a string we want to match) you’ll be asking yourself why you left regular expressions in the corner for so long.”

Question for Linux Programmers

Question for Linux programmers: say I want to write a GUI app (in C or C++) that runs on both KDE and GNOME. What APIs (or frameworks) should I use? GTK or QT? Or something else? Does the answer change depending on what license I want to release my software under? What if it’s GPL, what if BSD, what if commercial?

RFC: MetaWeblog API

UserLand: “This API views a post as a package of metadata with some well-known names and room to grow on an organized or an ad hoc basis. In my experience those are the kinds of APIs that have legs.” I agree that an API richer than the Blogger API is needed—and that using a struct is the way to do it.

iNET will run on Mac OS X

MacCentral: “Halcyon Software, a company that specializes in migration services and technology business, has released a beta version of its iNET technology, the first commercially available Java-based implementation of the Microsoft .NET framework.” As Paul Revere is said to have said: The redcoats are coming!

User Authentication with Apache and PHP

DevShed: “As it turned out, my user authentication module had enough security holes in it to drive a few hundred dump trucks through. I spent the next week plugging those holes, and along the way learnt a number of valuable things about access control—most notably, that it’s not as easy or as obvious as you might think.”

Title and Link API RFC

Regarding Daniel Berlinger’s Title and Link API RFC: I agree. It’s very needed. The only thing missing from the RFC was the full method names.

Dual-boot

After several days of struggling, I finally have a dual-boot Windows/Linux machine.

Imagine my pleasure when I discovered that KDE does anti-aliased text. Finally! That made my choice of desktop very simple. My biggest complaint with desktop Linux has long been the jaggy appearance of fonts.

The anti-aliasing could be of higher quality. And there should be an option to not anti-alias text below a certain size—but still, I’m pleased, those are nits.

Redesign

Redesigned. Like it? It matches the ranchero.com redesign.

The DNS change hasn’t taken hold yet, so this site is at test.inessential.com for now.

Building with Ant: Introduction

Earthweb: “The more interesting your application becomes, the more complicated your build process. In this article, I will sketch out a framework for how to use simple tools (like Ant and JUnit) and a simple directory structure to avoid many of the common growing pains of application development.”

New unix-porting mailing list

Apple’s new mailing list is “for community discussions regarding all the questions people face when doing a port: What’s different about Darwin? Which high-level toolkits should I use for my GUI? Is there a workaround for this problem? Has someone tried to port this before?”

AWPS Template Builder/Renderer

The Little Page of Beta AppleScripts: “AWPS (Applescriptable Web Publishing System) is a template-based webpage rendering system; basically a framework into which you add your own code, templates and data, and let it do all the hard work of putting these together. The control logic (standard AppleScript) is kept completely separate to the html templates, making design and editing a snap.”

Getting List of All Processes on Mac OS X

Apple Technical Q&A 1123: “If you want to list all of the running applications you should use the Carbon Process Manager routine GetNextProcess. This will return a list of all application processes, including those running in the Carbon, Cocoa, and Classic environments. However, this doesn’t return a list of non-application (daemon) processes.”

pySlice for Frontier

Greg Pierce: “pySlice is a suite of scripts for UserLand Frontier or Radio UserLand that implement string and list slicing, based on index values (ie, ‘1:3’)—the same way slicing is implemented in the Python language.”

Developing C/C++ Applications with the KDevelop IDE

Linux Journal: “The aim of this article is to enable you to create an application with the KDevelop Integrated Development Environment (IDE) on a Linux/UNIX system running KDE 2. We explain this process by creating a sample application that gives some insight into the development framework and how it works.”

03/05/02

Question, for a piece of software I’m working on: what are the type and creator codes for Dreamweaver, GoLive, Fireworks, Photoshop, and ImageReady?

Plugging RDF Content into Your Site with PHP

Developer Shed: “Imagine a site that carried the latest news from the hottest portals on the Web. Stock prices, weather information, news stories, threaded discussions, software releases...all updated dynamically, on an hourly basis, without any manual intervention. Imagine the traffic such a site would get.”

Aspect-Oriented Programming with WebObjects

Stepwise: “AspectJ is an aspect-oriented extension to the Java programming language. It is freely available as open source, and version 1.0 was released on November 30 last year. It’s time for WebObjects developers to evaluate if and how they can benefit from using AspectJ.”

03/04/02

I love BBEdit. I wrote a song for it.

You know you’re a geek when you write songs for your favorite apps.

BBEdit
You’re so nice
You’re like sugar
And like spice.

I use you
All the time
Because you’re cool
Not like slime.

BBEdit
BBEdit
You’re the app that
Always gets it.

BBEdit
I confess
I love you
You suck less.

Frontier Stuff

The old Frontier content—on FileMaker, MacBird, and UCMDs—has been imported into the new site. Most of it’s obsolete, or at least pretty old, but it may still be useful to somebody.

3/01/02

This is my last day at UserLand. My decision to resign is for personal reasons, and has nothing to do with the company, its software, its people, or its mission—regarding all of which I have high opinions.

I’m proud of the work I accomplished over the last five years—I’m proud of the work the entire team accomplished. So many more people write for the Web now than did five years ago, because of the work of UserLand and others, and this gives me immense personal satisfaction.

I’m grateful to UserLand, and to Dave Winer in particular, for teaching me how to be a software developer. It reminds me of the old days when, instead of going to college, you would join a trade guild as an apprentice and learn your craft from a mentor. I got a great education.

I learned that being a software developer is more than just about programming—it’s also about respect, empathy, and integrity.

So... what’s next for me?

I’ll be doing software for Frontier and Radio. I’ll still be on the same mailing lists, reading the same discussion groups. I’ll continue doing this weblog and mac.scripting.com.

In other words: I’m still here.

Thanks to everyone for the notes of thanks, via email and the Web. I appreciate it very much. It means alot to me, more than you probably imagine.