<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">
    <title>hross.net</title>
    <link rel="alternate" type="text/html" href="http://hross.net/blog/" />
    
    <id>tag:hross.net,2008-10-25:/blog//1</id>
    <updated>2009-09-12T17:30:23Z</updated>
    <subtitle>Tech + Caffeine = blog</subtitle>
    <generator uri="http://www.sixapart.com/movabletype/">Movable Type Open Source 4.1</generator>

<link rel="self" href="http://feeds.feedburner.com/hross" type="application/atom+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><entry>
    <title>Windows Tools</title>
    <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/hross/~3/qotfXYyDXO0/windows-tools.html" />
    <id>tag:hross.net,2009:/blog//1.48</id>

    <published>2009-09-12T17:30:23Z</published>
    <updated>2009-09-12T17:30:23Z</updated>

    <summary>It came out just in time for my birthday this year: Scott Hanselman’s 2009 Windows Power Tools list. It is indeed a great list. If you are a developer working in Windows and have a few minutes to spare, you...</summary>
    <author>
        <name>hross</name>
        
    </author>
    
    
    <content type="html" xml:lang="en-US" xml:base="http://hross.net/blog/">
        &lt;p&gt;It came out just in time for my birthday this year: &lt;a href="http://www.hanselman.com/blog/ScottHanselmans2009UltimateDeveloperAndPowerUsersToolListForWindows.aspx"&gt;Scott Hanselman’s 2009 Windows Power Tools list&lt;/a&gt;. It is indeed a great list. If you are a developer working in Windows and have a few minutes to spare, you might just find something on that list that makes your life a million times easier.&lt;/p&gt;  &lt;p&gt;As some of you may know, I recently took a new job within Oracle, and as such I had the privilege of getting a brand new laptop for my birthday (okay, I happened to start the job the same week as my birthday, but it &lt;strong&gt;*felt*&lt;/strong&gt; like I got a birthday present). There is nothing quite like a fancy new laptop and a list of awesome tools and utilities to install on it.&lt;/p&gt;  &lt;p&gt;Anyway, since I’ve finally got it perfectly configured (never to be this fast or nice again), and since searching through the 2009 list is a bit of a grind, I thought I’d share my own, much smaller, list of tools I love (I’ll try to keep this not-so-development-oriented):&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pssoftlab.com/pshl_info.phtml"&gt;&lt;strong&gt;PS Hot Launch&lt;/strong&gt;&lt;/a&gt; – I hate the start menu, and the quick start tray is never big enough for all my icons. Enter PS Hot Launch, where I can now keep all my frequently used programs &lt;strong&gt;and&lt;/strong&gt; bind hotkeys for startup. There are a lot of heavy duty hotkey managers and the like, but for my money (or lack thereof) this is the easiest, best, and most free version.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;a href="http://sourceforge.net/projects/console/"&gt;Console&lt;/a&gt;&lt;/strong&gt; – I never use a dos prompt anymore. This one looks way cooler and supports more features (like easy copy and paste).&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;a href="http://gnuwin32.sourceforge.net/"&gt;GNU Win32&lt;/a&gt;&lt;/strong&gt; – One of my biggest peeves about Windows is not being able to do &lt;em&gt;find . | xargs grep “blah”&lt;/em&gt; and get results. I sometimes use &lt;a href="http://www.cygwin.com/"&gt;cygwin&lt;/a&gt;, but this is much less overhead and more native. Thank you GNU.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=bff59fcf-3148-40b8-a286-fe7274f6e4d8"&gt;Microsoft TimeZone&lt;/a&gt;&lt;/strong&gt; – This is a weird one, but I find myself constantly having to check what time it is on the west coast, central, etc.. I am never sure how many hours to subtract. This super simple free utility runs in your tray and lets you customize up to five locales to show current times for when you click on it. A lot easier than googling “current time pacific”.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;a href="http://desktop.google.com/"&gt;Google Desktop&lt;/a&gt;&lt;/strong&gt; – When it first came out, I thought “will I really use this?” Now I can’t go a day without it. How many times have you thought about an email you sent two months ago but could only remember various key words? Or an old coding project that has something specific you did that you now can’t remember? I can’t even count the number of hours this has saved me in “hunting for stuff” time. Seriously… if you don’t have this you don’t even know what you’re missing.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;a href="http://www.textpad.com/"&gt;Textpad&lt;/a&gt;&lt;/strong&gt; – My favorite of the “enhanced text editors” crowd. It has a vast array of pluggable syntax highlighting (no more Eclipse to edit one line of Java code), explorer shell integration, and an intuitive interface without a ton of annoying bells and whistles.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;a href="http://www.postbox-inc.com/"&gt;Postbox&lt;/a&gt;&lt;/strong&gt; – A lightweight email client. If it had better calendar integration I’d give it a gold star. Still a great quick and dirty client that has some nice search capability.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/"&gt;PuTTY&lt;/a&gt;&lt;/strong&gt; – Remember when people made applications that fit in a single executable and just did the job? Yeah… I do too. If you’re not using PuTTY I have no idea why not.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.straightrunning.com/XmingNotes/"&gt;&lt;strong&gt;Xming&lt;/strong&gt;&lt;/a&gt; – Perhaps a limited audience on this one, but if you need to use X in Windows, this one is for you.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;a href="http://www.oracle.com/technology/products/database/sql_developer"&gt;SQLDeveloper&lt;/a&gt;&amp;#160;&lt;/strong&gt;– Wait… you mean to tell me Oracle made a lightweight, user friendly, super powerful database tool? And I don’t have to use sqlplus or &lt;a href="http://www.toadsoft.com/"&gt;Toad&lt;/a&gt; anymore? And it’s free?! Say no more…&lt;/p&gt;  &lt;p&gt;&lt;a href="http://directory.apache.org/studio/"&gt;&lt;strong&gt;Apache Directory Studio/Server&lt;/strong&gt;&lt;/a&gt; – I absolutely love these two. I used to use &lt;strong&gt;&lt;a href="http://www.ldapbrowser.com/"&gt;Softerra LDAP Browser&lt;/a&gt;&lt;/strong&gt;, which is a great tool in its own right, but I cannot tell you how happy I am to see an easy to install, easy to configure LDAP directory for Windows. I can now test LDAP integrations with impunity! Documentation is a bit sparse, but the first time I downloaded and installed this sucker I got all warm and fuzzy inside.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://winmerge.org/"&gt;&lt;strong&gt;WinMerge&lt;/strong&gt;&lt;/a&gt; – I blogged about this earlier and it is great for file and directory comparisons.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;a href="http://www.pdfsam.org/"&gt;PDF Split and Merge&lt;/a&gt;&lt;/strong&gt; – This is a great tool if you find yourself having to create expense reports or combine PDF’s of scanned documents. The name says it all.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;a href="http://they.misled.us/dark-room"&gt;Darkroom&lt;/a&gt;&lt;/strong&gt; – I tend to take a lot of notes in text editors and this one just looks awesome. You may not use it all the time, but it definitely gets an A+ on style points.&lt;/p&gt;  &lt;p&gt;Here are a few more that are pretty common so I won’t write blurbs about them: &lt;a href="http://www.pidgin.im/"&gt;Pidgin&lt;/a&gt;, &lt;a href="http://www.imgburn.com/"&gt;ImgBurn&lt;/a&gt;, &lt;a href="http://www.getpaint.net/"&gt;PaintDotNet&lt;/a&gt;, &lt;a href="http://download.live.com/writer"&gt;LiveWriter&lt;/a&gt;, and &lt;a href="http://www.wireshark.org/"&gt;Wireshark&lt;/a&gt;. And of course there are the myriad plugins you can get for Firefox, but they deserve a separate post.&lt;/p&gt;  &lt;p&gt;Alright... happy downloading!&lt;/p&gt;
        
    &lt;img src="http://feeds.feedburner.com/~r/hross/~4/qotfXYyDXO0" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://hross.net/blog/2009/09/windows-tools.html</feedburner:origLink></entry>

<entry>
    <title>Sample Search Portlets</title>
    <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/hross/~3/zdOF36wmDpE/sample-search-portlets.html" />
    <id>tag:hross.net,2009:/blog//1.47</id>

    <published>2009-09-03T12:02:03Z</published>
    <updated>2009-09-03T12:02:03Z</updated>

    <summary>A while back I wrote this post detailing my struggle to find a quick and dirty way of displaying paginated table data in the portal (or anywhere, for that matter). I ended up settling on the method I found at...</summary>
    <author>
        <name>hross</name>
        
    </author>
    
    
    <content type="html" xml:lang="en-US" xml:base="http://hross.net/blog/">
        &lt;p&gt;A while back I wrote &lt;a href="http://hross.net/blog/2009/05/direct-web-remoting-jquery-and.html"&gt;this post&lt;/a&gt; detailing my struggle to find a quick and dirty way of displaying paginated table data in the portal (or anywhere, for that matter). I ended up settling on the method I &lt;a href="http://www.spartanjava.com/2008/paginated-lists-made-really-easy-part-1-of-2-front-end/"&gt;found at Spartan Java&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;While I enjoyed the series of articles, I still ended up having to review a &lt;a href="http://dotnetslackers.com/articles/ajax/JQuery-Primer-Part-1.aspx"&gt;jQuery primer&lt;/a&gt;, the &lt;a href="http://directwebremoting.org/dwr/documentation.html"&gt;DWR documentation&lt;/a&gt; and the &lt;a href="http://svn.apache.org/repos/asf/ibatis/java/ibatis-3/trunk/doc/en/iBATIS-3-User-Guide.pdf"&gt;iBATIS user guide&lt;/a&gt;. I would have liked to have been able to download the finished application. On top of that there were the usual struggles with portletizing the code, and scrambling to jam a bunch of features into the finished web application before launch.&lt;/p&gt;  &lt;p&gt;Thus, when I got asked to provide some “development best practices” portal code, I was in a bit of a bind. I wanted to show off the WCI portal’s ability to consume and use a variety of frameworks, but my original source was… pretty crappy. In the end I went back and rewrote a very simple sample application from scratch (including documentation) using the methods described above.&lt;/p&gt;  &lt;p&gt;Hopefully I can save you some time and effort in similar endeavors. Without further ado here is a link to a &lt;a href="http://hross.net/blog/SearchSample.war"&gt;sample database search application&lt;/a&gt; using the &lt;a href="http://www.oracle.com/technology/obe/obe1013jdev/common/OBEConnection.htm"&gt;Oracle HR sample data&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;It’s nothing fancy (yes, there are even possible SQL injection vulnerabilities), but if you want a simple example of jQuery, iBATIS, Java and the portal, this is definitely something to check out. All you should have to do is import the war file into eclipse and read the index.html documentation.&lt;/p&gt;
        
    &lt;img src="http://feeds.feedburner.com/~r/hross/~4/zdOF36wmDpE" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://hross.net/blog/2009/09/sample-search-portlets.html</feedburner:origLink></entry>

<entry>
    <title>Configuring Oracle XE</title>
    <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/hross/~3/e0CJCU_ENy4/configuring-oracle-xe.html" />
    <id>tag:hross.net,2009:/blog//1.46</id>

    <published>2009-08-27T21:46:37Z</published>
    <updated>2009-08-27T21:46:37Z</updated>

    <summary>Lately I have found myself setting up a lot of Amazon EC2 instances, new computers, virtual machines and the like. As such, I’ve come to know and love Oracle XE. While it “just works”, there are a few tweaks that...</summary>
    <author>
        <name>hross</name>
        
    </author>
    
    
    <content type="html" xml:lang="en-US" xml:base="http://hross.net/blog/">
        &lt;p&gt;Lately I have found myself setting up a lot of Amazon EC2 instances, new computers, virtual machines and the like. As such, I’ve come to know and love &lt;a href="http://www.oracle.com/technology/products/database/xe/index.html"&gt;Oracle XE&lt;/a&gt;. While it “just works”, there are a few tweaks that vastly improve performance and behavior. All of these tweaks require you to log in as the system user and run the noted SQL. In no particular order, they are:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Modifying the default listening port of the web server (why is it listening on the default Tomcat port?!):      &lt;br /&gt;      &lt;pre&gt;begin
	dbms_xdb.sethttpport('7080');
	dbms_xdb.setftpport('2100');
end;&lt;/pre&gt;
  &lt;/li&gt;

  &lt;li&gt;Increasing the number of sessions and processes so you don’t get locked out of the database: 
    &lt;br /&gt;

    &lt;pre&gt;alter system set sessions=250 scope=spfile;
alter system set processes=200 scope=spfile;&lt;/pre&gt;
  &lt;/li&gt;

  &lt;li&gt;Making the web server available for non-local access (in case you are running out of a console): 
    &lt;pre&gt;begin 
	dbms_xdb.setlistnerlocalaccess(false); 
end;&lt;/pre&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here are the original links for these tips: &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href="http://www.markcallen.com/oracle/oracle-xe-tuning"&gt;Mark C. Allen&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;&lt;a href="http://daust.blogspot.com/2006/01/xe-changing-default-http-port.html"&gt;daust_de&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;&lt;a href="http://www.liberidu.com/blog/?p=185"&gt;blog.gralike.com&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Finally, I have a tip of my own. If you are running Oracle XE in an EC2 instance (&lt;a href="http://www.oracle.com/technology/pub/articles/lokitz-cloud.html"&gt;see this article&lt;/a&gt;), you will undoubtedly notice that when you restart your brand new AMI with a new IP, Oracle will fail to start (doh!). In order to fix this, you need to do the following:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Make copies of your listener.ora and tnsnames.ora files. Modify them so that your current hostname in EC2 is replaced with “localhost”, and rename them to listener.ora.localhost and tnsnames.ora.localhost. &lt;/li&gt;

  &lt;li&gt;Add this script to the /etc/init.d/oracle-xe startup script (under start is preferable): 
    &lt;pre&gt;NEWHOST=`hostname`

