Ben Langhinrichs

Photograph of Ben Langhinrichs

IBM Champion logo

E-mail address - Ben Langhinrichs







Recent posts

Wed 14 Nov 2018

Short agents



Tue 2 Oct 2018

No cookies for you



Fri 28 Sep 2018

We need more than baby steps


December, 2018
SMTWTFS
      01
02 03 04 05 06 07 08
09 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31

Search the weblog





























Genii Weblog

Short agents

Wed 14 Nov 2018, 09:41 PM



by Ben Langhinrichs
When I say I still write LotusScript, I should include a disclaimer that my scripts tend to be under 30 lines long. Here's one that generates JSON for the documents in a specific view using MongoDB format and spits it out to the browser. All of nineteen lines long if you count the Dims and such. Before somebody says it, I know you can generate JSON with a special Domino URL, but you'd have zero control over the output, whereas I can change that one parameter to 'Saleforce' and get  a different set of JSON or to 'Domino' and get yet another. Or I can pick just a few items to include. Or include formulas or db lookups. Or change that to a GenerateCSV call and get a CSV stream. On top of that, any rich text which gets converted is high fidelity and intact, unlike the stuff generated by the Domino server natively. But otherwise, I'll acknowledge that it's pretty much the same thing as Domino Access Services if you'll acknowledge that the New England Patriots are playing pretty much the same game as the Cleveland Browns.
 
Anyway, short agents don't have to be short on functionality if you have Tom Brady the Midas LSX on your team.
 
(My apologies if you are not a U.S. sports fan and don't understand the analogy. I'm sure some of the Boston-based IBMers and HCLers could interpret for you.)
 
Inline JPEG image
 
 

Copyright © 2018 Genii Software Ltd.

What has been said:


1128.1. Doug Finner
(11/14/2018 12:25 PM)

Ben,

I can't thank you enough for your willingness to give back to the community. I've used your help for much of the time I've been doing Notes and appreciate your expertise and good humor. Thank you!


1128.2. Erik Brooks
(11/15/2018 11:53 AM)

Nice, Ben. Though for this to perform well on larger datasets you should use a stringbuffer. This line:

totalstr = totalstr + textstr

...gets brutal fast.


1128.3. Ben Langhinrichs
(11/15/2018 02:35 PM)

Erik,

Of course, you are right. This is just a demo. In a real application, I could change the

totalstr = totalstr + textstr

to

Print textstr

or process some other ways. This is good for demos because I can look at the whole JSON string at once. But I should think about making my short agents more production-ready.

Have your say:

Name *:
E-mail:
e-mail addresses will not be displayed on this site
Comment *:


<HTML is not allowed>
Linking: Add links as {{http://xxx|title}}, and they will be activated once approved
Blocked? Unable to post a comment? Please read this for a possible explanation...