I'm doing this with two simple PHP scripts that redirect the cadenhead.org URLs to the correct PyCS URLs.
I implemented this feature so that I can take comment and trackback links offline when PyCS experiences an outage.
During a comment/trackback server outage, Workbench (and presumably most Radio weblogs) won't display a weblog page until the server request times out with an error -- a delay of 60 seconds or more. Most visitors conclude the site itself is offline and give up, causing traffic to slow to a trickle.
Now during an outage, I can replace the redirection scripts with "comments offline" and "trackbacks offline" text.
Here's the PHP script to redirect comments:
$url = str_replace("128729", "0000001", $REQUEST_URI);
$url = str_replace("/workbench/php/comments.php", "/system/comments.py", $url);
header("Location: http://www.pycs.net".$url); exit;
This script does three things to the requested URL, which PHP makes available in a $REQUEST_URI variable:
The same technique is used in a trackback redirection PHP script:
$url = str_replace("128729", "0000001", $REQUEST_URI);
$url = str_replace("/workbench/php/trackback.php", "/system/trackback.py", $url);
The scripts are stored in a php folder inside Radio's www folder. When there's an outage, I move the scripts and create new versions of the files with nothing but text like this:
There's probably a way to accomplish this in Apache with .htaccess files and mod_rewrite, but PHP made it too easy to look elsewhere.
The script's a nice, straightforward example of how to use UserTalk to read XML data from a file and do something with it.
I have modified his script to create a random text link that can be displayed on any Radio Web page. The link will be updated each time the page is republished, displaying a different link from an XML file called randomtextlinks.xml
Here's the script:
To use the script:
After the script has been installed and the XML file has been created, you can put the text <%workspace.randomTextLink()%> on any Web page or page template to call the macro, which displays a randomly selected link.
Right now, he's providing the countdown manually by editing the text himself.
I wrote a short UserTalk script that can count down to any specified date in the future:
To use it:
The optional arguments all default to zero, causing the countdown to use midnight as the time if no hour, minute, or second are specified.
Here's a countdown to Christmas:
<% workspace.daysUntilEvent(25, 12, 2003) %>
As of the last time this page was published, there are [Macro error: Can't call the script because the name "daysUntilEvent" hasn't been defined.] days until Christmas 2003.
Here's a countdown to Millard Fillmore's 204th birthday:
<% workspace.daysUntilEvent(7, 1, 2004) %>
There are [Macro error: Can't call the script because the name "daysUntilEvent" hasn't been defined.] days until Fillmore's birthday.
Radio only runs a macro on a page when the page has been updated. If you're putting the countdown clock on your weblog's home page, you can make it publish automatically once a day using the scheduler.addTask verb:
The clock.now verb returns a value representing the current second. You can use a different value for the first argument to cause the page to be published earlier or later in the day. Just add the number of seconds until it should first be run -- for example, scheduler.addTask(clock.now() + 79200, "radio.weblog.publish()", 1440) runs it 22 hours in the future, then every 24 hours after that.
Another way to save space on your weblog: Set up Radio to publish some of your files to a second server. If you have an FTP account on another server, it's easy to publish a folder to that server.
1. Create a new folder in your /Radio Userland/www folder. I called mine offsite.
2. Create a new password for your FTP account. Don't put your FTP username in the Password Name field. Instead, give it a descriptive name such as the name of your FTP provider. I called mine BellSouth.
3. Create a file called #upstream.xml that takes this form:
<upstream type="ftp" version="1.0">
Change the values in this file to match those required by your FTP server: username (FTP username), server (FTP server), path (folder on the FTP server), url (Web address of that folder), and passwordName (the descriptive name from Step 2). Don't put your FTP password in this file.
4. Save #upstream.xml in the new folder.
5. Try it out -- save something in the folder such as this Microsoft Bob mug:
If the FTP settings are correct, the file will show up automatically in the new server, which you can check in Radio's Events Log. Anything else you save in the folder will be upstreamed to the server (except for files beginning with a "#" character).
Radio supports multi-server publishing with FTP, XML-RPC, and SOAP. More information is available in the #upstream.xml specification.
To add the driver to Radio Userland:
Important note: None of this makes your category private. You must make sure the FTP location is private on your own.
I published my category to a folder that uses Apache's .htaccess feature to keep people out. As far as I can tell, it's working. If anyone can figure out a way to view what I have said about the musical group Creed in my private weblog, let me know and I'll update this story.
It's possible to publish a Salon Blog as a category of your existing Radio Userland weblog, but it's a pretty messy process.
Though I think it might be more trouble than it's worth, here's how I set it up, thanks to some tips from people on the Radio Userland support forum:
At this point, anything you post to the new Salon category will show up on your Salon weblog, instead of your main Radio Userland weblog. Your Salon weblog will use the main weblog's navigator links, referrer link, and updates link. Also, if you use comments, the Salon weblog will use the same commenting system as your main weblog, rather than the one on Salon's community server.
When you post an item, Radio saves it on your computer in a database file called weblogData.root in the software's Data Files folder. Any time your weblog is published, Radio reads data from this database, produces HTML files from it, then uploads those HTML files to the Salon Blogs community server. If you set up Radio on two different computers, they will have different weblogData.root files.
I don't have an always-on Internet connection. If I wanted to post from different computers with Radio, I would run the software from a folder on some kind of portable storage device, such as a ZIP disk, USB microdrive, or the like.
If you can stay connected to the Internet, there are two ways to post to a Radio weblog from multiple PCs.
Posting Remotely to Radio Userland Using E-mail
Turn on the Mail-to-Weblog feature. Radio can read an e-mail account and post everything sent to it with a specific subject line. All other mail will be ignored, so it should be an e-mail account you're not using for any other purpose.
This feature only reads mail while Radio is running and connected to the Internet. If you shut down Radio and go on a trip, any weblog entries you e-mail while traveling won't be posted until you run the software again.
Connecting to Radio Userland Remotely
If the Remote Access and Security feature is turned on and set up with a username and password, you can connect to the computer running Radio over the Internet and use its browser interface to work on your weblog.
You must know the IP address or host name of the computer. To load Radio remotely, type this address in a Web browser's Address bar followed by the port number 5335. For example, if I was running Radio on cadenhead.org, I would connect to http://cadenhead.org:5335.
Phillip Pearson describes both of these options in more detail on his Salon blog.
An easier way to grab the item: Click any empty spot to the right or left of it.
To show this, I've added yellow boxes to the outline below. If you wanted to move Item 1a, you could click anywhere in those yellow areas (which aren't visible in Radio Userland) and hold your mouse down, dragging the item to a new location.
I found this tip in Matt Neuberg's book Frontier: The Definitive Guide, which is available for free online. Though it documents Frontier 4.2.3 for the Macintosh, the book can be useful for Radio Userland users who want to learn how to write scripts and make use of the Radio Userland interface and database, because Radio Userland shares so much in common with Frontier.
Radio Userland doesn't offer access control at the present time, so your weblog's open to the public from the moment you set it up.
Step 1: Change Your User-Agent String
First, modify the User-Agent string in Internet Explorer. The User-Agent string is sent to a server when you request a page, and it identifies your browser, browser version, and often other things about your system.
Here's my current User-Agent string for Internet Explorer 6 on Windows XP:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461; .NET CLR 1.0.3705)
You can see your browser's User-Agent string on this IP Delivery browser variable page.
The User-Agent string contains several tokens in parenthesis separated by semi-colons. You can add a token of your own by adding an item to the Windows Registry. (Standard disclaimer: Be careful when editing your registry. It's a great way to hose your system if you're not sure what you are doing.)
Run the Registry Editor and open the folder My Computer, HKEY_LOCAL_MACHINE, SOFTWARE, Microsoft, Windows, CurrentVersion, InternetSettings, User Agent, Post Platform.
Add a new item: Choose Edit, New, String Value. An item will appear in the Post Platform folder with the type REG_SZ and the name New Value #1. Give it a new name that isn't likely to appear in someone's User-Agent string -- Foobar, Swordfish, Heffalump, Woozle, or the like.
Exit the Registry, shut down Internet Explorer, and open it back up. Your User-Agent will have the new token in it. When I added Swordfish to mine, it became this:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461; Swordfish; .NET CLR 1.0.3705)
Step 2: Add a Script to Your Weblog
After you have modified your User-Agent string, add a script to the HTML templates of your weblog to look at that string and send people to a different page if their User-Agent doesn't contain the token.
If you know how to change your templates and republish the weblog, add a script like this to the top of each page that should not be open to the public, right after the <body> tag:
This script requires two changes:
First, modify the text in the if statement so that it includes everything in your User-Agent after the first "/" character.
Next, set the variable top.location to the URL where people should be sent if they don't have the right User-Agent string. I sent people to the Radio Userland home page.
Save the template and republish the pages in your weblog that use the template.
I have written a Radio Userland format driver to read Amazon's XML feed of best-selling products for any category and keyword you designate (example; requires Internet Explorer 5 or 6 to view in a browser).
To add the driver to Radio Userland:
After the script has been added, open the News aggregator page and add an Amazon XML feed. Feel free to modify my example -- change "naviseek" to your Amazon Associates ID, change "books" if you want a different category (such as "software") and change "Rogers%20Cadenhead" to the keyword you want to search for, replacing all spaces with %20 as I did).