opendocumentbykey

A simple workaround for OpenDocumentByKey

Since, well, like “ever”, it’s possible to open a Notesdocument in the browser by using the first sorted column in a view as the key. Something like:

http://server/database.nsf/sortedview/yourkey?OpenDocument

Since a couple of years, we can also use notes://-links. Very neat if you want to open a database, view or document directly in Notes. What if you want to use a key in a view for opening a document in Notes?

notes://server/database.nsf/sortedview/yourkey?OpenDocument

… doesn’t work.

After spreading my wings on the web, I found:

OpenDocumentByKey

The OpenDocumentByKey command was added in Notes 8.5 to support the ability to open a document by specifying a view and a key within that view. The definition of key is the same as the Domino server uses in here as used in the OpenDocument method. The client preferred to be more explicit by creating a new command to prevent conflicts that could occur with certain keys and document identifiers.

notes://acme/register.nsf/Registered+Users/Jay+Street?OpenDocumentByKey

Great! It may be working within their acne domain, but it certainly doesn’t work overhere! “The document specified by the link cannot be located within the linked-to database.” And the fix is deferred to a future release.

We have 2 options: say to our client that IBM knows about the problem and that a fix is deferred to a future release (sorry for that) :-) OR we create a simple alternative.

I created a page notesredirect: it redirects a http url to a notesdocument link. I like simple namings :-). There’s a computed field on it that does a @DbLookup in the sorted view, using the key you initially wanted to use.

Follow these steps:

  1. Create a page notesredirect (or whatever name you prefer) and set it as pass through.
    passthrough
  2. Write some simple html that does the redirecting:
    <html>
    <head>
    <meta http-equiv="Content-Language" content="en-gb">
    <meta http-equiv="refresh" content="0; url=<Computed Value>">
    </head>
    <body>
    </body>
    </html>
  3. For the computed value:
    key:=@UrlQueryString("ref");
    unid:=@DbLookup("":"NoCache";"":"";"vREF";key;1;[ReturnDocumentUniqueID]:[FailSilent]);
    @If(unid="";"./refnotfound?OpenPage&ref="+key;"notes://server/"+@WebDbName+"/view/"+unid+"?OpenDocument")
  4. Create a page refnotfound to show an error page to the user if for some reason a document could not be found.
  5. To use it, you need to create your url in this form:
    http://server/database.nsf/notesredirect?OpenPage&ref=xxxxxxx

It’s not high-tech and it’s old school, but it works :-).

goback

Internet Explorer pain – How to bypass forced compatibility mode on your intranet?

You use Firefox or Chrome as your primary testing tool for your intranet applications, aren’t you? (If you aren’t, consider doing so: Firefox + Firebug = a powerful web developer tool)

You ignore the fact that the company you’re working for wants Internet Explorer as the default browser. And because there are so many clients and configurations (Windows XP + IE7?) scattered all over the buildings and/or some applications were developed in the middle ages of the (not-so) worldwibe web (yet), your IT-department tends to follow a conservative approach…

compatibilitymode“Great, we can enforce compatibility mode for all users, with the power of a single setting! Feel the power of the Almighty Administrator!” What does this function do exactly? For years developers were begging Microsoft to implement some general css3 features and follow web standards (and it has worked for the latest incarnations of Internet Explorer), then suddenly your browser is thrown back in time, Before It All Really Started To Change. Moreover, the option to change this setting when I want it (for personal use) is grayed out.

What does this mean for the poor developer? Your carefully crafted XPage suddenly looks like you’re doing your first steps on the web. It’s even worse when you want to explore the edges of XPages, f.e. if you’re trying to bootstrap your XPages. Great looks in Firefox, ugly pages and broken layouts in Internet Explorer. It’s like meeting a girl in the evening, having a great night out with her, and see her in hard light in the morning, just to realise there isn’t much left of the magic you saw the evening before :-).