sed s/localhost/$NEWHOST/ /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin/listener.ora.localhost &amp;gt; /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin/listener.ora
sed s/localhost/$NEWHOST/ /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin/tnsnames.ora.localhost &amp;gt; /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin/tnsnames.ora&lt;/pre&gt;
  &lt;/li&gt;

  &lt;li&gt;Profit (you may want to modify the above to run as the oracle user -- not as root). &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;(sorry Windows users, you will have to create your own variation of this)&lt;/p&gt;
        
    &lt;img src="http://feeds.feedburner.com/~r/hross/~4/e0CJCU_ENy4" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://hross.net/blog/2009/08/configuring-oracle-xe.html</feedburner:origLink></entry>

<entry>
    <title>EC2/Cloudwatch Gaming Results</title>
    <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/hross/~3/oyXbGNopNiM/ec2cloudwatch-gaming-results.html" />
    <id>tag:hross.net,2009:/blog//1.45</id>

    <published>2009-05-31T22:37:19Z</published>
    <updated>2009-05-31T22:37:19Z</updated>

    <summary>As I mentioned in my previous post, I wanted to capture some real world info on hosting a game server in the cloud. The results were a rousing success. We had 5 or 6 people connected at various times, played...</summary>
    <author>
        <name>hross</name>
        
    </author>
    
    
    <content type="html" xml:lang="en-US" xml:base="http://hross.net/blog/">
        &lt;p&gt;As I mentioned in &lt;a href="http://hross.net/blog/2009/05/running-a-game-server-on-amazo.html"&gt;my previous post&lt;/a&gt;, I wanted to capture some real world info on hosting a game server in the cloud. The results were a rousing success. We had 5 or 6 people connected at various times, played some Deathmatch and Capture the Flag, and everyone had a ping of 40 or less the entire time. I didn’t notice any latency whatsoever and there were absolutely no packet loss or lag complaints throughout.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;em&gt;Cost&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;I haven’t broken down the numbers yet, but all told I started up an EC2 instance and hosted a game for 2 hours. I also attached an elastic IP for ease of use. That cost me less than $0.50. I’d say that’s a pretty good deal.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;strong&gt;Usage&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;Below are the usage stats for network I/O and CPU usage. I gathered these using &lt;a href="http://hross.net/blog/2009/05/monitoring-performance-with-am.html"&gt;my simple Java application&lt;/a&gt; and created these no-frills charts in Microsoft Excel (all told, this took about 5 minutes to put together):&lt;/p&gt;  &lt;p&gt;&lt;a href="http://hross.net/blog/WindowsLiveWriter/EC2CloudwatchGamingResults_E05F/image_2.png"&gt;&lt;img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="348" alt="image" src="http://hross.net/blog/WindowsLiveWriter/EC2CloudwatchGamingResults_E05F/image_thumb.png" width="644" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Figure 1 – Network I/O over a 2 hour F.E.A.R. game.&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://hross.net/blog/WindowsLiveWriter/EC2CloudwatchGamingResults_E05F/image_4.png"&gt;&lt;img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="239" alt="image" src="http://hross.net/blog/WindowsLiveWriter/EC2CloudwatchGamingResults_E05F/image_thumb_1.png" width="644" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Figure 2 – CPU Usage over a 2 hour F.E.A.R. game.&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;em&gt;Conclusion&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;This is a short and imperfect analysis, but overall I’d say the “small” EC2 instance could easily have handled a 16 person game, both from a load and network traffic standpoint, and it would have cost me a dollar or so to host for 2 hours. That seems like great bang for your buck if you’re looking to crank up a quick game and then move on to something else.&lt;/p&gt;
        
    &lt;img src="http://feeds.feedburner.com/~r/hross/~4/oyXbGNopNiM" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://hross.net/blog/2009/05/ec2cloudwatch-gaming-results.html</feedburner:origLink></entry>

<entry>
    <title>Update Publisher Publishing Targets</title>
    <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/hross/~3/z9eL1c0dnr4/update-publisher-publishing-ta.html" />
    <id>tag:hross.net,2009:/blog//1.44</id>

    <published>2009-05-21T12:09:38Z</published>
    <updated>2009-05-21T12:09:38Z</updated>

    <summary>I have recently been working on a utility for porting ALUI databases from a production environment to a development environment. Fabien Sanglier started this effort, and I hope to have some code to contribute to his ALUI toolbox project very...</summary>
    <author>
        <name>hross</name>
        
    </author>
    
    
    <content type="html" xml:lang="en-US" xml:base="http://hross.net/blog/">
        &lt;p&gt;I have recently been working on a utility for porting ALUI databases from a production environment to a development environment. &lt;a href="http://fsanglier.blogspot.com/"&gt;Fabien Sanglier&lt;/a&gt; started this effort, and I hope to have some code to contribute to his &lt;a href="http://code.google.com/p/alui-toolbox/"&gt;ALUI toolbox project&lt;/a&gt; very soon.&lt;/p&gt;  &lt;p&gt;In the meantime, however, I have been banging my head against the pain that is migrating Publish and Preview target URL’s in Publisher. These URL’s are stored in a binary BLOB in the Publisher database, and are actually serialized Java classes, making them extremely difficult to update (especially when you don’t have access to the original Publisher source code).&lt;/p&gt;  &lt;p&gt;My original plan was to wrap all of this stuff into one “uber-utility” and then blog about it. Recently, though, I saw this post on the Oracle Webcenter Interaction discussion forums: &lt;a title="http://forums.oracle.com/forums/thread.jspa?threadID=900736&amp;amp;tstart=0" href="http://forums.oracle.com/forums/thread.jspa?threadID=900736&amp;amp;tstart=0"&gt;http://forums.oracle.com/forums/thread.jspa?threadID=900736&amp;amp;tstart=0&lt;/a&gt; and it made me think I should probably post the code for migrating Publishing Targets, for the benefit of the sanity of the community at large.&lt;/p&gt;  &lt;p&gt;Here is a &lt;a href="http://hross.net/blog/updatepublishtargets.jar"&gt;link to a jar file which will update Publisher publish targets&lt;/a&gt;. If you crack the jar file with a zip editor, you will be able to update the &lt;em&gt;configuration.properties&lt;/em&gt; file in the root directory to suit your needs.&lt;/p&gt;  &lt;p&gt;I took the liberty of including the Publisher classes in my own jar, making it simpler to run from a command line. To run it, you will only need to download the correct jdbc driver for your database:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html"&gt;Oracle JDBC Driver&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/data/aa937724.aspx"&gt;SQL Server JDBC Driver&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Next, simply execute it from a java command line with the driver in your classpath, like so:&lt;/p&gt;  &lt;pre&gt;java -cp updatepublishtargets.jar;ojdbc14.jar net.hross.content.UpdatePublishTargets&lt;/pre&gt;

&lt;p&gt;Note that the utility is in debug mode by default, so nothing will happen to your Publisher database until you set debug to false in the configuration, although now is probably a good time to let you know that &lt;strong&gt;&lt;em&gt;I provide no warranties of any kind with this code&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In order to build and run the source, you will need the &lt;em&gt;content.jar&lt;/em&gt; and &lt;em&gt;dom4j.jar&lt;/em&gt; found in the WEB-INF/lib directory of your &lt;em&gt;ptcs.war&lt;/em&gt;. Here is the relevant source code, in case you are looking to build your own version of the utility (source is also in the jar):&lt;/p&gt;

&lt;pre class="csharpcode"&gt;package net.hross.content;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import net.hross.utility.Configuration;

import com.plumtree.content.data.AttributeKey;
import com.plumtree.content.data.impl.RdbiPublishingTarget;

