357 Lotus blogs updated hourly. Who will post next? Home | Downloads | Events | Pods | Blogs | Search | myPL | About 
 
Latest 7 Posts
Building an App with the frostillic.us Framework, Part 6
Wed, Jul 23rd 2014 82
The Industry's Vileness
Tue, Jul 22nd 2014 150
Generating Toaster, dGrowl, etc. Notifications From Server Code
Tue, Jul 22nd 2014 85
Value and Method Bindings in XPages
Mon, Jul 21st 2014 118
Building an App with the frostillic.us Framework, Part 5
Mon, Jul 21st 2014 75
Meandering Musing About Views
Sun, Jul 20th 2014 125
How I Deal With Collections in the Framework
Sun, Jul 20th 2014 109
Top 10
"Build Automatically", "Refresh automatically", and "Team Development"
Thu, Jan 23rd 2014 427
Domino the Identity Server
Tue, Feb 11th 2014 427
So it goes.
Mon, May 12th 2014 378
An XPage As A Tree: Implications
Wed, Apr 16th 2014 353
Couchbase StateManager for XPages, Part 1
Wed, Jan 29th 2014 347
SNTT: Reconstructing DateRanges
Thu, Feb 27th 2014 345
The Trouble With Developing on Domino
Tue, Jul 8th 2014 341
My Current Model Framework, Part 2: An Example
Fri, Feb 21st 2014 320
Better Living Through Reverse Proxies
Thu, May 30th 2013 315
Couchbase StateManager for XPages, Part 2
Fri, Feb 21st 2014 312


Arbitrary Scripting Languages in XPages
Jesse Gallagher    

I think I've settled on JSR 223, the generic "Scripting in Java" specification, as the likely best way to embed Ruby. It seems like the "correct" way to do it and generally the cleanest. I don't like the notion that the way to customize the runtime is by setting system properties, so I'm still a little wary, but it'll do for now, in any event.

The side benefit of JSR 223 (and this would be true of BSF as well) is that it supports a crapload of languages, and it does so in a very unified and generic way. Accordingly, I modified my ViewHandler and created a GenericBindingFactory to browse through the list of non-Ruby available languages and create EL bindings for each.

The upshot is that, when this code is active, any JSR-223-compliant language in your server's classpath will become available for "#{whatever: ... }" bindings just by virtue of its presence. Note, though, that that doesn't necessarily mean it will be a good experience. For one, the page's variables (like param, facesContext, view, and so forth) aren't just available - you'd have to make something like the method_missing method I wrote for Ruby to automatically resolve them via FacesContext.getCurrentInstance(). Furthermore, some languages are problematic: for some reason, Jython throws NullPointerException errors for even the most basic formulas on almost every page load, while PHP still requires <?php ?> tags and spits anything else out to the server console.

I know what question is on the tip of your tongue, though, so I won't keep you waiting: yes, you can use your home-grown string-concatenation operators in Scheme! You can breathe a sigh of relief now:

