Scripts

Error Tracker Pepper

Posted on September 10th, 2005 @ 7:58 PM EST

Error Tracker Pepper for Mint

Description

Error Tracker is a Pepper for Mint that enables you to see common HTTP errors (401, 403, 404, and 500) that your visitors receive while accessing your site.

Installation

Listed below are the instructions on how to start using the Pepper:

  1. Download the files and unzip the file.
  2. Create a custom error page for each of the following error types: 401, 403, 404, and 500.
  3. Be sure to include a link to the Mint external Javascript file in each:
    <script type="text/javascript" src="/mint/mint.js.php"></script>
  4. Upload the files to your root web directory (e.g. public_html).
  5. If your server is running Apache, add the lines below to a file named “.htaccess” in your root web directory (e.g. public_html). If your web server is not running Apache you’ll need to contact your web host to find out what you need to do to have the server direct your visitors to your customized error pages.
    # error handling
    ErrorDocument 401 /401.php
    ErrorDocument 403 /403.php
    ErrorDocument 404 /404.php
    ErrorDocument 500 /500.php

    Note: Be sure to replace .php with the extension of the file type you’re using.

  6. Upload the /xhtmled/ directory and its contents to /mint/pepper/.
  7. Login to your Mint installation and in the Preferences click “Install” under Pepper.
  8. Click the Error Tracker Pepper “Install” button. Click “Okay.”
  9. Click Error Tracker under Pepper in the preferences pane.
  10. In each of the boxes, enter some words that are unique to each error page.
  11. Click “Done.”

Feel free to submit a comment to this post if you experience any bugs or have any suggestions.

Version History

v1.06 (February 18, 2006)

v1.05 (September 23, 2005)

  • Corrected an issue with HTML entities in the preferences pane.
  • Added compatibility with the new getCfgValue() API calls. (Mint 1.1+ is now required)

v1.04 (September 13, 2005)

  • The path to the error now links to the missing file and a secondary line has been added that displays and links to the referring page.
  • Truncated the error text to cut down on horizontal scrolling. (the full path may be viewed in the popup text by mousing over the error)

v1.03 (September 12, 2005)

  • Added an error checking routine that displays an error if one or more of the required fields are missing in the Preferences pane.

v1.02 (September 11, 2005)

  • Fixed a bug where the entire page title was being displayed instead of the error code.

v1.01 (September 10, 2005)

  • Initial release.

Disclaimer

THIS SOFTWARE IS PROVIDED AS-IS, WITHOUT WARRANTY OF ANY KIND. THE AUTHOR DISCLAIMS ANY DAMAGES RESULTING FROM THE USE OR MISUSE OF THIS SOFTWARE.

Download

error_tracker_pepper_106.zip
File Size: 8 KBs
Downloads: 2797

Support

Error Tracker is offered free of charge, however donations of any amount are always welcome.

Show Netflix Movies using PHP 5

Posted on August 30th, 2005 @ 12:02 PM EST

I wrote the following PHP script for use on the Netflix page that I recently added to my site. The script parses the RSS feeds that are available for my Movie Queue and Previously Viewed Movies using the URLs that Netflix provides for my account. It uses PHP 5’s new SimpleXML extension which really simplifies parsing XML documents by quickly extracting data. In order to accomplish the same results under PHP 4 a lot of code would have been needed.

<?php

// define feed urls
$queue_feed = 'http://rss.netflix.com/QueueRSS?id=ENTER_YOUR_ID_HERE'; // url to queue feed
$recent_activity_feed = 'http://rss.netflix.com/TrackingRSS?id=ENTER_YOUR_ID_HERE'; // url to the most recent rental activity feed

// function that parses the xml and converts it to a nice ordered list
function show_movies($file) {
        
$xml = simplexml_load_file($file);

        echo
"<ol>\n";
        foreach (
$xml->channel->item as $item) {
            
$link = $item->link;
            
$title = $item->title;
            
$title = preg_replace("[[0-9]+- |Shipped: |Received: ]", '', $title);
            echo
"  <li><a href=\"$link\" title=\"$title\">$title</a></li>\n";
        }
        echo
"</ol>\n\n";
}

echo
"<h2 title=\"Movie Queue\">Movie Queue</h2>\n";
show_movies($queue_feed);

echo
"<h2 title=\"Previously Viewed Movies\">Previously Viewed Movies</h2>\n";
show_movies($recent_activity_feed);

?>

In order to use the script your server will need to be running PHP 5. Just replace “ENTER_YOUR_ID_HERE” with your id number and you’re ready to go. You can get the id by logging into your Netflix account then clicking on the RSS link at the bottom of the page. The number can be found under the Personalized Feeds section and it starts after the = sign in the URL.

iChatStatusPublisher

Posted on August 9th, 2004 @ 11:15 PM EST

Description

iChatStatusPublisher is a stay-open script application that enables you to make your site more interactive by displaying your current iChat status. When you’re available, it will display a hyperlink that your visitors can click on to send you an instant message.

