The October 2008 Blog
send me a comment

Pumpkin Destruction Day (Friday, Oct 31)
[ permalink ] [ e-mail me ] [ ]

I got an e-mail today about Pumpkin Destruction Day, going on this weekend at the Rock Ranch in Barnesville, GA. From the e-mail:

This Saturday (November 1) is Pumpkin Destruction Day at The Rock Ranch. This event takes place from 10am to 10pm and offers fun and exciting methods of recycling the family pumpkin and creating a fun family memory. In addition to the everyday attractions at The Rock Ranch, guests will enjoy pumpkin destruction by using:

  • the pumpkin cannon (that will shoot pumpkins through an unsuspecting automobile)
  • the hammer smash
  • pumpkin bowling
  • pumpkin pie eating contests
  • pumpkin crushing (a monster truck style exhibition where large trucks and other equipment will run over pumpkins)
  • the pumpkin drop (from a 40 foot lift crane)
  • pumpkin bombing airplanes
  • pumpkin rolling races
  • pumpkin mashing (with a tractor)

Guest may choose to bring their own family pumpkin or they may use some of the pumpkins remaining from The Rock Ranch pumpkin patch.

That's just good clean fun right there. I've watched the pumpkin cannon in action before, and it rocks. When we were there last year a pumpkin shot several hundred yards across a huge pond and bounced off a cow. Yeehaw brother, yeehaw.

The pumpkin cannon at Rock Ranch in Barnesville, GA

I also found a video of the pumpkin cannon, and surely there are more such things on YouTube. Happy Halloween y'all!

XmlNodeReader: An Easy Way To Parse XML In LotusScript (Monday, Oct 27)
[ permalink ] [ e-mail me ] [ ]