&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; UpdatePublishTargets {

    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; main(String[] args) {
        Connection connection = Configuration.getConnection();

        &lt;span class="kwrd"&gt;if&lt;/span&gt; (&lt;span class="kwrd"&gt;null&lt;/span&gt; == connection) {
            System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.println(&lt;span class="str"&gt;&amp;quot;Unable to connect to database. Exiting.&amp;quot;&lt;/span&gt;);
        }

        &lt;span class="kwrd"&gt;int&lt;/span&gt; directoryId = Integer.parseInt(Configuration
                .getString(Configuration.CONFIG_DIRECTORY_ID));
        boolean debug = Boolean.parseBoolean(Configuration
                .getString(Configuration.CONFIG_DEBUG_MODE));
        String newPublishTarget = Configuration
                .getString(Configuration.CONFIG_PUBLISH_TARGET);

        System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.println(&lt;span class="str"&gt;&amp;quot;Updating publish targets for directory ID: &amp;quot;&lt;/span&gt;
                + directoryId);

        System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.println();
        &lt;span class="kwrd"&gt;if&lt;/span&gt; (debug) {
            System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.println(&lt;span class="str"&gt;&amp;quot;** DEBUG MODE ON ** Nothing will be updated.&amp;quot;&lt;/span&gt;);
        } &lt;span class="kwrd"&gt;else&lt;/span&gt; {
            System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.println(&lt;span class="str"&gt;&amp;quot;** DEBUG MODE OFF ** This is happening for real.&amp;quot;&lt;/span&gt;);
        }
        System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.println();

        updatePublishTarget(connection, directoryId, newPublishTarget, debug);
    }

    &lt;span class="rem"&gt;/***&lt;/span&gt;
&lt;span class="rem"&gt;     * Update the publishing target for a specified directory ID (-1 for all&lt;/span&gt;
&lt;span class="rem"&gt;     * items).&lt;/span&gt;
&lt;span class="rem"&gt;     * &lt;/span&gt;
&lt;span class="rem"&gt;     * @param connection&lt;/span&gt;
&lt;span class="rem"&gt;     *            Publisher database connection.&lt;/span&gt;
&lt;span class="rem"&gt;     * @param directoryId&lt;/span&gt;
&lt;span class="rem"&gt;     *            Directory ID to update. -1 for all items.&lt;/span&gt;
&lt;span class="rem"&gt;     * @param newPublishTarget&lt;/span&gt;
&lt;span class="rem"&gt;     *            - New publishing target.&lt;/span&gt;
&lt;span class="rem"&gt;     * @param debug&lt;/span&gt;
&lt;span class="rem"&gt;     *            - if true, no replace will be made, data will just be output.&lt;/span&gt;
&lt;span class="rem"&gt;     */&lt;/span&gt;
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; updatePublishTarget(Connection connection,
            &lt;span class="kwrd"&gt;int&lt;/span&gt; directoryId, String newPublishTarget, boolean debug) {

        &lt;span class="rem"&gt;// create a statement to query the directory id&lt;/span&gt;
        &lt;span class="kwrd"&gt;try&lt;/span&gt; {

            &lt;span class="rem"&gt;// create prepared statement for directory query&lt;/span&gt;
            PreparedStatement psDirectory = &lt;span class="kwrd"&gt;null&lt;/span&gt;;
            &lt;span class="kwrd"&gt;if&lt;/span&gt; (directoryId &amp;gt; 0) {
                psDirectory = connection
                        .prepareStatement(&lt;span class="str"&gt;&amp;quot;SELECT * FROM PCSDIRECTORY WHERE ITEMTYPE=0 AND DIRECTORYID=?&amp;quot;&lt;/span&gt;);
                psDirectory.setInt(1, directoryId);
            } &lt;span class="kwrd"&gt;else&lt;/span&gt; {
                psDirectory = connection
                        .prepareStatement(&lt;span class="str"&gt;&amp;quot;SELECT * FROM PCSDIRECTORY WHERE ITEMTYPE=0&amp;quot;&lt;/span&gt;);
            }
            ResultSet rs = psDirectory.executeQuery();

            &lt;span class="rem"&gt;// loop through any rows we need to check&lt;/span&gt;
            &lt;span class="kwrd"&gt;while&lt;/span&gt; (rs.next()) {

                &lt;span class="rem"&gt;// get basic info about the object&lt;/span&gt;
                String itemName = rs.getString(&lt;span class="str"&gt;&amp;quot;ITEMNAME&amp;quot;&lt;/span&gt;);
                &lt;span class="kwrd"&gt;int&lt;/span&gt; size = rs.getInt(&lt;span class="str"&gt;&amp;quot;DATASIZE&amp;quot;&lt;/span&gt;);
                
                &lt;span class="rem"&gt;// reset directory ID in case it was generic&lt;/span&gt;
                directoryId = rs.getInt(&lt;span class="str"&gt;&amp;quot;DIRECTORYID&amp;quot;&lt;/span&gt;);

                &lt;span class="rem"&gt;// get binary input stream&lt;/span&gt;
                InputStream input = rs.getBinaryStream(&lt;span class="str"&gt;&amp;quot;DATABYTES&amp;quot;&lt;/span&gt;);

                &lt;span class="rem"&gt;// if there's actually some settings, let's check them&lt;/span&gt;
                &lt;span class="kwrd"&gt;if&lt;/span&gt; ((&lt;span class="kwrd"&gt;null&lt;/span&gt; != input) &amp;amp;&amp;amp; (0 != size)) {

                    &lt;span class="rem"&gt;// generic catch statement for problems with this item&lt;/span&gt;
                    &lt;span class="kwrd"&gt;try&lt;/span&gt; {
                        &lt;span class="kwrd"&gt;byte&lt;/span&gt;[] buffer = &lt;span class="kwrd"&gt;new&lt;/span&gt; &lt;span class="kwrd"&gt;byte&lt;/span&gt;[size];
                        input.read(buffer);

                        &lt;span class="rem"&gt;// load the hash map from the database&lt;/span&gt;
                        Map map = (HashMap) deserialize(buffer);

                        &lt;span class="rem"&gt;// loop through the keys in the hash map&lt;/span&gt;
                        Iterator keys = map.keySet().iterator();
                        &lt;span class="kwrd"&gt;while&lt;/span&gt; (keys.hasNext()) {
                            Object key = keys.next();

                            &lt;span class="rem"&gt;// this should probably always be true&lt;/span&gt;
                            &lt;span class="kwrd"&gt;if&lt;/span&gt; (key.getClass().equals(AttributeKey.&lt;span class="kwrd"&gt;class&lt;/span&gt;)) {
                                AttributeKey akey = (AttributeKey) key;

                                &lt;span class="rem"&gt;// if we found a publishing target...&lt;/span&gt;
                                &lt;span class="kwrd"&gt;if&lt;/span&gt; (akey.getKeyString().equals(
                                        &lt;span class="str"&gt;&amp;quot;PUBLISHING_TARGET&amp;quot;&lt;/span&gt;)) {
                                    System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.println();
                                    System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.println(&lt;span class="str"&gt;&amp;quot;--------------------&amp;quot;&lt;/span&gt;);
                                    System.&lt;span class="kwrd"&gt;out&lt;/span&gt;
                                            .println(&lt;span class="str"&gt;&amp;quot;Updating publishing target for:&amp;quot;&lt;/span&gt;);
                                    System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.println(directoryId + &lt;span class="str"&gt;&amp;quot; - &amp;quot;&lt;/span&gt;
                                            + itemName);

                                    &lt;span class="rem"&gt;// get the publishing target info&lt;/span&gt;
                                    RdbiPublishingTarget val = (RdbiPublishingTarget) map
                                            .get(key);
                                    String publishTarget = val
                                            .getPublishDetail()
                                            .getTargetLocation();
                                    String publishBrowser = val
                                            .getPublishDetail()
                                            .getBrowserLocation();
                                    String previewTarget = val
                                            .getPreviewDetail()
                                            .getTargetLocation();
                                    String previewBrowser = val
                                            .getPreviewDetail()
                                            .getBrowserLocation();
                                    String ftpUser = val.getPublishDetail()
                                            .getUsername();
                                    String ftpPassword = val.getPublishDetail()
                                            .getPassword();

                                    System.&lt;span class="kwrd"&gt;out&lt;/span&gt;
                                            .println(&lt;span class="str"&gt;&amp;quot;Publish  browser location: &amp;quot;&lt;/span&gt;
                                                    + publishBrowser);
                                    System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.println(&lt;span class="str"&gt;&amp;quot;Preview target: &amp;quot;&lt;/span&gt;
                                            + previewTarget);
                                    System.&lt;span class="kwrd"&gt;out&lt;/span&gt;
                                            .println(&lt;span class="str"&gt;&amp;quot;Preview browser location: &amp;quot;&lt;/span&gt;
                                                    + previewBrowser);
                                    System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.println(&lt;span class="str"&gt;&amp;quot;FTP user: &amp;quot;&lt;/span&gt; + ftpUser);
                                    System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.println(&lt;span class="str"&gt;&amp;quot;FTP password: &amp;quot;&lt;/span&gt;
                                            + ftpPassword);
                                    System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.println(&lt;span class="str"&gt;&amp;quot;Old publish target: &amp;quot;&lt;/span&gt;
                                            + publishTarget);
                                    System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.println(&lt;span class="str"&gt;&amp;quot;New publish target: &amp;quot;&lt;/span&gt;
                                            + newPublishTarget);

                                    &lt;span class="rem"&gt;// if we are doing this for real, update&lt;/span&gt;
                                    &lt;span class="rem"&gt;// values&lt;/span&gt;
                                    &lt;span class="kwrd"&gt;if&lt;/span&gt; (!debug) {
                                        val.setTargetValues(newPublishTarget,
                                                publishBrowser, previewTarget,
                                                previewBrowser, ftpUser,
                                                ftpPassword);

                                        map.put(key, val);

                                        &lt;span class="rem"&gt;// update the directory&lt;/span&gt;
                                        serializeToDirectory(connection,
                                                directoryId, map);
                                        System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.println(&lt;span class="str"&gt;&amp;quot;Update successful.&amp;quot;&lt;/span&gt;);
                                    }
                                    System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.println(&lt;span class="str"&gt;&amp;quot;--------------------&amp;quot;&lt;/span&gt;);
                                    System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.println();
                                }
                            }
                        }

                        &lt;span class="rem"&gt;// clean up&lt;/span&gt;
                        input.close();
                    } &lt;span class="kwrd"&gt;catch&lt;/span&gt; (IOException ex) {
                        System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.println(&lt;span class="str"&gt;&amp;quot;Something bad happened.&amp;quot;&lt;/span&gt;);
                        ex.printStackTrace();
                    }
                } &lt;span class="rem"&gt;// if null&lt;/span&gt;
            } &lt;span class="rem"&gt;// while next rs&lt;/span&gt;
        } &lt;span class="kwrd"&gt;catch&lt;/span&gt; (SQLException ex) {
            System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.println(&lt;span class="str"&gt;&amp;quot;Something bad happened.&amp;quot;&lt;/span&gt;);
            ex.printStackTrace();
        }

        System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.println(&lt;span class="str"&gt;&amp;quot;Procedure successfully completed.&amp;quot;&lt;/span&gt;);
    }

    &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; Object deserialize(&lt;span class="kwrd"&gt;byte&lt;/span&gt; bytes[]) {
        &lt;span class="kwrd"&gt;try&lt;/span&gt; {
            ByteArrayInputStream byteStream = &lt;span class="kwrd"&gt;new&lt;/span&gt; ByteArrayInputStream(bytes);
            ObjectInputStream objectStream = &lt;span class="kwrd"&gt;new&lt;/span&gt; ObjectInputStream(byteStream);
            &lt;span class="kwrd"&gt;return&lt;/span&gt; objectStream.readObject();
        } &lt;span class="kwrd"&gt;catch&lt;/span&gt; (Exception ex) {
            &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;null&lt;/span&gt;;
        }
    }

    &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; serializeToDirectory(Connection conn, &lt;span class="kwrd"&gt;int&lt;/span&gt; directoryId,
            Object obj) throws IOException, SQLException {
        &lt;span class="kwrd"&gt;byte&lt;/span&gt; bytes[] = getBytes(obj);
        ByteArrayInputStream byteStream = &lt;span class="kwrd"&gt;new&lt;/span&gt; ByteArrayInputStream(bytes);

        PreparedStatement ps = conn
                .prepareStatement(&lt;span class="str"&gt;&amp;quot;UPDATE PCSDIRECTORY SET DATASIZE=?, DATABYTES=? WHERE DIRECTORYID=?&amp;quot;&lt;/span&gt;);
        ps.setInt(1, bytes.length);
        ps.setBinaryStream(2, byteStream, bytes.length);
        ps.setInt(3, directoryId);
        ps.execute();
        conn.commit();
    }

    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;byte&lt;/span&gt;[] getBytes(Object obj) throws java.io.IOException {
        ByteArrayOutputStream bos = &lt;span class="kwrd"&gt;new&lt;/span&gt; ByteArrayOutputStream();
        ObjectOutputStream oos = &lt;span class="kwrd"&gt;new&lt;/span&gt; ObjectOutputStream(bos);
        oos.writeObject(obj);
        oos.flush();
        oos.close();
        bos.close();
        &lt;span class="kwrd"&gt;byte&lt;/span&gt;[] data = bos.toByteArray();
        &lt;span class="kwrd"&gt;return&lt;/span&gt; data;
    }
}&lt;/pre&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;
        
    &lt;img src="http://feeds.feedburner.com/~r/hross/~4/z9eL1c0dnr4" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://hross.net/blog/2009/05/update-publisher-publishing-ta.html</feedburner:origLink></entry>

<entry>
    <title>Monitoring Performance with Amazon CloudWatch</title>
    <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/hross/~3/WlhusRpfKOw/monitoring-performance-with-am.html" />
    <id>tag:hross.net,2009:/blog//1.43</id>

    <published>2009-05-20T00:13:24Z</published>
    <updated>2009-05-20T00:13:24Z</updated>

    <summary>It is rare that I am on the bleeding edge of technology. Normally, I don’t think its worth the time and effort necessary to learn something brand new unless it has been at least somewhat widely adopted and accepted by...</summary>
    <author>
        <name>hross</name>
        
    </author>
    
    
    <content type="html" xml:lang="en-US" xml:base="http://hross.net/blog/">
        &lt;p&gt;It is rare that I am on the bleeding edge of technology. Normally, I don’t think its worth the time and effort necessary to learn something brand new unless it has been at least somewhat widely adopted and accepted by the community at large.&lt;/p&gt;  &lt;p&gt;Oddly enough, my blog post about &lt;a href="http://hross.net/blog/2009/05/running-a-game-server-on-amazo.html"&gt;running a game server on EC2&lt;/a&gt; turned out to be perfectly timed, as Amazon &lt;a href="http://aws.amazon.com/about-aws/whats-new/2009/05/17/monitoring-auto-scaling-elastic-load-balancing/"&gt;launched its new CloudWatch, Elastic Scaling and Load Balancing services on Sunday&lt;/a&gt;. And since, as I discussed earlier, I have been looking at ways to monitor the usage of my EC2 game server, I somehow find myself on the bleeding edge of the cloud.&lt;/p&gt;  &lt;h3&gt;Why CloudWatch?&lt;/h3&gt;  &lt;p&gt;As I discussed in my &lt;a href="http://hross.net/blog/2009/05/running-a-game-server-on-amazo.html"&gt;previous post&lt;/a&gt;, setting up monitoring on an EC2 instance wasn’t that hard to do. However, it did come with some drawbacks:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;Maintenance&lt;/strong&gt; – Although it can be fun to install new software and learn its in’s and out’s, the actual task of upgrading that software, maintaining it, patching it, watching it for security risks, etc, etc is a major pain in the rear end. &lt;a href="http://aws.amazon.com/cloudwatch/"&gt;CloudWatch&lt;/a&gt; solves this problem by providing a simple service for retrieving performance data, no maintenance or special setup required. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Granularity&lt;/strong&gt; – As I discovered with &lt;a href="http://munin.projects.linpro.no/"&gt;munin&lt;/a&gt;, there are limitations to the frequency with which you can store performance data, not to mention the storage requirements for vast quantities of it. Again, this is hidden from us in the case of &lt;a href="http://aws.amazon.com/cloudwatch/"&gt;CloudWatch&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Performance&lt;/strong&gt; – Last but certainly not least, monitoring something usually incurs a performance hit. In my previous article I was sampling data on the same host I was tracking statistics from. The very act of collecting performance data could cause that data to be skewed. Since &lt;a href="http://aws.amazon.com/cloudwatch/"&gt;CloudWatch&lt;/a&gt; abstracts this away from individual instances, this is no longer a problem. &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;Getting Started With CloudWatch&lt;/h3&gt;  &lt;p&gt;There are quite a few resources available to get you started with CloudWatch. I recommend taking a look at the &lt;a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=2521&amp;amp;categoryID=187"&gt;javascript scratch pad&lt;/a&gt; and the other various &lt;a href="http://developer.amazonwebservices.com/connect/kbcategory.jspa?categoryID=187"&gt;developer libraries already available&lt;/a&gt; (more on this later).&lt;/p&gt;  &lt;p&gt;If you really want to get down to the nitty gritty, you should start with the CloudWatch command line interface (CLI). Here are some simple steps to get you started:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Download the &lt;a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=351&amp;amp;categoryID=88"&gt;EC2 API Tools&lt;/a&gt; first (you’ll need them to set up monitoring). Check out the &lt;a href="http://docs.amazonwebservices.com/AWSEC2/2008-12-01/GettingStartedGuide/"&gt;Getting Started Guide&lt;/a&gt; for instructions on extracting the tools and setting up the proper environment variables. &lt;/li&gt;    &lt;li&gt;Download the &lt;a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=2534&amp;amp;categoryID=88"&gt;CloudWatch API Tools&lt;/a&gt;. Check out the included readme for details on environment variable setup. &lt;/li&gt;    &lt;li&gt;Start up an EC2 instance like you normally would (see my &lt;a href="http://hross.net/blog/2009/05/running-a-game-server-on-amazo.html"&gt;previous post&lt;/a&gt;). &lt;/li&gt;    &lt;li&gt;Enable monitoring on your running instance using the EC2 API Tools command: &lt;em&gt;ec2-monitor-instances &amp;lt;instanceId&amp;gt;.&lt;/em&gt; &lt;/li&gt;    &lt;li&gt;Take a look at the &lt;a href="http://docs.amazonwebservices.com/AmazonCloudWatch/latest/DeveloperGuide/index.html"&gt;CloudWatch Getting Started Guide&lt;/a&gt; for details on the available monitoring parameters, etc. &lt;/li&gt;    &lt;li&gt;Run the CloudWatch command &lt;em&gt;mon-get-stats&lt;/em&gt; to get some statistics from your running instance (&lt;em&gt;mon-get-stats –help&lt;/em&gt; should give you some examples). &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Here are a few things to keep in mind when running the command line utility:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;I normally output data to a CSV file so I can create fancy graphs in Excel. Here is an example command (Windows) that delimits stats by comma and outputs to a CSV file:      &lt;pre&gt;mon-get-stats CPUUtilization --start-time 2009-05-19T21:00:00
 --end-time 2009-05-19T22:00:00 --period 60 --statistics Average 