Requirements

  • Mac OS X 10.1 or higher
  • iChat AV

Installation

  1. Download the script.
  2. Create a new folder named “iChat” in your user’s Library folder (/Users/USERNAME/Library/iChat).
  3. Open the Script Editor which is located in the AppleScript directory inside your system’s Applications folder (/Applications/AppleScript/Script Editor).
  4. Copy and paste AppleScript code into the top box of the Script Editor.
  5. Edit the config variables at the top of the script and enter the appropriate information. I recommend using the SCP option as it is a more secure method of transfering files. If your web host does not support connections via SSH then you’ll need to use FTP. In this case I recommend creating an additional FTP account that just has access to a sub-folder on your account to help minimize security risks.
  6. Click “File” then “Save As…” and a dialog box will appear (see below).
    Dialog Box
  7. Save the file as “iChatStatusPublisher” and save it to your system’s Applications folder.
  8. Select “Application” from the File Format drop-down menu.
  9. Check the option to “Stay Open”. This will keep the script running in the background so it can communicate with iChat.
  10. Go to your Applications folder and double click on the icon for “iChatStatusPublisher” to run the script. You may also want to create an alias to the script and save it to your Desktop.
  11. Copy the PHP code and paste it where you would like the iChat status to appear on your webpage. This file must be saved as a .php file. (If your page is currently saved as an .htm or .html file, please see the instructions below on how to get it working on your page.)
  12. Edit the config variables at the top of the script and enter the appropriate information.

You should now be up and running! If you have any questions or problems, feel free to send me an email or post a comment. Feedback is greatly appreciated!

SCP Transfers

SCP (Secure Copy) is an alternative to using FTP and is a more secure protocol. Much like SSH, it uses secure shell encryption to protect your information in transit. If you would like to transfer the data to your webserver using SCP then follow the instructions listed below. If you’re not sure if support for SCP (SSH) is available to you, you’ll need to check with your web host to see if they support this feature. In order to transfer files via SCP, you’ll need to generate an SSH public/private key pair. These instructions assume that you don’t have any other keys present on your web server.

  1. Open Terminal on your local computer and start a new shell session from the File menu.
  2. Type “ssh-keygen -d”.
  3. After entering the command, press the enter key three times.
  4. Your public and private keys are now saved to “~/.ssh/id_dsa.pub” and “~/.ssh/id_dsa”.
  5. Copy the key to your webserver by typing “scp ~/.ssh/id_dsa.pub yourdomain.com:.ssh/authorized_keys2”.
  6. Enter the password for your account on the webserver when prompted then press the enter key.
  7. Test the SSH key by typing “ssh yourdomain.com”. It should log you in without a password. If not, check to make sure you typed everything in correctly.
  8. If you successfully connected to your account then you should be all ready to start uploading your iChat status file to your webserver.

If Your Pages End in .html

If your pages end in .html there are two different methods that you can follow to get iChatStatusPublisher to work on your site. I recommend the first one even though the second method is easier and doesn’t require you to rename all of your pages. The second method can slow your server down a bit because PHP will have to parse your HTML when it may not need to. These instructions will only work if your website is hosted on a UNIX server.

Rename Your Pages to .php

  1. Rename your pages from .html to .php.
  2. Upload your .php files to your server and delete the .html files which will no longer be used.
  3. Paste the PHP code below where you would like your iChat status to appear in your pages and be sure to change the config variables.
  4. Upload your pages to your web server and you should now be able to view your iChat status.
  5. Now create a new file and name it “.htaccess” without the quotes.
  6. Copy and paste the four lines of code below into the file.
  7. Upload the file to your root web directory (e.g. public_html). This will make it so any links that currently point to your .html pages will be redirected to the new .php pages.
# Redirect any links that point to .html extensions to .php
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(.+).html$ $1.php [L]

Use PHP In Your .html Pages

  1. Create a new file and name it “.htaccess” without the quotes.
  2. Copy and paste the line of code below into the file.
  3. Upload the file to your root web directory (e.g. public_html).
  4. Your .html pages will now be parsed as PHP.
  5. Paste the PHP code below where you would like your iChat status to appear in your pages and be sure to change the config variables.
  6. Upload your pages to your web server and you should now be able to view iChat status.
AddType application/x-httpd-php .htm .html

Version History

v1.2 (August 11, 2004)

  • Added support for transfers via SCP.

v1.1 (August 9, 2004)

  • Initial release.

Disclaimer

THIS SOFTWARE IS PROVIDED AS-IS, WITHOUT WARRANTY OF ANY KIND. THE AUTHOR DISCLAIMS ANY DAMAGES RESULTING FROM THE USE OR MISUSE OF THIS SOFTWARE.

THIS SOFTWARE IS COPYRIGHT © 2004 JEFF MILLER. YOU MAY USE AND/OR DISTRIBUTE THE SOFTWARE WITHOUT RESTRICTION.

Download

iChatStatusPublisher_1.2.sit
File Size: 4.42 KBs
Downloads: 2389