I've been toying around recently with ATOM feeds from Quickr, and lamenting the fact that there isn't an easier way to parse and read XML in LotusScript. So, over the past few weeks I've spent some time developing a wrapper around the NotesDomNode class to simplify the whole process. Here's what I came up with:

  • XmlNodeReader: an easy way to parse XML in LotusScript
  • It's kind of a poor man's XPath -- not all the functionality and power, but very easy to use and understand. For example:

    Set exporter = session.CreateDXLExporter(db, stream)
    Dim reader As New XmlNodeReader
    Call reader.ReadStream( stream )
    Print reader.get( "database.@title" )

    I used LotusScript.doc to generate the documentation and put together a few sample agents for you to play with. Hopefully it all makes sense to someone besides me. Personally, it's made it a lot easier to deal with XML in my code.

    Stuffed Mushroom Recipe (Sunday, Oct 26)
    [ permalink ] [ e-mail me ] [ ]

    A little off-topic, but I've posted recipes here before (like crab dip) so I have precedent. Anyhoo, we've made this stuffed mushroom recipe a couple times in the last few days, and it's really easy to make and a really good appetizer for guests.

    One note about this: make sure you use UNSALTED butter -- people who have commented on the recipe have mentioned that using salted butter makes it very... salty. Also, what I listed below has been modified slightly based on us not having any sliced almonds and using small/medium white mushrooms instead of large mushrooms. If you're truly using large mushrooms, see the original recipe for adjusted proportions.


    Remove stems from mushrooms and finely chop; set caps aside. In a skillet, saute chopped mushroom stems in butter until tender, about 6-8 minutes. Remove from heat; stir in bread crumbs and onion soup mix. Stuff firmly into mushroom caps. Place on a baking pan or cookie sheet; sprinkle with cheese. Bake, uncovered, at 425 degrees F for 12-15 minutes or until tender.

    Endless Streetcar Ride (Tuesday, Oct 14)
    [ permalink ] [ e-mail me ] [ ]

    There are certain stories and books that stick in your mind your whole life. For whatever reason, a bit of story or poetry will resound very deeply when you read it, and it will keep coming back and replaying itself over and over.

    A short story I read in seventh grade [I think... close enough anyway] did this to me. It was called The Endless Streetcar Ride into the Night, and the Tinfoil Noose, and I finally found it on the Internet so I formatted it and saved it so I'll always have it. Click the link, you can read it for yourself.

    A few things were interesting for me in the search for that story. It was really hard for me to find because I remembered ideas but not too many searchable details, and the details I remembered were ever so slightly wrong. I remembered something about a tie with an electric blue snail on it, and a deodorant advertisement that said "Do you offend?", both of which were almost right but not quite. "Almost right" is hard to search on sometimes. In fact, I've probably been trying to find that story on the 'net for a few years now, and it took this long to get the correct combination of search terms and available sources.

    Another interesting thing is that the story is even better than I remember it, which isn't always how these things work out (your mind can make grand memories out of plain things). I think I re-read it 4 or 5 times in the last day or so and it keeps making me smile.

    I also had no idea that it was one of the short stories from Jean Shepherd's book In God We Trust, All Others Pay Cash, which is what parts of the modern classic movie A Christmas Story is based on. I'm finally going to buy that book and read the whole thing.

    Anyway, you might like it too, you might not. And maybe in some sort of way it'll explain all sorts of weird things about me, I dunno. I'm just glad to have found it again.

    SnTT: Run JavaScript Via LotusScript (Thursday, Oct 9)
    [ permalink ] [ e-mail me ] [ ]

    UPDATE: I added some information below about my JIT debugger getting launched in certain instances, and how to disable the debugger.

    I almost had a need to call a JavaScript function from within a LotusScript agent the other day. It turns out that I didn't have to go that route in the end, but if I had it's actually quite easy to do -- at least if you're on Windows. Here's how:

        Dim js As Variant
        Set js = CreateObject ("MSScriptControl.ScriptControl")
        js.Language = "javascript"
        Call js.AddCode( "function add2(num) { return num+2; }" )
        '** NOTE: Eval() will not always trigger runtime errors, so you should 
        '** make sure to trap JavaScript errors with try/catch blocks
        Msgbox js.Eval("add2(5)")

    Pretty easy, huh? You just create an MSScriptControl object, load your JavaScript functions using AddCode(), and call Eval() with whatever parameters you want. It's even easy to modify any of the code or parameters at runtime too, so you have a lot of flexibility.

    You'll also see that I left you a note in the comments that a JavaScript runtime error that results from using the Eval() method will not always trigger a runtime error in LotusScript. For example, if your JavaScript function was "{return num/0;}" it would compile just fine, but when you ran the code and got a divide-by-zero error it wouldn't be obvious that an error occurred. You still get a result, but it's a really funky string ("1.#INF" for me).

    Be careful though. One of my machines has some JavaScript JIT debuggers installed and registered, and with certain runtime errors the code would halt and I would get prompted with this dialog:

    JavaScript JIT Debugger Dialog

    You wouldn't want this happening on your client machines, and certainly not on your servers. If you set the following Windows registry entry to 0 (zero), the JIT debugger will be disabled:

    HKEY_CURRENT_USER\Software\Microsoft\Windows Script\Settings\JITDebug
    # a value of 1 will enable JIT debugging, 0 will disable

    In any case, make sure you have good try/catch blocks in any JavaScript code you run, and check your input parameters BEFORE you call Eval().

    Compile errors (i.e. -- bad JavaScript syntax) WILL always trigger a LotusScript error in the AddCode() method, though. You can catch compile-time errors (and some runtime errors) with an error-handler like this:

        If (js Is Nothing) Then
            Print "LotusScript error: " & Error
        Elseif (js.Error.Description = "") Then
            Print "LotusScript error: " & Error
            '** for the various error object properties, see
            Print "JavaScript error: " & js.Error.Description
        End If

    I don't have any "real world" production experience with this technique, so I'm not sure what kind of performance hits you might get, especially if you run the same code a bunch of times or load up a really large amount of JavaScript to use for processing. However, if you have a few relatively small chunks of JavaScript code with functionality that might be difficult to reproduce in LotusScript, this might give you a quick win.

    Show NLCache Reset (Thursday, Oct 2)
    [ permalink ] [ e-mail me ] [ ]

    Note to self: when testing web applications on a Domino server, especially when you're changing group memberships and user access and ACLs to see what effects they have, issue a "show nlcache reset" command on the server after each change. You'll save yourself from pulling a lot of hairs out and wondering why security doesn't work the way you think it does.

    Thanks to Thomas Gumz and others for telling us non-admin-types these things.

    Oh, and I should be extra responsible by saying that you should consult your admin before issuing this command on a busy server with a big directory. But you ARE doing all your changes and testing on a development server, right?