10.16.2017

Bark-bark!! The LotusScript CWebContentConsumer now support REST Service POSTs with files++

Tags: LotusScript Java
0

A couple of days ago I wrote the blog-post Teach the old dog some new tricks: Let LotusScript consume REST Services the easy way. I thank you all for the good feedback! Nice to see that some old school, classic Notes development, still got some traction Smile

Well, I was in the spirit to add some features today too!

First and foremost you now have the ability to add a payload to the PostJson, PostXML and PostHTML. By payload I mean a text string of any kind, but typically a JSON or XML. In a way you can think of it as a way of uploading a file or text together with other request headers or URL parameters.

This means that code like this;

image

… results in this;

image

Note that the payload isn't tagged a a proper multipart MIME or anything, but perhaps you can add that yourself with a combination of the new support methods for base64 encoding and decoding? You now have these additional methods;

  • EncodeStringAsBase64. Encode a string as base64. Build your own multipart XML or MIME structure, and combine that with one or more AddRequestHeaders? Or stuff the base64-encoded string as a payload directly with SetPayload.
  • EncodeFileAsBase64. Encode a whole file as base64. Remember that this hasn't been tested on huge files or anything Smile
  • DecodeBase64String. Decode a base64-encoded string back to it's textual form.
  • DecodeBase64StringToFile. Finally decode a base64-encoded string directly into a file on your disk.

I also added DownloadFileFromURL which can download any file from the specified URL and store it on disk as a file.

The demo-agents in the downloadable sample-database has been updated to use SetPayload, and the other methods are now demoed in a third agent with the name "Test Support Methods".

Happy coding!

10.13.2017

Teach the old dog some new tricks: Let LotusScript consume REST Services the easy way

Tags: LotusScript Java
0

This article shows you how to consume REST Services in LotusScript like this:

SNAGHTML110bfb33

You can both GET and POST with the classes.

Behind the scenes this is accomplished with two script libraries. One back-end worker class made with Java (class:CWebContentConsumerJava) which does all the heavy lifting, and a LotusScript wrapper class (class:CWebContentConsumer) which uses the LotusScript-to-Java bridge LS2J to interface the back-end java directly.

Click on “Read more” to read the details.

07.04.2017

Unexpected results reading a plain text file with NotesStream in LotusScript (or when strings contain MORE than meet the eye)

Tags: LotusScript
0

This is a little LotusScript experiment with a plain text file and a LotusScript agent using NotesStream. After reading the text from the file I try to use the string to locate a document with a corresponding key in a NotesView. While everything looks fine in the debugger, something is not correct and the lookups fail. This article has some suggestions for solutions at the end but they are not state-of-the-art! Perhaps you know other ways?

First off, I have a super-simple plain text file with a single number in it;

SNAGHTML6c68e14

Then I have a super-simple LotusScript agent reading this text file, and trying to locate a Notes document with the same number from a NotesView.

SNAGHTML6c794b7

The documents have all their numbers stored as text, like this;

SNAGHTML6c802d2

Why stored as text? Because this is how I found the (to me) abnormality in the first place Smile And why NotesStream? Because code with the concept herein also runs on an iSeries, where it works fine …

The LotusScript-code looks like this;

SNAGHTML6d2928f

The code uses a NotesView (1) and a NotesStream (2) to open the file and read out the contents with the ReadText-method (3). Finally the code tries to locate the document in the NotesView first by a hardcoded key (4), and then by the value retrieved via NotesStream (5). In a moment you will see how the first works and the second not.

02.21.2017

Classic LotusScript: When 100.0 isn't 100.0 anymore?!

Tags: LotusScript
0

Today I had to debug some old code, and when doing so I stumbled over something which I found strange.

LotusScript would not consider the value 100 equal to the value 100 … Let me explain with some simple code (you can click on every image to get a larger one by the way);

SNAGHTML148d4a90

I put the above code in a test-agent.

