<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/">
	<channel>
		<title>Codestore Activity Log</title>
		<description>Latest ten updates to codestore, be they blogs or articles.</description>
		<language>en-gb</language>
		<link>http://www.codestore.net</link>
		<lastBuildDate>Fri, 18 May 2012 05:36:57 -0500</lastBuildDate>
		<atom:link href="http://www.codestore.net/store.nsf/rss.xml" rel="self" type="application/rss+xml" />

		<item>
			<title>Using Java to Create Rich GUI Interfaces in the Notes Client | Blog</title>
			<pubDate>Fri, 18 May 2012 05:36:57 -0500</pubDate>
			<author>Jake Howlett</author>
			<description><![CDATA[ <p>This last couple of weeks I've made what I hope to be a brief return to developing for the Notes client. One of the requirements I had was to "add a form" to an existing Notes database, which allowed the user to input a few parameters and do a simple search of a remote SQL database, present the results to the user for their review before letting them import the resulting data in to the Notes database.</p> <p>It goes without saying that I'd forgotten how to program in the Notes client. Having had such a long absence from Notes I came at it assuming that I could use Java code in the client (maybe you can and I missed something?). </p> <p>For example, I'd assumed that, by now, I'd be able to write Java code in the Click event of a Button. As you can see below, this isn't an option.</p> <p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.codestore.net/store.nsf/rsrc/84FDF715D15D714186257A02003A4CF5/$file/image_041d4295-888c-44ae-9e3d-b07ba8d28b1d.png" width="486" height="165"></p> <p>I'm sure there's good reasons why we can't (is there?) but it left me a bit stuck. Was LotusScript my only option? I didn't relish the idea of fudging my way through getting LotusScript to do what I needed to do. It's not that I don't think it could. I'm sure it can, but it was a problem that really needed Java as the solution. </p> <p>Not wanting to learn client development all over again or struggle trying to get LotusScript to do it I opted to write a Java Swing-based interface. </p> <p>You can see an example below:</p> <p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.codestore.net/store.nsf/rsrc/5D2E55564517A50B86257A02003A4E44/$file/image_15eb7ad4-0f11-4db1-8181-b619b71f0f4d.png" width="604" height="425"></p> <p>In the above example the user has clicked the Action button on the view and up popped the interface you can see. After entering some data and clicking a button the results table is populated from the SQL data. Then, when the Import button is pressed the data is saved in Notes -- a new document for each row of the table.</p> <h4>How does it work?</h4> <p>It's quite simple. The View's Action button looks like this:</p> <p><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.codestore.net/store.nsf/rsrc/5BD2574B53B3F44286257A02003A4FBF/$file/image_7474ebc5-00af-4caa-bc66-3b91696e43cd.png" width="418" height="98"></p> <p>This runs a Java Agent called "Import". Inside this agent the Java code simply creates an instance of a JFrame, adds all the components to it and then displays it. As far as the user's concerned it's just a part of Notes - when in fact it's a "standalone" Java application running inside Notes' JVM.</p> <h4>Powerful</h4> <p>The more I got in to this approach the more powerful I realised it was. Not only because the Java code is all self-contained in an Agent; meaning there are no installers or separate executable files to mange or distribute. But also because the app gets updated at the same time as the database design. Even the icons used in the buttons are stored as Resource files in the Agent itself. It's win win.</p> <p>And because it's written in pure Java it's uses true OO patterns and a rich GUI. There are endless possibilities and pretty much no limit as to what you can do inside that popup window. I even managed to use a Thread to add and update a progress bar during the import process, which made me feel all geeky going multi-threaded (easier than it may sound!).</p> <p>It also used a Data Access Layer (DAL) and data-modelling classes to abstract away from the SQL database. I had to do this as it's schema is subject to change. Also, at some point, the system will be moved off of Notes. At that point it will be easier to migrate this pure OO Java-based solution than it would be a Notes one.</p> <p>It's worth noting that it runs inside the Notes JVM as the current user, meaning there's no need to store or ask for their password.</p> <h4>Gotchas</h4> <p>The one thing I don't like about using these Java windows is there's no way to open them as modal to the Notes client. It's all to easy for them to slip under the Notes client and the user to lose track of where it's gone.</p> <p>However, they can be made to run (and stay) on top of all other windows, but that's a bit annoying. To do that would involve editing the java.policy file (found in &lt;Notes Folder&gt;\JVM\lib\security) on the user's machine and adding this permission:</p><code>permission java.awt.AWTPermission "setWindowAlwaysOnTop";</code>  <p>Then in the code itself you can set the Swing frame to stay on top, like so:</p><pre class="code2">try{
  frame.setAlwaysOnTop(true);
} catch (SecurityException sex){ }</pre>
<p>Also, I've I've yet to work out how to limit it to only showing one window at a time. If the windows pops below others and the user presses the View Action button again they end up with two of them. I'd rather it brought the first back in to focus. </p>
<p>The other gotcha I found was that any button click (or other event) handlers in the popup window had no access to the Agent's Session object. That's because the Agent itself has completed running and all the session-based object have been recycled. If you want the Java code to interact with Notes then you need to create a new session. </p>
<p>To do this I wrote the basis of the Agent like this:</p><pre class="code2"><span class="TPkeyword1">public class </span>JavaAgent <span class="TPkeyword1">extends </span>AgentBase <span class="TPbracket">{</span>

 <span class="TPkeyword1">private static </span><span class="TPkeyword2">String </span>databaseServer;
 <span class="TPkeyword1">private static </span><span class="TPkeyword2">String </span>databasePath;

 <span class="TPkeyword1">public void </span>NotesMain<span class="TPbracket">() {</span>
  <span class="TPkeyword1">try </span><span class="TPbracket">{</span>
   Session session <span class="TPoperator">= </span>getSession<span class="TPbracket">()</span>;
   
   <span class="TPcomment">//So that later any session/threads can access this database</span>
   databaseServer <span class="TPoperator">= </span>session.getCurrentDatabase<span class="TPbracket">()</span>.getServer<span class="TPbracket">()</span>;
   databasePath <span class="TPoperator">= </span>session.getCurrentDatabase<span class="TPbracket">()</span>.getFilePath<span class="TPbracket">()</span>;
   
   <span class="TPcomment">//Launch the dialog/form for user input</span>
   <span class="TPcomment">//initializeUI();</span>

 <span class="TPbracket">} </span><span class="TPkeyword1">catch</span><span class="TPbracket">(</span><span class="TPkeyword2">Exception </span>e<span class="TPbracket">) {</span>
   e.printStackTrace<span class="TPbracket">()</span>;
 <span class="TPbracket">}</span>
<span class="TPbracket">}</span>


 <span class="TPkeyword1">private static void </span>calledFromSwingUIAfterAgentIsDone<span class="TPbracket">(){</span>
  <span class="TPkeyword1">try</span><span class="TPbracket">{</span>
   NotesThread.sinitThread<span class="TPbracket">()</span>;
   Session session <span class="TPoperator">= </span>NotesFactory.createSession<span class="TPbracket">()</span>;

   Database db <span class="TPoperator">= </span>session.getDatabase<span class="TPbracket">(</span>databaseServer, databasePath<span class="TPbracket">)</span>;
   Document doc <span class="TPoperator">= </span>dc.createDocument<span class="TPbracket">()</span>;

   <span class="TPcomment">//etc</span>

  <span class="TPbracket">} </span><span class="TPkeyword1">catch </span><span class="TPbracket">(</span><span class="TPkeyword2">Exception </span>e<span class="TPbracket">){</span>
   <span class="TPcomment">//report error</span>
  <span class="TPbracket">} </span><span class="TPkeyword1">finally </span><span class="TPbracket">{</span>
   NotesThread.stermThread<span class="TPbracket">()</span>;
  <span class="TPbracket">}</span>
 <span class="TPbracket">}</span>
<span class="TPbracket">}</span></pre>
<p>Note that I stored the database's server name and file path in two Strings that we can refer to later when we create our own Session object and re-open the database.</p>
<h4>Summary</h4>
<p>All in all it's an approach I'm happy with and it's got the job done. Some of you may think it's crazy overkill but, for me, it was the best (if not only) solution.</p>
<p>If there's any interest I can package up a downloadable example?</p>
<p><a href="http://www.codestore.net/store.nsf/unid/BLOG-20120518-0536?open#post"><img border="0" src="http://www.codestore.net/store.nsf/images/rss_reply.gif" alt="Click here to post a response" /></a></p> 		]]></description>
			<link>http://www.codestore.net/store.nsf/unid/BLOG-20120518-0536</link>
			<guid isPermaLink="true">http://www.codestore.net/store.nsf/unid/BLOG-20120518-0536</guid>
			<comments>http://www.codestore.net/store.nsf/unid/BLOG-20120518-0536?Open#comments</comments>
			<slash:comments>10</slash:comments>
			<wfw:commentRss>http://www.codestore.net/store.nsf/blog.xml?Open=20120518-0536</wfw:commentRss>
		</item>
		<item>
			<title>Native Look and Feel With Java Swing Windows | Blog</title>
			<pubDate>Mon, 14 May 2012 08:58:02 -0500</pubDate>
			<author>Jake Howlett</author>
			<description><![CDATA[ <p>A while back I <a href="http://www.codestore.net/store.nsf/unid/BLOG-20120330-0645">talked about</a> how I'd been using Java Swing components within code running inside the Lotus Notes client to "extend its interface" however I liked. </p> <p>As an example, I showed this progress-bar-enabled output window:</p> <p><img src="http://www.codestore.net/store.nsf/rsrc/476AB77C3DE77E32862579D100409E33/$file/image_453a5e84-0e90-4ea0-a6a9-8199de11d6c2.png"></p> <p>It works but looks a bit too Java-ery for my liking. Too obviously not a standard part of the client itself. It just jarred with me ('scuse the Java pun there).</p> <p>Well, if you add the following line in to the Java code before opening the window above:</p><pre>UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() );</pre>
