Wednesday, December 12, 2007

Debugging: Inspect what's being posted from a form

Sometimes I make parts of a form using PassThruHTML/hidden notes-fields. Mostly because Domino-generated HTML is hard to style (especially radio-buttons/checkboxes). This sometimes work immediately, and sometimes it takes hours to make it work. I've found it a great help to see what is being posted to the server.

There are HTTP-sniffer applications that you can inspect the request with, but I find it easier to post the form to an agent, and then print the request-content as a HTML-table.

Example of output, Jake's FakeNames database, Person-form with a couple of fields filled in.

It's also handy to "echo" get-requests when developing agents: A simple ?OpenAgent

In the demo-application for this blogpost, I've made a (javascript) action-button that rewrites the action-field in the form to point to an agent. The agent tries to print every field in NotesSession.DocumentContext.

To make this work in your applications, (hopefully,) you only have to copy the Script Library, InspectRequest, the agent inspectrequest, and the shared action, Inspect current form-values. Insert the shared action into the form you want to test.

To inspect DocumentContext in other agents, use docToHTML in the Script Library, InspectRequest. As a rare occurence, I've actually documented this function.

To get the current field-values, I trigger the equivalent of @Command( [ViewRefreshFields] ), using the Domino _doClick function.

>> Download demo application

Tuesday, December 11, 2007

IdeaJam: Let SearchView return XML, JSON

I've wanted this functionality so many times in Domino (for Ajaxy applications). Hopefully blogging about it will increase it's visibility, and get more people voting for it.

Sunday, December 9, 2007

What if....IBM collected all the best tips of the N/D "blogosphere" into a Redbook?

(Sorry for stealing your subject "pattern", Bob)

I watched a japanese TV-show some weeks ago, where they interviewed a couple of japanese bloggers that converted their blogs into book-format.

It would be great, if someone like IBM could extract all the best tips/techniques/patterns/etc. from the N/D "blogosphere" into a Redbook (along with accompanying demo-dbs) yearly.

Maybe this would help motivating even more people to spread their knowledge through blogs.

Saturday, December 8, 2007

Readable lookups: Lookups -> HTML with formula

Update, 20.12.07: Demo-application done.

To avoid making a monsterpage, I'll split up the different tricks you can do with the readable lookups technique.

First example, generating HTML from lookups with templating, in a readable way. I'll post a demo-db when I'm done making examples.

The lookup-view


First, I create a lookup-view.

First column: firstName + " " + lastName
For real-life apps, I mostly use ComputedWhenComposed-fields with @Unique as a general lookup-field.

Second column:

The advantage in writing it this way is that all you have to do to add more data is to add the field-name to the fields-list. Another advantage is that there is less chance of typing errors, as less is written. The biggest disadvantage is performance. If you have a lot of documents (maybe 20 000++), I'd think the above way of writing the column formula would be more resource-heavy on view-indexing than if you simply concatenate strings.


Formula-templating-examples:


First, take a look at my previous, less readable technique, where i had pipe-separated lookup-data.

New, "self documenting" lookup -> HTML technique:
Definition lists
A table

>> Result of the above to examples

Top 5 browsers of my visitors Jan-Jun vs Jul-Dec

Inspired by Wissel.net, here is this blog's browser statistics:



A little disappointed that my favorite browser, Opera, is less represented at the end of the year than at the beginning.

Friday, December 7, 2007

Readable lookups

Update, 20.12.07: Demo-application done.

A colleague of mine, Torbjørn Halsne, found a better/more readable way of creating readable lookups than my "Keyword/Value lookup fields", on searchdomino.

The technique.

The worst part about my K/W-technique was that it wasn't really suitable for lookups that returns more than one value.

This new (to me) technique adds overhead on view-indexes, but you get a lot in return.

I'm working on a demo to show all the great stuff you can do with this technique. E.g. using the same view for server-side lookups as client-side lookups (XML), a lot more readable formula-templating and hopefully (if it's not too time consuming/me too lazy) LS-WQO templating demo.

Hopefully I will have it ready/online before the end of the weekend.