--namespace AWS/EC2 --delimiter &amp;quot;,&amp;quot; 
--dimensions &amp;quot;InstanceId=i-2bb5cc42&amp;quot; &amp;gt; stats.csv&lt;/pre&gt;
  &lt;/li&gt;

  &lt;li&gt;Timestamps – As per the forums, input timestamps are in &lt;a href="http://en.wikipedia.org/wiki/ISO_8601"&gt;ISO-8601&lt;/a&gt; format with the default timezone UTC (Eastern Standard Time + 4 hours). Output timestamps are in UTC and cannot be changed (so start thinking in Greenwich Mean Time). &lt;/li&gt;

  &lt;li&gt;Virtually as soon as monitoring is enabled, statistics are retrieved from your instances. Data is available up to a per-minute frequency and is stored for two weeks. &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Writing a Simple Java Monitoring Utility&lt;/h3&gt;

&lt;p&gt;As much fun as I was having trying to parse and decipher various command line inputs, I was somewhat disappointed in the output. For one thing, there was the time formatting problem. For another, only one set of statistics (CPU utilization, network I/O, etc) were available at one time.&lt;/p&gt;

&lt;p&gt;I am not one to do more work than I need to, so instead of setting off to invent an uber-utility for aggregating data, I simply downloaded the &lt;a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=2517&amp;amp;categoryID=187"&gt;Java library for CloudWatch&lt;/a&gt; and hacked up some of the sample code until I had a very basic utility for downloading and aggregating the data I wanted. I present it below in case someone finds it useful:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Properties;

import com.amazonaws.cloudwatch.AmazonCloudWatch;
import com.amazonaws.cloudwatch.AmazonCloudWatchClient;
import com.amazonaws.cloudwatch.AmazonCloudWatchException;
import com.amazonaws.cloudwatch.model.Datapoint;
import com.amazonaws.cloudwatch.model.GetMetricStatisticsRequest;
import com.amazonaws.cloudwatch.model.GetMetricStatisticsResponse;
import com.amazonaws.cloudwatch.model.GetMetricStatisticsResult;

&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; GrabStats {

    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; main(String[] args) {
        
        String fileName = &lt;span class="str"&gt;&amp;quot;C:\\stats.csv&amp;quot;&lt;/span&gt;;

        String startTime = &lt;span class="str"&gt;&amp;quot;2009-05-19T20:00:00&amp;quot;&lt;/span&gt;;
        String endTime = &lt;span class="str"&gt;&amp;quot;2009-05-20T00:00:00&amp;quot;&lt;/span&gt;;
        
        String[] statList = { &lt;span class="str"&gt;&amp;quot;CPUUtilization&amp;quot;&lt;/span&gt;,&lt;span class="str"&gt;&amp;quot;NetworkIn&amp;quot;&lt;/span&gt;,&lt;span class="str"&gt;&amp;quot;NetworkOut&amp;quot;&lt;/span&gt; }; &lt;span class="rem"&gt;//(%, bytes, bytes)&lt;/span&gt;
        
        HashMap&amp;lt;String, HashMap&amp;lt;String, Double&amp;gt;&amp;gt; map = &lt;span class="kwrd"&gt;new&lt;/span&gt; HashMap&amp;lt;String, HashMap&amp;lt;String, Double&amp;gt;&amp;gt;();
        
        &lt;span class="rem"&gt;// grab stats for each stat value&lt;/span&gt;
        &lt;span class="kwrd"&gt;for&lt;/span&gt; (&lt;span class="kwrd"&gt;int&lt;/span&gt; i = 0; i &amp;lt; statList.length; i++) {
            HashMap&amp;lt;String, Double&amp;gt; stats = getStatistics(startTime, endTime, statList[i]);
            map.put(statList[i], stats);
        }
        
        &lt;span class="rem"&gt;// write to disk&lt;/span&gt;
        &lt;span class="kwrd"&gt;try&lt;/span&gt; {
            FileWriter fw = &lt;span class="kwrd"&gt;new&lt;/span&gt; FileWriter(fileName);
            
            &lt;span class="rem"&gt;// write the header&lt;/span&gt;
            fw.write(&lt;span class="str"&gt;&amp;quot;Date&amp;quot;&lt;/span&gt;);
            &lt;span class="kwrd"&gt;for&lt;/span&gt; (&lt;span class="kwrd"&gt;int&lt;/span&gt; i = 0; i &amp;lt; statList.length; i++) {
                fw.write(&lt;span class="str"&gt;&amp;quot;,&amp;quot;&lt;/span&gt;);
                fw.write(statList[i]);
            }
            fw.write(&lt;span class="str"&gt;&amp;quot;\n&amp;quot;&lt;/span&gt;);
            
            &lt;span class="rem"&gt;// get a date iterator from our first statistic&lt;/span&gt;
            Iterator&amp;lt;String&amp;gt; dateIterator = map.get(statList[0]).keySet().iterator();

            &lt;span class="kwrd"&gt;while&lt;/span&gt;(dateIterator.hasNext()) {
                String date = dateIterator.next();
                fw.write(date);
                
                &lt;span class="rem"&gt;// get values for each stat at this date&lt;/span&gt;
                &lt;span class="kwrd"&gt;for&lt;/span&gt; (&lt;span class="kwrd"&gt;int&lt;/span&gt; i = 0; i &amp;lt; statList.length; i++) {
                    Double &lt;span class="kwrd"&gt;value&lt;/span&gt; = map.get(statList[i]).get(date);
                    fw.write(&lt;span class="str"&gt;&amp;quot;,&amp;quot;&lt;/span&gt;);
                    fw.write(&lt;span class="kwrd"&gt;value&lt;/span&gt;.toString());
                }
                
                fw.write(&lt;span class="str"&gt;&amp;quot;\n&amp;quot;&lt;/span&gt;);
            }
            
            fw.close();
        } &lt;span class="kwrd"&gt;catch&lt;/span&gt; (IOException ex) {
            &lt;span class="rem"&gt;// error storing data&lt;/span&gt;
            System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.print(&lt;span class="str"&gt;&amp;quot;Error writing file: &amp;quot;&lt;/span&gt; + fileName);
        }

    }

    &lt;span class="rem"&gt;// define the cloudwatch service (should be a singleton)&lt;/span&gt;
    &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; final String _accessKeyId = &lt;span class="str"&gt;&amp;quot;&amp;lt;insert key here&amp;gt;&amp;quot;&lt;/span&gt;;
    &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; final String _secretAccessKey = &lt;span class="str"&gt;&amp;quot;&amp;lt;insert access key here&amp;gt;&amp;quot;&lt;/span&gt;;
    &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; AmazonCloudWatch _service = &lt;span class="kwrd"&gt;new&lt;/span&gt; AmazonCloudWatchClient(
            _accessKeyId, _secretAccessKey);

    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; HashMap&amp;lt;String, Double&amp;gt; getStatistics(String startTime,
            String endTime, String statName) {
        HashMap&amp;lt;String, Double&amp;gt; map = &lt;span class="kwrd"&gt;new&lt;/span&gt; HashMap&amp;lt;String, Double&amp;gt;();

        &lt;span class="rem"&gt;// build the request with some defaults&lt;/span&gt;
        GetMetricStatisticsRequest request = &lt;span class="kwrd"&gt;new&lt;/span&gt; GetMetricStatisticsRequest();
        ArrayList&amp;lt;String&amp;gt; stats = &lt;span class="kwrd"&gt;new&lt;/span&gt; ArrayList&amp;lt;String&amp;gt;();
        stats.add(&lt;span class="str"&gt;&amp;quot;Average&amp;quot;&lt;/span&gt;);
        request.setStartTime(startTime);
        request.setEndTime(endTime);
        request.setPeriod(60); &lt;span class="rem"&gt;// statistics every minute&lt;/span&gt;
        request.setMeasureName(statName);
        request.setNamespace(&lt;span class="str"&gt;&amp;quot;AWS/EC2&amp;quot;&lt;/span&gt;);
        request.setStatistics(stats);

        &lt;span class="kwrd"&gt;try&lt;/span&gt; {

            GetMetricStatisticsResponse response = _service
                    .getMetricStatistics(request);

            &lt;span class="kwrd"&gt;if&lt;/span&gt; (response.isSetGetMetricStatisticsResult()) {
                GetMetricStatisticsResult getMetricStatisticsResult = response
                        .getGetMetricStatisticsResult();
                java.util.List&amp;lt;Datapoint&amp;gt; datapointsList = getMetricStatisticsResult
                        .getDatapoints();
                &lt;span class="kwrd"&gt;for&lt;/span&gt; (Datapoint datapoints : datapointsList) {
                    map.put(datapoints.getTimestamp(), datapoints.getAverage());
                }
            }

        } &lt;span class="kwrd"&gt;catch&lt;/span&gt; (AmazonCloudWatchException ex) {

            System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.println(&lt;span class="str"&gt;&amp;quot;Caught Exception: &amp;quot;&lt;/span&gt; + ex.getMessage());
            System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.println(&lt;span class="str"&gt;&amp;quot;Response Status Code: &amp;quot;&lt;/span&gt; + ex.getStatusCode());
            System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.println(&lt;span class="str"&gt;&amp;quot;Error Code: &amp;quot;&lt;/span&gt; + ex.getErrorCode());
            System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.println(&lt;span class="str"&gt;&amp;quot;Error Type: &amp;quot;&lt;/span&gt; + ex.getErrorType());
            System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.println(&lt;span class="str"&gt;&amp;quot;Request ID: &amp;quot;&lt;/span&gt; + ex.getRequestId());
            System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.print(&lt;span class="str"&gt;&amp;quot;XML: &amp;quot;&lt;/span&gt; + ex.getXML());
        }

        &lt;span class="kwrd"&gt;return&lt;/span&gt; map;
    }

}&lt;/pre&gt;
&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;h3&gt;Conclusion&lt;/h3&gt;

&lt;p&gt;The CloudWatch tools and utilities are nothing less than I’d expect from Amazon. Everything worked as expected, the documentation was well put together and there were no real surprises with the API. Overall, I am very satisfied with the finished product of my meager efforts.&lt;/p&gt;

&lt;p&gt;There are, of course, a few shortcomings:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;It would be nice to have more statistics available (memory usage being the main one I’m thinking of). Having the ability to define and collect your own statistics via an API would be even better. Since the API already has a flexible way of defining statistic and type, I have to assume this is coming. &lt;/li&gt;

  &lt;li&gt;Output visualization is certainly lacking. It would be great to see someone hack a Google Chart generator into the javascript scratch pad (given my lack of copious amounts of free time, this person won’t be me). &lt;/li&gt;

  &lt;li&gt;Adding some statistic collection and enablement to ElasticFox would certainly make things easier to set up and administer. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I have to assume these drawbacks will be addressed in future updates, as they have been in the past. I am willing to accept them as the price to pay for being on the bleeding edge of the cloud.&lt;/p&gt;
        
    &lt;img src="http://feeds.feedburner.com/~r/hross/~4/WlhusRpfKOw" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://hross.net/blog/2009/05/monitoring-performance-with-am.html</feedburner:origLink></entry>

<entry>
    <title>Direct Web Remoting, jQuery and Tables</title>
    <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/hross/~3/mYfA3BU0DQc/direct-web-remoting-jquery-and.html" />
    <id>tag:hross.net,2009:/blog//1.42</id>

    <published>2009-05-12T01:34:49Z</published>
    <updated>2009-05-12T01:34:49Z</updated>

    <summary>I recently came across a project where I had a need to display the results of a large SQL query in an HTML table using Java. Of course, I wanted to paginate it, style it, use AJAX to update it,...</summary>
    <author>
        <name>hross</name>
        
    </author>
    
    
    <content type="html" xml:lang="en-US" xml:base="http://hross.net/blog/">
        &lt;p&gt;I recently came across a project where I had a need to display the results of a large SQL query in an HTML table using Java. Of course, I wanted to paginate it, style it, use AJAX to update it, and avoid the need for bulky toolkits or large frameworks. Oh yeah, I was also on an extremely tight deadline (&lt;em&gt;read:&lt;/em&gt; proper coding and design principles were not used).&lt;/p&gt;  &lt;p&gt;I looked into a couple of options:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;a href="http://displaytag.sourceforge.net/1.2/"&gt;Display Tag&lt;/a&gt; – I used this for another project, but it uses session variables to paginate and doesn’t lend itself well to AJAX updates. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://code.google.com/webtoolkit/"&gt;GWT&lt;/a&gt; – One of the guys over at &lt;a href="http://www.function1.com"&gt;Function1&lt;/a&gt; used it recently and it looked pretty slick. Unfortunately, it seemed like a lot of overhead and a styling headache for simple “display a table” functionality. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://directwebremoting.org/"&gt;DWR&lt;/a&gt; and &lt;a href="http://jquery.com/"&gt;jQuery&lt;/a&gt; – As it turns out, I found a great series of blog posts (&lt;a href="http://www.spartanjava.com/2008/paginated-lists-made-really-easy-part-1-of-2-front-end/"&gt;part 1&lt;/a&gt;, &lt;a href="http://www.spartanjava.com/2008/paginated-lists-made-really-easy-part-2-of-2-back-end/"&gt;part 2&lt;/a&gt;) over at Spartan Java that pretty much laid out a solution to my problem.&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;As you can see from the posts on Spartan Java, creating the framework to display SQL results using DWR and jQuery was simple, fast, and fairly straightforward. Because the poster makes some assumptions about your knowledge of DWR and jQuery, I would suggest combining the above with the &lt;a href="http://directwebremoting.org/dwr/getstarted"&gt;getting started guide for DWR&lt;/a&gt; and the &lt;a href="http://docs.jquery.com/How_jQuery_Works"&gt;jQuery tutorials&lt;/a&gt;, if you are unfamiliar with either.&lt;/p&gt;  &lt;p&gt;If you know basic DHTML and Java the learning curve should be no problem.&lt;/p&gt;  &lt;h3&gt;DWR and the Portal&lt;/h3&gt;  &lt;p&gt;As usual, the code I was writing was eventually destined to show up in the portal. Because jQuery is just a simple javascript library, it works great in the portal without issue. Unfortunately, DWR, like many other AJAX frameworks, has its issues when it is gatewayed.&lt;/p&gt;  &lt;p&gt;After combing through the dustier nooks of the documentation, googling profusely, and downloading the source code, I discovered the secret to making DWR work. Since some of you may be thinking “wow, DWR looks like something I want to use in my next portlet”, I thought I’d elaborate:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Add an anchor tag to whatever portlet you will eventually display in the portal. This anchor tag should have an id (let’s call it “gatewaybase”) and it should reference the base path of DWR in your application (this will almost always be /dwr/). So, for any portlet I want to use DWR in, I would always have the following (this is in a JSP, you might need to change &amp;lt;%=path%&amp;gt; to another base path): &lt;/li&gt;    &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;script&lt;/span&gt; &lt;span class="attr"&gt;src&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;dwr/interface/ClassNameExample.js&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;script&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&amp;lt;script src=&lt;span class="str"&gt;&amp;quot;dwr/engine.js&amp;quot;&lt;/span&gt;&amp;gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;script&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;a&lt;/span&gt; &lt;span class="attr"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;gatewaybase&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;target&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;&amp;lt;%=path%&amp;gt;/dwr/&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;href&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;&amp;lt;%=path%&amp;gt;/dwr/&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;a&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
  &lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

  &lt;li&gt;
    &lt;div&gt;The trick to getting DWR working is intercepting its initialization javascript. As it turns out, DWR unofficially supports this, but does not document it. Assuming you’re using jQuery, adding this javascript to either an external .js file, or directly in the page, should do the trick: &lt;/div&gt;

    &lt;pre class="csharpcode"&gt;jQuery(document).ready(&lt;span class="kwrd"&gt;function&lt;/span&gt;() {
    &lt;span class="kwrd"&gt;if&lt;/span&gt; (&lt;span class="kwrd"&gt;typeof&lt;/span&gt;(PTPortalPage)!=&lt;span class="str"&gt;&amp;quot;undefined&amp;quot;&lt;/span&gt;) {
        &lt;span class="rem"&gt;//TODO: this check won't work if JS in gateway&lt;/span&gt;
        dwr.engine._urlRewriteHandler = doInterceptUrl;
    } &lt;span class="kwrd"&gt;else&lt;/span&gt; &lt;span class="kwrd"&gt;if&lt;/span&gt; (document.getElementById(&lt;span class="str"&gt;&amp;quot;gatewaybase&amp;quot;&lt;/span&gt;) != &lt;span class="kwrd"&gt;null&lt;/span&gt;) {
        dwr.engine._urlRewriteHandler = doInterceptUrl;
    }
});