Marked by 1, I set my reference value to the value 100 (and yes, by purpose I don’t use the forced floating point notation 100.0)

Marked by 2, I fill my array of 12 doubles with 1/12 of 100 each.

Marked by 3, I compare the two variables dblOneHundred and dblHundred.

Below you see how the array look in the Designer’s Debugger;

image

As you see LotusScript does a nice job of converting my division (100/12) and storing it as a doubles. For each time I fill in an element in the array, I accumulate the values in the variable dblHundred. Again LotusScript seems to do this nicely. Below you see what it looks like after I have run the loop 11 times;

SNAGHTML1495daf2

… and when the array is completely filled, the Debugger shows that the variable dblHundred has the accumulated value of 100. Below you see the code just before the comparison line marked by 1 is executed;

image

As we see in the debugger, both values are shown as 100 in the debugger, and I would believe that the comparison would be true. But no

SNAGHTML149cb595

If you want to see more, both on my take for an explanation, the workarounds including code to try out, please continue to read below.

11.21.2013

Classic Notes: How to communicate with IBM Connections from LotusScript wrapping IBM SBT with LS2J - Part 3

Tags: LotusScript Java Connections
0

This part 3 of 3 in the article series “Classic Notes: How to communicate with IBM Connections from LotusScript wrapping IBM SBT with LS2J”.

Read the others here:

Part 1

Part 2

11.21.2013

Classic Notes: How to communicate with IBM Connections from LotusScript wrapping IBM SBT with LS2J - Part 2

Tags: LotusScript Java Connections
0

This part 2 of 3 in the article series “Classic Notes: How to communicate with IBM Connections from LotusScript wrapping IBM SBT with LS2J”.

Read the others here:

Part 1

Part 3

11.21.2013

Classic Notes: How to communicate with IBM Connections from LotusScript wrapping IBM SBT with LS2J - Part 1

Tags: LotusScript Java Connections
0

This part 1 of 3 in the article series “Classic Notes: How to communicate with IBM Connections from LotusScript wrapping IBM SBT with LS2J”.

Read the others here:

Part 2

Part 3

… embark! …

You have seen the cool IBM Social Business Toolkit (IBM SBT), and you played around with the ??bercool Playground application. You dive into the code and quickly discover that you need some Java or JavaScript knowledge.

- Ooops, but I am mostly doing LotusScript, you say … what now?

Perhaps you ask a question on StackOverflow to see if anybody has some advice for your scenario (just completely out of the sky – perhaps something similar to this question Smilefjes). The chances are that you’d get a lot of advice abandoning your old and tired LotusScript  in favor for the much more modern Java language. Your challenge is that you have a lot of LotusScript code that you would love to enhance with the new cool IBM SBT possibilities, and perhaps not the time to take the heavy plunge into learning a new language.

This article – which assumes a whole bunch of details are in place – will show you how to have this small piece of LotusScript code …

SNAGHTMLcc5370

… put an entry into an Activity Stream in a specified community like this;

SNAGHTML61694e

11.14.2013

How I got Lotus Connectors (LCLSX) to finally connect from our IBM i to a remote Windows DB/2 server

Tags: LotusScript Connectors
0

If you have seen error messages like “30061 - Error: Relational database BLABLA not found.,  Connector 'db2',  Method -Connect-  (-30061) - Relational database BLABLA not found.” or “Error: Communication error occurred on distributed database processing.  See SQ30080 for invalid possibilities.  A common error is that the  password is case sensitive and is not being provided in the correct case” you’re not alone!

Read on how to see the bigger picture on how IBM i’s “Relational Database Directory Entries” should be configured based on what you see in the real target database. Finally you’ll see how to code Lotus Connectors LSX (LCLSX) to use this information to connect to the database.

