The May 2007 Blog
send me a comment

The UrlFetcher LotusScript Library (Tuesday, May 22)
[ permalink ] [ e-mail me ] [ ]

Last week we talked about getting URLs in LotusScript, and Jan-Piet Mens asked about a more cross-platform approach (actually, he also made the same request on his own blog a few months ago). So, I recycled some old code and wrote some new, and J-P helped me test and debug it. As a result, here is a database with some Java and LS2J code that allows you to easily make cross-platform GET and POST requests from Java or LotusScript:

The UrlFetcher Java library is pretty well commented, and should answer most of your questions about how everything works. The UrlFetcherLS library in LotusScript is just an LS2J wrapper around the Java stuff, and it's not nearly as well documented, but just read the comments in the Java class and you'll figure it out.

There are also a few sample agents that show how some of the functionality works. For example:

Option Public
Option Declare
Use "UrlFetcherLS"

Sub Initialize
	Dim fetcher As New UrlFetcher
	Print fetcher.getUrlAsString("http://www.nsftools.com")
End Sub

That's not too bad, is it? You can also get HTTP headers, set headers, add POST parameters, make proxy settings, and a few other things. I even have an example of making an SSL/HTTPS request, but that's Notes 7 only. Everything else should work in both Notes 6 and 7.

GMail Spellcheck (Correction: It's Firefox) (Monday, May 21)
[ permalink ] [ e-mail me ] [ ]

CORRECTION: Okay, I'm a bonehead. It's actually Firefox 2.0 doing the spellchecking, not Gmail. I finally updated from Firefox 1.5 on the machine I usually check mail on. I thought about deleting this blog entry and pretending I never wrote it, but then I figured I'd just leave my tattered laundry out for everyone to see. What the heck.


This is cool. There's inline spellcheck in Gmail Firefox -- using the familiar red dotted underline for unknown words and right-click to get suggestions:

GMail Spellcheck Screenshot

Then again, maybe it's been there for a while (UPDATE: yes, it has...) and I've never noticed (UPDATE: stupid, stupid, stupid...). It works in Gmail chat too.

Article on Web Services in Domino 8 (Wednesday, May 16)
[ permalink ] [ e-mail me ] [ ]

There's a new Domino Web Services article on developerWorks today: Engineering WS-I compliant Web Services for IBM Lotus Domino V8.

Even if you're not specifically interested in trying to make your Domino Web Services fully WS-I compliant, there are some great tips and gotchas in there, including:

Regarding arrays as parameters using custom classes/complex data types, here's how I like to set that up:

Class PhoneNumbers
    Public phoneNumberArray() As String
    Public count As Integer
End Class

Class DirectoryAssistance
    Public Function reverseLookup (nums As PhoneNumbers) As NameList
        ...
    End Function
End Class

I mention this type of setup in one of my web services articles. The nice thing about this structure is that it's easy for the client to determine whether or not an array that is a return value is empty (count=0) or not -- you can decide for yourself if you want to enforce proper "count" values on the server side when accepting the class as a parameter.

Luckily, it also seems to have the fortunate side-effect of making the arrays work properly as method parameters for WSDL formats other than RPC/Encoded. I need to do some more testing to confirm, but I don't remember having problems before, and the new "WS-I Compliant Web Services" article seems to say that it's true.

Native TNEF Decoding, Java Library Crashes (Monday, May 14)
[ permalink ] [ e-mail me ] [ ]

Here are two [hopefully] unrelated interesting things I saw recently on the IBM Support site.

First, SPR #SBRN5PGPCN describes a fix for TNEF extraction on Domino. The really interesting thing is that it applies to Domino 7.0.2 and 6.5.6. So maybe native TNEF extraction is in the Domino 6.5.6 server too? That would be cool. I'm not sure if I saw that anywhere before or not.

Second, Technote #1202732 describes a scenario where Java JAR files that are attached to agents or script libraries can cause Out Of Memory errors. There's an SPR associated with it, which would seem to indicate that it's a problem that hasn't been fixed yet. The solution is to detach the JAR file to the local file system and access it that way (either the JavaUserClasses INI setting or just plopping it in the JRE ext directory).

The wording of the technote (at the time I'm writing this -- it may change) makes it a little unclear as to whether this affects code that run on servers, or just clients. It talks about a "Domino client" (?!?), and also mentions that if you access the library using JavaUserClasses then every time the JAR file changes "you must copy it to your local server" -- and, um, I don't think that a Notes client that has a JAR file listed in JavaUserClasses would look on a Domino server for a JAR file. But hey, maybe it does, and that's one more thing I don't know.

Debugging JavaScript in IE (Sunday, May 13)
[ permalink ] [ e-mail me ] [ ]

Now, I know that the be-all-end-all of JavaScript debuggers these days is Firebug, but sometimes I have to use Internet Explorer for my testing (like intranet pages with VBScript or ActiveX controls). I've always used the old Microsoft Script Debugger for such things -- which isn't even in the same league as Firebug, but at least it allows you to step through code and change variables and execute expressions on the fly.

In the last week or so, I've seen links to two very interesting other ways of debugging JavaScript in IE:

So, new toys to try...

UPDATE: I got some great suggestions in the comments so far, including:

SnTT: Fetching URLs With LotusScript (Thursday, May 10)
[ permalink ] [ e-mail me ] [ ]

Someone asked me how to fetch a URL using LotusScript today. It's pretty easy, but if you need some code here's an old test agent I dug up:

Sub Initialize '** this will give you the whole web page, not including the HTTP Headers, '** as raw HTML/XML text Dim XmlHttpRequest As Variant Dim response As String Set XmlHttpRequest = CreateObject("Microsoft.XMLHTTP") Call XmlHttpRequest.Open("GET", "http://www.google.com", False) Call XmlHttpRequest.Send() response = XmlHttpRequest.responseText '** this will give you the body of the web page, translated to NotesRichText '** (the HTTP headers are available as individual fields -- one for each header '** name -- on the document) Dim session As New NotesSession Dim db As NotesDatabase Dim doc As NotesDocument Dim pageBody As String Set db = session.CurrentDatabase Set doc = db.GetDocumentByURL("http://www.google.com", True) pageBody = doc.GetItemValue("Body")(0) Call doc.Remove(True) End Sub

If you run this on a server, make sure you have the "Runtime Security Level" set to at least "2", since you're doing network operations.

Also, the GetDocumentByURL method uses the Web Navigator database somehow (perweb.nsf on the client, or web.nsf plus the WEB service on a server), so make sure that's all set up properly. That database can get kind of funky sometimes and cause problems, as John Roling can tell you. On the other hand, the XmlHttpRequest method only works on Windows, so choose your poison.

BONUS: Thomas Adrian has a good quick reference on his site too.

UPDATE: Markus Koller mentioned in the comments that ServerXmlHttp might be a better option than XmlHttp for this -- and he linked to a very good Microsoft Knowledgebase article describing the difference between the two. Looks like ServerXmlHttp allows you to set up some proxy settings, which could be very handy. Thanks Markus!

technorati tag: ,

A Warren Of Rabbits (Wednesday, May 9)
[ permalink ] [ e-mail me ] [ ]

We saw a couple of rabbits in the back yard the other day, and since there was more than one I told the kids that there are probably a whole bunch of them out in the woods somewhere -- or will be soon, they being rabbits and all...

However, I knew that "bunch" wasn't the correct word for a group of rabbits. I know that cows are in herds, birds are in flocks, and even that frogs are in armies. But I had no idea what the collective name for rabbits was.

Go Google, go! After one or two searches and a few clicked links, I found two excellent references:

The reference.com page is a little more complete, but the San Diego Zoo site has some great links with more information about the animals themselves. I think my favorites on the list were a plague of locusts, and a shiver of sharks. A parliament of owls and a scourge or mosquitoes were probably close seconds.

Oh, and rabbits come in "warrens" (there were a few other names, but that seemed the most common in other references).

A Dog Named Poop (Wednesday, May 2)
[ permalink ] [ e-mail me ] [ ]

This weekend we got a dog. A puppy actually. From the Humane Society, so she's nice and "rescued". Here's a picture:

Julian and the dog: feel the love

You can just feel the love right there, can't you?

She's actually a really good dog, except for the fact that she's not quite housebroken yet. We're still trying out different names on her. I'm currently leaning toward the name: "It Shits All Over The House" -- that would be "Isaoth" for short, but it doesn't have a good ring to it. We'll see.

Drive Cancelled (Tuesday, May 1)
[ permalink ] [ e-mail me ] [ ]

What better way to pull me out of an unofficial one month blogging break than for Fox Broadcasting to cancel my new favorite show: Drive.

Drive: the TV Show on Fox

Produced by Tim Minear (producer/co-writer of Firefly and Angel) and starring Nathan Fillion (star of Firefly), it was a show that Joss Whedon fans at least had to try -- I tried it and liked it. A lot.

After only four episodes, it got pulled off the air. Rumor has it that it got poor ratings and it was also lowering ratings for '24'.

However, that just doesn't sound right to me. There are plenty of truly lousy shows that last WAY more than 4 episodes. And if it was a ratings issue for '24', they could have just moved it to another night. There's got to be something else going on there. Here are my conspiracy theories:

I'm pretty fond of the last theory, even if it's kind of far-fetched. Firefly was hugely successful AFTER it got cancelled by Fox, and has sold a whole lot of DVD box sets. The success was largely a word-of-mouth and Internet grassroots effort. Fox will supposedly air the LAST two episodes of the show this summer, but I'm wondering if they might continue on where they left off if there's enough "underground" interest -- especially because there would be much less competition from other popular shows over the summer.

Maybe it's just wishful thinking on my part too...

Oh, and if you missed the show, now's a good time to watch the first 4 episodes. You can buy the episodes for $1.99 each at the official BitTorrent site, or I've heard that the torrents are also available for download on "other" servers. I'm not sure if a Google search for "drive fox torrent" would help there or not.