&lt;span class="kwrd"&gt;function&lt;/span&gt; doInterceptUrl(data) {
    &lt;span class="rem"&gt;// this function intercepts http requests from DWR&lt;/span&gt;
    &lt;span class="rem"&gt;// and gateways them using an anchor on the main page&lt;/span&gt;
    &lt;span class="rem"&gt;//TODO: is there a better way? AJAX request for base?&lt;/span&gt;
    &lt;span class="kwrd"&gt;var&lt;/span&gt; rooturl = document.getElementById(&lt;span class="str"&gt;&amp;quot;gatewaybase&amp;quot;&lt;/span&gt;).href;
    &lt;span class="kwrd"&gt;var&lt;/span&gt; nongateroot = document.getElementById(&lt;span class="str"&gt;&amp;quot;gatewaybase&amp;quot;&lt;/span&gt;).target;

    data = data.replace(nongateroot, rooturl);
    &lt;span class="kwrd"&gt;return&lt;/span&gt; data; 
};&lt;/pre&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;What this will do is effectively intercept any javascript requests from your page and add a properly gatewayed URL (via that anchor tag you added in step 1) to the HTTP request.&lt;/p&gt;

&lt;p&gt;Also note that you may need to modify your web.xml with the following init-param for DWR:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;servlet&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;servlet-name&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;dwr-invoker&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;servlet-name&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;display-name&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;DWR Servlet&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;display-name&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;servlet-class&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;org.directwebremoting.servlet.DwrServlet&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;servlet-class&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;init-param&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
     &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;param-name&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;debug&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;param-name&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
     &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;param-value&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;true&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;param-value&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;init-param&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="rem"&gt;&amp;lt;!-- added for gateway compatability --&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;init-param&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
     &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;param-name&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;crossDomainSessionSecurity&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;param-name&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
     &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;param-value&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;false&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;param-value&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;init-param&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;servlet&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
I’m sure there are probably a million ways to build a better mousetrap when displaying tables with Java, but using the above technologies was quick, easy and rewarding.
        
    &lt;img src="http://feeds.feedburner.com/~r/hross/~4/mYfA3BU0DQc" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://hross.net/blog/2009/05/direct-web-remoting-jquery-and.html</feedburner:origLink></entry>

<entry>
    <title>Running a Game Server on Amazon EC2</title>
    <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/hross/~3/_RldQ8kQyNo/running-a-game-server-on-amazo.html" />
    <id>tag:hross.net,2009:/blog//1.41</id>

    <published>2009-05-11T01:52:54Z</published>
    <updated>2009-05-11T01:52:54Z</updated>

    <summary>Yes, it’s true that I haven’t posted in quite a while. My bad. Hopefully you enjoy this little tidbit, even though it’s my first non-ALUI post on this blog… Game Night Recently, after a long workday some co-workers and friends...</summary>
    <author>
        <name>hross</name>
        
    </author>
    
    
    <content type="html" xml:lang="en-US" xml:base="http://hross.net/blog/">
        &lt;p&gt;Yes, it’s true that I haven’t posted in quite a while. My bad. Hopefully you enjoy this little tidbit, even though it’s my first non-ALUI post on this blog…&lt;/p&gt;  &lt;h3&gt;Game Night&lt;/h3&gt;  &lt;p&gt;Recently, after a long workday some co-workers and friends of mine started discussing a “game night”. All of us have jobs, lives outside of work, and are no longer college students, but all of us remember the glory days of &lt;a href="http://en.wikipedia.org/wiki/Counter-Strike"&gt;Counterstrike&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Quake"&gt;Quake&lt;/a&gt; and the like.&lt;/p&gt;  &lt;p&gt;Of course, none of us has anything more than a decently performing laptop, and all of us have an aversion to spending money. And so it was that we happened upon a game called &lt;a href="http://projectorigin.warnerbros.com/fearcombat/main"&gt;F.E.A.R. Combat&lt;/a&gt;. Perhaps its a bit long in the tooth, and perhaps it is behind the times, but it sure is fun, and it sure is &lt;strong&gt;FREE&lt;/strong&gt;.&lt;/p&gt;  &lt;p&gt;The point of that longwinded story is that every other Wednesday has become game night, or more specifically, &lt;strong&gt;F.E.A.R.&lt;/strong&gt; night. And since we are all computer geeks, and we all work in the web technology world in some way or another, &lt;a href="http://techopener.com/blog/"&gt;someone&lt;/a&gt; brought up the idea of running a &lt;strong&gt;F.E.A.R.&lt;/strong&gt; instance on Amazon’s EC2.&lt;/p&gt;  &lt;p&gt;Recently, I had a bit of time on my hands and an urge to try it out, and thus this post was born…&lt;/p&gt;  &lt;h3&gt;Starting and Connecting to an EC2 Instance&lt;/h3&gt;  &lt;p&gt;First, I signed up for &lt;a href="http://aws.amazon.com/ec2/"&gt;Amazon EC2&lt;/a&gt; (actually, I had already signed up when I wrote &lt;a href="http://hross.net/blog/2008/04/integrating-amazon-s3-with-the.html"&gt;this blog post&lt;/a&gt;). The invaluable &lt;a href="http://docs.amazonwebservices.com/AWSEC2/2008-05-05/GettingStartedGuide/index.html"&gt;Getting Started Guide&lt;/a&gt; contained all the basics I needed to start instances, make images, sign up, etc..&lt;/p&gt;  &lt;p&gt;Next, I made sure to download the &lt;a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=609"&gt;ElasticFox plugin for Firefox&lt;/a&gt;. This makes managing and running EC2 instances much easier. If you want to get started quickly, here is a great &lt;a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1797"&gt;Getting Started Guide&lt;/a&gt; for the plugin.&lt;/p&gt;  &lt;p&gt;After installing and setting up ElasticFox, I was ready to start up a base image. I chose to run an Ubuntu image, since package management and documentation is readily available. &lt;a href="http://alestic.com/"&gt;This site&lt;/a&gt; has a few base AMI’s which I used to get started. I simply searched for the AMI ID I wanted and followed the Elasticfox instructions on starting an instance.&lt;/p&gt;  &lt;p&gt;One thing I had to keep in mind was that I wanted to allow the proper TCP/UDP access so that people could connect to my server. In this case, I allowed the following ports:&lt;/p&gt;  &lt;div align="center"&gt;   &lt;table cellspacing="0" cellpadding="2" width="400" align="center" border="1"&gt;&lt;tbody&gt;       &lt;tr&gt;         &lt;td valign="top" width="133"&gt;&lt;strong&gt;Application&lt;/strong&gt;&lt;/td&gt;          &lt;td valign="top" width="133"&gt;&lt;strong&gt;Protocol&lt;/strong&gt;&lt;/td&gt;          &lt;td valign="top" width="133"&gt;&lt;strong&gt;Port&lt;/strong&gt;&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="133"&gt;SSH&lt;/td&gt;          &lt;td valign="top" width="133"&gt;TCP&lt;/td&gt;          &lt;td valign="top" width="133"&gt;22&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="133"&gt;HTTP&lt;/td&gt;          &lt;td valign="top" width="133"&gt;TCP&lt;/td&gt;          &lt;td valign="top" width="133"&gt;80&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="133"&gt;F.E.A.R.&lt;/td&gt;          &lt;td valign="top" width="133"&gt;TCP/UDP&lt;/td&gt;          &lt;td valign="top" width="133"&gt;27888&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="133"&gt;TeamSpeak&lt;/td&gt;          &lt;td valign="top" width="133"&gt;UDP&lt;/td&gt;          &lt;td valign="top" width="133"&gt;8767&lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;p align="center"&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;The other thing I did, in order to keep things simple for future connections, was associate a static IP with my running instance (these are called &lt;a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1346"&gt;Elastic IP’s&lt;/a&gt; in EC2 parlance). The procedure is mind-numbingly simple in ElasticFox, so I’ll refer you to the &lt;a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1797"&gt;Getting Started Guide&lt;/a&gt; if you need more information on how to do it.&lt;/p&gt;  &lt;p&gt;At first, I had some issues actually connecting to my image using SSH (Elasticfox will auto launch an SSH client). The problem ended up being that I was using &lt;a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/"&gt;Putty&lt;/a&gt; for SSH and it does not recognize the private key format used by EC2. Doh. Fortunately, you can convert your keys using Puttygen. Amazon was nice enough to dedicate an appendix in their &lt;a href="http://docs.amazonwebservices.com/AWSEC2/2008-05-05/GettingStartedGuide/index.html"&gt;Getting Started Guide&lt;/a&gt; for &lt;a href="http://docs.amazonwebservices.com/AWSEC2/2008-05-05/GettingStartedGuide/index.html?putty.html"&gt;this exact problem&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Problem solved.&lt;/p&gt;  &lt;p&gt;My next steps were the steps you’d take to install and configure any server so that it could host F.E.A.R. Combat, a TeamSpeak server (an in-game voice communication server), and a &lt;a href="http://munin.projects.linpro.no/"&gt;Munin&lt;/a&gt; monitoring instance (so I could get some stats to see how well EC2 performed in a real world scenario).&lt;/p&gt;  &lt;h3&gt;Preparing for the Installation&lt;/h3&gt;  &lt;p&gt;After everything was running, I wanted to make sure I had the prerequisites to run F.E.A.R. and install any optional components. As it turned out, my Ubuntu instance was fairly locked down. In order to download/install what I needed, I had to &lt;a href="https://help.ubuntu.com/community/Repositories/CommandLine"&gt;update my sources list to included the multiverse and universe repositories&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Once this was done, I updated the list of installable applications via:&lt;/p&gt;  &lt;pre&gt;apt-get update&lt;/pre&gt;

&lt;p&gt;And installed some C++ compatibility libraries for the dedicated server via:&lt;/p&gt;

&lt;pre&gt;apt-get install libstdc++5&lt;/pre&gt;

&lt;p&gt;At this point I was all set to install the base components of my server.&lt;/p&gt;

&lt;h3&gt;Installing and Configuring F.E.A.R. Combat&lt;/h3&gt;

&lt;p&gt;My first step was to download the &lt;a href="http://fear.filefront.com/file/FEAR_v108_Dedicated_Linux_Server;71429"&gt;F.E.A.R. dedicated linux server here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Since I already had the prerequisites installed (see above), all I had to do was extract the archive to disk, modify the included &lt;em&gt;start.sh&lt;/em&gt; to my liking (I used a custom configuration via the –optionsfile argument, used nohup to prevent it from shutting down accidentally, etc), and start the server.&lt;/p&gt;

&lt;h3&gt;Installing and Configuring TeamSpeak&lt;/h3&gt;

&lt;p&gt;&lt;a href="http://www.teamspeak.com/"&gt;TeamSpeak&lt;/a&gt; is an in-game voice communication server. Since my game night buddies are mostly remote, I figured it would be nice to provide some voice communication for trash talk and strategy.&lt;/p&gt;

&lt;p&gt;I logged in as root and ran:&lt;/p&gt;

&lt;pre&gt;apt-get install teamspeak-server&lt;/pre&gt;