“Oh great IT-God!”, you cry, “Please open the Gates of Progression, at least for my application!” (I don’t care about the others who enjoy staying in the past) “Computer says no,” God answers. It’s only possible to change a general setting on domain level :-(. If you need compatibility mode for a single application in the company, then they enforce it for all applications and for the whole company.

Fortunately, there’s a meta-tag you can add in the head section of your page to override compatibility mode:

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

“Grrreat!”, you shout. “… and eh, where do I add this in my XPage? I can add meta name-value pairs, but no such thing as http-equiv?”

After reading an inspirational blog from Michael Gollmick, I learned you can add some SSJS to beforeRenderResponse event of an XPage to get the line above added to the html head:

facesContext.getExternalContext().getResponse().setHeader("X-UA-Compatible", "IE=edge,chrome=1");

If you have a custom control with your layout, you can even add it to the beforeRenderResponse of that CC, so that you only have to add it once in your application!

This single line of code changes this:

ie7

to this:

ie9I’m a happy man :-).

@JdbcExecuteQuery with parameters – the correct syntax

So you like the XPages Extension Library and you want to use the JDBC integration it offers? You did your own research or you let the web guide you, f.e. with my article about SQL Server and JDBC? Or you used the extraordinary good book Xpages Extension Library – A Step-by-Step Guide?

There’s a section in it explaining you can use @JdbcExecuteQuery with parameters, so that it becomes easier to add your own parameters/variables in the query you want to throw to that database server.

This is the example code from the book:

var con:java.sql.Connection;
try {
con = @JdbcGetConnection("HR");
var params = ['employees','1234'];
var results:java.sql.ResultSet =
@JdbcExecuteQuery(con,
"SELECT * FROM ? WHERE ACTIVE='?'", params);
} finally {
con.close();
}

The idea is that every value in the parameter array replaces a value in the query accordingly.  When you try this out, it doesn’t work. For some reason it doesn’t execute the query correctly.

The problem is in the quotes surrounding the question mark. When I tried removing them, it DOES work. Perhaps, since the string in the params array is already surrounded by quotes, the query gets “over-quoted” :-).  Anyway, if you’re ever in this situation, just try removing the quotes around the ?.  The correct syntax should be:

var con:java.sql.Connection;
try {
con = @JdbcGetConnection("HR");
var params = ['employees','1234'];
var results:java.sql.ResultSet =
@JdbcExecuteQuery(con,
"SELECT * FROM ? WHERE ACTIVE=?", params);
} finally {
con.close();
}

SQL_2012_Desktop_Background_1680x1050_101111

MS SQL Server connection via JDBC

I recently had to pull out some data from a Microsoft SQL Server database to feed the type ahead of an XPages Edit Box.  In the past, I already got this working for DB2, so how hard could it be? Well… a little more complicated than I imagined, so I decided to add it to my little private-public collective-individual memory: my blog :-).

Continue reading

Quick tip when Quicksearching an application

dblookup1Did you ever encouter this? You want to open an Application (previously known as Database), you start typing in the Open Application Search (or whatever that field is called), just to notice that every replica of the one you’re looking for is listed.  You know on what server you want it, but you can’t see the server.

Continue reading

Immediate UpdateFTIndex

So your code relies heavily on fulltext index for searches.  So you press Update Index to force it a little.  Nothing happens.  Or maybe an agent forces it a little.  No immediate succes.

I could be wrong, but it looks like in the browser you can really really have it updated immediately.  I created an empty XPage, with only one computed field with the following SSJS:

database.updateFTIndex(false)

Preview in browser and BLAM: all documents are indexed!

soapUI_header_logo

Test your webservices in Domino Designer with SOAP UI Eclipse Plugin

SOAP UI is well-known test equipment for webservice testing.  Sometimes you just think: “Hey, maybe this or that is possible…” and you launch Google just to check if your silly idea is far fetched  :-).  I wondered if it exists as an Eclipse Plugin, guess what: bingo!

Continue reading

Show relational data in Domino Designer with Quantum DB Eclipse Plugin and jdbc drivers

Great! With XPages and the Extension Library we can connect to external databases easily! But what if you have connection problems? Or what if your queries are wrong? You want to be able to debug them, right?  So how do you test this?

The easiest way would be if  you could test right in Domino Designer.  Luckily enough, we’re in an Eclipse environment, so there are plugins available we can install.  And there happens to be the QuantumDB Eclipse Plugin that does exactly this.

Continue reading

Domino source control: CIAO! versus Mercurial/SVN/GIT/…?