<xp:text><xp:this.value><![CDATA[#{scheme: (set! + (let ((original+ +)) (lambda args (if (and (not (null? args)) (string? (car args))) (apply string-append args) (apply original+ args))))) (+ "Hello " "from " "Scheme") }]]></xp:this.value></xp:text>

Yes, that works, and no, there's no reason to do it. If you really like Lisp, though, Scheme and Clojure can now be in your XPages toolbox.

Once I'm able to post to OpenNTF, I'll include this in my first Ruby-in-XPages release, though I may leave the applicable code commented out by default. Who knows what horrors this could unleash?



---------------------
http://frostillic.us/f.nsf/posts/F660516EC59A25FC852579E5007D5F9C
Apr 19, 2012
106 hits



Recent Blog Posts
82


Building an App with the frostillic.us Framework, Part 6
Wed, Jul 23rd 2014 12:12p   Jesse Gallagher
Define the data model Create the view and add it to an XPage Create the editing page Add validation and translation to the model Add notification to the model Add sorting to the view Basic servlet REST with Angular.js Add sorting to the view This step in the framework example is very similar to the second in that there's nothing particularly Framework-y about it. Technically, the work in the title of this step is already done: I had already enabled click-to-sort and set sortable="true" i [read] Keywords: notes xpages java
150


The Industry's Vileness
Tue, Jul 22nd 2014 9:13p   Jesse Gallagher
Fair warning: this post isn't technical. It's also full of sweeping generalities. When I attended middle and high school, it was as part of the last group of geeks and nerds that should face systemic ostracization. Naturally, high school will still be terrible for most people, just because it's full of high schoolers, but the world at large has seen a near-complete triumph for geeks and nerds generally. And this has had some very positive side effects: because we had to deal with exclu [read] Keywords: community development
85


Generating Toaster, dGrowl, etc. Notifications From Server Code
Tue, Jul 22nd 2014 10:12a   Jesse Gallagher
In yesterday's Framework-series post, I offhandedly mentioned that the "flashMessage" routine I use could easily be paired with or replaced by "toaster"-style notifications. This turned out to be very coincidental, as just today a NotesIn9 episode went up featuring Brad Balassaitis talking about using dGrowl for this purpose, along with an accompanying blog post. Whenever I've used something like this, I've run into situations where I want to generate the message from the server, sa [read] Keywords: formula language ibm xpages dojo java javascript properties server xml
118


Value and Method Bindings in XPages
Mon, Jul 21st 2014 3:12p   Jesse Gallagher
When you use any binding in XPages - anything with "#{...}" or "${...}", regardless of whether it's EL, SSJS, or other - you're creating what is called in JSF-land either a ValueBinding or a MethodBinding, and the distinction is important but can be subtle, particularly when dealing with SSJS. Value Bindings The simplest case of value bindings are sprinkled throughout even the most basic XPage app, created when you bind a control to a document's field: The meaning is clear: "thi [read] Keywords: notes xpages interface java javascript
75


Building an App with the frostillic.us Framework, Part 5
Mon, Jul 21st 2014 1:12p   Jesse Gallagher
Define the data model Create the view and add it to an XPage Create the editing page Add validation and translation to the model Add notification to the model Add sorting to the view Basic servlet REST with Angular.js Add notification to the model The next step in building our Framework app is a simple one: adding some basic visual notification when user saves a note. We'll leave the navigation rule to send the user to the home page in place and use flashScope (included in the Framework) a [read] Keywords: email java
125


Meandering Musing About Views
Sun, Jul 20th 2014 9:15p   Jesse Gallagher
As happens periodically, I've been thinking about Domino views lately. When I get into one of these moods, I find it helps to take a step back to look at what an NSF is. An NSF is, in its heart of hearts, a key/value store. Each entry has several keys of which the useful ones are Note ID and the UNID, which are 32-bit and 128-bit integers, respectively, and where the Note ID is fixed and the UNID is mutable. Each entry's value is a multimap with string keys and values that are either ef [read] Keywords: agent domino formula language ibm database java javascript openntf server sql
109


How I Deal With Collections in the Framework
Sun, Jul 20th 2014 8:13a   Jesse Gallagher
A post on Christian G├╝demann's blog and a followup on Nathan Freeman's made me figure it could be useful to discuss how I deal with the job of working with document collections in the frostillic.us Framework. First of all: I am not solving the same original problem Christian had. His post discussed strategies for actually opening and processing every document and secondarily building a collection using inadvisable selection formulas for views (namely, @Today). I don't generally do that [read] Keywords: domino ibm rich text xpages bug database java openntf
170


Platform Defensiveness
Fri, Jul 18th 2014 6:12p   Jesse Gallagher
If you were a Mac user in the 90s and early 2000s, life could be tough. Though you loved your platform of choice and could see its advantages plain as day, you were in a distinct minority. The world was full of people ready to line up to explain why you're an idiot on a sinking ship. And the part that stung was that they weren't always wrong: for every person talking out of their ass about how great having a menu bar in every window was or the joys of running ancient line-of-business DOS [read] Keywords: domino ibm notes notes client xpages apple community desktop exchange exchange google mac microsoft server
92


Building an App with the frostillic.us Framework, Part 4
Thu, Jul 17th 2014 1:12p   Jesse Gallagher
Define the data model Create the view and add it to an XPage Create the editing page Add validation and translation to the model Add notification to the model Add sorting to the view Basic servlet REST with Angular.js Add validation and translation to the model Now that we have a page to edit the model objects, it's time to spruce them up a bit by adding some type information, an additional field, and some basic translation. When we first set up the Note model, it didn't contain any infor [read] Keywords: domino xpages java properties sql
76


Building an App with the frostillic.us Framework, Part 3
Thu, Jul 17th 2014 12:12p   Jesse Gallagher
Define the data model Create the view and add it to an XPage Create the editing page Add validation and translation to the model Add notification to the model Add sorting to the view Basic servlet REST with Angular.js On the scale of "bog-standard" to "weird", the next phase of writing a frostillic.us Framework app sits in the middle: the basic steps of creating a model-editing page are pretty standard, but you can use unique aspects of the Framework to save a bunch of coding and add som [read] Keywords: domino ibm notes xpages dojo properties xml




Created and Maintained by Yancy Lent - About - Blog Submission - Suggestions - Change Log - Blog Widget - Advertising - Mobile Edition