&lt;p&gt;A teamspeak user was added, the server started and I was ready to rock and roll. As for configuring the server… it seemed to work okay, so I didn’t bother =). However, you can find some &lt;a href="http://forum.teamspeak.com/showthread.php?t=15438"&gt;instructions for configuration here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;Installing and Configuring Munin&lt;/h3&gt;

&lt;p&gt;&lt;a href="http://munin.projects.linpro.no/"&gt;Munin&lt;/a&gt; is a monitoring tool that allows you to capture CPU, memory, process data, and all kinds of other stats in 5 minute increments. It can be used for monitoring many systems with many kinds of statistics, but that is outside of the scope of this post. For now let’s just say I wanted a simple way to capture statistics for my AMI.&lt;/p&gt;

&lt;p&gt;The installation also turned out to be very simple. It involved using apt-get to install apache and Munin. Rather than regale you with the details, I’ll just point you to &lt;a href="http://www.debuntu.org/book/export/html/134"&gt;this simple tutorial&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; I did have some issues getting Munin to work at first, but once I made sure my local node was listening on the loopback adapter only, it seemed to work. See &lt;em&gt;Section 1.3 (Configuring the Node)&lt;/em&gt; of the &lt;a href="http://www.debuntu.org/book/export/html/134"&gt;tutorial&lt;/a&gt; for details.&lt;/p&gt;

&lt;h3&gt;Creating and Registering an AMI&lt;/h3&gt;

&lt;p&gt;At this point I had everything I needed to run a game server. I tested client connections to my Teamspeak host, Apache server hosting Munin, and the F.E.A.R. server itself and everything worked great.&lt;/p&gt;

&lt;p&gt;The only problem was that if I ever shut down the running instance, all of my work would be gone and I would have to re-install everything the next time I wanted to host a game. Thus, I needed to create an AMI from my base image.&lt;/p&gt;

&lt;p&gt;The procedure for this was relatively simple, and well documented in the Getting Started Guide &lt;a href="http://docs.amazonwebservices.com/AWSEC2/2008-05-05/GettingStartedGuide/index.html?creating-an-image.html"&gt;here&lt;/a&gt;. However, there are a few things you might want to know before you dive in:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;You’ll need at least a basic working knowledge of &lt;a href="http://aws.amazon.com/s3/"&gt;Amazon S3&lt;/a&gt;, since you’ll need it to store your finished AMI. I suggest grabbing &lt;a href="http://www.s3fox.net/Default.aspx"&gt;S3Fox&lt;/a&gt; and using it to create an Amazon S3 bucket. This process is fairly simple, but still a minor annoyance. &lt;/li&gt;

  &lt;li&gt;The base image I used did not have the &lt;a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=351"&gt;EC2 API tools&lt;/a&gt; installed on it, which meant that I could not register my EC2 instance without installing them. I did this by running: &lt;/li&gt;
&lt;/ul&gt;

&lt;pre&gt;apt-get install ec2-api-tools&lt;/pre&gt;

&lt;p&gt;After that, all I needed to do was set my &lt;strong&gt;JAVA_HOME&lt;/strong&gt; environment variable and follow the rest of the &lt;a href="http://docs.amazonwebservices.com/AWSEC2/2008-05-05/GettingStartedGuide/index.html?creating-an-image.html"&gt;Getting Started Guide&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;Final Thoughts&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;&lt;u&gt;Security:&lt;/u&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As you probably noticed, the configuration on my AMI is hardly secure. I ran things as root, didn’t bother changing passwords or restricting IP’s, etc, etc.. I offer no excuses, save my own laziness.&lt;/p&gt;

&lt;p&gt;However, the nice thing about an AMI is that it is only going to be used on game night for a few hours. I’m hardly worried about being hacked. Any time there is a problem, all I have to do is terminate the instance and boot up another AMI. Since nothing is persistent, and there are no credentials on the box, this is great. &lt;/p&gt;

&lt;p&gt;Imagine if I had set up a dedicated server for this. I’d have to worry about all kinds of hardening due to the longevity of the configuration. Yuck.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;&lt;u&gt;Going Further:&lt;/u&gt;&lt;/em&gt;&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;Of course, as always, there are some things I could have done that would have taken this post further:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Capturing “real” usage stats and anecdotal performance data (is this a feasible, reliable, and cost effective solution?). This will probably follow in a future blog post (after the next “game night”). &lt;/li&gt;

  &lt;li&gt;Writing a wrapper for the AMI so that it can be started and stopped on-demand via the web. Someone could definitely write a dedicated hosting web site if they could figure out all the possible licensing restrictions. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Otherwise… that’s about it. After reading this you should be in a position to create your own AMI’s using EC2. The overall experience for me was rather pleasant, though there were some things I think Amazon could have done to simplify the process.&lt;/p&gt;
        
    &lt;img src="http://feeds.feedburner.com/~r/hross/~4/_RldQ8kQyNo" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://hross.net/blog/2009/05/running-a-game-server-on-amazo.html</feedburner:origLink></entry>

<entry>
    <title>Adventures in Search - Part 4 - Search Node Operation</title>
    <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/hross/~3/rCl1xozNKw0/adventures-in-search-part-4-se.html" />
    <id>tag:hross.net,2008:/blog//1.40</id>

    <published>2008-12-08T12:48:21Z</published>
    <updated>2008-12-08T12:48:21Z</updated>

    <summary>You know, it's funny how some things can seem extremely complicated and then when you crack them open they turn out to be fairly easy to understand. Remember the mystery behind how a G.I. Joe stayed together, but then you...</summary>
    <author>
        <name>hross</name>
        
    </author>
    
    
    <content type="html" xml:lang="en-US" xml:base="http://hross.net/blog/">
        &lt;p&gt;You know, it's funny how some things can seem extremely complicated and then when you crack them open they turn out to be fairly easy to understand. Remember the mystery behind how a G.I. Joe stayed together, but then you broke one and found it was simply a rubber band holding his guts together? Turns out search server is much like that. A terribly complicated-seeming C program that, fundamentally, is held together by a rubber band.&lt;/p&gt; &lt;h3&gt;What is a Search Node?&lt;/h3&gt; &lt;p&gt;From my &lt;a href="http://hross.net/blog/2008/07/adventures-in-search-part-1-wh.html"&gt;previous posts&lt;/a&gt;, you've probably inferred that search nodes are the fundamental building blocks of ALUI's search capability. In fact, search nodes are actually the *only* building blocks of the search capability. Everything you need to set up a clustered or non-clustered search environment is contained in one simple install, a few directories and an executable.&lt;/p&gt; &lt;p&gt;All this seemingly complicated system amounts to is the following breakdown:&lt;/p&gt; &lt;ol&gt; &lt;li&gt;An executable running somewhere listening for requests  &lt;li&gt;An open TCP port that receives text based search queries  &lt;li&gt;Two directories that contain everything search needs to operate: a cluster directory and a node directory.&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;Here's a more complicated picture of what I just listed:&lt;/p&gt; &lt;p&gt;&lt;a href="http://hross.net/blog/WindowsLiveWriter/AdventuresinSearchPart4SearchNodeOperati_92AA/search_node_architecture_2.jpg"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="354" alt="search_node_architecture" src="http://hross.net/blog/WindowsLiveWriter/AdventuresinSearchPart4SearchNodeOperati_92AA/search_node_architecture_thumb.jpg" width="523" border="0"&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Figure 1 - Search Node Architecture&lt;/strong&gt;&lt;/p&gt; &lt;h3&gt;Search Requests&lt;/h3&gt; &lt;p&gt;Let's start with the executable. When you start it up using the command line (from the bin directory in a *nix environment, or via a service on Windows), it uses environment variables to find its various configuration files, starts up a process, opens a TCP socket on whatever port you tell it to, and sits around waiting for stuff to happen.&lt;/p&gt; &lt;p&gt;The "stuff that happens" turns out to also be fairly simple. Search server doesn't actually know anything about portals, documents or anything else for that matter. It sits around and waits for one of two things:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;An index request (put some information into the search index so it can be searched for later)  &lt;li&gt;A search request (search for something in the current index)&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;These two things are specified in a text-based custom language over a TCP port. What I mean is that you, Joe Six-pack, could open up a telnet session to your search server port and type a search query (index or request) freehand, were you so inclined. You would type something like the following:&lt;/p&gt;&lt;pre&gt;( FIELDALIAS ptsearch,[2]PT1,[2]PT1_en,[0.1]PT2,[0.1]PT2_en,[0.1]PT50 ) (((ptsearch:a) TAG phraseQ OR (ptsearch:a*) TAG nearQ) AND ((subtype:"PTCARD")[0])) AND ((((@type:"PTPORTAL")[0]) OR ((@type:"PTCONTENTTEMPLATE")[0])) AND (((ptacl:"u2") OR (ptacl:"51"))[0]) AND (((ptfacl:"u2") OR (ptfacl:"51"))[0])) &lt;/pre&gt;&lt;pre&gt;METRIC logtf [1] RESULTS 10 PRINT FIELDS parentids,ptacl,ptfacl,PT51,PT56,@type,subtype,ancestors,PT58,PT7,PT53,abstracttype,&lt;/pre&gt;&lt;pre&gt;PT1,PT1_en,PT2,PT2_en,PT3,PT4,PT5,PT6,PT8,collab_properties,collab_project_url,collab_project_name,collab_icon_alttext_index,collab_acl,publisheduser,portletid TERMS 10000 results[1-10] KWIC 15
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Obviously, this kind of a query isn't very pretty or intuitive, but the point is you could type it via telnet and search server would spit out an XML formatted response to your query. You can see these types of queries in your search node logs if you set your logging levels high enough. Lucky for you, the search API takes care of all of this heavy lifting and converts those XML results into the pretty HTML you see when you perform a search in the portal.&lt;/p&gt;
&lt;h3&gt;Building a Search Index&lt;/h3&gt;
&lt;p&gt;"Okay Ross," you're probably thinking, "I can run search queries over telnet to see what's in my search index. That's all well and good, but how does all that junk get in the index in the first place?"&lt;/p&gt;
&lt;p&gt;How indeed. As I mentioned above, that junk gets in there via an index request, which is much like a search request (runs over a TCP port, follows a specific querying language), but allows whoever or whatever to put information into search instead of extract it.&lt;/p&gt;
&lt;p&gt;If you look closely at your Publisher &lt;em&gt;content.properties&lt;/em&gt; file, Collaboration &lt;em&gt;config.xml&lt;/em&gt; file or even at the portal database (PTSERVERCONFIG table), you will see an "Indexing Search Port" and "Indexing Search Host" specified. What these values really do is tell each product (Portal, Publisher, Collaboration) where to submit their new document data (i.e. when someone publishes something, uploads something to a project, or a crawler runs). That data is submitted over the same TCP port to the same type of node that handles queries.&lt;/p&gt;
&lt;h3&gt;How an Indexing Request Works&lt;/h3&gt;
&lt;p&gt;Here's a brief explanation followed by a couple of pictures:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;An index request is submitted to a search node. Since that search node may be part of a multi-node cluster, the request goes straight to the cluster file system (remember, all nodes share this directory). 
&lt;li&gt;The request is assigned a transaction ID and added to a queue on the cluster (you can see this in the form of the requests folder in the cluster folder of your search node). 
&lt;li&gt;Every search node in the cluster independently maintains its own transaction ID, which corresponds to the last index request it processed. These nodes continually poll the shared requests folder. If they find a transaction that has a higher ID than the one they maintain, they pull the information for that transaction and add it to their local search index. They then update their local transaction ID to match the transaction they just processed.&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;You can actually see this process in real time by amping up your search logs and watching the transaction ID's increment when you upload a collab document, create and admin object, etc.. Here's a few Powerpoint diagrams I created of this process:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://hross.net/blog/WindowsLiveWriter/AdventuresinSearchPart4SearchNodeOperati_92AA/index_request1_2.jpg"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="332" alt="index_request1" src="http://hross.net/blog/WindowsLiveWriter/AdventuresinSearchPart4SearchNodeOperati_92AA/index_request1_thumb.jpg" width="566" border="0"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Figure 2 - Adding an index request to the cluster's transaction queue.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://hross.net/blog/WindowsLiveWriter/AdventuresinSearchPart4SearchNodeOperati_92AA/index_request2_2.jpg"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="359" alt="index_request2" src="http://hross.net/blog/WindowsLiveWriter/AdventuresinSearchPart4SearchNodeOperati_92AA/index_request2_thumb.jpg" width="568" border="0"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Figure 3 - Updating a local search index from the transaction queue.&lt;/strong&gt;&lt;/p&gt;
&lt;h3&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;As far as node operation goes, that should clear up most of the mystery. At this point, you should understand most of the how's and why's of search operation. The last piece to this puzzle is the "checkpoint" feature, which I'll review in the final exciting chapter of this blog series.&lt;/p&gt;
        
    &lt;img src="http://feeds.feedburner.com/~r/hross/~4/rCl1xozNKw0" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://hross.net/blog/2008/12/adventures-in-search-part-4-se.html</feedburner:origLink></entry>