Most of our Domino servers run on IBM i (aka System i, iSeries and AS/400). Since IBM i have DB2 natively supported, there is no need to install DB2 Client or DB2 Data Server Drivers (more on those below). The target DB/2 server is running on a remote Windows server, and I thought it would be a breeze to connect IBM i and the Windows machine together. Not so! First and foremost, there is sparse information on the net on how to exactly do this. You very quickly find sample code similar to this;

SNAGHTML13265e9

So how come the code above bails out at the Connect-method?

02.16.2013

Test

Tags: Web Services Java LotusScript
0
Test

05.09.2012

Classic Notes Development: Updated code to open design elements from Notes - in Designer

Tags: LotusScript
0

Thanks to Stephan Wissel who pointed me in the correct direction regarding how to open design elements directly – from the Notes client with LotusScript.

05.07.2012

Classic Notes Development; How to launch a database in Designer with Command Line Parameters

Tags: LotusScript
0

Ever wanted to launch a database directly in Designer? Yes, then you probably are a developer Smilefjes

Read more to see a snippet of LotusScript code on how to launch the Designer with a specified database.

BTW – wish I could specify a specific designer element, so if you know, please chime in.

04.30.2012

Classic Notes Development - Access Search Bar from LotusScript

Tags: LotusScript
0

Have you ever wanted to access the Search Bar from LotusScript?

image

Being able to do so would perhaps remove the need for various homecooked solutions on how to do full text searches and display the results to the user. Even though we do have programmatic access to full text, I have allways felt that something is missing. Why not just use the standard search bar in the Notes client? This post describes how to do exactly that with a couple LotusScript classes, using Windows API functions. You can set and get the text of the Search Bar, and even click the "Search" button programmatically.

10.09.2011

Notes client Bookmark Export and Import database

Tags: DXL Lotus Notes LotusScript
0
From time to time I like to completely reinstall Notes, because Notes, like Windows, accumulate issues  (oh, "features" we call them, he he ...) over time. So just like reinstalling Windows once a year, I try to reinstall Notes too. One of the drawbacks with complete reinstallation, is that you loose settings, amongst them  Workplace and Bookmarks. This means that I have to manually recreate my bookmark folder structure, opening up a bunch of databases and remember to add them to bookmarks. Boring, tedious and error-prone.

I have therefore created the Bookmark Export and Import database, which let you export your bookmarks to a backup document, and then later import it again. Below you see a screenshot of my latest backup document;

A picture named M2

Yup, nothing fancy in regard of design here The backup document contains two DXL files (which the Export agents creates for you) along with a bunch of other fields to keep track of all relations in the original bookmark.nsf file. Below you see the content of the About-document

12.02.2010

Is it just me? Domino Designer for Eclipse contains some copy/paste issues ...

Tags: Lotus Notes LotusScript Question
0

Using the latest and greatest Lotus Notes 8.5.2 All Clients installation on a Windows 7 64-bit machine…

Let me start by saying that DDE is absolutely a huge step in the correct direction, and I wouldn’t even dream of going back. Just having a serious editor for my LotusScript classes is such a pro that I can’t ever go back to the old editor Smilefjes

