The Latest Blog
send me a comment

Agent to List Databases+Info on a Server (Friday, Aug 22)
[ permalink ] [ e-mail me ] [ ]

I meant to write this up last night, but I got tired and went to bed instead. So here's an early morning blog post for you.

This is code for an agent that will connect to a server, get all the databases (and templates) on the server, and write a ton of information about each database to a comma-delimited file for your spreadsheeting pleasure:

Just import the LSS file into a new agent, save it, and run it. You will be prompted for a server and an output file name, and in return you will get a CSV file with lots and lots of information.

Note that I have only tested this on Domino 8 and you MUST have rights to run remote console commands on the server you run this against -- if you don't, you can get a subset of this information using NotesDbDirectory, but it's a LOT slower (I leave this as an exercise for the reader). Also, the code to get a list of servers is Windows-only, so you Mac guys may need to comment a few things out (not sure).

Oh, and speaking of CSV files, the reverend Steve McDonagh posted a fix to my CsvReader class for those of you who need to use CsvReader on an iSeries box. Apparently you have to open text files in a very special way on an iSeries.

Passport Renewal (Saturday, Aug 16)
[ permalink ] [ e-mail me ] [ ]

A couple months ago I realized my passport was going to expire early next year. I know I'll be out of the country a few more times this year (Collaboration University and UKLUG in London, and the View Developer conference in Amsterdam), so I figured I'd look into getting my passport renewed in January after all that travel was over.

Well, then someone told me that some countries won't accept your passport if it's going to expire within 6 months of your anticipated return date. I thought that was strange, but I did a quick search (since Google knows everything) and sure enough it's true. In fact, you can even look up the country you're going to on the US International Travel site and check the passport expiration rules.

Just to be safe I went ahead and renewed my passport. I even paid the extra $60 for the "Expedited" service since CollabU and UKLUG are next month, and I remember that a few people had serious delays with their passports before ILUG last year. Happily, I got my new passport less than 2 weeks after I sent the application off (along with my current passport, which was a little scary to be without) for processing. It's nice when things work the way they're supposed to.

Ninjalympics (Wednesday, Aug 13)
[ permalink ] [ e-mail me ] [ ]

Tired of the Olympics? Too bad they're not televising the Ninjalympics:

AskANinja Ninjalympics

AskANinja also has the best explanation of the problem with Net Neutrality I've ever heard.

Yellow Day: Infinite Recursive Notes Icon (Monday, Aug 11)
[ permalink ] [ e-mail me ] [ ]

In celebration of Yellow Day, here's a little something to make you dizzy: an infinite recursive Lotus Notes icon:

Infinite Recursive Lotus Notes Icon

It's not quite as smooth as the Hasselhoffian recursion (thanks Damien) or the Sierpinski zoom, but it's not bad for something I threw together in front of the TV. If you have greater graphic abilities than I do (which is likely), please feel free to improve on the technique.

Macho Manscara (Saturday, Aug 9)
[ permalink ] [ e-mail me ] [ ]

I was listening to the Wait, Wait, Don't Tell Me podcast this morning (a funny "week in review" sort of show), and they had a story about a company that is trying to enter the largely untapped market of male cosmetics. Their new line is called Taxi Man.

In a hurry for dinner? Late for work? Don't worry men, just apply a little Manscara and Guy-Liner and you'll be as fresh as ever.

Dude, you look Mantastic!

Cauliflower Mushroom (Wednesday, Aug 6)
[ permalink ] [ e-mail me ] [ ]

I was walking through my back yard yesterday and saw this laying near some trees:

Sparassis crispa aka Cauliflower Mushroom (looks like a loofah sponge to me)

It's about the size of a small teapot. I thought it was a loofah sponge that the dog dragged into the yard, but it was rooted to the ground. A little Internet research later, and I'm pretty sure it's a Sparassis crispa, also known as a Cauliflower Mushroom. Supposedly it's edible and delicious when young and fresh, but I don't think I'll be eating it.

Just for kicks, I also uploaded the picture to WikiMedia Commons. I'm not a Wikipedia contributor or anything (well, I guess I am now), but I had a hard enough time identifying what the heck it was that I figured I'd share the photo with the world. Maybe that'll help someone else.