A very short question for the experts out there: what should I use for source control in Designer? We have some CIAO!-licenses here we could start using, but what are the additional benefits of CIAO!? Is it easier/better integrated/more stable? Or not really worth the money? I checked Teamstudio’s site, but they don’t really offer a real comparison with the open source alternatives out there. So, what do you use for your version control?

Session “Design Frameworks” on BLUG

Yesterday I spoke at BLUG for my very first time. I had the privilege to work together with Mark Myers, Matt White and Mark Leusink, 3 giants from the Domino world, so I consider myself lucky for this :-).

It was a great learning moment and quite some fun too, so thank you for that! Also, a big thank you  to Theo Heselmans for organising the event, that was once again a success!  

Continue reading

Quick tip: adding StackOverflow as a search tool to Firefox

If you know what Notes.net means, then you’re old :-).  In the early Notes-era, if we had a problem, we could:

  • hire the A-team
  • search on Notes.net for a solution

At that time, it was interesting to add those sites to your browser search engine list.

Since StackOverflow is rapidly becoming the new first aid tool for all your Domino development and infrastructure, I figured it makes sense to add the site to my Firefox search engines too.

A quick search brought me this add-on, one click further et voilà: search_stackoverflow

 

Wait! Hold on… Using a preloader in XPages to warn the user stuff is happening and (s)he should have some patience

preloadI have an XPages application that is querying a DB2 table via JDBC, and it takes a couple of seconds before it returns some data I display in a nice grid after a partial update.

The thing is: if the user should wait a couple of seconds, he should be warned, so that he knows something is going on.  First of all, it’s nice, user friendly and polite.  Secondly, you don’t want your user to get all experimental and starting to click all over the place in order to get some feedback.  Because he will, eventually  ;-).

Continue reading

Creating a java webservice client in Domino using Apache CXF

My client wanted me to develop a webservice consumer that sends it requests to a Documentum webservice.  I had some previous experiences with LotusScript webservice classes generated by Domino automatically, but this turned out to be a non-solution, because I had to access the SOAP header.  I had to enter the Scary Java World for a proper alternative… It became quite a queeste!

scary java

Continue reading

Debugging Java code in Domino Designer 8.5 or 9

Since Domino 8.5 it should be possible to debug your java agents directly in the Domino Designer IDE. In theory. It’s documented in the help, but it took me several hours (and more) to get it to work. This is how I use it, and some caveats I encountered.  I think my way of working is easier than how it is explained in Help, so follow these steps to locally debug a Java agent (“foreground debugging”)

Continue reading

Powered by Domino XPages

Since I started developing in XPages, customers don’t seem to realize that the browser page they’re looking at was created with Domino. Often, if they think of Notes, they see dinosaurs and a sinking Titanics. When they taste XPages, it doesn’t look like anything they know about Notes.

So, it’s our task to advertise, and to show the world: “Hey, this is XPages! This is Domino!”. However, when I started looking for a decent image to use, I didn’t find any. I don’t like this image. So I created my own:

If you want the button only, it looks like this:

As always, right-click to save the images and feel free to use them.

Continue reading

Performance issues with many subforms on a form and how to solve them

After reworking an application in my Designer 8.5 I asked my collegue to test it in his Notes 6.5 client. To my surprise he couldn’t open any document, the only thing he saw was a white screen and an hour glass. Many trials, errors and crashes later, I found out that the older Notes versions have issues with too many subforms.

Continue reading

Airplay in a car with Airport Express

Why?

If you have a Bluetooth capable car stereo, there’s no real reason why you would try to install an Airport Express in your car. My previous car could stream music with bluetooth. Since 2 months I own a new car (a Peugeot RCZ) with (what I thought) state-of-the-art audio/video capabilities, thanks to the WIP COM 3D (with multimedia and navigation).

Apparently, it only supports bluetooth for telephone, not for streaming music :-(. So, if I want to play my iTunes songs, I had to convert them all to mp3, copy them to the internal car harddisk or an SD-card, and then… use the way playlists work in the car, t.i. sorted by song title. If I want to hear a song starting with a V, I could force my hand just by the number of turns on the huge button to make.

Continue reading