Charles Roth: Credit Acceptance Weblog
A weblog is a personal diary of thoughts and information, intentionally published on the web.  This weblog is specific to useful & interesting information I learned, assembled, or created regarding my work at Credit Acceptance.

Contents of this weblog reflect the author's opinion and not that of Credit Acceptance.  No proprietary information belonging to Credit Acceptance is posted here.

Table of Contents

Daily Entries

21 July 2003 -- Code formatters for PL/SQL, Javascript, Java
I got sufficiently tired of dealing with unformatted, unindented code to justify digging up some good automatic code formatting tools for PL/SQL, Javascript, and Java.  I've appended a small rant on proper formatting, as well, since I've been working with formatters for over 20 years.

19 May 2003 -- Installing Citrix Linux client
Having made "the switch" from Windows to Linux, I've described the details of installing the Linux Citrix client on a Redhat 8 laptop. 

24 March 2003 -- Launching PDFs from Powerpoint
Problem: Insert a hyperlink in a Powerpoint slideshow that points to a PDF file on the web.  Display the slideshow in full-screen mode, and click on the hyperlink.  A dialog box pops up, warning that files on the web may contain viruses, and requests confirmation to show the file.  Click "OK", and the PDF file appears -- underneath the slideshow!

Solution: Change the hyperlink to point to an HTML file that in turn loads the PDF file into the same window.  This avoids the dialog box (which is apparently what causes the slideshow to retain "focus" and stay on top).

For example, the following HTML file would be invoked as:
and reads "mydoc.pdf" from the query string, and reloads the window with that file.
   <script language="javascript">
      function reloadme() {
         location.href = ""
   <body bgcolor="#FFFFFF" onLoad="reloadme();" >

14 August 2002 -- Compiling C shared object files
Two excellent how-to's on creating shared object libraries from C modules, at (Linux) and (Solaris).

25 July 2002 -- PL/SQL htp package
Question: where's the documentation for the PL/SQL htp package?  It's a handy tool for writing HTML from within PL/SQL.
Answer:  There's some dated (Oracle 7) but possibly useful context about calling PL/SQL in/with web pages, at

Now, why aren't we using PSP (PL/SQL Server side Pages) instead...?

10 July 2002 -- Writing DHTML pull-down menus with a text field
Problem: we'd like to have a web page with a pull-down menu, but if the user doesn't like any of the choices, allow them to add a choice.

Solution: overlay a pull-down menu with a one-line text field in the same position, so that only one of them is visible at a time.  The last choice in the pull-down is "type a value"; when it is selected, the text field becomes visible (and the select box goes away).  Typing a value into the text box adds it to the list of values in the select box.  When focus leaves the text box, --presto-- the select box returns.

See it: lovt.html.  Requires IE 5.01 or Netscape 6.1 or higher.

Notes: Uses style-sheet positioning and visibility controls to place (and hide) the two form elements (select and text field).  Defines two functions to handle onChange's in each element.  The elements are defined by 'id's, and have a common root, so that it becomes easy to generate as many pairs of select/text fields as you like -- they all use the same pair of functions.

Of course, some users will be upset that the additional choices they added today won't be there tomorrow... <sigh>.

3 July 2002 -- Saving PowerPoint presentations as (efficient) web pages
Problem:  we have a ~6MB PowerPoint presentation that we want to make available, over the web, to dealers/customers that only have dial-up connections.  The presentation has mostly "nature scenes" or similar graphics as backgrounds, with a lot of text and simple charts overlaying the backgrounds.

The immediately obvious options all had problems:

  • Download the entire presentation as is.  Takes about 30 minutes on a 33K modem at full blast before you see anything.

  • "Save as Web", and download a slide at a time.  Starts up right away, but takes anywhere from 20 - 60 seconds per slide, for 120 slides.  We'd lose the user by the 5th slide.

  • Save each slide as a single JPEG.  This looked hopeful, and we were willing to give up animation effects to make the download time reasonable... but the net time was still in the 10 - 60 second range.  I tried further compressing the JPEGs, but the text & charts quickly become messy without any significant time savings.

A little theoretical analysis finally paid off.  The fundamental problem is that we're mixing two different kinds of images: natural scenes, which are best stored as JPEGs; and text/charts, which have sharp edges and are best stored as GIFs.

So, the solution was clearly to separate the two kinds of images.  Briefly, I extracted the backgrounds and stored them as JPEGs; and then after removing the backgrounds, I saved each slide as a GIF.  The result shrank from 6MB (or 10+MB for the "save as web"!) to about 2MB. 

The best part was, with a little scripting, the human time involved was proportional to the number of backgrounds -- and the entire 120 slide presentation used only 4 different backgrounds.

The Details

  1. In Powerpoint, go through the slides and find the unique backgrounds.

  2. Pick a particular slide for each background.  In Powerpoint, delete all of the elements on that slide except the background.  Save just that slide as a JPEG.  (Fiddle with the size parameters until you get what you want; I settled on 720 x 540 so that people with 800 x 600 screens could still see the whole thing.)

  3. Close the presentation (w/o saving it) and reopen it.  Now right click on the background (on any slide), and change its color to something that is not used in the presentation.  I used full red (RGB 255,0,0).  Save the entire presentation as a set of GIFs.

  4. Change the gifs so that full red is "transparent".  There are a variety of tools for doing this, but since I'm a unix hacker at heart, here's the approach I took:

    1. I wanted to use the unix giftrans to make red transparent.  But *&#! powerpoint writes a record into the gifs it makes that giftrans can't read.  ("Cloud everything, the dark side does, hmmm?")

    2. So I used Lview Pro to load all of the images in "batch mode" (as a "catalog") and write them back out again.  That removed the nasty powerpoint record.

    3. Then a small unix script finds the color index for red in each gif file, and makes it transparent:

         for x in *.gif; do
            giftrans -l $x 2>colorindex
            color=`grep "Red.*255.* 0, .* 0, " colorindex | \
                   head -n 1 | (read a b c; echo $b)`
            color=`echo $color | tr -d ":"`
            giftrans -t $color $x >temp
            mv temp $x

  5. Finally, I assemble the whole thing with some HTML and Javascript so that each GIF appears as a (big) cell in a table, and the relevant background JPEG appears as the background image for that cell.  The transparent parts of each GIF allow the background JPEG to show through.

  6. This could be done in a variety of ways: the simplest would be to make a straight-forward HTML page for each slide.  In this case, I wrote one HTML page with some javascript to "advance" the image for each click.  See slidefbshow.html.

  7. I used one more "trick" to speed up the perceived download time, called image preloading.  Basically, once a slide has finished loading, you start downloading the next slide while the user is reading the current slide.  If you're lucky, this can make the next slide seem to appear instantaneously.  (I first encountered this trick in David Siegel's excellent Killer Web Sites book.)