<entry>
    <title>Back in the Saddle (Again)</title>
    <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/hross/~3/JrjmrMmIWCc/back-in-the-saddle-again.html" />
    <id>tag:hross.net,2008:/blog//1.39</id>

    <published>2008-10-28T21:38:19Z</published>
    <updated>2008-10-28T21:38:19Z</updated>

    <summary>As you may have noticed (or not noticed, if your read this site from your aggregator), my blog has undergone some much needed renovation. I realize that as a blog reader myself, I appreciate a dearth of "State of the...</summary>
    <author>
        <name>hross</name>
        
    </author>
    
    
    <content type="html" xml:lang="en-US" xml:base="http://hross.net/blog/">
        &lt;p&gt;As you may have noticed (or not noticed, if your read this site from your aggregator), my blog has undergone some much needed renovation. I realize that as a blog reader myself, I appreciate a dearth of "State of the Union" posts in the blogs I read. Nonetheless, there have been quite a few changes, so here's an infrequent update...&lt;/p&gt; &lt;ul&gt; &lt;li&gt;I use Movable Type to publish, and despite its complexity, I love the customizability and performance. I found &lt;a href="http://www.codemonkeyramblings.com/themes/2008/03/shadedgrey.html"&gt;a great style&lt;/a&gt; from the &lt;a href="http://www.codemonkeyramblings.com/themes/"&gt;CMR Movable Type Styles Blog&lt;/a&gt;, and have customized it to my liking. Finally, no more blah "Minimalist Red" scheme.  &lt;li&gt;&lt;a href="http://dev2dev.bea.com"&gt;Dev2Dev&lt;/a&gt; is finally gone for good, which means some of my blog images were 404'ing. Thank you helpful readers for pointing this out. I finally went back and reset them to point to my own blog.  &lt;li&gt;&lt;a href="http://blog.billbenac.com/blog/"&gt;Bill Benac&lt;/a&gt; recommended we Plumtree bloggers start linking to each other, so you'll notice a blogroll on the right side of the page. If you're blogging and you want to be listed here, give me a shout.  &lt;li&gt;The blog slogan has now officially become "Tech + Caffeine = blog", since I'm tired of dealing with these product name changes. &lt;a href="http://blog.thebdgway.com/2008/10/top-ten-tips-for-writing-plumtree.html"&gt;As are other people, apparently&lt;/a&gt;.  &lt;li&gt;That Jeep in the picture is mine, featured in some mind-blowingly isolated terrain right outside the &lt;a href="http://www.nps.gov/badl/"&gt;Badlands&lt;/a&gt;.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;So what's in store for the future? Well, I still have some posts to write in my Search Series, I have a long backlog of posts regarding various technical minutiae, and then there is your input... Thoughts?&lt;/p&gt;
        
    &lt;img src="http://feeds.feedburner.com/~r/hross/~4/JrjmrMmIWCc" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://hross.net/blog/2008/10/back-in-the-saddle-again.html</feedburner:origLink></entry>

