<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mission Data Blog &#187; Utilities</title>
	<atom:link href="http://www.missiondata.com/blog/tag/utilities/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.missiondata.com/blog</link>
	<description>Louisville-based Web Development &#38; Software Engineering</description>
	<lastBuildDate>Tue, 24 Jan 2012 14:58:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>&#8216;cvs update: move away foo.bar; it is in the way&#8217;</title>
		<link>http://www.missiondata.com/blog/system-administration/81/cvs-update-move-away-foobar-it-is-in-the-way/</link>
		<comments>http://www.missiondata.com/blog/system-administration/81/cvs-update-move-away-foobar-it-is-in-the-way/#comments</comments>
		<pubDate>Thu, 26 Apr 2007 21:00:40 +0000</pubDate>
		<dc:creator>darrend</dc:creator>
				<category><![CDATA[System Administration]]></category>
		<category><![CDATA[CVS]]></category>
		<category><![CDATA[Utilities]]></category>

		<guid isPermaLink="false">http://www.missiondata.com/blog/utilities/81/cvs-update-move-away-foobar-it-is-in-the-way/</guid>
		<description><![CDATA[A client site still uses cvs, the ever trusty version control system. After what seemed a run of the mill merge I noticed this: C lib/jt400_3_3.jar cvs update: move away lib/jt400_3_3.jar; it is in the way Very peculiar. That file hadn&#8217;t changed on the branch. I googled around and an explanation started to come together. [...]]]></description>
			<content:encoded><![CDATA[<p>A client site still uses cvs, the ever trusty version control system. After what seemed a run of the mill merge I noticed this:</p>
<pre><code class="console">C lib/jt400_3_3.jar
cvs update: move away lib/jt400_3_3.jar; it is in the way</code></pre>
<p>Very peculiar. That file hadn&#8217;t changed on the branch. I <a href="http://www.google.com/search?q=cvs+update+move+away">googled around</a> and an explanation started to come together.</p>
<p>First, from the always excellent <a href="http://mindprod.com/jgloss/cvs.html">Roedy Green’s Java &amp; Internet Glossary on Mindprod</a>:</p>
<blockquote><p>CVS is disturbed by the appearance of repository files it did not put there. Your best bet is simply to delete the entire directory containing the offending file by hand, and re checkout or reupdate the directory to build the necessary entries. Then you can add the files safely.</p></blockquote>
<p>Then, I found this <a href="http://mail.lon-capa.org/pipermail/lon-capa-admin/Week-of-Mon-20030915/000367.html">mailing list post</a>:</p>
<blockquote><p>This means the file that CVS wants to checkout exists on the local machine but CVS never created the file in the past. This it isn&#8217;t CVS&#8217;s file and it complains rather than blindly overwriting.</p></blockquote>
<p>The solution everywhere was the same: just blow away the directory and check it out again. Worked for me. Now I need to puzzle out how it happened in the first place&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.missiondata.com/blog/system-administration/81/cvs-update-move-away-foobar-it-is-in-the-way/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>iSeries SQL Performance</title>
		<link>http://www.missiondata.com/blog/system-administration/68/iseries-sql-performance/</link>
		<comments>http://www.missiondata.com/blog/system-administration/68/iseries-sql-performance/#comments</comments>
		<pubDate>Mon, 12 Mar 2007 01:08:10 +0000</pubDate>
		<dc:creator>Rich Rodriguez</dc:creator>
				<category><![CDATA[System Administration]]></category>
		<category><![CDATA[as400]]></category>
		<category><![CDATA[IBM Visual Explain]]></category>
		<category><![CDATA[Utilities]]></category>

		<guid isPermaLink="false">http://www.missiondata.com/blog/utilities/68/iseries-sql-performance/</guid>
		<description><![CDATA[Our project has entered the stage where we start tuning the data access to improve performance. This project uses Hibernate to access a AS400/iSeries system via the JT400 JDBC driver. My prior experience using the SQL Server database introduced me to Microsoft&#8217;s Query Analyzer, which is a nice tool for identifying where you need to [...]]]></description>
			<content:encoded><![CDATA[<p>Our project has entered the stage where we start tuning the data access to improve performance. This project uses Hibernate to access a AS400/iSeries system via the JT400 JDBC driver.  My prior experience using the SQL Server<br />
database introduced me to Microsoft&#8217;s Query Analyzer, which is a nice tool for identifying where you need to index the database. A bit of searching turned up an IBM tool called <a title="Visual Explain" href="https://publib.boulder.ibm.com/iseries/v5r2/ic2924/index.htm?info/rzajq/rzajqmstvisexpl.htm">Visual Explain</a> that fits the same need. The sysadmin started the profiling tool against my connection, and I ran through a standard usage scenario in our application. Visual Explain showed each query, how long it took, the access strategy, and recommended indexes. This kind of tool is absolutely essential for database performance tuning.</p>
<p>The second important item we learned from this process is the performance difference between a true SQL index on the iSeries and a keyed logical index. From iSeries V4R2 on, SQL indexes have page sizes of 64k. By comparison, a DDS logical will max out at 32k, and will typically be much smaller. The performance is so much better that our customer is converting all all their DDS logical indexes to SQL, even if only their legacy RPG applications use it. <a title="DDS and SQL Performance" href="http://www-03.ibm.com/servers/eserver/iseries/db2/pdf/Performance_DDS_SQL.pdf">This IBM document</a> has a good discussion of this issue.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.missiondata.com/blog/system-administration/68/iseries-sql-performance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using the Hibernate API to Inspect Mapped Classes</title>
		<link>http://www.missiondata.com/blog/software-development/60/using-the-hibernate-api-to-inspect-mapped-classes/</link>
		<comments>http://www.missiondata.com/blog/software-development/60/using-the-hibernate-api-to-inspect-mapped-classes/#comments</comments>
		<pubDate>Thu, 03 Aug 2006 02:21:11 +0000</pubDate>
		<dc:creator>Rich Rodriguez</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[hibernate]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[Utilities]]></category>

		<guid isPermaLink="false">http://blogs.missiondata.com/?p=60</guid>
		<description><![CDATA[For my current project we needed to audit the property setters Hibernate was using on our objects to make sure that any logic in them was not overly state dependent. More about this issue in Hibernate is available here. We have fairly rich object models, and a lot of methods, including setters, are never used [...]]]></description>
			<content:encoded><![CDATA[<p>For my current project we needed to audit the property setters Hibernate was using on our objects to make sure that any logic in them was not overly state dependent. More about this issue in Hibernate is available <a title="Hibernate Forums" href="http://forum.hibernate.org/viewtopic.php?t=937664">here</a>. We have fairly rich object models, and a lot of methods, including setters, are never used by Hibernate. We wanted a report of the setters actually used by Hibernate to limit the amount of code we had to examine.</p>
<p>The Hibernate API allows you a lot of access to its configuration object model, and this is ideal for finding out how Hibernate is interacting with your code. I wrote a small class to do this inspection. The method below is run after a Hibernate Configuration object named creatively as &#8220;configuration&#8221; has been built with mapping files:</p>
<pre><code>public Map findSetters() throws MappingException
{
  Map classToSetters = new HashMap();
  Iterator classMappingIterator =   configuration.getClassMappings();

  while(classMappingIterator.hasNext())
  {
    PersistentClass persistentClass = (PersistentClass)classMappingIterator.next();
    Class mappedClass = persistentClass.getMappedClass();
    Iterator propertyIt = persistentClass.getPropertyIterator();
    List classSetters = new LinkedList();

    classToSetters.put(mappedClass, classSetters);

    while(propertyIt.hasNext())
    {
      Property property = (Property)propertyIt.next();
      Setter setter = property.getSetter(mappedClass);

      classSetters.add(setter.getMethodName());
    }
  }
  return classToSetters;
}</code></pre>
<p>I have uploaded <a id="p61" onmousedown="selectLink(61);" href="http://blogs.missiondata.com/wp-content/uploads/2006/08/HibernateTools.tar.gz">a Java project</a> that contains the full HibernateInspector class, as well as some sample classes and mappings. Un-tar it, and run</p>
<pre><code class="console">ant -Dhibernate.home="path to hibernate 3" </code></pre>
<p>to build and run the example.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.missiondata.com/blog/software-development/60/using-the-hibernate-api-to-inspect-mapped-classes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>managing disk space with logrotate</title>
		<link>http://www.missiondata.com/blog/system-administration/48/managing-disk-space-with-logrotate/</link>
		<comments>http://www.missiondata.com/blog/system-administration/48/managing-disk-space-with-logrotate/#comments</comments>
		<pubDate>Thu, 27 Apr 2006 02:28:13 +0000</pubDate>
		<dc:creator>darrend</dc:creator>
				<category><![CDATA[System Administration]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[logrotate]]></category>
		<category><![CDATA[Utilities]]></category>

		<guid isPermaLink="false">http://blogs.missiondata.com/?p=48</guid>
		<description><![CDATA[At a customer site, the test and production linux servers for some intranet applications were slowly running out of disk space. The apps themselves were running fine, it was the logfiles generated by the apps that were the issue; logging that came in useful just in case something went wrong, but quickly aged. In one [...]]]></description>
			<content:encoded><![CDATA[<p>At a customer site, the test and production linux servers for some intranet applications were slowly running out of disk space. The apps themselves were running fine, it was the logfiles generated by the apps that were the issue; logging that came in useful just in case something went wrong, but quickly aged. In one particular case, a catalina.out file was several years old and was 11 gigabytes; 90% of it wasn&#8217;t really relevant any longer.</p>
<p>The solution to the problem of wrangling logfiles is probably already installed on your server: it&#8217;s <a href="http://iain.cx/src/logrotate/">logrotate</a>. Chances are logrotate is already configured in your system crontab as a daily task, and chances are it is configured to obey any configuration files found in the <tt>/etc/logrotate.d</tt> directory. If you find that directory, you are probably good to go.</p>
<p><span id="more-48"></span><br />
In <tt>/etc/logrotate.d</tt> you&#8217;ll find several short configuration files. Each configuration deals with 1 or 2 related logfiles that should be checked and possibly administered on a regular basis. Logrotate can do alot of things with a logfile: clear the target log, create a copy of it, compress the copy, keep <em>N</em> backup copies, and it can be configured to rotate the target logfile on a daily, weekly, or monthly basis.</p>
<p>For example, here is how my client handles a logfile generated by a log4j-enabled java rmi server:</p>
<pre>
<code> /appdir/log/java_rmi_log.txt {
    daily
    rotate 10
    copytruncate
    compress
    notifempty
    missingok
 }</code>
</pre>
<p>This configuration means<br />
<blockquote>On a <em>daily</em> basis <em>rotate</em>, <em>compress</em>, and retain up to <em>10</em> days worth of logs using the <em>copytruncate</em> method. But <em>notifempty</em>; if the log is empty don&#8217;t do anything. Finally, <em>missingok</em>, so no need to log an error anywhere if the target logfile isn&#8217;t found.
</p></blockquote>
<p>This is nigh on a <a href="http://en.wikipedia.org/wiki/Domain_Specific_Language">domain specific language</a> for logfile rotation, and like most DSLs I&#8217;ve come across it&#8217;s much easier to read than it is to remember when writing. Don&#8217;t worry, the <a href="http://www.die.net/doc/linux/man/man8/logrotate.8.html">man page for logrotate</a> lists all the details.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.missiondata.com/blog/system-administration/48/managing-disk-space-with-logrotate/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Long arguments and getops</title>
		<link>http://www.missiondata.com/blog/system-administration/17/17/</link>
		<comments>http://www.missiondata.com/blog/system-administration/17/17/#comments</comments>
		<pubDate>Tue, 07 Mar 2006 18:28:33 +0000</pubDate>
		<dc:creator>steveny</dc:creator>
				<category><![CDATA[System Administration]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Utilities]]></category>

		<guid isPermaLink="false">http://blogs.missiondata.com/?p=17</guid>
		<description><![CDATA[I recently had a need to adapt a script that recrawls a site with nutch. One of my design goals was to use the same command line options as the Fetchtool (one of the steps I had to take to recrawl a site). It became apparent fairly quickly that bash&#8217;s built-in &#8216;getopts&#8217; didn&#8217;t support long [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had a need to adapt a script that <a href="http://today.java.net/pub/a/today/2006/02/16/introduction-to-nutch-2.html">recrawls</a> a site with <a href="http://wiki.apache.org/nutch/">nutch</a>.  One of my design goals was to use the same command line options as the <a href="http://wiki.apache.org/nutch/DissectingTheNutchCrawler#head-35f305b76ece4e69fd33a02838f985f3d2cac0af">Fetchtool</a> (one of the steps I had to take to recrawl a site).</p>
<p>It became apparent fairly quickly that bash&#8217;s built-in &#8216;getopts&#8217; didn&#8217;t support long command line arguments, so I had to fall back on <a href="http://www.devdaily.com/unix/man/man1/getopt.1.shtml">getopt</a>.</p>
<p>Here is the portion of the script that parses the command line arguments:</p>
<pre>
<code>set -- `getopt -n$0 -u -a --longoptions="depth: adddays: topN:" "h" "$@"` || usage
[ $# -eq 0 ] &amp;&amp; usage

while [ $# -gt 0 ]
do
    case "$1" in
       --depth)   depth=$2;shift;;
       --adddays) adddays=$2;shift;;
       --topN)    topN=$2;shift;;
       -h)        usage;;
       --)        shift;break;;
       -*)        usage;;
       *)         break;;            #better be the crawl directory
    esac
    shift
done</code>
</pre>
<p>Deconstructing this bit by bit:</p>
<p><span id="more-17"></span></p>
<pre>
  <code>set -- `getopt -n$0 -u -a --longoptions="depth: adddays: topN:" "h" "$@"` || usage
[ $# -eq 0 ] &amp;&amp; usage
  </code>
</pre>
<p>&#8216;set &#8211;&#8217; unsets the existing postional parameters and sets them to the result of getopt.<br />
The call to getopts works like this:</p>
<ul>
<li> -n$0, sets the nicename to the name of the script (so warnings come back nicely from getopts)
<li> -a, allows long arguments to start with a singe &#8216;-&#8217; (they ususally have two (&#8216;&#8211;&#8217;)
<li> &#8211;longoptions=&#8221;depth: adddays: topN:&#8221;, sets the format of the long options.  In this case I have 3 (depth, adddays, and topN).  The<br />
trailing colon indicates I am expecting an additional argument. </p>
<li>  &#8220;h&#8221;, the short options (-h)
<li> &#8220;$@&#8221;, the arguments passed into the script
  </ul>
<p>The &#8216;||&#8217; at the end and the second line will call my usage statement if  an error comes back from getopt (a non-0 return code).  The next line make sure we get at least one argument back.</p>
<p>To help understand what goes on next, lets run that command at the shell:</p>
<pre>
  <code class="console"> $ getopt -nrecrawl.sh -u -a --longoptions="depth: adddays: topN:" "h" -depth 5 -adddays 10 -topN 3 -h -x
recrawl.sh: unrecognized option `-x'
 --depth 5 --adddays 10 --topN 3 -h --
  </code>
</pre>
<p>A few items of note.  The first is the warning message we get because &#8216;x&#8217; is an unknown option (notice it is prefaced by what we supplied to the -n argument).  The second is the result of the getopt operation on my command line parameters.</p>
<p>Now to interpret the results:</p>
<pre>
  <code>while [ $# -gt 0 ]
do
    case "$1" in
       --depth)   depth=$2;shift;;
...
       -h)        usage;;
       --)        shift;break;;
       -*)        usage;;
       *)         break;;            #better be the crawl directory
    esac
    shift
done
  </code>
</pre>
<p>The while loop loops through each of the arguments return from getopt.  If an argument requires an additional value, I use $2 to snag that value and assign it to a variable.  When we are done with an argument, we shift passed it and move on to the next one.  A few special cases exist:</p>
<ul>
<li>-*) matches any unkown option and prints the usage statement
<li> *) matchs any other argument (in this case it is our required directory)
<li> &#8211;) is the end marker from getopt
  </ul>
<p>The script then goes on to verify the parameters (like the directory exists) and does the crawl&#8230;.but that is for another day.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.missiondata.com/blog/system-administration/17/17/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>cvs history</title>
		<link>http://www.missiondata.com/blog/system-administration/16/cvs-history/</link>
		<comments>http://www.missiondata.com/blog/system-administration/16/cvs-history/#comments</comments>
		<pubDate>Wed, 22 Feb 2006 15:45:52 +0000</pubDate>
		<dc:creator>darrend</dc:creator>
				<category><![CDATA[System Administration]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Utilities]]></category>

		<guid isPermaLink="false">http://blogs.missiondata.com/?p=16</guid>
		<description><![CDATA[For alot of people, CVS is history; they&#8217;ve switched to SVN and are loving life. For those of us continuing the use this venerable tool, I present the following cobbled together bit of utility. It&#8217;s a bash function. and a nice way to keep an eye on what&#8217;s happening on a cvs repository. I work [...]]]></description>
			<content:encoded><![CDATA[<p>For alot of people, CVS <strong>is</strong> history; they&#8217;ve switched to SVN and are loving life. For those of us continuing the use this venerable tool, I present the following cobbled together bit of utility.</p>
<p>It&#8217;s a bash function. and a nice way to keep an eye on what&#8217;s happening on a cvs repository. I work with a team of around 7 guys, and I like to keep an eye on what&#8217;s changed and who changed it.</p>
<p>It works like this, summarizing what I consider to be the highlights from the <code>cvs history</code> command, and defaults to showing checkins for the current date:</p>
<pre><code class="console">$ cvshist
M 2006-02-22 10:34 EDT jsmith  1.3  InternalOperation.java         APRJ7A/src/com/ppc/oepica/model/internal
M 2006-02-22 10:53 EDT jsmith  1.37 FooBarCopier.java              APRJ7A/src/com/ppc/oepica/model/external
M 2006-02-22 11:26 EDT darrend 1.23 CommonJobBase.java             APRJ7A/src/com/ppc/oepica/model/common</code></pre>
<p>I use the <code>date</code> command, which gives me some flexibility when specifying a date</p>
<pre><code class="console">$ cvshist yesterday
$ cvshist 2 days ago
$ cvshist january 10
$ cvshist 2006-01-11</code></pre>
<p>Here&#8217;s the source. I&#8217;ve used this on linux and cygwin; you&#8217;ll need bash, gnu date, and cvs.</p>
<pre><code class="console">$ declare -f
cvshist ()
{
  export CVSROOT=:pserver:darrend@shlnxtest1:/home/cvs;
  TARGET_DATE=$(date -d "$*" +%Y-%m-%d);
  cvs history -a -z EDT -c -D $TARGET_DATE | sed "s/\s*==.*$//" | grep "$TARGET_DATE"
}</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.missiondata.com/blog/system-administration/16/cvs-history/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

