NotesIn9 | Category Archives: Community
In this show Tim Tripcony explains that while we’ve typically been binding to a value all this time, it’s possible to bind to a component inside your XPages Development.
This show was originally published elsewhere and I basically grabbed this to try and improve the visibility and get Tim’s information as much exposure as possible.
I have 2 new unpublished videos from Tim coming next.
First I want to highlight OpenNTF’s recent post regarding Tim’s projects. Let me simply say that I think the #codefortim idea is brilliant. Pure genius and so appropriate. Tim shared. Period. I just read that post like 5 minutes ago so I’m going to let it sink in before I talk any more about it.
Which brings us to the topic of today. This email exchange I’m going to post was forwarded to me by my friend Dan. He asked Tim a question and as usual got a great response back. I’m so very thankful he sent this to me. What make this really special is just how recent it is. It was only a couple of days before Tim passed. This is the last email I have to publish. If anyone has any similar emails that they’d be willing to share I’d be very happy to publish them as well. Next up is some videos.
On May 7, 2014 at 4:30:20 PM, Daniel wrote:
I was looking at an answer you gave Naveen on Stack Overflow on the use of the JSON-RPC control.
From how you describe the control, it sounds like an AJAX operation. Is my understanding correct?
I’m thinking of an application for it and I wonder if you could tell me if it’s the right tool.
I have an Xpage I’m building that accepts input from a proximity scanner. When an ID is scanned (badgeNo), I’d like to be able to query and SQL db to get the person’s EmpID number and use that to display his image on the screen. Would the JSON-RPC control be appropriate for that kind of operation?
From: Tim Tripcony
Date: 05/08/2014 02:15 AM
Subject: Re: JSON-RPC control
In my opinion, that use case is almost definitely a good fit for JSON-RPC.
RPC stands for “remote procedure call”. Simply put, you’re telling the server to run a method — and how to run that method (in other words, passing method arguments) — and send back a result. So yes, this is AJAX, but it’s slightly different from partial refresh events in XPages.
Similarly, submission of any data the user has entered is also automatic. While there are ways to override exactly how much data is sent for each specific event, the default is to just post the entire form to the server. This facilitates the “statefulness” of XPages — with each event, the server state of the page is essentially synchronized with what the client state now is, so both the browser and the server have some level of awareness of the user’s behavior, and both can account for that current state.
JSON-RPC, by comparison, might appear rather manual at first glance. Adding one of these components to your page and defining one or more methods is essentially defining an API that you can then call… but you still need to then add client-side code to actually call it, and also to respond to whatever data the server sends back to the browser. There are a few bits of good news in this regard, however:
– The performance of this type of service is incredibly lean for two reasons. One reason is that it sends the absolute minimum amount of data in both directions. To be precise, it sends only identifiers for which service is being called and which method it should run, as well as the value of any arguments; in return, it sends back only whatever value you explicitly return from whichever method is called. So instead of posting the values of potentially dozens or even hundreds of fields and getting back a big blob of HTML, it might send only a single number (e.g. badge ID) to the server and get back a single string (e.g. employee ID)… although the response object can be as simple or complex as you want.
The other reason it’s faster is because the default behavior is to not save the component tree after an RPC method runs. It’s assuming that you’re doing something very similar to the use case you described, so there’s no need to re-serialize the entire page state, because you’re not sending a bunch of form data that should update a backing model bean, etc.; rather, you’re just sending it a badge ID and asking it to send back a corresponding employee ID, so there shouldn’t be a need for it to “remember” that it did once it has.
For both of these reasons, JSON-RPC tends to be lightning fast when compared to most partial refresh events, even under low-bandwidth / high latency conditions.
Here’s some pseudo-code to give you a feel for what this might look like if you decide to take the JSON-RPC approach. Somewhere in your XPage you’d have component markup that looks similar to the following:
<xe:jsonRpcService id=”scannerRpc” pathInfo=”scanner”>
<xe:remoteMethod name=”getEmployeeId” script=”return getEmployeeIDFromSQL(badgeId);”>
<xe:remoteMethodArg type=”number” name=”badgeId” />
The assumption, of course, is that the getEmployeeIDFromSQL() function is already defined somewhere — presumably, in a SSJS library. So for what you’re describing, all that might really need to change in the above example is to alter the type of the badgeId argument (if, for instance, that should be a string, not a number) or to change the getEmployeeIDFromSQL reference to whatever code will be responsible for actually performing the SQL query, whether that be SSJS or perhaps a method of some Java bean.
The other half of this, then, is defining client-side code to call the remote method defined above. If that’s triggered by a “Search” button, for instance, you might end up with something like this:
<xp:button value=”Search” id=”button1″>
<xp:eventHandler event=”onclick” submit=”false”>
<xp:this.script><![CDATA[var badgeId = someCodeToGetIdFromScanner();
You might, of course, be setting the innerHTML of a div instead of the value of an input, but hopefully the above example illustrates the basic premise:
– Because the RPC service defines a remote method named “getEmployeeId” that accepts a single argument named “badgeId”, the global client-side object has a function called “getEmployeeId” that is also expecting a single argument.
– Calling that client-side function does not immediately send the AJAX request; rather, it returns an object that has a .addCallback method. Calling this method does immediately trigger the AJAX call… and passing a function to addCallback() defines what code will run when the AJAX call returns. Since we’re just expecting to get back a single string value, we specify that the function that we pass to addCallback() accepts a single argument, which we can then use inside the function to somehow update the page or otherwise inform the user that we now know what the scanned employee’s ID is.
No doubt there’s a myriad of valid approaches for your specific use case, but I’ve become rather fond of JSON-RPC for this type of functionality, both because of the relative ease of implementation and because of the comparative performance. Hopefully this overly verbose explanation gives you an indication of whether or not the JSON-RPC approach would, in fact, be a good fit for what you’re trying to do.
For anyone reading this information that’s interested in the JSON-RPC stuff. I believe it’s come up on NotesIn9 a couple times as well. So there should be some examples available.
Below is an email thread between Serdar Basegmez, Tim Tripcony and myself. Serdar reminded me of it and re-sent it to me so I could share. It’s a little dated but I’m reposting this because the quality of the information should be shared.
Now this realization did not happen over night for me. I believe this email came in right after my famous battle with Phil Riand. Where I said I’ll never use Java and SSJS should be made better and the “bug” should be fixed. And he said it’s not really a “bug” and to use Java. we went back and forth a bit and I ended up losing royally and now I write with Java. haha
So anyway here’s Serdar’s original question:
I guess I just wanted to give everyone a heads up on my current thoughts on publishing material that I have from Tim.
I have 2 emails filled with “Tim Info” that I want to publish and just get it out there. 1 is pretty old but the other was forwarded to me last week and I think was from that past Thursday. Both have some really good information that deserves to be more widely available I think.
I also have 2 videos from Tim. One from a couple weeks ago on using OAuth. Another small one from a couple months ago that I just totally missed and forgot about.
There’s also a video from a while ago that was intended for NotesIn9 but I think I was on vacation that week and he just got impatient and put it up on his YouTube Channel. I pretty much intend to republish that inside NotesIn9 so try and get it more visibility.
Anyway – that’s my thoughts. My current intention is to get all this out as soon as possible.
Last night a memorial get together was held in honor of our friend, Tim “XMage” Tripcony. We met at the Allentown Brewhouse which did seem like a pretty nice place. It kinda reminded me of the Big River Grill at Disney where we always meet for BALD the day before Lotusphere starts. So very fitting.
Jesse Gallagher, Chris Toohey and I wanted to have some kind of get together to raise a glass to Tim and share some stories and I think it worked out very well.
It was great to see old friends, Rob and Jim, and make new ones in Dave and Dennis. Everyone seemed to have a good time. Good enough that we might try to do another meetup in the area sometime in the future.
Here’s a couple pics from the event.
I really don’t remember all the details of how I met Tim “XMage” Tripcony, but from early on he was always kind to me and a friend of my NotesIn9 screencast.
I remember talking to him probably via email and/or Sametime about a blog post he made on “Fancy Typeahead”. I thought it was brilliant and as like many things Tim was involved with, no one had ever done that before in XPages. I eventually pretty much stole that entire post (with his blessing) and turned it into Episode 24. http://notesin9.com/index.php/2011/02/11/notesin9-24-fancy-type-ahead-in-xpages/
I’m not sure but I THINK I first met Tim in person at the Lotusphere 2010 Opening Party. This was now my second Lotusphere. I was doing NotesIn9 by then so I started to talk to people in the community but I really didn’t know many people “in person”. Just from online chats and stuff really. The original “XPages Blog” brought a lot of people together I think.
I did meet some people in person for the first time at BALD. Declan Lynch was one of them as I was presenting with him that year. I remember bumping into someone from BALD at the Sunday night party as I wandered around aimlessly and they told me not to move as “Tim was looking for me”. Sure Tim and I had communicated by then a little bit for him to actively try and look for me was something else. Made me feel very special and included. I’ll always remember the blogger photo from Lotusphere that year where this popular genius of the community ,who was also the nicest guy you could ever hope to find, chose to stand with me.
I remember Tim pinging me on Skype one day. He said Nathan, who I never spoke to before, wanted to talk to me. I said to Tim: “Oh Crap! Nathan wants to cancel NotesIn9 because I’m doing it all wrong!”. Tim assured me that wasn’t the case.
I remember on a business trip to Atlanta arranging to meet Tim for dinner. We went to this really good BBQ place called Foxboro I think and just sat and talked for hours. It was great.
I remember thinking of him as the “Mr. Spock” of our community. Tim was completely brilliant. And where Spock would say “fascinating” Tim would say “Indeed”.
Tim was the SWAT team of the XPages world. You get stuck on something then you ask someone. If no one else knows THEN you called Tim. Tim always happily answered. Which didn’t mean you understood the solution all the time. but he tried explaining it. I remember him coming over to my room in Lotusphere one time. I was really stuck on something… I don’t remember what. Tim sat and looked at my stuff and I think gave me a couple ways to proceed. One of them I understood.
When I would describe Tim to someone I would always bring up a reference to Star Trek IV. I’d say talking to Tim is like talking Scotty. It’s like talking to someone from the future and he has the formula to Transparent Aluminum. I think Tim got a kick out of that one.
Tim was actually my best contributor to NotesIn9. He love to share. He came on for 8 shows that totaled over 3 and a half hours. I’ll put links to those shows at the end of this post. I have 2 more unpublished shows from Tim. One I knew about and another one that I just completely missed. I’d forgotten all about it. That one seems extra special to me now for some reason. I’m going to try and publish both next week. I swear on the bigger show from just a couple weeks ago he seemed “giddy” when going through the code.
I’m a better person for knowing Tim Tripcony. He was an inspiration, a personal hero, and a friend.
Tim contributed to these NotesIn9 shows: (2 more coming)
I’ve gotten a great response to this! I believe we’re up to 11 people that are likely. Amazing!
But the initial plan needs to change. Apparently some of the local colleges graduate that day and the Bethlehem location was booked. So we’re going to try and move it to their Allentown location.
This isn’t really a “room” or anything. It’s basically reservations for 5:00pm. I’ve never been there so I don’t know what to expect. I assume there’s a bar if you get there early. I’m sure I’ll be there a little earlier.
This is low key! The same as Tim or any other LUG type event. No real “agenda”. We’ll hang… chat… morn, commiserate… explore the future maybe. Just basically a meet and be social as in “real world social”.
Please let me know if you have any questions. And if you’re planning on coming and haven’t let me know yet please do!
As much as I would like to, I’m unable to get to Tim Tripcony’s actual memorial with his family and friends in the Atlanta area. But here’s the thing, Tim has friends all over the world. So here’s what I’m going to do:
This Sunday evening, May 18th, starting at 5:30ish in the Bethlehem Pa area, I’ll be getting together with Chris Toohey and Jesse Gallagher. We’re going to toast our friend*, maybe tell a story or 2 and then probably talk some XPages and whatever.
We’d like to invite anyone to join us for a very informal low-key event. If we get enough interest one of the topics will be if we want to try and meet again for a more formal-ish “XPages and Beer” type learning event.
I feel that the best way to honor our friend is to continue to practice what he did every single day:
Learn. Code. Share
Again this is open to all whether you knew Tim personally, read his blog, or are just interested in talking XPages with like minded people.
If you are wanting to attend, please let me know ASAP – (dleedy @ notesin9) so I can try and get a count for the possible venue – most likely at:
http://www.thebrewworks.com/bethlehem-brew-works/. If you can’t make it on Sunday but are interested in a possible future event please let me know that as well.
UPDATE: Venue Changed to: http://www.thebrewworks.com/allentown-brewworks/
* I personally will not be toasting with a White Russian simply because I don’t know how to drink “big boy” drinks and also don’t like coffee.
This weekend I was working on a NotesIn9 from Tim Tripcony that I’ve been sitting on for a couple of weeks. I pinged him on Skype this morning to ask a question. I was literally just about to start rendering the video when I got word that he has passed away.
Here’s the linked in post from Scott Hooks
Tim was my friend. My heart breaks over this news.
My thoughts and prayers go out to his family and friends.
I want to be more eloquent but simply can’t. I can barely breath.
I would like to put this idea out… if anyone wants to send me any audio stories or memories of Tim, I’d like to put them together and publish them. just email me: dleedy @ notesin9
Here is one of my few pictures of the two of us. It’s also my favorite. Taken from the 2010 blogger photo. Tim standing next to my putting his chin on my shoulder.