<entry>
    <title>Using diff to avoid re-importing PTE's</title>
    <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/hross/~3/T0GtkTiXh5g/using-diff-to-avoid-reimportin.html" />
    <id>tag:hross.net,2008:/blog//1.38</id>

    <published>2008-10-23T20:08:23Z</published>
    <updated>2008-10-23T20:08:23Z</updated>

    <summary>Let's take a quick timeout from Search for a more basic post... I don't have a "Cool Tools" section of my blog, like some other notable ALUI bloggers, but I do know of a few "cool tools" that have helped...</summary>
    <author>
        <name>hross</name>
        
    </author>
    
    
    <content type="html" xml:lang="en-US" xml:base="http://hross.net/blog/">
        &lt;p&gt;Let's take a quick timeout from Search for a more basic post...&lt;/p&gt; &lt;p&gt;I don't have a "Cool Tools" section of my blog, like some other &lt;a href="http://function1.com"&gt;notable ALUI bloggers&lt;/a&gt;, but I do know of a few "cool tools" that have helped me do my job. One of my favorites is a fancy &lt;a href="http://en.wikipedia.org/wiki/Diff"&gt;diff&lt;/a&gt; utility called &lt;a href="http://www.winmerge.org/"&gt;WinMerge&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;&lt;em&gt;(go download it now if you haven't already)&lt;/em&gt;&lt;/p&gt; &lt;p&gt;One of the primary things I use it for is validating product upgrades. If you're as lazy and/or paranoid as I am, you have probably given pause during an ALUI upgrade when you saw the step "re-import the PTE". As most of us know, re-importing a PTE is a mixed bag, as it comes along with a lot of dependencies and can frequently wipe out customizations to web services, portlets, etc. Worse yet, you never quite know what's happening when you import.&lt;/p&gt; &lt;p&gt;What if we could analyze a PTE and figure out what changes were made so that we could either: &lt;/p&gt; &lt;ul&gt; &lt;ul&gt; &lt;li&gt;make the changes ourselves&lt;/li&gt; &lt;li&gt;not bother re-importing&lt;/li&gt; &lt;li&gt;at least know what changes were going to be made to our existing data?&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt; &lt;p&gt;Turns out this is rather simple (and, obviously, involves WinMerge).&lt;/p&gt; &lt;p&gt;Let's use a relevant example to demonstrate: a Publisher upgrade from 6.4 to 6.5. This is an upgrade of a minor revision number, so you would think there would be relatively few changes to the PTE's. Nonetheless, the install guide tells me to re-import, re-import, re-import.&lt;/p&gt; &lt;p&gt;Yuck.&lt;/p&gt; &lt;p&gt;Instead, I'll take an alternate approach. First, I run the Publisher 6.5 upgrade installer as I normally would. However, once I get to the re-import step, I navigate to the ptcs/6.4/serverpackages directory of my &lt;strong&gt;previous Publisher install&lt;/strong&gt; and grab the publisher.pte file therein. Next, I grab the same PTE file from my ptcs/6.5/serverpackages directory.&lt;/p&gt; &lt;p&gt;Now I have both default install PTE's. Any differences between them will be the changes due to the 6.4 to 6.5 upgrade. Since these PTE's are really just XML files with fairly obvious naming conventions, I simply open them up side by side in WinMerge and compare the differences...&lt;/p&gt; &lt;p&gt;&lt;a href="http://hross.net/blog/WindowsLiveWriter/UsingdifftoavoidreimportingPTEs_A0F5/pte_diff_2.jpg"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="124" alt="pte_diff" src="http://hross.net/blog/WindowsLiveWriter/UsingdifftoavoidreimportingPTEs_A0F5/pte_diff_thumb.jpg" width="615" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;As it turns out, the only changes to the Publisher package in 6.5 are some /jspell URL's that have been added to the gateway settings for some web services. Since I can read the new URL in WinDiff, I can copy the gateway URL's and add them manually. Now I no longer need to import the PTE.&lt;/p&gt; &lt;p&gt;... and even if there were more changes and I had to re-import, I would be well informed of what they were before running the import.&lt;/p&gt; &lt;p&gt;Okay. We now return you to your regularly scheduled programming.&lt;/p&gt;
        
    &lt;img src="http://feeds.feedburner.com/~r/hross/~4/T0GtkTiXh5g" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://hross.net/blog/2008/10/using-diff-to-avoid-reimportin.html</feedburner:origLink></entry>

<entry>
    <title>Adventures in Search - Part 3 - Search Administration</title>
    <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/hross/~3/9B5n8BcmoDY/adventures-in-search-part-3-se.html" />
    <id>tag:hross.net,2008:/blog//1.37</id>

    <published>2008-10-20T12:38:00Z</published>
    <updated>2008-10-20T12:38:00Z</updated>

    <summary>Here we are, back again for another installment in my new blog "mini-series" about search. When I first started researching these posts (er... presentation, actually) the mini-series might have been more aptly titled "Lost" (not to be confused with ABC's...</summary>
    <author>
        <name>hross</name>
        
    </author>
    
    
    <content type="html" xml:lang="en-US" xml:base="http://hross.net/blog/">
        &lt;p&gt;Here we are, back again for another installment in my new blog "mini-series" about search. When I first started researching these posts (er... presentation, actually) the mini-series might have been more aptly titled "Lost" (not to be confused with ABC's hit series, except for the mass confusion and never ending storyline).&lt;/p&gt; &lt;p&gt;Last time I promised some hard-hitting dirt on Search Administration, and as always, I deliver on my blog promises. Okay, maybe hard hitting is a bit of a stretch... let's talk about Search Administration. Most of you are probably familiar with the &lt;em&gt;Search Cluster Manager&lt;/em&gt; and &lt;em&gt;Search Service Manager&lt;/em&gt; in the Administrative Utilities drop down, but what are they and how do they work?&lt;/p&gt; &lt;p&gt;Let's start tackling this with a diagram:&lt;/p&gt; &lt;p&gt;&lt;a href="http://hross.net/blog/WindowsLiveWriter/AdventuresinSearchPart3SearchAdministrat_AFAD/search_admin_1_2.jpg"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="347" alt="search_admin_1" src="http://hross.net/blog/WindowsLiveWriter/AdventuresinSearchPart3SearchAdministrat_AFAD/search_admin_1_thumb.jpg" width="679" border="0"&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;This diagram represents the end-all be-all of the search administration process. There are two parts:&lt;/p&gt; &lt;ol&gt; &lt;li&gt;Portal communication with a search node directly. This is the &lt;em&gt;Search Service Manager &lt;/em&gt;(left side of the diagram). It is basically the portal asking the node about the health and topology of the search server and the node replying with this information. This node is extremely important, since it tells the portal front end how and which search nodes to query. The query is performed over the same port as any other search request, using the same mechanisms, and will show up in your search logs if you have them at a high enough verbosity. &lt;li&gt;Portal communication with the search topology indirectly. This is done via the &lt;em&gt;Search Cluster Manager &lt;/em&gt;(right side of the diagram). I have heard much rumor and hearsay regarding the Search Cluster Manager, so let me clear up any misconceptions you might have with a properly bolded and formatted statement:&lt;/li&gt;&lt;/ol&gt; &lt;p align="center"&gt;&lt;strong&gt;&lt;u&gt;&lt;em&gt;The Search Cluster Manager is a Java web application that reads and writes files on the Cluster File System.&lt;/em&gt;&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p align="justify"&gt;What this really means is that the Search Cluster Manager is totally unnecessary. All administration can be done with the &lt;strong&gt;cadmin&lt;/strong&gt; tool (in your search server's bin directory) or via direct changes to specific initialization files (this is what the Search Cluster Manager does, anyway). So basically, the diagram above actually looks like this:&lt;/p&gt; &lt;p align="justify"&gt;&lt;a href="http://hross.net/blog/WindowsLiveWriter/AdventuresinSearchPart3SearchAdministrat_AFAD/search_admin_2_2.jpg"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="380" alt="search_admin_2" src="http://hross.net/blog/WindowsLiveWriter/AdventuresinSearchPart3SearchAdministrat_AFAD/search_admin_2_thumb.jpg" width="688" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;h3&gt;Wrap Up&lt;/h3&gt; &lt;p align="justify"&gt;So that's it. Basically, the take-away's here are:&lt;/p&gt; &lt;ol&gt; &lt;li&gt; &lt;div align="justify"&gt;Search Cluster Manager is simply a prettied up version of the command line utility and does not need to run for search to function in the portal.&lt;/div&gt; &lt;li&gt; &lt;div align="justify"&gt;Search Service Manager controls the contact node and determines search topology for the portal front end.&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt; &lt;p align="justify"&gt;Pretty simple, eh? Next up... some more interesting details on node operation.&lt;/p&gt;
        
    &lt;img src="http://feeds.feedburner.com/~r/hross/~4/9B5n8BcmoDY" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://hross.net/blog/2008/10/adventures-in-search-part-3-se.html</feedburner:origLink></entry>

<entry>
    <title>Adventures in Search - Part 2 - Search Architecture</title>
    <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/hross/~3/ptqGEyjYVyo/adventures-in-search-part-2-se.html" />
    <id>tag:hross.net,2008:/blog//1.36</id>

    <published>2008-10-15T21:05:35Z</published>
    <updated>2008-10-15T21:05:35Z</updated>

    <summary>Once again, I'm back from the dead. I admit it, I haven't been that busy lately, just had a hard time motivating myself to get through this search series. Perhaps more coffee will do the trick... Breaking Down a Search...</summary>
    <author>
        <name>hross</name>
        
    </author>
    
    
    <content type="html" xml:lang="en-US" xml:base="http://hross.net/blog/">
        &lt;p&gt;Once again, I'm back from the dead. I admit it, I haven't been that busy lately, just had a hard time motivating myself to get through this search series. Perhaps more coffee will do the trick...&lt;/p&gt; &lt;h3&gt;Breaking Down a Search Collection&lt;/h3&gt; &lt;p&gt;Last time I listed the various functions of search and reposted my first search slide. It was fairly simple, just an abstract "Search Collection" diagram. This time let's break that diagram down a bit more:&lt;/p&gt; &lt;p&gt;&lt;a href="http://hross.net/blog/WindowsLiveWriter/AdventuresinSearchPart2SearchArchitectur_E9CF/what_is_search_3_2.jpg"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="359" alt="what_is_search_3" src="http://hross.net/blog/WindowsLiveWriter/AdventuresinSearchPart2SearchArchitectur_E9CF/what_is_search_3_thumb.jpg" width="557" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;What we see above is a less abstract view of the same diagram. Instead of one giant "Search" lump, we actually have an API, which makes the communication decisions, and a collection of search nodes. These nodes are just processes running somewhere, listening on a specific port. More about them later.&lt;/p&gt; &lt;h3&gt;Partitions&lt;/h3&gt; &lt;p&gt;That was pretty simple, right? Let's throw in one more wrinkle before moving on to the complicated bits: &lt;em&gt;Partitions&lt;/em&gt;. A partition is simply a grouping of search data into a set of nodes. Applying that concept to the above diagram, a partitioning of our search collection might look something like:&lt;/p&gt; &lt;p&gt;&lt;a href="http://hross.net/blog/WindowsLiveWriter/AdventuresinSearchPart2SearchArchitectur_E9CF/what_is_search_partitions_2.jpg"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="263" alt="what_is_search_partitions" src="http://hross.net/blog/WindowsLiveWriter/AdventuresinSearchPart2SearchArchitectur_E9CF/what_is_search_partitions_thumb.jpg" width="494" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;In other words, some of the data indexed by search (search results) will reside in Partition 1 on Node 1, and some of the data will reside in Partition 2 on Nodes 1 and 2. If we draw out the partitions in a more abstract manner, they look like this:&lt;/p&gt; &lt;p&gt;&lt;a href="http://hross.net/blog/WindowsLiveWriter/AdventuresinSearchPart2SearchArchitectur_E9CF/what_is_search_partitions_abstract_2.jpg"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="236" alt="what_is_search_partitions_abstract" src="http://hross.net/blog/WindowsLiveWriter/AdventuresinSearchPart2SearchArchitectur_E9CF/what_is_search_partitions_abstract_thumb.jpg" width="495" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;As you can see, there are two separate "bins" of data. When new information is indexed it goes into one of these two bins. It is important to note that neither partition contains duplicate data, so when you search for something the results from Partition 1 and Partition 2 must be &lt;strong&gt;aggregated&lt;/strong&gt; together. Duplicate data will, however, exist on Nodes 1 and 2 in Partition 2 (see above).&lt;/p&gt; &lt;h3&gt;Search Coordination&lt;/h3&gt; &lt;p&gt;With all this data moving about, being partitioned, searched, etc, you may be wondering how all of the search nodes communicate with one another. How do they know which partition they belong to, which node they are and what data has already been indexed?&lt;/p&gt; &lt;p&gt;The answer, it turns out, is extremely simple. They all must share at least one common set of files and directories, which I'll call the "Cluster File System". There is no special port-to-port communication, magic pixie dust, or any other way for search nodes to talk to each other. The cluster file system contains configuration information about the entire search topology, as well as a common queue/locking mechanism for incoming search indexing requests (more detail later). In other words, our previous diagram now looks like this:&lt;/p&gt; &lt;p&gt;&lt;a href="http://hross.net/blog/WindowsLiveWriter/AdventuresinSearchPart2SearchArchitectur_E9CF/what_is_search_cluster_file_system_2.jpg"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="365" alt="what_is_search_cluster_file_system" src="http://hross.net/blog/WindowsLiveWriter/AdventuresinSearchPart2SearchArchitectur_E9CF/what_is_search_cluster_file_system_thumb.jpg" width="509" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;And that's really all there is to it. I've just covered all of the concepts you'll need for a basic understanding of search.&lt;/p&gt; &lt;h3&gt;Wrap Up&lt;/h3&gt; &lt;p&gt;Alright, well we've covered the basics, but as you know, I'm never fully satisfied with the basics. Hopefully you now have a base understanding of search operation and are ready to stick with me for the under-the-covers part. Most of the information I've provided to this point is covered in the docs, just (in my opinion) not very well. Next time look for some more detailed information on how search administration works and under the covers node operation.&lt;/p&gt;
        
    &lt;img src="http://feeds.feedburner.com/~r/hross/~4/ptqGEyjYVyo" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://hross.net/blog/2008/10/adventures-in-search-part-2-se.html</feedburner:origLink></entry>

<entry>
    <title>Adventures In Search - Part 1 - What is Search?</title>
    <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/hross/~3/NdsxN_l7N8s/adventures-in-search-part-1-wh.html" />
    <id>tag:hross.net,2008:/blog//1.35</id>

    <published>2008-07-22T12:18:28Z</published>
    <updated>2008-07-22T12:18:28Z</updated>

    <summary>If you'll recall, a few posts ago I promised to start fleshing out the presentation I gave at Participate in this blog. It's a somewhat boring task, since I already came up with a presentation, but since I gave the...</summary>
    <author>
        <name>hross</name>
        
    </author>
    
    
    <content type="html" xml:lang="en-US" xml:base="http://hross.net/blog/">
        &lt;p&gt;If you'll recall, a few posts ago I promised to start fleshing out the presentation I gave at Participate in this blog. It's a somewhat boring task, since I already came up with a presentation, but since I gave the presentation and posted it to my blog, there has been a lot more interest in it than I anticipated.&lt;/p&gt;  &lt;p&gt;Apparently, everybody else is just as confused about what search is and how it works as I was. So how about we break out the flashlight and provide a point of reference for the folks who weren't at Participate, or who prefer reference material to a presentation (I know I am in that camp).&lt;/p&gt;  &lt;h3&gt;What is Search?&lt;/h3&gt;  &lt;p&gt;As illustrated by the diagram below, when I talk about search, I simply mean a repository of information. On one side, information about the stuff we want to search is added to the repository and on the other side users or programs query that repository with requests for that information:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://hross.net/blog/WindowsLiveWriter/AdventuresInSearchPart1WhatisSearch_BF00/what_is_search_2.jpg"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="386" alt="what_is_search" src="http://hross.net/blog/WindowsLiveWriter/AdventuresInSearchPart1WhatisSearch_BF00/what_is_search_thumb.jpg" width="644" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;However, this is a somewhat simplified version of Search, since it interfaces with our portal in more ways than just the search box in the header. &lt;/p&gt;  &lt;p&gt;Here is a comprehensive listing of search uses (that I know of):&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;Portal Search Box&lt;/strong&gt; - When you search for things in the portal as a non-administrator. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Administrative Search&lt;/strong&gt; - When you search for things as an administrator (folders, objects, etc) &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Knowledge Directory&lt;/strong&gt; - All of the folder/document browsing screens are built from the search index, not the database. You can change this in Portal Admin Options, but it's not recommended, for performance reasons. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Content Crawlers&lt;/strong&gt; - Every time a new document is submitted, metadata is updated, etc (basically every time a crawler is run) &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Publisher&lt;/strong&gt; - Used only when publishing/saving content. Publisher search is actually just a database query) &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Collaboration File Upload&lt;/strong&gt; - Used when uploading/indexing Collaboration documents. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Collaboration Search&lt;/strong&gt; - Collaboration search actually does use Search. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;IDK Search Factory&lt;/strong&gt; - When you use the IDK to perform search requests. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;That's really it. In its basic operation, search is extremely simple. Next time I'll start to delve into search architecture, specifically Nodes and Partitions.&lt;/p&gt;
        
    &lt;img src="http://feeds.feedburner.com/~r/hross/~4/NdsxN_l7N8s" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://hross.net/blog/2008/07/adventures-in-search-part-1-wh.html</feedburner:origLink></entry>

<entry>
    <title>Authentication Sources and You</title>
    <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/hross/~3/zcN2j0Jd0aU/authentication-sources-and-you.html" />
    <id>tag:hross.net,2008:/blog//1.34</id>

    <published>2008-07-01T12:31:14Z</published>
    <updated>2008-07-01T12:31:14Z</updated>

    <summary>Since Fabien finally updated his blog with a nice write up on the published content redirect, and I told him I would try and beat him to the punch, I think I now owe a post or two. This one...</summary>
    <author>
        <name>hross</name>
        
    </author>
    
    
    <content type="html" xml:lang="en-US" xml:base="http://hross.net/blog/">
        &lt;p&gt;Since &lt;a href="http://fsanglier.blogspot.com/"&gt;Fabien finally updated his blog&lt;/a&gt; with a nice write up on the &lt;a href="http://fsanglier.blogspot.com/2008/06/alui-publisher-part-2-increase_30.html"&gt;published content redirect&lt;/a&gt;, and I told him I would try and beat him to the punch, I think I now owe a post or two. This one has been sitting unpublished for a few days, so here we go...&lt;/p&gt;  &lt;hr /&gt;  &lt;br /&gt;  &lt;p&gt;One of my favorite parts of portal work is the fact that most portal implementations touch a variety of technologies: different programming languages, a variety of internal systems and many different authorization and authentication mechanisms. One of the most common of these is LDAP, whether it be in the form of Active Directory or some other LDAP server.&lt;/p&gt;  &lt;p&gt;Unfortunately, I have the same problem I'd like to think most techies have: if I don't work with something for 6 months or so, I tend to forget at least half of the important details. And since LDAP integration usually only happens every so often, mostly on new portal installs, I find I tend to forget the details only to have to re-learn them again.&lt;/p&gt;  &lt;p&gt;Hopefully this post can serve as a reminder, and perhaps a primer for the uninitiated.&lt;/p&gt;  &lt;h3&gt;User Synchronization&lt;/h3&gt;  &lt;p&gt;For every user that logs into the portal, the portal has a record of their account in its &lt;strong&gt;PTUSERS&lt;/strong&gt; database table. No matter that they are in Active Directory, LDAP, what have you, the user still must be listed in this table in order to log into the portal (basically meaning they are a user object in the portal).&lt;/p&gt;  &lt;p&gt;The &lt;strong&gt;PTUSERS&lt;/strong&gt; table is updated periodically by jobs run on configured authentication sources which essentially go out to an LDAP directory (or custom directory), ask for any new user accounts or groups and set them up in the portal.&lt;/p&gt;  &lt;p&gt;One thing to note about this mechanism is that there is a time lag between when a user is created in a directory and when they can log into the portal. It would be nice if the authentication source were queried if the user was not found, and you can introduce customizations to do this, but OOTB you have to wait on the sync job.&lt;/p&gt;  &lt;p&gt;Every authentication source in the portal also has an associated prefix, as well as a set of users and groups. The prefix is like (and can even be) a Windows domain. It is used to distinguish duplicate user names on different authentication sources.&lt;/p&gt;  &lt;h3&gt;A Quick Reference&lt;/h3&gt;  &lt;p&gt;Unfortunately, it can be highly confusing when you're trying to figure out what all the different user properties in the portal are, how they relate to LDAP/AD configuration, and what they actually mean. To that end, I have come up with the following table that (hopefully) explains each mapping in enough detail that you can see how it is built and what it is meant to do.&lt;/p&gt;  &lt;table cellspacing="2" cellpadding="2" border="1"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top"&gt;&lt;strong&gt;&lt;em&gt;PTUSERS Column&lt;/em&gt;&lt;/strong&gt;&lt;/td&gt;        &lt;td valign="top"&gt;&lt;strong&gt;&lt;em&gt;AD Auth Source Value&lt;/em&gt;&lt;/strong&gt;&lt;/td&gt;        &lt;td valign="top"&gt;&lt;strong&gt;&lt;em&gt;LDAP Auth Source Value&lt;/em&gt;&lt;/strong&gt;&lt;/td&gt;        &lt;td valign="top"&gt;&lt;strong&gt;&lt;em&gt;User Profile Value&lt;/em&gt;&lt;/strong&gt;&lt;/td&gt;        &lt;td valign="top"&gt;&lt;strong&gt;&lt;em&gt;Description&lt;/em&gt;&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top"&gt;&lt;em&gt;NAME&lt;/em&gt;&lt;/td&gt;        &lt;td valign="top"&gt;Auth Source Prefix + User Name Attribute&lt;/td&gt;        &lt;td valign="top"&gt;Auth Source Prefix + User Name Attribute&lt;/td&gt;        &lt;td valign="top"&gt;Display Name&lt;/td&gt;        &lt;td valign="top"&gt;A &amp;quot;throw away&amp;quot; descriptive name for the user. Can be changed with a PWS or manually by the user.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top"&gt;&lt;em&gt;MAPPINGAUTHNAME&lt;/em&gt;&lt;/td&gt;        &lt;td valign="top"&gt;User Name Attribute&lt;/td&gt;        &lt;td valign="top"&gt;User Name Attribute&lt;/td&gt;        &lt;td valign="top"&gt;none&lt;/td&gt;        &lt;td valign="top"&gt;A base mapping name for the user (without auth source prefix)&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top"&gt;&lt;em&gt;LOGINNAME&lt;/em&gt;&lt;/td&gt;        &lt;td valign="top"&gt;Auth Source Prefix + User Name Attribute&lt;/td&gt;        &lt;td valign="top"&gt;Auth Source Prefix + User Name Attribute&lt;/td&gt;        &lt;td valign="top"&gt;Login Name&lt;/td&gt;        &lt;td valign="top"&gt;The name a user has to type to log into the portal on the login screen (including the value that must be in the auth source drop down)&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="160"&gt;&lt;em&gt;AUTHUNIQUENAME&lt;/em&gt;&lt;/td&gt;        &lt;td valign="top" width="154"&gt;objectGUID in AD (not specifiable)&lt;/td&gt;        &lt;td valign="top" width="159"&gt;User Unique Name Attribute (defaults to DN)&lt;/td&gt;        &lt;td valign="top" width="151"&gt;Remote Unique Name&lt;/td&gt;        &lt;td valign="top" width="247"&gt;A uniqueness constraint in the directory to tell the portal this is the same user, even if their login or name changes.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="160"&gt;&lt;em&gt;AUTHUSERNAME&lt;/em&gt;&lt;/td&gt;        &lt;td valign="top" width="154"&gt;User Authentication Attribute (usually userPrincipalName to guarantee cross domain uniqueness - not sAMAccountName which is only unique in the domain)&lt;/td&gt;        &lt;td valign="top" width="159"&gt;User Authentication Name Attribute (if not specified, defaults to DN - Distinguished Name)&lt;/td&gt;        &lt;td valign="top" width="151"&gt;Remote Authentication Name&lt;/td&gt;        &lt;td valign="top" width="247"&gt;The property used to authenticate the user with the directory. May not be used for authentication if an SSO solution is in place.&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;A couple of notes:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;The help files on the authentication source configuration files are surprisingly helpful. &lt;/li&gt;    &lt;li&gt;If you need to figure out your LDAP/AD structure, see user properties or run queries, I highly recommend this free tool: &lt;a href="http://www.softerra.com/download.htm"&gt;Softerra LDAP Browser&lt;/a&gt;. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;See you next time.&lt;/p&gt;
        
    &lt;img src="http://feeds.feedburner.com/~r/hross/~4/zcN2j0Jd0aU" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://hross.net/blog/2008/07/authentication-sources-and-you.html</feedburner:origLink></entry>

</feed>
