Java App Blogging

JAB is a client-side Java application that automates updating a web page using FTP.

JAB menus and buttons

Setting up your web page

Add the text "<!-- jab here -->" to a blank line at the point where you want new entries inserted into your web page. Don't include the quotes.

If you want to use the archive feature, include the text "<!-- jab there -->" on a blank line below the jab here line.

Making a template for entries

A template is the snippet of HTML code that JAB will insert into your web page after the "jab here" marker. The included file "sampleTemplate.html" is an example for making a template. The following strings in a template file will be replaced with their substitution:

JAB command:Substitution:
<$body$>The text of your entry
<$date$>The date the entry is posted
<$time$>The time of day the entry is posted
<$unique$>A unique string to mark this entry. Think: anchor tag.
<$username$>The username used to FTP upload this entry
<$startdailyblock$>Marks a portion in the template that will only show up once a day
<$enddailyblock$>Ends the daily block. Make sure you include this if you have a startdailyblock command.

Note: All commands and markers are case-sensitive. Also, the template parser will choke if the first character in a template is $. This would be an easy bug to fix, but it's even easier to include some whitespace at the top of your template for now.

Telling JAB where to find your files

JAB requires all of the following information:

  1. How to access your web page with an HTTP address
  2. How to access your template file locally, or with an HTTP address
  3. The address of your FTP server
  4. The full path of your page on your FTP server. (This is the same file as in #1, just via FTP instead of HTTP.)
  5. The full path to a not-yet-existing temporary page on your FTP server. JAB will upload changes to the temporary page and prompt you after the upload whether or not you want to overwrite your main page. This way, incomplete uploads will not overwrite your old pages. Also, if you bookmark the temporary page you may preview and choose to discard an update.
  6. The full path to a FTP directory for archiving old pages.

Starting JAB with the "java mawilson.jab.JABSwing" command will open up the settings dialog.

Don't include the quotes, but you already knew that, right?

After making an initialization file, you can start JAB by typing "java JABSwing <path to initialization file>".

Also, to find the full path to your file's directory on a UNIX server, try the command "cwd" at the UNIX prompt.

Using JAB

Steps in sending an entry in JAB:
  1. Start JAB with an initialization file
  2. Select File->Load page to HTTP download your web page and template file. This will enable the "Send", "View" and "New Entry" buttons.
  3. Enter your FTP username and password
  4. Type in your new entry
  5. Click "View" if you want to see what your entry will look like inside your template
  6. Click the "New Entry" button if you want to write another entry during this session
  7. Click "Send" when you're done
  8. Click "yes" unless you've had second thoughts

Using the archive function

This function is still very raw and isn't idiot proofed yet. How it works is you choose a line out of your main page somewhere between the "jab here" and "jab there" lines. Also, you'll probably want to choose a line that's the beginning of a particular entry or day. JAB then splits the page into four parts: "jab here" and above, "jab here" to where you split the file, below the split line to "jab there" and everything below "jab there."

Using these parts, JAB constructs two web pages. One web page includes all the entries above the split line and one page includes everything below the split line. The top entries return to the main page and the bottom entries are uploaded into a new page in the archive directory that has the file name "__.html". The day in the filename is the day that the archive was made and probably has nothing to do with the breadth of time the individual entries were made.

It's not exactly intuitive, but it works for me. I'm pretty sure the archiver will puke if you feed it a line that isn't between the "here" and "there" markers.