Run Command Line Tools Using Java (Tuesday, Aug 5)
[ permalink ] [ e-mail me ] [ ]

In case you didn't realize this, you can actually run programs and command line tools using Java, similar to the LotusScript "Shell" function. The advantage this has over the Shell function is that you can capture the output of a command line tool or statement without having to resort to creating batch files and trying to wait until they're done.

For example, here's an agent that will run NBTStat to attempt to determine the machine name and user login name for a given IP address:

import lotus.domino.*;
import java.net.*;
import java.io.*;
import java.util.*;

// NOTE: Agent Runtime Security must be at least 2, and
// agent signer must be able to run unrestricted operations
public class JavaAgent extends AgentBase {

    public void NotesMain() {

        try {
            Session session = getSession();
            AgentContext agentContext = session.getAgentContext();
            Document doc = agentContext.getDocumentContext();
            String remoteAddr = doc.getItemValueString("Remote_Addr");
            InetAddress addr = InetAddress.getByName(remoteAddr);
            
            PrintWriter pw = getAgentOutput();
            pw.println("Remote address is: " + addr.getHostName());
            
            String[] cmd = new String[3];
            cmd[0] = "cmd.exe" ;
            cmd[1] = "/C" ;
            cmd[2] = "nbtstat -A " + remoteAddr;
           
            // must be run with unrestricted access
            Runtime rt = Runtime.getRuntime();
            Process proc = rt.exec(cmd);
            BufferedReader in = new BufferedReader(
                    new InputStreamReader(proc.getInputStream()) );
            BufferedReader err = new BufferedReader(
                    new InputStreamReader(proc.getErrorStream()) );
            //int exitVal = proc.waitFor();
            
            // instead of printing the output, you could parse it of course
            String line = "";
            pw.println("<br/><br/><b>Output is:</b><br/>");
            while ( (line = in.readLine()) != null)
                pw.println("<br/>" + line);
            
            pw.println("<br/><br/><b>Errors were:</b><br>");
            while ( (line = err.readLine()) != null)
                pw.println("<br/>" + line);
            
        } catch(Exception e) {
            e.printStackTrace();
        }
    }
}

As I mention in the code comments, an agent using this technique must have a runtime security setting of at least 2 ("Allow restricted operations"), and the agent signer must have the ability to run unrestricted operations.

Compile JavaScript to EXE, More LotusScript Speech (Sunday, Aug 3)
[ permalink ] [ e-mail me ] [ ]

My last blog entry about talking LotusScript was supposed to be kind of a throw-away bit of code, but there was enough interest in it that I decided to research the Microsoft Speech Application Programming Interface (SAPI) a bit more. There is also a Java Speech API, but I haven't had time to play with that yet.

Before I get into bullet points though, there was an interesting diversion on one of the pages that came up in my searches. On "The Glass Is Too Big" blog, there was some discussion on using MS SAPI to convert an RSS feed to a podcast, along with some instructions on how to compile JavaScript to an EXE file using the free .NET SDK -- in fact, you may already have the jsc.exe file in your C:\WINDOWS\Microsoft.NET\Framework\v### folder. I'm going to file that away under the "might be interesting to try out sometime" category in my brain. (Yes, I know that technically it's JScript being written/compiled, not JavaScript.)

Anyway, a few tidbits about SAPI:

On the LotusScript side of things, here's a slightly longer bit of sample code than before:

Sub Initialize
    Dim spVoice As Variant
    Dim voices As Variant
    Dim v As Variant
    Dim i As Integer
    Dim msg As String
    Set spVoice = CreateObject("SAPI.SpVoice")
    Set voices = spVoice.getVoices()
    For i = 0 To voices.Count-1
        Set v = voices.Item(i)
        Set spVoice.Voice = v
        msg = "Voice " & i & " is called " & v.GetDescription(0)
        Print msg
        Call spVoice.Speak(msg, 0)
    Next
    
    Dim fileStream As Variant
    Dim fileName As String
    Set fileStream = CreateObject("SAPI.SpFileStream")
    fileName = "C:\TestAudioOutputStream.wav"
    Call fileStream.Open(fileName, 3, False)
    Set spVoice.AudioOutputStream = fileStream
    Call spVoice.Speak("I got two. turn tables, and a microphone", 0)
    Call fileStream.Close
    Set spVoice.AudioOutputStream = Nothing
