Hello World, or Rise of the Phoenix

My name is Toby and I am a “habitual blog re-starter”, I have a problem, I love sharing the knowledge that I have gained from working with XPages but I tend to find myself putting it on the back burner for so long that it ends up being almost a year before I post anything new.  I am taking this opportunity to have a re-birth of sorts into the blog-o-sphere and as Brain would say “Try to take over the world”.  In the coming few weeks please look forward to hearing from me on topics such as XPages, Java, OSGi, Domino, Hibernate, maybe even some angular thrown in there for good measure.

Advertisements

OpenNTF Domino API

Open Source just plain rocks.  Many times as developers we get frustrated with the lack of usability of a certain API or the hacks that we have to do to make what we are trying to do work easily with the API.  The other day I was working with a relational database that stored binary files in the database as bytes.  I was working to send out an email with with the binary file as an attachment.  As I’ve been using the openntf domino api I planned on using the DominoEmail class to quickly create an email, however I noticed that the Attachment API only supported creating attachments from Attachments in a Document or from a file on the file system.  So I reached out to the Contributors of the API, questioning whether I missed something.  I had not missed it, the functionality was not built in, however I was given the opportunity to add it.  I had some extra time that day so I cloned the github project down and added a couple new methods and sent it back in the matter of a couple of hours new functionality that will help lots of users, that is the power of open source its the community that gets to decide what is important.  I am thankful for the team that put so much effort into the API and excited that we now have the power on the Notes/Domino World to change our environment without waiting months or years.  I encourage everyone to check out the API and if you see something missing, add it.  Simple as that.

Script Resources in Xpages

Earlier today I was looking through some example of a javascript framework and in them they used <script> tags in the <head> of the html document.  I was trying to take the example and apply it into xpages, however I was having issues adding a script tag that had inner text into the head of an xpage, I wasn’t aware of how to do it outside of writing a custom ScriptResource.  However I reached out to a few experts and Tim Tripcony came through for me again and gave me the answer I was looking for.  The standard Xpages ScriptResource resource actually includes an attribute called “contents”  that writes the script out to the head tag.  I thought I would share here in case someone else was looking for a way to do it.

<?xml version=”1.0″ encoding=”UTF-8″?>
<xp:view xmlns:xp=”http://www.ibm.com/xsp/core”&gt;
<xp:this.resources>
<xp:script clientSide=”true”>
<xp:this.contents><![CDATA[alert(“This will display inside the script tag”);]]></xp:this.contents>
</xp:script>
</xp:this.resources>
</xp:view>

The above Xpage will render a tag inside the head tag like this:

<head>

<script type=”text/javascript”>alert(“This will display inside the script tag”);</script>

</head>

Xpages LDAP Datasource

A couple of days ago I contributed an opensource project on openntf that is a datasource for Xpages that will allow the developer to connect to an LDAP server and use it as a datasource for their Xpage.  An example of an Xpage that uses it is below:

 

xpage

 

The code for this project is definitely still considered a beta, however I contributed this more as an example of how to add a component or datasource to your Domino server by using an extension library.  So if you feel so inclined download the source play around with it.  As I mentioned the source is available on openntf

http://www.openntf.org/internal/home.nsf/project.xsp?action=openDocument&name=Xpages%20LDAP%20Datasource

and github

https://github.com/tsamples/ldapdatasource

If anyone has any questions or wants to discuss this datasource or any of those topics please contact me and I’ll do my best to help.

 

OSG what?

Everyone who has ever coded more than a hello world statement in any language probably has a few go to functions or subroutines or methods that they use all the time and in almost every app they write.  I have been lucky enough to stand on the shoulders of giant as well and not only do I use my own utility libraries, but I also have been able to borrow and steal libraries that have made my life easier and my apps better.  However since I use these same libraries in almost every app it would be nice to not have to add the Library to every app.  There are many ways in which this is accomplished.  It appears in the Lotus Domino world this has always been accomplished by using design inheritance.  I have to admit this concept through me when I first was learning the platform because it seemed weird to me to have multiple copies of the code even if they could be overwritten at a moments notice.  With Xpages we have a powerful new feature that allows us to store code and components on a server in a way where it will be accessible by every Application on the server.  This new mechanism is a buzz word that we hear all the time in the Xpages world, OSGi.  OSGI is actually just a way of modularizing all the code on a server so that each piece can be used individually and can be updated without affecting other apps depending on the old versions of the code.  There are many ways of modularizing code.  Methods, Classes, Packages, Jars, and OSGi Bundles.

We will start by building an OSGi Bundle that is an Xpages extension library to extend our server to have more functionality in every app.  Xpages uses these extension libraries to add on new code server wide instead of just in a single App.  The most well known of these extension libraries is the Extension Library created by IBM and made opensource on Openntf.

On my next post we will start building this Bundle and plugin so we can put our custom code library on the Domino Server and make it available to every app.

Obligatory egocentric First Post

OK, so I’ve thought about doing this for awhile, tried it once or twice, however I never really kept it up.  So I have a new philosophy.  This blog will be for my thoughts on Xpages Development, Java Development, Domino, OSGi, Websphere, .net, other random technical stuff and maybe some personal life stuff.  But it will be a blog that I will occasionally write on.  I have been prodded and inspired by many in the IBM Notes and Domino community, but while typing this a couple come to mind that I’d like to mention.  First of all Marky Roden made a heck of a case for blogging even if you are like me and can’t put together two words in his blog post.  Also Kathy Brown described kind of how I feel when I go to community events and when I interact with others in the community at her spark ideas session.  So Hopefully I will feel like blogging again and this blog will not just be abandoned like so many before it.  I also have plans to put up a dev/demo box that I have so I can run some of the things I’m talking about online, but all in good time I guess.  So in conclusion I hope that I don’t bore you too much with my ramblings and odd discussion of some rather obscure technology.