But …. some issues almost drives me nuts …. and probably has to do with the way Notes expose LotusScript to Eclipse. That said, most of the problems below doesn’t occur when you edit Java code, so I guess this has to do with LotusScript tooling somehow…

  • First of all, almost no matter when you paste, Eclipse insist on placing the cursor at the end of the line …. This means if you copy parts of code, such as as the “viewNew” from the code below …
    SNAGHTML11a5f83[6]
    …copy “viewNew” to the clipboard, and now doubleclick on the “viewOriginal”, then paste;
    SNAGHTML11ce526
    … the cursor ends up after the Refresh method!!! I don’t like this. Paste and stay at the end of the pasted value, like any other normal editor!!

    This is however, not really a huge problem, just annoying ….
  • Much worse problem! Sometimes the editor inserts the text in reverse order!!!!

    Now I have a problem, this is super-annoying! Below you see how the editor insists on inserting the word “portal” backwards!

    SNAGHTML122b0ae
    I start at (1), and at (2) I have written the first 4 characters “port”… and at (3) I have finished “portal”. Nice eh?!

    When I try to delete this corky text, I always gets the next problem…
  • Something obviously goes completely wrong when deleteing text…

    It always happened when I try to delete reversed text as descriped above, but sometimes it also happens when deleting text for no obvious reason;

    SNAGHTML1265028

    By the way, which log?!? Certainly not log.nsf Smilefjes

    I have also learnt the hard way that when I see such errors, Its best to quit the editor session to get out without corrupting the code.
  • The auto-identer goes haywire and takes forever…

    SNAGHTML12807e2

    As soon as I paste something, the auto-indenter normally indents the pasted text fast. Sometimes it needs a long time to think, and the above dialog box (2) stays on for 15-20 seconds, while the class-explorer marked with the arrow (1) blinks intensively.
  • The class-explorer suddenly doesn’t show all members…

    This problem only occurs if I choose to continue to edit the code after error messages like…

    SNAGHTML12bc9d9

    The code compiles if I try to Recompile All LotusScript, but methods (typically the last ones added to a LotusScript-class) aren’t visible. Sometimes I have to end Notes completely (like kill to get rid of all processes …) in order to make DDE show them again. Hasn’t lost any code yet due to this problem, but it has sure scared me a lot (like “where the h…. is the latest method !!!!!” …)

Has anybody else experienced one or more of the issues above? I hope they get ironed out in future releases Smilefjes

10.19.2010

I wish I could combine NotesDocumentCollection with PickListCollection dialog box

Tags: LotusScript Lotus Notes Question
0

I have a database where I want to select some document with LotusScript. These documents should be presented to the user in a dialog box so he or she can choose what documents to delete.

Now, this isn’t hard to do with a dialog box containing a list of selected values from the documents. However, this always looks “oh so dialogish” ….

What if I could present any documents (such as a NotesDocumentCollection) in a PickListCollection dialog box? This would be much more nice looking IMO.

My initial ideas is to use a hidden folder, and store the NotesDocumentCollection with PutAllInFolder. Then the PickListCollection would show those documents. This may however lead to a race-condition if multiple users attempt to do the same thing at the same time.

Unfortunately it seems like I can’t use a temporary folder name either, as the folder must to be known to the design collection at an early stage of the database-open process. The PickListCollection seems to have issues finding newly created folders.

Any ideas?

05.12.2010

Do you need a list of reserved words in LotusScript or Formula-language?

Tags: LotusScript Formula
0
I have compiled 3 lists of reserved words for the LotusScript language itself, the exposed Notes-classes (such as NotesSession etc) and finally for the Formula-language. You may download them here.

My primary use for these lists is to have the super-configurable spellchecker AsUType behave better when I program in Domino Designer!

A picture named M2

02.09.2009

Do you need zip and/or unzip support in LotusScript? Download my free DLL

Tags: LotusScript
0
Have you ever needed zip and/or unzip support in your LotusScript projects? If so, you can download the free Windows 32-bit DLL from here! Please note that whilst VCZIPSUP generate fully compatible zip archives, this is a very simple implementation so don't expect support for advanced stuff like encryption etc. Enjoy!

01.30.2009

How I fixed a problematic view with columns that did not update the underlaying viewdata anymore

Tags: Lotus Notes LotusScript DXL
0
Have you ever had a database where the view-data seems to get stuck? You have an initial design and when you drag the columns around, the underlaying data won't reflect the changes? Hey, you can't even add new columns to the view anymore? ncompact -D, deleting the cache.ndk, reverting the database down from Designer 8.5 to 7.02, reverting the ODS ... and still those b***stard columns won't obey your commands .... Read on if you want to see how I finally got it solved!

01.28.2009

Tiny update on the download Lotusphere 2009 pdfs agent code