End Sub

Talking LotusScript (Friday, Aug 1)
[ permalink ] [ e-mail me ] [ ]

Here's a little Friday fun for you. Create a button in a Lotus Notes e-mail with the following code:

Sub Click(Source As Button)
    Dim voice As Variant
    Set voice = CreateObject("SAPI.SpVoice")
    Call voice.Speak("Would you like to play a game?", 0)
End Sub

Then send the e-mail to someone old enough to remember the movie War Games and get them to click the button.

For bonus points, use Tim Tripcony's event binding code to inject this into the PostOpen event of every view and form in a database.

NOTE: I'm not sure what actually installs the voice library (I think it might be MS Office correction: looks like it's on XP by default), so this may not work on your machine. It certainly won't work on a non-Windows machine. Sorry Mac and Linux guys.

Mac Laptop Opinions? (Wednesday, Jul 30)
[ permalink ] [ e-mail me ] [ ]

This is almost a silly question (because I know what the answer is going to be), but does anyone have an opinion on whether or not I should buy a Mac as my next work laptop?

I'm thinking that the 15" MacBook Pro looks nice, and would be a lot easier to travel with than the mammoth 17" MacBook Pro (I played with them both at the Apple store), but I guess I'm still not sure. I've heard that they run really hot. Is that true? That's kind of important to me because I actually use my laptop on my lap.

My other big question is whether or not I'm really gaining anything in productivity. I know Macs are pretty, and all the cool kids have 'em, but at the end of the day is it worth all the relearning and adjustment?

SIDENOTE: I'm not really considering going back to Linux either. I spent a year with Linux as my primary desktop, and as fun as it was it just ended up being too much tweaking and researching for my taste.

Snapped Up! (Monday, Jul 28)
[ permalink ] [ e-mail me ] [ ]

SNAPPS Logo Story by Mabel Syrup, InfoNetWhirled Magazine
28 July 2008

Lotus Notes developer Julian Robichaux has been hired by Strategic Network Applications (SNAPPS) Inc., with an expected start date of Friday, August 8. In this exclusive interview with Mr. Robichaux, InfoNetWhirled magazine gets the details.

InfoNetWhirled: Good morning Mr. Robichaux. How are you doing today?

Julian Robichaux: Fine, thank you. You did bring coffee, didn't you? That was part of the deal.

INW: Yes, here it is. Extra wide double-fat cappuccino with a shot of lantana.

JR: Hrm. I'll try it. Hand it over.

INW: Here you go. Can I ask you about your new job at Snapps?

JR: Yes, you may. And it's SNAPPS, not Snapps. Say it right.

INW: Okay. So, what will your position be at SNAPPS? What will you be doing there?

JR: I'll be a Senior Developer. Or Senior Consultant. Or Senior something-or-other. Something senior. I'm getting old, you know. In any case, I'll be a programmer working on high-end projects with the SNAPPS team. And it won't be just sitting in a corner typing on a keyboard. Like the rest of the SNAPPS team, I'll be working closely with their enterprise clients.

INW: What about your internationally loved website, nsftools.com? Will nsftools go away? Please say “No”! PLEASE!

JR: Sit down, woman. It's fine. My website and the blog aren't going anywhere. If nothing else, I'll be getting back to my roots with a bit more technical content on the site (I've been pretty lazy about that in the past year or so). Rob Novak definitely encourages that sort of thing, as you've probably seen on his own blog as well as Viktor Krantz's blog. The TakingNotes podcast will continue as well. The only big change is that any work that was previously going through my nsftools corporation will now go through SNAPPS.

INW: So, if someone wants you to do some work for them...?

JR: Go ahead and contact me like you always have. All my work will now be done through SNAPPS, that's all. Now, keep in mind that SNAPPS does fixed-price project work rather than hourly jobs, but that actually ends up better for everyone in the end. I'll be talking to my existing clients this week about everything, although very little should change with them. This was very good timing as far as that goes.

INW: Speaking of timing, what's up with the funky start date? 08-08-08?

JR: I just liked the number, that's all. 08-08-08 is 2 cubed three times, and 8 is a lucky number. This coffee you brought me is terrible, by the way.

