The June 2006 Blog
send me a comment

SnTT: show tasks -xml (Thursday, Jun 29)
[ permalink ] [ GoogleTrack ] [ e-mail me ] [ >> ]

I can't remember what the context or the medium was, but at some point Thomas Gumz mentioned that all most of the server console tasks in Domino 7 could be followed by a "-xml" switch to make their output come back as XML instead of whatever text format they would normally come back as. Heck, maybe this was available in ND6 too, but I know it's there in R7 (my test server tells me so). (UPDATE: yes, it's been available since Domino 6.0).

So, you can make a call like:

show tasks -xml

and get a bunch of formatted -- and easily parsable -- XML instead of a text list.

As an example of taking advantage of this capability for your own selfish gain, this week's post is a LotusScript agent that calls "show tasks -xml" on the server and returns a nice custom formatted list of return values. For example:

Task list display example

Here's the code I used, for your reading pleasure (I also incorporated a simple tree control from Silverstripe on my box to make the output look nicer):

  • XmlTasklist.lss (also available in prettified HTML format)
  • There are, of course, plenty of directions you can go with this once you understand the technique. Statistic reporting, custom server logging, cool admin tools, etc. The only limit is your imagination.
    ;-)

    technorati tag: ,

    JavaScript Lists (UPDATED) (Friday, Jun 23)
    [ permalink ] [ GoogleTrack ] [ e-mail me ] [ >> ]

    NOTE: the original version of this blog post used "var whateverList = new Array()", and was changed to use "new Object()" instead. Thanks to Andrew Tetlaw for pointing out that several smart JavaScript gurus (a club of which I'm certainly not a member) have recently discussed this very subject and have come to the conclusion that "new Object() is the correct way to do this. See this Ajaxian post and this post by Andrew Dupont for the whole story.

    And I apologize for reporting what is apparently old news, after reading through those other blog postings. I've actually been using this technique for a while (see my Zip Code Lookup page from a year and a half ago, for example) but never thought to discuss it before. Late to the party, as usual...
    ;-)


    I was writing some JavaScript today and was using a technique that may not be obvious, so I thought it would be a good thing to share with the class.

    In LotusScript, we often use Lists to easily manage... well, lists of information, at times where an Array would be inconvenient or impossible to use. In JavaScript, you can create Objects that act much like your LotusScript Lists. For example:

    var fruitList = new Object();
    fruitList["apple"] = "red";
    fruitList["orange"] = "orange";
    fruitList["pear"] = "green";
    for (fruit in fruitList) {
      alert("A " + fruit + " is " + fruitList[fruit]);
    }
    

    This can be especially handy when you're aggregating values. For example:

    var divs = document.getElementsByTagName("div");
    var divList = new Object();
    for (i = 0; i < divs.length; i++) {
      var cls = divs[i].className;
      divList[cls] = (divList[cls] ? divList[cls] + 1 : 1);
    }
    for (div in divList) {
      alert(divList[div] + " divs use the class " + div);
    }
    

    Keep in mind that such a list will not have a .length property (or any properties, for that matter), although you could easily determine the length by iterating through it.

    Winmail Extractor Update (Wednesday, Jun 21)
    [ permalink ] [ GoogleTrack ] [ e-mail me ] [ >> ]

    Thanks for all the positive feedback on the Winmail Extractor database that I posted to OpenNTF last week. It's over 100 downloads already, and... well, so far so good.

    I just posted a slightly updated version -- version 1.1 -- so you can take a look if you want. There aren't any bug fixes, so the original version should continue to work just fine. Really what I did was to make it easier to change the language of the messages that are returned to the user. Not everyone speaks English, of course. Gerco Wolfswinkel left a comment asking if I could allow all of the language-specific strings to be set in the Profile document instead of in the code itself, and that seemed like a good thing to do. So I did.
    ;-)

    Otherwise, a commenter on the previous post pointed out that the Lotus Notes 7.0.2 update will include a way to natively deal with TNEF/Winmail.dat files. Thank goodness!

    I responded that I would be more than happy for this database to become obsolete, and I'm all for improvements to the Notes client. However, the 7.0.2 update won't be available for several more months, and frankly not everyone is going to be in a position to upgrade to 7.02 when it does come out. Plenty of people are still at 6.x.

    So anyway, new Winmail Extractor database version on OpenNTF -- download it if you need it.

    Ubuntu Performance Tips (Tuesday, Jun 20)
    [ permalink ] [ GoogleTrack ] [ e-mail me ] [ >> ]

    I told Jack Dausman that I was going to blog this after his most recent DC Lotus User Group meeting, which featured Jack doing a presentation on the joys of Ubuntu. But then I forgot. And now I remembered. So...

    Here are a few useful Ubuntu links that my friend Mark sent to me a few weeks ago:

    Running Internet Explorer on Linux
    http://www.tatanka.com.br/ies4linux/index-en.html

    This is a package of the files necessary to run Internet Explorer in Wine. Not that you'd really want to use IE as a browser on Linux, but if you need to test web pages for IE compatibility without leaving the comfort of your Linux environment, it could come in handy.

    One thing I thought was funny about this page is that it advertises itself as "No clicks needed. No boring setup processes. No Wine complications. Just one easy script and you'll get three IE versions to test your Sites."

    And then it tells you that you need to install Wine and cabextract first, and run the executable to install it. Not sure what "no Wine complications" was supposed to mean there...

    Ubuntu Performance Settings
    http://ubuntuforums.org/showthread.php?t=189192

    I haven't tried too many of these yet, but it's good information. Especially the tip about installing the right kernel for your processor. By default, everyone gets the i386 kernel -- which pretty much runs on anything Intel/AMD based, but doesn't have any optimizations.

    To see what you're currently running, open a terminal window and type:

    uname -a

    which will tell you what kernel version is installed (2.6.12-10-386 for me) and what kind of processor has been detected (i686 on mine).

    If you want to see some specifics about the processor you have, type:

    cat /proc/cpuinfo

    to tell you the processor type, speed, and cache size that are being detected.

    Anyway, on my machine, I wanted to get the i686 kernel, so I did this (I think all the kernels are available via Synaptic also):

    sudo apt-get install linux-686

    which downloaded and installed the correct kernel for me. I'm not sure if you have to reboot after that (pretty sure you don't), but I did anyway.

    Another good tip that I had already done was enabling DMA support on my hard drive. It's also something you want to do on your CD/DVD drives (along with enabling async I/O). Just do a:

    sudo gedit /etc/hdparm.conf

    and follow the instructions. For most Ubuntu installs, you can just uncomment out the last hard drive example (/hda) and restart -- or remount I suppose, but I usually feel better rebooting. On my system the CD and DVD drives were showing up as hdc and hdd, although YMMV.

    The other thing I tried was SwiftFox, the optimized Firefox distro for Linux at: http://getswiftfox.com

    To determine which version you need (they compiled it for all manner of processors), just do a "cat /proc/cpuinfo" as before to determine your processor type. After that you just download, unzip, and run the "firefox" shell program directly from the unzip directory (no install required).

    However, I will warn you that after using SwiftFox the first time on my machine, I could no longer use the Firefox install I already had -- presumably because some of the program files and/or extensions had been updated and were no longer compatible with the slightly older version of Firefox on my machine. Firefox would try to launch, and then nothing would happen. I had to do a "killall firefox-bin" to kill it and run SwiftFox instead.

    It seems to be better now that I updated to Dapper, though. It's also very possible that the Dapper version of Firefox is faster anyway, and this tip isn't as important anymore. Not sure.

    SnTT: Winmail Extractor Database (Thursday, Jun 15)
    [ permalink ] [ GoogleTrack ] [ e-mail me ] [ >> ]

    This week's Show and Tell Thursday post is an announcement of a new OpenNTF project:

    The Winmail Extractor database

    Long ago (coming up on 2 years ago) I posted an agent that you could add to your mail database to extract the contents of TNEF files -- a TNEF file being one of those Winmail.dat or ATT0001.dat files produced by an improperly configured MS Outlook client. My agent was a Java agent that makes use of the open-source and GPLed JTNEF library by Amichai Rothman.

    I get a lot of e-mails from people who are using this agent and are happy with it, but I also get a fair amount of "support" e-mails from people who really aren't sure how to set agents up in the first place (especially Java agents).

    In the spirit of "there has to be a better way", it occurred to me recently that an easier way to implement this functionality would be to create a mail-in database that processes the e-mails for the users. That way it could be set up one time by an administrator (instead of in every user's mail database), and all the users would have to do is forward their Winmail.dat e-mails to the mail-in database and wait a minute for a response.

    So that's what I did.

    All the functionality of the agent is now wrapped up in an "After new mail arrives" agent in the Winmail Extractor database, so all you have to do is:

    I tried to write the code so it will run on Windows and *NIX servers, and I have some instructions on what to change if you want to use it in a non-English language environment. However, since this is the first release of the database, I'm hoping that people can test it out and find some bugs for me.
    ;-)

    Hope that helps someone out there.

    UPDATE: oh, and of course this database uses OpenLog for error handling. If you're looking for an example of how easy it is to use OpenLog with Java agents/script libraries.

    UPDATE #2: Chris Whisonant has already tested the database on iSeries... and it worked! Woot! Thanks Chris.

    technorati tag: ,

    Ubuntu Upgrade (Tuesday, Jun 13)
    [ permalink ] [ GoogleTrack ] [ e-mail me ] [ >> ]

    I finally got around to upgrading my Ubuntu system to 6.06 (Dapper Drake) yesterday. Man, was that easy. I opened the Update Manager, clicked the "Check" button to make sure I was current on all my packages, and then clicked the "Upgrade" button at the top of the dialog:

    There were a few prompts I had to answer yes or no to, but otherwise it just updated everything by itself. The 2 downsides were:

    But really those are minor complaints, because it really was very painless and automatic.

    I even took a chance and let it update my Wine install to 0.9.9. I've had Lotus Notes running under Wine pretty smoothly for a while now, but that was on an older version that I locked in Synaptic so it wouldn't update. I actually did have some Notes client crashes after the 0.9.9 update, but thanks to some tips by Ted Ruegsegger (specifically renaming /usr/lib/wine/usp10.dll.so and adding a native mfc42u.dll file) it seems to be up and running again. And much faster too! I haven't used it enough to see if there's any weirdness (like hangs or crashes), but so far so good.

    Slow Windows Unzip? Try 7-Zip (Monday, Jun 12)
    [ permalink ] [ GoogleTrack ] [ e-mail me ] [ >> ]

    I was unzipping the Java 1.5 documentation the other day so I could have it locally on my computer. I used the built-in Windows "Extract All..." menu option to do this, and it took forever. I finally just walked away from the computer for a while, and it was done when I came back. I just figured that since it was a 44 MB zip file with over 10,000 files zipped up inside it, that was how long it took.

    Well, for some reason it was still on my mind this morning, so I did a timing test. Here's the extraction progress using the native Windows unzip functionality:

    Windows Unzip Timing

    It ended up taking 44 minutes and 36 seconds to extract all the files. I checked to make sure that there were no strange anti-virus scans or hard drive utilities running at the time, and there weren't. Just the file extraction.

    Then I tried extracting using 7-Zip, which I often have loaded on my computers to deal with non-pkzip archives like TAR/GZIP files. Here's a screenshot:

    7-Zip Unzip Timing

    Total time to extract: 1 minute 8 seconds. Yeah, that's just a hair faster.

    BTW, the stopwatch program you see running is the StopWhatcher widget that runs on the Yahoo Widget Engine (the technology formerly known as Konfabulator). Not a high degree of accuracy, but for a "loose" timing test of over 1 minute it was close enough.

    Lotus Toilet Seats (Sunday, Jun 11)
    [ permalink ] [ GoogleTrack ] [ e-mail me ] [ >> ]

    Via the latest entry on Mr. Ports' blog, I spotted a link to the Lotus Smart Toilet Seats web site:

    Lotus Smart Toilet Seats

    Another fine Lotus-branded product. And check out the features on the product page:

    I mean, do I want a toilet seat with Massage Wash, a Dryer, AND a Remote Control? Hell yes I do!

    Task Manager Shutdown Menu (or not) (Friday, Jun 9)
    [ permalink ] [ GoogleTrack ] [ e-mail me ] [ >> ]

    In a comment to a blog entry about rebooting remote computers from a few weeks ago, Bill Buchan mentioned that the Task Manager menu on one of his remote machines had a Shutdown menu. Like this:

    Task Manager with Shutdown Menu

    Strange thing was, my machine and none of the machines I could remote console into had "Shutdown" as a menu option. Everything else about the Task Manager menu was the same, but no Shutdown option.

    After a lot of research and testing, I found out that the Shutdown menu option is only available if you use the Windows XP Welcome Screen. If you use CTL-ALT-DEL to log in, it's not there. Strange but true. I was unable to find out if there was any kind of registry hack to turn the menu option on if you aren't using the Welcome Screen.

    Also, a few people suggested that CTL-ALT-END brings up a shutdown option on machines that you're remote consoled into -- which is a good tip if you actually do have remote console access to the other machine. If you don't, you have to use other means.

    SnTT: Use Java To Get URL Files, Access The Clipboard (Thursday, Jun 8)
    [ permalink ] [ GoogleTrack ] [ e-mail me ] [ >> ]

    This week's Show 'n Tell Thursday bit is actually inspired by a couple of SnTT posts by other people from last week.

    First off, Steve Castledine was looking for a cross-platform way to copy to the system clipboard. He used a neat trick that quickly created a UIDoc, wrote to a field, and then copied the field and closed the doc. Pretty clever.

    You can do it in Java too. Here's a sample agent that shows you how: NotesClipboard.java.

    Second, Tim Tripcony lamented the fact that there wasn't an easy way in Java to get the contents of a web page. He wrote a solution but didn't share with the class...
    ;-)

    Here's how I usually grab files from the Internet in Java: NotesGetUrlFile.java.

    That's all for now. I've also been meaning to try to turn my simple HTTP proxy program into a servlet in response to Joachim Dagerot's post from a few weeks ago, but haven't had a chance to see if it would convert properly. If I ever get around to that I'll post it too.

    technorati tag: ,