WDB Contributed Scripts, Tips & Tricks

S. C. Johnson once said :
A successful tool is one that was used to do something undreamed of by its author.
- and indeed, WDB has surprised me once or twice, with the ease with which it is possible to add new functionality, or to integrate other tools with this - and still have it look like a coherent interface to the user. If you have written a script, or has some tips or trick that is useful when creating WDB forms - and you want to share them with all the other WDB users - send them to me, together with a small description, and I'll add it to this page.

- Share, and enjoy


Scripts

  • textohtml - Convert TeX characters to HTML
  • toupper - Convert a string to uppercase
  • findfiles - Find full text version of file.
  • MattWrap - Genetic sequence formatter
  • Tips

  • Formating numbers
  • Printing just the date part of a Sybase datetime field
  • Tricks

  • Forcing full screen output mode

  • This page is still under construction. Some of the entries below might be incomplete.

    textohtml - Convert TeX characters to HTML

    Convert TeX style special characters to the equivalent HTML characters. (not complete - but the most used characters are there.) ref.: http://arch-http.hq.eso.org/wdb/html_chars.html
    Usage
    from_db = &textohtml( $val{'...'} );
    Available
    - in the eso_util.pl library.
    Written by
    Bo Frese Rasmussen - (bfrasmus@eso.org)

    toupper - Convert a string to uppercase

    Usage
    from_db = &toupper( $val{'...'} );
    to_db = &toupper( $val );
    Available
    - in the eso_util.pl library.
    Written by
    Bo Frese Rasmussen - (bfrasmus@eso.org)

    findfiles - Find full text version of file.

    These where the requirements for this script :

    Given a large table with document info : document number, title, author, date, issue, etc., a link to the full text version of the document should automatically be generated if it is available. Also, the file can be available in several formats - PostScript, HTML, other formats might be added later.

    No link should be shown if the text is not available - dead end URL's are not allowed ! The authors shouldn't be bothered updating the database when the online version of their document is ready (in whatever format) - it should be enough to simply deposit it in the correct directory.

    Each row in the database contains :

    (Description still being worked on..... )
    Usage
    VLTSWDOC = /wdb/vlt
    VLTSWDOC_DIR = /home/ac2c/users/wdb/WWW/vlt
    ... etc. ...
    from_db= &findfiles( $val{'file'}, $val{'doc_no'}, $val{'issue'} )
    Available
    - in the vlt.pl library.
    Written by
    Bo Frese Rasmussen - (bfrasmus@eso.org)

    MattWrap - Genetic sequence formatter

    My database has genetic sequence data (amino acids or nucleotides) stored as text without delimiters. This does not look very nice to view, so I wrote a short Perl function that I call with from_db to (1) insert spaces and (2) make it all UPPERCASE because some records are in lowercase:

    Usage
    fromdb = &MattWrap( $val{'sequence'} )
    Available
    Here : (this of course is in the PERL section at the top of the fdf) sub MattWrap { local($MattIn) = @_; local($MattLen) = length($MattIn); local($i,$MattHead,$MattWrapped); for($i=0;$i <=$MattLen/10;$i++) { $MattHead = $MattHead . substr($MattIn,10*$i,10) . " . "; $MattHead =~ tr/a-z/A-Z/; } $MattWrapped = $MattHead }
    Written by
    Matthew D. Healy <healy@seviche.med.yale.edu>

    ?

    Your script could be here ....
    Usage
    Available
    Written by


    Tips


    Formating numbers

    from_db= sprintf( "%3.1f", $val{'nights'} )

    Printing just the date part of a Sybase datetime field

    from_db= substr( $val{'issue_date'}, 0, 11 )

    Tricks


    Forcing full screen output mode

    PERL = $in{'full_screen_mode'}="on" if $key_args;
    Send comments to bfrasmus@eso.org (Bo F.R.) ......... Last update 10/11-1994 .