INW: Sorry about the coffee. When you mentioned projects before, what kind of projects will you be working on? Isn't SNAPPS just a Quickplace company?

JR: It's Quickr now, lady. Quickr. And no, they're not “just a Quickr company”. True, they created THE set of templates for the Quickr product and they do plenty of work with those templates and that product, but the SNAPPS programmers have a much deeper skillset than just Quickr, especially when you talk about developing web-based Domino applications. In fact, with the web and Dojo expertise they already have combined with the Notes client and Java experience I bring to the table, we're perfectly positioned for Notes 8.5 development in addition to working with all the shipping versions of the product. It's a good match, and we can take on virtually any Notes/Domino project.

INW: One last question. What about Collaboration University?

JR: What about it?

INW: Will you be speaking there?

JR: Hell, Rob will do anything to get out of giving sessions. I'm sure he's got plenty planned for me. That should also give me the ability to attend the UKLUG conference in September (which is just after CollabU), although I think Warren is full-up with speakers right now so I'll probably just be an attendee there. Why do you ask?

INW: Well, I might be in London in September, so maybe we could have coffee.

JR: You may leave now.

Ender's Comic, Dr. Horrible Alternate Languages (Sunday, Jul 27)
[ permalink ] [ e-mail me ] [ ]

I've been reading through my Dad's Entertainment Weekly magazines, thinking I need to get a subscription. I'm not a Hollywood kinda guy, but there are some good scoops here.

For example, the July 25th edition talks about Comic-Con and an upcoming comic book based on Orson Scott Card's most excellent book Ender's Game, along with some follow up stories.

Also, the August 1st edition (we're engaging in a bit of magazine time travel here, apparently) has a three page spread on Joss Whedon's Dr. Horrible's Sing-Along Blog, along with information from Whedon about the DVD version:

We want to have [language tracks]: French, Spanish, Japanese translated back very badly into English, classical Latin, and panther noises.

There will also be a commentary track sung to original music that runs the length of the show. Fantastic.

Bananas (Sunday, Jul 20)
[ permalink ] [ e-mail me ] [ ]

I was listening to a Scientific American podcast about bananas the other day, and it was fascinating. That may be true because I have a real soft spot for people who are completely obsessed with relatively obscure topics. But the guy who was being interviewed -- Dan Koeppel, author of the book Banana: The Fate of the Fruit That Changed the World -- was just totally into bananas. Some things I learned:

There's plenty more, including a visit to a banana plantation. One more bit of trivia for you too: Tim Tripcony recently noticed that the dancing banana animated gif dances to the tune of the song "Your Star" by the All-American Rejects. How he noticed that I have no idea...

Programming Languages Are Not A Zero Sum Game (Friday, Jul 18)
[ permalink ] [ e-mail me ] [ ]

Catching up on old podcasts this week. There was an interesting "Is Java Dead" podcast on developerWorks in May that had an excellent quote from Scott Davis:

The notion that there's one true language to rule them all is an absolute fallacy. Programming languages are not a zero-sum game.

I'll let you stew on that one for a while to see what you think.

There are plenty of other good points and issues brought up in that show, like the difference between the Java language and the Java runtime, "polyglot" programmers, and Ted Neward saying: "for each language according to its abilities, to each project according to its needs". (You can apply that thinking to toolkits and technologies equally as well as languages)

UPDATE: Interesting follow-up by Nathan.

NotesDocuments to HTML Using Notes API (Tuesday, Jul 15)
[ permalink ] [ e-mail me ] [ ]

I remember hearing long ago that a few Notes API functions to convert Notes objects directly to HTML were going to be made public in 7.0.2. I then promptly forgot hearing about it, other than e-mails from random people every couple months asking if I knew anything about said API functions.

Today the subject popped into my head again for unknown reasons, and I spent an hour or so trying to figure out how it all works. Rather than trying to explain what I found to you, here's an example agent you can look at and play with and squeeze and whatever:

I have no idea how backwards-compatible this is for Notes versions prior to 7.0.2, but it does seem to work in Notes 8.0. A few items of note:

Also, this will not have nearly as good or flexible results as using something like the Midas Rich Text Tools, but if all you need is some quick and dirty HTML this might be something to look at.