<p>You get something that looks like this. All together a bit better looking.</p>
<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.codestore.net/store.nsf/rsrc/17AF0E62A456C92F862579FE004CB94C/$file/image_4cb1e846-206c-48f6-9f10-a873156a2fb5.png" width="549" height="428"></p>
<p>When this appears after clicking a button inside a database inside the Notes client you can be forgiven for thinking it was a natural part of the Notes UI. Almost.</p>
<p><a href="http://www.codestore.net/store.nsf/unid/BLOG-20120514-0858?open#post"><img border="0" src="http://www.codestore.net/store.nsf/images/rss_reply.gif" alt="Click here to post a response" /></a></p> 		]]></description>
			<link>http://www.codestore.net/store.nsf/unid/BLOG-20120514-0858</link>
			<guid isPermaLink="true">http://www.codestore.net/store.nsf/unid/BLOG-20120514-0858</guid>
			<comments>http://www.codestore.net/store.nsf/unid/BLOG-20120514-0858?Open#comments</comments>
			<slash:comments>6</slash:comments>
			<wfw:commentRss>http://www.codestore.net/store.nsf/blog.xml?Open=20120514-0858</wfw:commentRss>
		</item>
		<item>
			<title>RFC: SharePoint From A Domino Perspective | Blog</title>
			<pubDate>Wed, 9 May 2012 01:56:53 -0500</pubDate>
			<author>Jake Howlett</author>
			<description><![CDATA[ <p>As a Domino developer, when you start to learn SharePoint, the first things that strikes you is how similar the two are. Well, they're quite different, but there are undeniable parallels.</p> <p>As I work my way through <a href="http://shop.oreilly.com/product/0790145300386.do">this book</a> I am compiling a table of the elements that make up SharePoint and trying to match them to Domino design elements I'm familiar with. There's no real point to it other than try and understand SharePoint from a perspective I'm used to.</p> <p>Here's the table as it stands (very much a draft):</p> <p> <table border="1" cellspacing="0" cellpadding="3" width="591"> <tbody> <tr> <td valign="top" width="117"><strong>Domino Element</strong></td> <td valign="top" width="145"><strong>SharePoint Element</strong></td> <td valign="top" width="327"><strong>Comments</strong></td></tr> <tr> <td valign="top" width="117">Domino Directory</td> <td valign="top" width="145">Active Directory</td> <td valign="top" width="327">Other way to store users? Dynamics?</td></tr> <tr> <td valign="top" width="117">&nbsp;</td> <td valign="top" width="145">Web Application</td> <td valign="top" width="327">&nbsp;</td></tr> <tr> <td valign="top" width="117">&nbsp;</td> <td valign="top" width="145">Site Collection</td> <td valign="top" width="327">&nbsp;</td></tr> <tr> <td valign="top" width="117">Database</td> <td valign="top" width="145">Site?</td> <td valign="top" width="327">Although there can be multiple Sites per SQL "content database" so maybe a Site Collection is more akin to a databases?</td></tr> <tr> <td valign="top" width="117">ACL</td> <td valign="top" width="145">Site Permissions</td> <td valign="top" width="327">&nbsp;</td></tr> <tr> <td valign="top" width="117">User</td> <td valign="top" width="145">AD User</td> <td valign="top" width="327">&nbsp;</td></tr> <tr> <td valign="top" width="117">Form</td> <td valign="top" width="145">Content Type?</td> <td valign="top" width="327">A Content Type combines a group of Site Columns and defines the pages used to edit/view them.</td></tr> <tr> <td valign="top" width="117">Subform</td> <td valign="top" width="145">Web Part?</td> <td valign="top" width="327">&nbsp;</td></tr> <tr> <td valign="top" width="117">View</td> <td valign="top" width="145">List</td> <td valign="top" width="327">&nbsp;</td></tr> <tr> <td valign="top" width="117">Agent (WQO and WQS)</td> <td valign="top" width="145">WorkFlow / Event Receiver?</td> <td valign="top" width="327">&nbsp;</td></tr> <tr> <td valign="top" width="117">Agent (via Action menu)</td> <td valign="top" width="145">Custom Action (Ribbon-based)</td> <td valign="top" width="327">There are options in SharePoint to get a handle on selected documents too.</td></tr> <tr> <td valign="top" width="117">Scheduled Agent</td> <td valign="top" width="145">Timer Job</td> <td valign="top" width="327"><a href="http://technet.microsoft.com/en-us/library/cc678870.aspx">More on Timer Jobs</a></td></tr> <tr> <td valign="top" width="117">Field</td> <td valign="top" width="145">Column</td> <td valign="top" width="327">&nbsp;</td></tr> <tr> <td valign="top" width="117">Shared Field</td> <td valign="top" width="145">Site Column</td> <td valign="top" width="327">&nbsp;</td></tr> <tr> <td valign="top" width="117">Computed Field</td> <td valign="top" width="145">Computed Column</td> <td valign="top" width="327">Hidden/Read Only Site Column perhaps? Accessed via object model</td></tr> <tr> <td valign="top" width="117">Readers Field</td> <td valign="top" width="145">FGP?</td> <td valign="top" width="327">FGP=Fine-Grained Permissions (<a href="http://technet.microsoft.com/en-us/library/cc287792(v=office.12).aspx#section3">link</a>)</td></tr> <tr> <td valign="top" width="117">Authors Field</td> <td valign="top" width="145">FGP?</td> <td valign="top" width="327">&nbsp;</td></tr> <tr> <td valign="top" width="117">Document</td> <td valign="top" width="145">List Item</td> <td valign="top" width="327">&nbsp;</td></tr> <tr> <td valign="top" width="117">Profile Document</td> <td valign="top" width="145">Property Bag</td> <td valign="top" width="327">Somewhere to keep "settings" and configuration. <a href="http://msdn.microsoft.com/en-us/library/ff649798.aspx">Various Options</a></td></tr> <tr> <td valign="top" width="117">Action Bar</td> <td valign="top" width="145">Ribbon</td> <td valign="top" width="327">Not as cut and dry but a simple comparison to make. Ribbon is way much more than a </td></tr> <tr> <td valign="top" width="117">Page</td> <td valign="top" width="145">Content Page</td> <td valign="top" width="327">Or maybe an Application Page?</td></tr> <tr> <td valign="top" width="117">Script Library</td> <td valign="top" width="145">*.cs files</td> <td valign="top" width="327">In Visual Studio you can create your own assemblies using as many and as complex a set of C# source files as you like.</td></tr> <tr> <td valign="top" width="117">File Resources/Images etc</td> <td valign="top" width="145">Module</td> <td valign="top" width="327">&nbsp;</td></tr> <tr> <td valign="top" width="117">&nbsp;</td> <td valign="top" width="145">Feature</td> <td valign="top" width="327">Can contain lots of combined objects such as ContentType, CustomAction, WebTemplate, Field etc</td></tr> <tr> <td valign="top" width="117">&nbsp;</td> <td valign="top" width="145">Package</td> <td valign="top" width="327">&nbsp;</td></tr> <tr> <td valign="top" width="117">&nbsp;</td> <td valign="top" width="145">Solution</td> <td valign="top" width="327">Combines lots of Features?</td></tr> <tr> <td valign="top" width="117">Mail-In Database</td> <td valign="top" width="145">List</td> <td valign="top" width="327">You can specify a mail-in email address for any List</td></tr></tbody></table></p> <p>If you have any input or comments please add them below and I'll amend the table accordingly.</p> <p>There are some gaps where, as far as I'm aware, there's no equivalent in the other system. If I'm wrong please say! Any SharePoint element with a question mark next to it are those I'm not confident about.</p>
<p><a href="http://www.codestore.net/store.nsf/unid/BLOG-20120509-0156?open#post"><img border="0" src="http://www.codestore.net/store.nsf/images/rss_reply.gif" alt="Click here to post a response" /></a></p> 		]]></description>
			<link>http://www.codestore.net/store.nsf/unid/BLOG-20120509-0156</link>
			<guid isPermaLink="true">http://www.codestore.net/store.nsf/unid/BLOG-20120509-0156</guid>
			<comments>http://www.codestore.net/store.nsf/unid/BLOG-20120509-0156?Open#comments</comments>
			<slash:comments>25</slash:comments>
			<wfw:commentRss>http://www.codestore.net/store.nsf/blog.xml?Open=20120509-0156</wfw:commentRss>
		</item>
		<item>
			<title>Solution to Java Applet Puzzle | Blog</title>
			<pubDate>Fri, 4 May 2012 02:24:00 -0500</pubDate>
			<author>Jake Howlett</author>
			<description><![CDATA[ <p>Here's the explanation and the solution to the Java applet issue <a href="http://www.codestore.net/store.nsf/unid/BLOG-20120503-0404">I mentioned yesterday</a>.</p> <p>As you saw the page combined a Domino Java View applet and an ActionBar applet. They are two <strong>separate</strong> applets. They talk to each other using JavaScript. You can see how by looking at the source to the page. </p> <p>Clicking the Refresh button on the applet calls this JavaScript function:</p><pre class="code2">function Action1_onClick<span class="TPbracket">() {</span>
 document.applets.view.refresh<span class="TPbracket">()</span>;
 <span class="TPkeyword1">return false</span>;
<span class="TPbracket">}</span>
</pre>
<p>That code is calling an exposed method of the View applet called "refresh()". And it's failing. Why?</p>
<p>Well, having isolated the issue to the Java code I needed to get to see the Java console in the hope that any errors were dumped there. </p>
<p class="sidePanel">I'd previously told Java not to add an icon to the Task Tray in Windows. If you do see the Java icon down there you can right click it and choose "Show Console".</p>
<p>After some digging I found out how to get to see the Java console. All you do is go to the Control Panel, open the Java options from there and make sure the following options are selected:</p>
<p><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.codestore.net/store.nsf/rsrc/98584400C1C5CC13862579F40028A39C/$file/image_b5071eb8-07b7-401f-97bf-01e8ffccef80.png" width="432" height="307"></p>
<p>Next time you open the <a href="http://www.codestore.net/apps/applets.nsf/view">webpage with the Applets</a> you should see the console appear and start logging, like so:</p>
<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.codestore.net/store.nsf/rsrc/3EA2BE68152B4C22862579F40028A46C/$file/image_f8432ffd-0ed7-4b27-abf7-7ce02adeeb58.png" width="567" height="546"></p>
<p>If it appears but with less logging detail, focus on the console and press "5" to set the logging level to verbose and reload the page.</p>
<p>With the console on display I then pressed the Refresh button again and "thankfully" saw an error, as below:</p><pre style="height: 300px" class="code2">network: Connecting http://www.codestore.net/apps/applets.nsf/view?ReadViewEntries&amp;PreFormat&amp;Start=2.1&amp;Navigate=15&amp;Count=40&amp;SkipNavigate=32784&amp;SkipCount=2 with proxy=DIRECT

An error occurred while reading in documents: java.security.AccessControlException: access denied (java.net.SocketPermission 63.254.226.99:80 connect,resolve)
java.security.AccessControlException: access denied (java.net.SocketPermission 63.254.226.99:80 connect,resolve)
                at java.security.AccessControlContext.checkPermission(Unknown Source)
                at java.security.AccessController.checkPermission(Unknown Source)
                at java.lang.SecurityManager.checkPermission(Unknown Source)
                at java.lang.SecurityManager.checkConnect(Unknown Source)
                at sun.plugin2.applet.Applet2SecurityManager.checkConnect(Unknown Source)
                at java.net.Socket.connect(Unknown Source)
                at sun.net.NetworkClient.doConnect(Unknown Source)
                at sun.net.www.http.HttpClient.openServer(Unknown Source)
                at sun.net.www.http.HttpClient.openServer(Unknown Source)
                at sun.net.www.http.HttpClient.&lt;init&gt;(Unknown Source)
                at sun.net.www.http.HttpClient.New(Unknown Source)
                at sun.net.www.http.HttpClient.New(Unknown Source)
                at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
                at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
                at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
                at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
                at lotus.notes.apps.viewpanel.ViewPanel.postUNIDList(Unknown Source)
                at lotus.notes.apps.viewpanel.ViewPanel.postUNIDList(Unknown Source)
                at lotus.notes.apps.viewpanel.ViewPanel.ReadAndParseViewEntries(Unknown Source)
                at lotus.notes.apps.viewpanel.ViewPanel.ReadLineRange(Unknown Source)
                at lotus.notes.apps.viewpanel.ViewPanel.refresh(Unknown Source)
                at lotus.notes.apps.viewpanel.ViewPanel.refresh(Unknown Source)
                at lotus.notes.apps.viewpanel.ViewPanel.deleteMarkedDocuments(Unknown Source)
                at lotus.notes.apps.viewapplet.ViewApplet.deleteMarkedDocuments(Unknown Source)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                at java.lang.reflect.Method.invoke(Unknown Source)
                at sun.plugin.javascript.JSInvoke.invoke(Unknown Source)
                at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                at java.lang.reflect.Method.invoke(Unknown Source)
                at sun.plugin.javascript.JSClassLoader.invoke(Unknown Source)
                at sun.plugin2.liveconnect.JavaClass$MethodInfo.invoke(Unknown Source)
                at sun.plugin2.liveconnect.JavaClass$MemberBundle.invoke(Unknown Source)
                at sun.plugin2.liveconnect.JavaClass.invoke0(Unknown Source)
                at sun.plugin2.liveconnect.JavaClass.invoke(Unknown Source)
                at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo$DefaultInvocationDelegate.invoke(Unknown Source)
                at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo$3.run(Unknown Source)
                at java.security.AccessController.doPrivileged(Native Method)
                at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo.doObjectOp(Unknown Source)
                at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo$LiveConnectWorker.run(Unknown Source)
                at java.lang.Thread.run(Unknown Source)
</pre>
<p>At this point I'd been trying all kinds of other approaches to debugging this and had spent hours on it. I've never been so grateful to see an error. 
<p>What I still didn't get was why the applet could load the view's content on the first page load - this was a major source of confusion. 
<p>Why was there an "access control" issue only when it reloads the view!? 
<p>After some searching and lots of reading (and lots of red herrings) I found out that since Java 6 <a href="http://www.oracle.com/technetwork/java/javase/6u22releasenotes-176121.html">reached "Update 22" a new security feature was implemented</a>. The fix meant that any Java applet making a URL connection which was the result of being asked to do so by a JavaScript call had to do so with the same security settings/permissions as the JavaScript itself. </p>
<p>That's when the applet goes all paranoid! In doing so it wants to rule out the chance it's the target of cross-domain security breach.</p>
<p>But again, things are odd here. It's <strong>not cross domain</strong>. The applets are loaded from the same domain as the web page itself. As are the subsequent calls to the XML data via ?ReadViewEntries! Why does it think it's cross domain. </p>
<p>The next step and the eureka moment was in working out how the applet decides if it's cross domain or not. </p>
<p>It all comes down to whether or not a "reverse DNS lookups" of the resolved IP address points to the same domain name as shown in the address bar.</p>
<p>To work this out you first need to ping the domain in use, like so:</p>
<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.codestore.net/store.nsf/rsrc/555639C2DE24A9B5862579F40028A4B7/$file/image_d12d904f-4ec2-43ef-8128-0c8b7f31e4d8.png" width="427" height="99"></p>
<p>Then I pinged the resolved IP address directly while including the "-a" parameter (resolves addresses to hostnames) and you can see the result below: </p>
<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.codestore.net/store.nsf/rsrc/0062D717CB658622862579F40028A4FE/$file/image_9c00da48-dd38-48e9-9f9c-d621b5ca3122.png" width="430" height="100"></p>
<p>Et voila! A reverse DNS lookup for codestore.net points to something completely different! That is why the Java applet breaks!!</p>
<p>To corroborate this I further tested in my own local network on my server called "dover" and resolvable in DNS both as dover and as dover.rockalldesign.com.</p>
<p>I then tried using the applets at the following URLs:</p>
<ol>
<li>http://dover/apps/applets.nsf/view 
<li>http://dover.rockalldesign.com/apps/applets.nsf/view</li></ol>
<p>The Refresh button worked on the first URL but not the second. Why? Consider the following:</p>
<p><a href="http://www.codestore.net/store.nsf/rsrc/0DFA712EAAF48F99862579F40028A562/$file/image2_5.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image2" border="0" alt="image2" src="http://www.codestore.net/store.nsf/rsrc/EC069A6CD8A853BE862579F40028A606/$file/image2_thumb_1.png" width="483" height="313"></a></p>
<p>On my local network a Reverse DNS Lookup for "dover.rockalldesign.com" doesn't match the expected name of "dover", so the 2nd URL fails. But as you can infer from the above a reverse lookup for "dover" does returns a matching name, so the Java applet is happy to continue loading for the 1st URL. </p>
<h4>Solution</h4>
<p>The obvious solution would be to make sure you used a domain name in your URL with matches the one returned by a reverse lookup. In the actual customer's case this was a viable solution, as it is for my dover server. But not for the codestore.net version as the mcleodusa.net address it points back to can't be resolved in the address bar.</p>
<p>The alternative (and probably the better) solution is to add a cross-domain.xml file at the root of the HTTP server, so it would be accessible at http://www.codestore.net/cross-domain.xml. The content of the file is simply:</p><pre class="code2">&lt;?xml version="1.0"?&gt;
&lt;!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd"&gt;
&lt;cross-domain-policy&gt;
 &lt;allow-access-from domain="*"/&gt;
&lt;/cross-domain-policy&gt;
</pre>
<p>This will let you access the database using any domain / host which points to the server.</p>
<h4>Summary</h4>
<p>My customer's response was "Jake, you're a genius!". Well, as much as I'd love to agree, I wouldn't go quite that far. All I am is a patient nerd with enough experience of computers to know how to second guess them. Some times with problems like this it's down to a simple combination of experience and gut instinct. </p>
<p>The fact it's only going to affect users of the Domino View Java Applets made me wonder if it's even worth sharing this (who in their right mind still uses them?!). But then the fact I was asked and then paid to solve it in the first place means people obviously still must use them. </p>
<p><a href="http://www.codestore.net/store.nsf/unid/BLOG-20120504-0224?open#post"><img border="0" src="http://www.codestore.net/store.nsf/images/rss_reply.gif" alt="Click here to post a response" /></a></p> 		]]></description>
			<link>http://www.codestore.net/store.nsf/unid/BLOG-20120504-0224</link>
			<guid isPermaLink="true">http://www.codestore.net/store.nsf/unid/BLOG-20120504-0224</guid>
			<comments>http://www.codestore.net/store.nsf/unid/BLOG-20120504-0224?Open#comments</comments>
			<slash:comments>5</slash:comments>
			<wfw:commentRss>http://www.codestore.net/store.nsf/blog.xml?Open=20120504-0224</wfw:commentRss>
		</item>
		<item>
			<title>Fancy A &amp;quot;Fun&amp;quot; Debugging Challenge? | Blog</title>
			<pubDate>Thu, 3 May 2012 04:04:43 -0500</pubDate>
			<author>Jake Howlett</author>
			<description><![CDATA[ <p>Yesterday I debugged a particularly nasty issue. The solution to which I thought I'd share with the world. Before I do I thought it would be fun to reproduce the problem, by way of a challenge for you guys. </p> <p>Fancy yourself as a half decent hacker? Take a look at the the following link:</p> <p><a title="http://www.codestore.net/apps/applets.nsf/view" href="http://www.codestore.net/apps/applets.nsf/view">http://www.codestore.net/apps/applets.nsf/view</a></p> <p>Pressing the Refresh button on the Action Bar should simply refresh the view. It doesn't. It just empties it. See if you can work out why. Muhaha.</p> <p>Your only clue: it has nothing to do with the Domino side of it! </p> <p><strong>Update</strong>: Some of you have noticed it's not broken. Therein lies clue 2: it won't affect all of you.</p>
<p><a href="http://www.codestore.net/store.nsf/unid/BLOG-20120503-0404?open#post"><img border="0" src="http://www.codestore.net/store.nsf/images/rss_reply.gif" alt="Click here to post a response" /></a></p> 		]]></description>
			<link>http://www.codestore.net/store.nsf/unid/BLOG-20120503-0404</link>
			<guid isPermaLink="true">http://www.codestore.net/store.nsf/unid/BLOG-20120503-0404</guid>
			<comments>http://www.codestore.net/store.nsf/unid/BLOG-20120503-0404?Open#comments</comments>
			<slash:comments>22</slash:comments>
			<wfw:commentRss>http://www.codestore.net/store.nsf/blog.xml?Open=20120503-0404</wfw:commentRss>
		</item>
		<item>
			<title>Gardening Advice Needed | Blog</title>
			<pubDate>Wed, 2 May 2012 03:27:00 -0500</pubDate>
			<author>Jake Howlett</author>
			<description><![CDATA[ <p>Four years ago this week <a href="http://www.codestore.net/store.nsf/unid/BLOG-20080428">I moved in to</a> - what was then - a newly-built office, shown below:</p> <p><img src="http://www.codestore.net/store.nsf/rsrc/bloggifs39/$file/IMG_1203.jpg"></p> <p>As somebody commented back then it looks like all it needs is a Ladies / Gentlemen sign above each door. They were right - it does have the look of a public convenience to it. The plan was to grow ivy up it as a form of camouflage and soon after it was built I planted ivy plants along its length.</p> <p>Here's what it looks like now, four years on:</p> <p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="2012-05-02 07.43.39" border="0" alt="2012-05-02 07.43.39" src="http://www.codestore.net/store.nsf/rsrc/EFB02F1695E89DF2862579F2002E6AB6/$file/2012-05-02%2007.43.39_db545741-4ba4-4dde-8259-d2a4fabd9f8f.jpg" width="454" height="342"></p> <p>I was expecting that, by now it would be completely covered in ivy. But it ain't. Why not?</p> <p>Notice the far end (past the office door) is completely covered. Here I planted an ivy plant that was in tub left by the previous owners. As expected it's gone bonkers and achieved the desired results.</p> <p>The other ivy you can see was bought from garden centres and has barely grown. Not only that but it's not sticking to the wall and I've had to hold it up with the wood you can see, which I'd rather not need to be there.</p> <p>The ivy nearest to the camera I cut right back the other day, thinking it might need a fresh start. Somebody told me that only new growth sticks to the wall. Maybe the growth I was seeing was from non-sticking existing growth.</p> <p>I know this is a strange request but it's becoming a bit of an obsession for me now. It's driving me nuts. How hard can it be to grow ivy?! I always thought it was a menace, that, given a chance, consumes everything in its path.</p> <p>What type of ivy do I need to buy to get the "mile a minute" stuff?</p>
<p><a href="http://www.codestore.net/store.nsf/unid/BLOG-20120502-0327?open#post"><img border="0" src="http://www.codestore.net/store.nsf/images/rss_reply.gif" alt="Click here to post a response" /></a></p> 		]]></description>
			<link>http://www.codestore.net/store.nsf/unid/BLOG-20120502-0327</link>
			<guid isPermaLink="true">http://www.codestore.net/store.nsf/unid/BLOG-20120502-0327</guid>
			<comments>http://www.codestore.net/store.nsf/unid/BLOG-20120502-0327?Open#comments</comments>
			<slash:comments>18</slash:comments>
			<wfw:commentRss>http://www.codestore.net/store.nsf/blog.xml?Open=20120502-0327</wfw:commentRss>
		</item>
		<item>
			<title>How I'm Learning SharePoint | Blog</title>
			<pubDate>Tue, 1 May 2012 05:41:44 -0500</pubDate>
			<author>Jake Howlett</author>
			<description><![CDATA[ <p>The fact that I'm learning SharePoint development (again) might seem like an about turn, seeing as though I didn't have much good to say about it a couple of years back when I first delved in.</p> <p>But back then I was using SharePoint 2007, which by all accounts, was a dog. In comparison SharePoint 2010 is a dream to work with. Dare I say it, it's almost enjoyable.</p> <p>My adventures with SharePoint back then were short-lived. Although it was enough to give me a good grounding and understanding of what's involved, but not so much to mean I don't have to re-learn lots of the finer detail of it from scratch again this time round.</p> <p>So, I already have an understanding of what SharePoint is and what the key design elements are. But I still want to learn it all over again - from scratch - and here's how I'm doing that.</p> <h4>Learning</h4> <p>I've always been a believer in learning by messing. "Messy play" if you will. Dig in and get your hands dirty. It's how I've learnt most of what I know about the technologies I currently use. I've never been on a formal training course or to any conference lectures or read many books.</p> <p>In the past I've been asked by Lotus Notes developers to recommend books to learn web development. I always just said get in there and mess with it and have never recommended any books.</p> <p>However, with SharePoint this approach doesn't seem as applicable (I've tried in the past to learn SharePoint by playing with it and it gets you nowhere fast). </p> <p>I've gone against my own advice and turned back to books. Albeit a more modern approach, which you can see in the photo below, where I have an iPad next to my keyboard, running the Kindle app and within easy reach for a left-handed flip of the page every now and then.</p> <p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="2012-04-27 12.30.35" border="0" alt="2012-04-27 12.30.35" src="http://www.codestore.net/store.nsf/rsrc/5BFC3B5914215AB7862579F1003AC062/$file/2012-04-27%2012.30.35_fc760590-2d80-4286-a8bc-bb240259fc7c.jpg" width="604" height="454"></p> <p>I'm working my way through <a href="http://shop.oreilly.com/product/0790145300386.do">the Microsoft SharePoint 2010 Developer Reference</a> and am about 26% of the way through it. It's a good book and I'd recommend it based on what I've read so far.</p> <p>As I work through the book I'm also following along from inside Visual Studio, using the downloadable source code that accompanies the book.</p> <p>The book assumes some working knowledge of ASP.NET (in particular "classic" WebForms), which, thankfully, I have and without which the book wouldn't make as much sense as it is doing. If you're going to learn SharePoint and have no experience of ASP.NET and or IIS then you may well struggle a little.</p> <p>If you're coming to SharePoint straight from a pure Lotus Notes development angle, with little web development knowledge, then I'm not sure how well you'll do. There are many parallels between the Notes paradigms and those used in SharePoint which make the transition between the two relatively easy, but there's no escaping the fact it's a pure web platform you're moving to.</p> <p align="left">At the same time as reading the above book I'm also reading <a href="http://shop.oreilly.com/product/9780596159849.do">Programming C# 4.0</a> (even though SharePoint 2010 supports a lesser version of C#, it's still a relevant read). I'm reading this book on my Kindle, while away from the desk.</p> <p class="sidePanel">I bought a Kindle Touch last week on impulse while in Tesco and I'm so glad I did. I'd always assumed it would be superfluous, seeing as though I have an iPad, but the Kindle is different enough to allow it a worthy place in our house. </p> <p align="left">It's entirely feasible that you could have been a Notes/Domino (client/web) developer for 10+ years and have little idea what a class is. Let alone an interface or a delegate or what it means to extend&nbsp; classes. If this is the case you're in for a rude awakening. Although the above C# book is good in that it takes things easy and assumes little prior coding experience.</p> <p>Luckily for me I'm not in that position as I've delved in to other technologies outside of Domino enough times to have needed to learn about the fundamentals of programming. Despite this I'm still reading back through the whole of the Programming C# book merely as a refresher course.</p> <h4>Taking it Further</h4> <p>As well as the two books mentioned above, I have bought a handful of other SharePoint books to work through as well as an exam study-guide, using which I plan to become a Microsoft certified SharePoint developer.</p> <p>Here are the SharePoint books I've added to my Kindle app so far:</p> <ul> <li><a href="http://oreilly.com/catalog/0790145336491">MOS 2010 Study Guide for Microsoft Office SharePoint</a> </li> <li><a href="http://oreilly.com/catalog/9780735627222">Microsoft SharePoint 2010 Administrator's Pocket Consultant</a></li> <li><a href="http://oreilly.com/catalog/0790145335920">Microsoft SharePoint 2010: Creating and Implementing Real-World Projects</a></li> <li><a href="http://oreilly.com/catalog/0790145331007">Microsoft SharePoint 2010: Customizing My Site</a></li> <li><a href="http://www.amazon.co.uk/Microsoft-SharePoint-Designer-2010-Step/dp/0735627339">Microsoft SharePoint Designer 2010 Step by Step</a></li> <li><a href="http://shop.oreilly.com/product/0790145300386.do">Microsoft SharePoint 2010 Developer Reference</a></li> <li><a href="http://www.amazon.co.uk/SharePoint-Development-Visual-Microsoft-ebook/dp/B00413PHRI/">SharePoint 2010 Development with Visual Studio 2010</a></li></ul> <p>Yeah, I know. I got a bit carried away. O'Reilly had a 50% off for a day deal going on. All in, when including purchasing Visual Studio 2010 Pro and a Kindle and all the above books it's been a heavy investment so far. You can see I'm not taking the idea lightly.</p> <p>Ultimately my challenge is - as with learning anything new - to do something interesting and useful with the new-found knowledge. Reading is one thing; doing is another. I'm going to create an actual working site in SharePoint. That is probably the point at which it will become interesting for you guys to follow along. </p>