If you've read this far, you deserve some reward -- here's a version of the actual presentation, as produced by the instructions above: Sample Training Presentation.  Click on the VCR buttons (or the image itself) to advance.

4 June 2002 -- Refreshing proxy
Seeing changes made to HTML files can be tricky, due to the caching done by the local proxy server.  Press Ctrl-F5 to force it to refresh the current page.

30 May 2002 -- Linking into a PDF
Context: from the web, everyone knows you can link into a part of an HTML document by using an "anchor" -- e.g. links to the place in document.html that contains the anchor <a name="section1">.

You can similarly link into the middle of a PDF document:

    causes the 3rd page to appear in the acrobat reader plugin in your browser.

    opens the bookmark tab listing any booksmarks in the document

    opens the document at the named destination mydest.

The last example is the most interesting, and the most like HTML anchors.  Turns out that adding named destinations to an existing PDF is pretty easy, at least if you have Acrobat 5.0 (the full utility, not the reader). 

To create a specific destination, say "mydest", load the PDF into Acrobat 5, and navigate to the location you want to link to.  (How you see the page is how the user will see it.)

  1. Pull down "Window", select "Destinations". 
  2. Choose "scan document". 
  3. Choose "New destination". 
  4. Enter "mydest" as the text of the destination. 
  5. Press enter.
  6. Save the file.

Notes:  It should also be possible to add a named destination earlier in the process (before you run distiller on your original), but I haven't tried that yet.  Quarkxpress 5 is supposed to have an "anchor" feature that translates directly into a named destination when you make a PDF.

Related links: -- dated but still useful -- good example -- why you can't link to bookmarks
PDF with Acrobat 5 (book) comes highly recommended by a technial author I respect.

29 May 2002 -- Oracle Portal
The "Oracle University" books on Oracle Portal are pretty bad.  Web Development with Oracle Portal looks a lot more readable.  I've ordered a copy.

(Later...)  Even better is Oracle 9i Application Server Portal Handbook.