Tags: Lotusphere LotusScript
0
Thanks to Joe Litton, which pointed out that my Lotusscript agent code to import session pdf files, found in this blog-entry, you may have wondered about why it only imported one single session pdf. If was due to an Exit forall-statement in the Initialize function. The purpose of this code was of course to test the logic. Then I forgot to remove it before posting! Sorry!

The Exit Forall is located just under Call ImportOrUpdateFile in case you don't want to download the code again. I have also updated the code to download.

01.27.2009

Import Lotusphere 2009 pdf files into GeniiSofts Session database

Tags: Lotusphere LotusScript
0
I have created an LotusScript agent which allows you to import all Lotusphere 2009 session PDF files into the Lotusphere 2009 Session database from Geniisoft. I have previously downloaded all pdf files into a single directory, If you haven't done this yourself, either access Lotusphere 2009 Online and do it manually from each session, or follow Karsten Lehmann's description. When all your session files are in one directory, you are ready to go!

Create an agent in the session database and import the .lss file included in this download. It will ask you about the directory and then enumerate the files in the selected directory. For each file named according to the session id (such as AD101.pdf, BP203.pdf etc) it will look up the corresponding session document in the session database, and import the pdf file as an attachment. The agent also keeps track of imported files and their file timestamps, and can thus update the pdf file has a different timestamp. Nothing advanced here, just checking for different timestamps. If you want to be sure only newer  files can be imported, you must code some LotusScript yourself.

Finally, the agent uses some Win32 code to browse for directories. Cut this code if you are on Mac or Linux and just replace the import directory with a hardcoded string or similar.

05.23.2008

The template for the "Icons and Images" and databases is now available

Tags: Lotus Notes Software DXL LotusScript
0
I am glad to make the database for the "Icons and Images" database available for download.
A picture named M2

05.22.2008

The template for the "Icon And Images" database will be available shortly

Tags: Lotus Notes Software DXL LotusScript
0
At May 21st I held a short presentation about the "Icons And Images" database at the Norwegian Lotus Software Usergroup's anual spring seminar with the title "How to store 1.8 million files in a single Notes database". I will make the template for the database itself available shortly.

05.18.2008

Part 6: Continuing with DXL to create the Favorites feature in the Icon and Images database

Tags: Lotus Notes Software DXL LotusScript
0
This is part 6 of a series of articles about the Icon and Images database (started in this article), This article focus on the Favorites page and how it was made.
A picture named M2

05.18.2008

Part 5: Continuing with DXL to create the Gallery feature in the Icon and Images database

Tags: Lotus Notes Software DXL LotusScript
0
This is part 5 of a series of articles about the Icon and Images database (started in this article), This article focus on the Gallery pages and how it was made.
A picture named M2

05.18.2008

Part 4: Using DXL to create imagery in documents - continued

Tags: Lotus Notes Software DXL LotusScript
0
In this the fourth part of  article about the Icon and Images database (started in this article), It continues where the third article left off.

05.18.2008

Part 3: Using DXL to create imagery in documents

Tags: Lotus Notes Software DXL LotusScript
0
In this third article about the Icon and Images database (see this article), I will cover how I use DXL to create the imagery in Notes documents.

04.07.2008

Part 2; Programming details on Icon and Images - Enumerating files

Tags: Lotus Notes Software DXL LotusScript
0
In the first article I introduced the Icon and Images database, in which I store more than 1.8 million icon files in a single database. This article dive into the programming details, showing how I enumerate the files to import.

04.04.2008

Part 1: Icon and Images database -or- How I store more than 1.8 million icon files in a single Notes database

Tags: Lotus Notes Software DXL LotusScript
0
You have always heard that Lotus Notes isn't that  capable of storing millions of documents. While that is mostly true, this article will show you how I store more than 1.8 million files in a single database. Perhaps these ideas can be used by your applications too?

Tags

Calendar