<p><a href="http://www.codestore.net/store.nsf/unid/BLOG-20120501-0541?open#post"><img border="0" src="http://www.codestore.net/store.nsf/images/rss_reply.gif" alt="Click here to post a response" /></a></p> 		]]></description>
			<link>http://www.codestore.net/store.nsf/unid/BLOG-20120501-0541</link>
			<guid isPermaLink="true">http://www.codestore.net/store.nsf/unid/BLOG-20120501-0541</guid>
			<comments>http://www.codestore.net/store.nsf/unid/BLOG-20120501-0541?Open#comments</comments>
			<slash:comments>9</slash:comments>
			<wfw:commentRss>http://www.codestore.net/store.nsf/blog.xml?Open=20120501-0541</wfw:commentRss>
		</item>
		<item>
			<title>A Personal Update | Blog</title>
			<pubDate>Fri, 27 Apr 2012 04:16:09 -0500</pubDate>
			<author>Jake Howlett</author>
			<description><![CDATA[ <p>It's been a while since I posted anything of a personal nature on here. Last time I did, if I remember right, it was when I was down in the dumps, desperate for work and considering throwing the towel in. </p> <p>Assuming anybody still cares here's a quick update on work, family and this site.</p> <h4>Work</h4> <p>Work is going well at the moment. I've got enough of it to keep me busy and pay the bills (and, more importantly, the taxman!!). </p> <p>Mostly I'm still doing Lotus Domino work. Legacy and maintenance stuff though. Nothing particularly interesting. And no XPages. I'm still yet to hear a customer even mention XPages. I doubt they even know what it is.</p> <p>All of my Domino work is for 3 or 4 main customers. All of them are in the process of moving to SharePoint. As am I!</p> <p>When I first started Rockall 9 years ago Domino work was plentiful and it was an exciting time. It doesn't feel that way any longer. I've not had a new customer for ages now. There was a time when, each year, I'd get a handful of leads for prospective jobs come my way. As a self-employed company owner that's half the buzz - finding and winning business. That buzz has all but gone. </p> <p>A while back I had the crazy notion that I could carve out a future as a mobile app developer. I've given up on that. What I've come to realise is that money is more important (to me) than how much I enjoy the work. Not that I'm a money-mad mercenary or anything. I just want to earn as much as I can while I'm at my prime (now?) so that I can put as much as possible away for a half-decent retirement. I don't want to look back as a broke pensioner and think "Well, at least I got job satisfaction and respect from my peers". I want to look back and think "Thank God I milked it while I could".</p> <p>My plan is to aggressively chase a career as a SharePoint developer. Who knows where it will lead but at least it seems to have a much better immediate future than trying to stick it out with Domino.</p> <h4>Family</h4> <p>No matter what happens with work I'll always have my family and I'm blessed to have three lovely kids and a wonderful wife.</p> <p>Felix (5):</p> <p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="o-matic" border="0" alt="o-matic" src="http://www.codestore.net/store.nsf/rsrc/7A793CC6E2E0DB7A862579ED0032E8A0/$file/o-matic_d603cd27-809f-4459-b32a-261f685c7f04.jpg" width="604" height="454"></p> <p>Minnie (3):</p> <p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="o-matic" border="0" alt="o-matic" src="http://www.codestore.net/store.nsf/rsrc/0B2310A22C0580B9862579ED0032E9A8/$file/o-matic_b0de2b19-cedc-491d-b2a0-53772f417071.jpg" width="604" height="454"></p> <p>Evelyn (2):</p> <p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="o-matic2" border="0" alt="o-matic2" src="http://www.codestore.net/store.nsf/rsrc/5DC9FD06F8556B0F862579ED0032EA93/$file/o-matic2_53721b03-3fa9-49dd-b8c2-910f16ab1249.jpg" width="604" height="454"></p> <p>Quinn (17) is doing well too. She's got herself a job in admin at a structural engineers in the city centre (near the shops!) and has a steady relationship with a really nice lad, called Adam, whose now at a local university studying Computer Animation. </p> <p>Life is good really. I hope to remember this time and look back on it as the happiest in my life.</p> <h4>CodeStore</h4> <p>What's the future for codestore? </p> <p>At points I've gotten very close to calling it a day with this site. I don't think I will yet though and will keep plodding along. I just have to get used to the idea it will never be what it once was.</p> <p>I still enjoy running this site and creating content, which is what matters really. I just have to stop dwelling on the past and look to the future.</p> <p>Expect more SharePoint!</p>
<p><a href="http://www.codestore.net/store.nsf/unid/BLOG-20120427-0416?open#post"><img border="0" src="http://www.codestore.net/store.nsf/images/rss_reply.gif" alt="Click here to post a response" /></a></p> 		]]></description>
			<link>http://www.codestore.net/store.nsf/unid/BLOG-20120427-0416</link>
			<guid isPermaLink="true">http://www.codestore.net/store.nsf/unid/BLOG-20120427-0416</guid>
			<comments>http://www.codestore.net/store.nsf/unid/BLOG-20120427-0416?Open#comments</comments>
			<slash:comments>55</slash:comments>
			<wfw:commentRss>http://www.codestore.net/store.nsf/blog.xml?Open=20120427-0416</wfw:commentRss>
		</item>
		<item>
			<title>SharePoint: Lists Based on Domino Views With CRUD | Blog</title>
			<pubDate>Wed, 25 Apr 2012 05:45:00 -0500</pubDate>
			<author>Jake Howlett</author>
			<description><![CDATA[ <p>Here's an example of a typical SharePoint List:</p> <p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.codestore.net/store.nsf/rsrc/C052A181000FF309862579EB003B0916/$file/image_41cfafbe-9025-4f17-b3d0-5d9f2b8597eb.png" width="604" height="334"></p> <p>&nbsp;</p> <p>What's different about this List is that it's displaying data from this Lotus Notes View:</p> <p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.codestore.net/store.nsf/rsrc/4B069A2D5E941066862579EB003B0A00/$file/image_2fd59e6e-805e-4a06-929e-5aa855191a72.png" width="604" height="211"></p> <p>Not only does the List display this data but it also offers full CRUD-like capabilities - you can also create, change and remove the documents from the Notes database using the SharePoint List frontend.</p> <p>Here it is creating a new document from within the SharePoint site that will update in to the Notes database.</p> <p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="image" border="0" alt="image" src="http://www.codestore.net/store.nsf/rsrc/E97C1D38B26DCBF5862579EB003B0AA8/$file/image14.png" width="358" height="259"></p> <p>All this with very little (as in no) evidence that what the user is looking at is anything other than a simple SharePoint Site.</p> <h4>How?</h4> <p>It uses "Business Data Connectivity" to create an External Content Type. This Content Type can then be mapped to a List.</p> <p>Remember recently I've been talking about <a href="http://www.codestore.net/store.nsf/unid/BLOG-20120416-0535">using Domino-based Web Service Providers to show Notes data in ASP.NET</a>. Well this is an extension of that.</p> <p>First thing I did was extend the Web Service by adding the methods required to make it CRUD-like. The skeleton code for it looks like this:</p><pre class="code2"><span class="TPkeyword1">public class </span>DesignerService <span class="TPbracket">{</span>
    <span class="TPkeyword1">public </span>FashionDesigner<span class="TPbracket">&#91;&#93; </span>getAllDesigners<span class="TPbracket">(){</span>
        <span class="TPcomment">//return an array of Fashion Designers</span>
    <span class="TPbracket">}</span>

    <span class="TPkeyword1">public </span>FashionDesigner getDesignerByName<span class="TPbracket">(</span><span class="TPkeyword2">String </span>name<span class="TPbracket">){</span>
        <span class="TPcomment">//Lookup and return a Fashion Designer object</span>
    <span class="TPbracket">}</span>

    <span class="TPkeyword1">public void </span>updateDesigner<span class="TPbracket">(</span>FashionDesigner designer<span class="TPbracket">){</span>
        <span class="TPcomment">//Makes changes to and save the Notes documents</span>
    <span class="TPbracket">}</span>

    <span class="TPkeyword1">public void </span>createDesigner<span class="TPbracket">(</span>FashionDesigner designer<span class="TPbracket">){</span>
        <span class="TPcomment">//Add a new Fashion Designer</span>
    <span class="TPbracket">}</span>

    <span class="TPkeyword1">public void </span>deleteDesigner<span class="TPbracket">(</span>FashionDesigner designer<span class="TPbracket">){</span>
        <span class="TPcomment">//Delete a document</span>
    <span class="TPbracket">}</span>
<span class="TPbracket">}</span>
</pre>
<p>You can now setup an External Content Type. To do this, open up Microsoft SharePoint Designer 2010, connect to your site and browse to the External Content Types section on the left hand pane.</p>
<p>The step-by-step process for doing this is too long-winded and I can't be bothered to write it all up. Basically you create a new External Content Type, add a data connection to it (point to your Domino Web Service's URL) and then map each method of the Web Service to the CRUD operation it corresponds to. Doing this is semi-intuitive from within SharePoint Designer.</p>
<p>In the shot below on the lower right you should be able to see that I've mapped each method to a particular type of operation.</p>
<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.codestore.net/store.nsf/rsrc/FC32BE183B829246862579EB003B0C24/$file/image_5055f561-2095-4336-a0e9-acbebc465826.png" width="604" height="365"></p>
<p>With the External Content Type configured and saved we can now create a List based on it.</p>
<p>Still in SharePoint Designer navigate to the Lists and Libraries section, as below, and click on the (new) External List button:</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.codestore.net/store.nsf/rsrc/00476465B8440A30862579EB003B0CDD/$file/image_edf62143-83df-412c-8565-4017bb70ff84.png" width="526" height="280"></p>
<p>In the dialog that appears you should see the External Content Type you already created. Select it and continue on to give your list a name. Once done the List will appear on the left have side of the site itself, as in the first screenshot above.</p>
<h4>Why?</h4>
<p>Why might you want to do this? Good question. It seems to me that lots of businesses are migrating from Domino to SharePoint. There's no denying that. It seems unlikely that that migration will happen overnight and that Domino will be switched off the day SharePoint goes live - there's bound to be a period of co-existence. No? If so, then it seems obvious that the two will need to talk to each other in such a way.</p>
<p>There are of course huge holes in the above solution. It doesn't take any kind of security or permissions in to account. It was merely as a proof of concept that I did it. Don't pull it apart too much.</p>
<p><a href="http://www.codestore.net/store.nsf/unid/BLOG-20120425-0545?open#post"><img border="0" src="http://www.codestore.net/store.nsf/images/rss_reply.gif" alt="Click here to post a response" /></a></p> 		]]></description>
			<link>http://www.codestore.net/store.nsf/unid/BLOG-20120425-0545</link>
			<guid isPermaLink="true">http://www.codestore.net/store.nsf/unid/BLOG-20120425-0545</guid>
			<comments>http://www.codestore.net/store.nsf/unid/BLOG-20120425-0545?Open#comments</comments>
			<slash:comments>4</slash:comments>
			<wfw:commentRss>http://www.codestore.net/store.nsf/blog.xml?Open=20120425-0545</wfw:commentRss>
		</item>
		<item>
			<title>Making Your Code Tidier With Fluent Interfaces | Blog</title>
			<pubDate>Tue, 24 Apr 2012 06:00:25 -0500</pubDate>
			<author>Jake Howlett</author>
			<description><![CDATA[ <p>&nbsp;</p> <p>I'm not saying it's the best way, or anything, but my preference when coding is to write the least number of lines possible. </p> <p>Going back to <a href="http://www.codestore.net/store.nsf/unid/BLOG-20120327-0501">the OutputWindow class</a> I talked about last month, you create and display it like this:</p><pre class="code2">OutputWindow output <span class="TPoperator">= </span><span class="TPkeyword1">new </span>OutputWindow<span class="TPbracket">()</span>;
output.show<span class="TPbracket">()</span>;</pre>
<p>But that's two lines of code, where the following single line would feel more natural, to me at least:</p>
<p><pre class="code2">OutputWindow output <span class="TPoperator">= </span><span class="TPkeyword1">new </span>OutputWindow<span class="TPbracket">()</span>.show<span class="TPbracket">()</span>;</pre></p>
<p>Maybe it's just me? </p>
<p>Either way, if you don't know how to write a class that allows "chaining" of methods, read on. </p>
<p>This approach uses a <a href="http://en.wikipedia.org/wiki/Fluent_interface">Fluent Interface</a> and it's very easy to achieve. Here's the basic code for the class, written in such a way so as to allow "chaining":</p><pre class="code2"><span class="TPkeyword1">class </span>OutputWindow<span class="TPbracket">{</span>
  <span class="TPkeyword1">public </span>OutputWinow<span class="TPbracket">(){</span>
    <span class="TPcomment">//construct it</span>
  <span class="TPbracket">}</span>

  <span class="TPkeyword1">public </span>OutputWindow show<span class="TPbracket">(){</span>
    <span class="TPcomment">//show it</span>
    <span class="TPkeyword1">return this</span>;
  <span class="TPbracket">}</span>
<span class="TPbracket">}</span></pre>
<p>Notice how the return type of the show() method is an object of the same class and that the method now returns the "this" object, whereas before the return type was void and it returned nothing.</p>
<p>That's all there is to it! </p>
<p>Taking it even further you could end up writing code like below if you change the setTitle and println method to also return "this".</p>
<p><pre class="code2">OutputWindow out <span class="TPoperator">= </span><span class="TPkeyword1">new </span>OutputWindow<span class="TPbracket">()</span>.setTitle<span class="TPbracket">(</span><span class="TPstring">"Test"</span><span class="TPbracket">)</span>.show<span class="TPbracket">()</span>.println<span class="TPbracket">(</span><span class="TPstring">"Line 1"</span><span class="TPbracket">)</span>;
</pre></p>To lots of you this is probably a no-brainer, but then maybe there are other long-term Notes developers like myself who are only now venturing in to the real world of programming and still discovering little tricks like this.
<p><a href="http://www.codestore.net/store.nsf/unid/BLOG-20120424-0600?open#post"><img border="0" src="http://www.codestore.net/store.nsf/images/rss_reply.gif" alt="Click here to post a response" /></a></p> 		]]></description>
			<link>http://www.codestore.net/store.nsf/unid/BLOG-20120424-0600</link>
			<guid isPermaLink="true">http://www.codestore.net/store.nsf/unid/BLOG-20120424-0600</guid>
			<comments>http://www.codestore.net/store.nsf/unid/BLOG-20120424-0600?Open#comments</comments>
			<slash:comments>14</slash:comments>
			<wfw:commentRss>http://www.codestore.net/store.nsf/blog.xml?Open=20120424-0600</wfw:commentRss>
		</item>


	</channel>
</rss> 

